import{s as fe,o as ge,n as ue}from"../chunks/scheduler.6062bdaf.js";import{S as de,i as me,g as r,s as o,r as L,A as be,h,f as a,c as s,j as le,u as M,x as l,k as pe,y as _e,a as i,v as R,d as C,t as q,w as j}from"../chunks/index.4bca734e.js";import{T as ye}from"../chunks/Tip.b9ac1f03.js";import{H as Y}from"../chunks/Heading.723dceba.js";function we(S){let n,f='<a href="/docs/huggingface_hub/main/en/package_reference/repository#huggingface_hub.Repository">Repository</a> is now deprecated in favor of the http-based alternatives. Given its large adoption in legacy code, the complete removal of <a href="/docs/huggingface_hub/main/en/package_reference/repository#huggingface_hub.Repository">Repository</a> will only happen in release <code>v1.0</code>.';return{c(){n=r("p"),n.innerHTML=f},l(c){n=h(c,"P",{"data-svelte-h":!0}),l(n)!=="svelte-j0sdv2"&&(n.innerHTML=f)},m(c,x){i(c,n,x)},p:ue,d(c){c&&a(n)}}}function ve(S){let n,f,c,x,g,I,u,Z=`The <code>huggingface_hub</code> library is a library for interacting with the Hugging Face Hub, which is a
collections of git-based repositories (models, datasets or Spaces). There are two main
ways to access the Hub using <code>huggingface_hub</code>.`,E,d,ee=`The first approach, the so-called “git-based” approach, is led by the <a href="/docs/huggingface_hub/main/en/package_reference/repository#huggingface_hub.Repository">Repository</a> class.
This method uses a wrapper around the <code>git</code> command with additional functions specifically
designed to interact with the Hub. The second option, called the “HTTP-based” approach,
involves making HTTP requests using the <a href="/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> client. Let’s examine the pros and cons
of each approach.`,G,m,z,b,te=`At first, <code>huggingface_hub</code> was mostly built around the <a href="/docs/huggingface_hub/main/en/package_reference/repository#huggingface_hub.Repository">Repository</a> class. It provides
Python wrappers for common <code>git</code> commands such as <code>&quot;git add&quot;</code>, <code>&quot;git commit&quot;</code>, <code>&quot;git push&quot;</code>,
<code>&quot;git tag&quot;</code>, <code>&quot;git checkout&quot;</code>, etc.`,W,_,ae=`The library also helps with setting credentials and tracking large files, which are often
used in machine learning repositories. Additionally, the library allows you to execute its
methods in the background, making it useful for uploading data during training.`,F,y,ie=`The main advantage of using a <a href="/docs/huggingface_hub/main/en/package_reference/repository#huggingface_hub.Repository">Repository</a> is that it allows you to maintain a local
copy of the entire repository on your machine. This can also be a disadvantage as
it requires you to constantly update and maintain this local copy. This is similar to
traditional software development where each developer maintains their own local copy and
pushes changes when working on a feature. However, in the context of machine learning,
this may not always be necessary as users may only need to download weights for inference
or convert weights from one format to another without the need to clone the entire
repository.`,O,p,U,w,B,v,ne=`The <a href="/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> class was developed to provide an alternative to local git repositories, which
can be cumbersome to maintain, especially when dealing with large models or datasets. The
<a href="/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> class offers the same functionality as git-based approaches, such as downloading
and pushing files and creating branches and tags, but without the need for a local folder
that needs to be kept in sync.`,D,H,oe=`In addition to the functionalities already provided by <code>git</code>, the <a href="/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> class offers
additional features, such as the ability to manage repos, download files using caching for
efficient reuse, search the Hub for repos and metadata, access community features such as
discussions, PRs, and comments, and configure Spaces hardware and secrets.`,J,T,K,$,se=`Overall, the <strong>HTTP-based approach is the recommended way to use</strong> <code>huggingface_hub</code>
in all cases. <a href="/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> allows to pull and push changes, work with PRs, tags and branches, interact with discussions and much more. Since the <code>0.16</code> release, the http-based methods can also run in the background, which was the last major advantage of the <a href="/docs/huggingface_hub/main/en/package_reference/repository#huggingface_hub.Repository">Repository</a> class.`,N,k,re='However, not all git commands are available through <a href="/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a>. Some may never be implemented, but we are always trying to improve and close the gap. If you don’t see your use case covered, please open <a href="https://github.com/huggingface/huggingface_hub" rel="nofollow">an issue on Github</a>! We welcome feedback to help build the 🤗 ecosystem with and for our users.',Q,P,he='This preference of the http-based <a href="/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> over the git-based <a href="/docs/huggingface_hub/main/en/package_reference/repository#huggingface_hub.Repository">Repository</a> does not mean that git versioning will disappear from the Hugging Face Hub anytime soon. It will always be possible to use <code>git</code> commands locally in workflows where it makes sense.',V,A,X;return g=new Y({props:{title:"Git vs HTTP paradigm",local:"git-vs-http-paradigm",headingTag:"h1"}}),m=new Y({props:{title:"Repository: the historical git-based approach",local:"repository-the-historical-git-based-approach",headingTag:"h2"}}),p=new ye({props:{warning:!0,$$slots:{default:[we]},$$scope:{ctx:S}}}),w=new Y({props:{title:"HfApi: a flexible and convenient HTTP client",local:"hfapi-a-flexible-and-convenient-http-client",headingTag:"h2"}}),T=new Y({props:{title:"What should I use ? And when ?",local:"what-should-i-use--and-when-",headingTag:"h2"}}),{c(){n=r("meta"),f=o(),c=r("p"),x=o(),L(g.$$.fragment),I=o(),u=r("p"),u.innerHTML=Z,E=o(),d=r("p"),d.innerHTML=ee,G=o(),L(m.$$.fragment),z=o(),b=r("p"),b.innerHTML=te,W=o(),_=r("p"),_.textContent=ae,F=o(),y=r("p"),y.innerHTML=ie,O=o(),L(p.$$.fragment),U=o(),L(w.$$.fragment),B=o(),v=r("p"),v.innerHTML=ne,D=o(),H=r("p"),H.innerHTML=oe,J=o(),L(T.$$.fragment),K=o(),$=r("p"),$.innerHTML=se,N=o(),k=r("p"),k.innerHTML=re,Q=o(),P=r("p"),P.innerHTML=he,V=o(),A=r("p"),this.h()},l(e){const t=be("svelte-u9bgzb",document.head);n=h(t,"META",{name:!0,content:!0}),t.forEach(a),f=s(e),c=h(e,"P",{}),le(c).forEach(a),x=s(e),M(g.$$.fragment,e),I=s(e),u=h(e,"P",{"data-svelte-h":!0}),l(u)!=="svelte-109fppz"&&(u.innerHTML=Z),E=s(e),d=h(e,"P",{"data-svelte-h":!0}),l(d)!=="svelte-udnnu9"&&(d.innerHTML=ee),G=s(e),M(m.$$.fragment,e),z=s(e),b=h(e,"P",{"data-svelte-h":!0}),l(b)!=="svelte-4k0jhw"&&(b.innerHTML=te),W=s(e),_=h(e,"P",{"data-svelte-h":!0}),l(_)!=="svelte-mpix11"&&(_.textContent=ae),F=s(e),y=h(e,"P",{"data-svelte-h":!0}),l(y)!=="svelte-b0wyfz"&&(y.innerHTML=ie),O=s(e),M(p.$$.fragment,e),U=s(e),M(w.$$.fragment,e),B=s(e),v=h(e,"P",{"data-svelte-h":!0}),l(v)!=="svelte-1v5bf2u"&&(v.innerHTML=ne),D=s(e),H=h(e,"P",{"data-svelte-h":!0}),l(H)!=="svelte-1hj1jj0"&&(H.innerHTML=oe),J=s(e),M(T.$$.fragment,e),K=s(e),$=h(e,"P",{"data-svelte-h":!0}),l($)!=="svelte-1myrvrv"&&($.innerHTML=se),N=s(e),k=h(e,"P",{"data-svelte-h":!0}),l(k)!=="svelte-n1wg4d"&&(k.innerHTML=re),Q=s(e),P=h(e,"P",{"data-svelte-h":!0}),l(P)!=="svelte-ctif0n"&&(P.innerHTML=he),V=s(e),A=h(e,"P",{}),le(A).forEach(a),this.h()},h(){pe(n,"name","hf:doc:metadata"),pe(n,"content",He)},m(e,t){_e(document.head,n),i(e,f,t),i(e,c,t),i(e,x,t),R(g,e,t),i(e,I,t),i(e,u,t),i(e,E,t),i(e,d,t),i(e,G,t),R(m,e,t),i(e,z,t),i(e,b,t),i(e,W,t),i(e,_,t),i(e,F,t),i(e,y,t),i(e,O,t),R(p,e,t),i(e,U,t),R(w,e,t),i(e,B,t),i(e,v,t),i(e,D,t),i(e,H,t),i(e,J,t),R(T,e,t),i(e,K,t),i(e,$,t),i(e,N,t),i(e,k,t),i(e,Q,t),i(e,P,t),i(e,V,t),i(e,A,t),X=!0},p(e,[t]){const ce={};t&2&&(ce.$$scope={dirty:t,ctx:e}),p.$set(ce)},i(e){X||(C(g.$$.fragment,e),C(m.$$.fragment,e),C(p.$$.fragment,e),C(w.$$.fragment,e),C(T.$$.fragment,e),X=!0)},o(e){q(g.$$.fragment,e),q(m.$$.fragment,e),q(p.$$.fragment,e),q(w.$$.fragment,e),q(T.$$.fragment,e),X=!1},d(e){e&&(a(f),a(c),a(x),a(I),a(u),a(E),a(d),a(G),a(z),a(b),a(W),a(_),a(F),a(y),a(O),a(U),a(B),a(v),a(D),a(H),a(J),a(K),a($),a(N),a(k),a(Q),a(P),a(V),a(A)),a(n),j(g,e),j(m,e),j(p,e),j(w,e),j(T,e)}}}const He='{"title":"Git vs HTTP paradigm","local":"git-vs-http-paradigm","sections":[{"title":"Repository: the historical git-based approach","local":"repository-the-historical-git-based-approach","sections":[],"depth":2},{"title":"HfApi: a flexible and convenient HTTP client","local":"hfapi-a-flexible-and-convenient-http-client","sections":[],"depth":2},{"title":"What should I use ? And when ?","local":"what-should-i-use--and-when-","sections":[],"depth":2}],"depth":1}';function Te(S){return ge(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ae extends de{constructor(n){super(),me(this,n,Te,ve,fe,{})}}export{Ae as component};
