import{s as ge,o as fe,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 q,t as C,w as S}from"../chunks/index.4bca734e.js";import{H as Y,g as ve}from"../chunks/Heading.8904b53b.js";import{T as we}from"../chunks/Tip.b9ac1f03.js";function ye(I){let n,g='<a href="/docs/huggingface_hub/v0.19.3/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/v0.19.3/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=g},l(c){n=h(c,"P",{"data-svelte-h":!0}),l(n)!=="svelte-1rkudrm"&&(n.innerHTML=g)},m(c,P){i(c,n,P)},p:ue,d(c){c&&a(n)}}}function He(I){let n,g,c,P,f,j,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>.`,G,d,ee=`The first approach, the so-called “git-based” approach, is led by the <a href="/docs/huggingface_hub/v0.19.3/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/v0.19.3/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> client. Let’s examine the pros and cons
of each approach.`,z,m,E,b,te=`At first, <code>huggingface_hub</code> was mostly built around the <a href="/docs/huggingface_hub/v0.19.3/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,v,ie=`The main advantage of using a <a href="/docs/huggingface_hub/v0.19.3/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.`,D,p,O,w,U,y,ne=`The <a href="/docs/huggingface_hub/v0.19.3/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/v0.19.3/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.`,B,H,oe=`In addition to the functionalities already provided by <code>git</code>, the <a href="/docs/huggingface_hub/v0.19.3/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/v0.19.3/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/v0.19.3/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/v0.19.3/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,x,he='This preference of the http-based <a href="/docs/huggingface_hub/v0.19.3/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> over the git-based <a href="/docs/huggingface_hub/v0.19.3/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 f=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 we({props:{warning:!0,$$slots:{default:[ye]},$$scope:{ctx:I}}}),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"),g=o(),c=r("p"),P=o(),L(f.$$.fragment),j=o(),u=r("p"),u.innerHTML=Z,G=o(),d=r("p"),d.innerHTML=ee,z=o(),L(m.$$.fragment),E=o(),b=r("p"),b.innerHTML=te,W=o(),_=r("p"),_.textContent=ae,F=o(),v=r("p"),v.innerHTML=ie,D=o(),L(p.$$.fragment),O=o(),L(w.$$.fragment),U=o(),y=r("p"),y.innerHTML=ne,B=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(),x=r("p"),x.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),g=s(e),c=h(e,"P",{}),le(c).forEach(a),P=s(e),M(f.$$.fragment,e),j=s(e),u=h(e,"P",{"data-svelte-h":!0}),l(u)!=="svelte-109fppz"&&(u.innerHTML=Z),G=s(e),d=h(e,"P",{"data-svelte-h":!0}),l(d)!=="svelte-1uk43ji"&&(d.innerHTML=ee),z=s(e),M(m.$$.fragment,e),E=s(e),b=h(e,"P",{"data-svelte-h":!0}),l(b)!=="svelte-tr7zen"&&(b.innerHTML=te),W=s(e),_=h(e,"P",{"data-svelte-h":!0}),l(_)!=="svelte-mpix11"&&(_.textContent=ae),F=s(e),v=h(e,"P",{"data-svelte-h":!0}),l(v)!=="svelte-culrd0"&&(v.innerHTML=ie),D=s(e),M(p.$$.fragment,e),O=s(e),M(w.$$.fragment,e),U=s(e),y=h(e,"P",{"data-svelte-h":!0}),l(y)!=="svelte-c3kjni"&&(y.innerHTML=ne),B=s(e),H=h(e,"P",{"data-svelte-h":!0}),l(H)!=="svelte-2254xe"&&(H.innerHTML=oe),J=s(e),M(T.$$.fragment,e),K=s(e),$=h(e,"P",{"data-svelte-h":!0}),l($)!=="svelte-zdna6y"&&($.innerHTML=se),N=s(e),k=h(e,"P",{"data-svelte-h":!0}),l(k)!=="svelte-qajiwt"&&(k.innerHTML=re),Q=s(e),x=h(e,"P",{"data-svelte-h":!0}),l(x)!=="svelte-1x8b03w"&&(x.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",Te)},m(e,t){_e(document.head,n),i(e,g,t),i(e,c,t),i(e,P,t),R(f,e,t),i(e,j,t),i(e,u,t),i(e,G,t),i(e,d,t),i(e,z,t),R(m,e,t),i(e,E,t),i(e,b,t),i(e,W,t),i(e,_,t),i(e,F,t),i(e,v,t),i(e,D,t),R(p,e,t),i(e,O,t),R(w,e,t),i(e,U,t),i(e,y,t),i(e,B,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,x,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||(q(f.$$.fragment,e),q(m.$$.fragment,e),q(p.$$.fragment,e),q(w.$$.fragment,e),q(T.$$.fragment,e),X=!0)},o(e){C(f.$$.fragment,e),C(m.$$.fragment,e),C(p.$$.fragment,e),C(w.$$.fragment,e),C(T.$$.fragment,e),X=!1},d(e){e&&(a(g),a(c),a(P),a(j),a(u),a(G),a(d),a(z),a(E),a(b),a(W),a(_),a(F),a(v),a(D),a(O),a(U),a(y),a(B),a(H),a(J),a(K),a($),a(N),a(k),a(Q),a(x),a(V),a(A)),a(n),S(f,e),S(m,e),S(p,e),S(w,e),S(T,e)}}}const Te='{"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 $e(I){return fe(()=>{new URLSearchParams(window.location.search).get("fw"),window.hfDocGoto=ve}),[]}class Le extends de{constructor(n){super(),me(this,n,$e,He,ge,{})}}export{Le as component};
