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 as c,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{T as ve}from"../chunks/Tip.b9ac1f03.js";import{H as Y}from"../chunks/Heading.723dceba.js";function ye(I){let n,g='<a href="/docs/huggingface_hub/v0.19.0.rc0/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.0.rc0/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(h){n=c(h,"P",{"data-svelte-h":!0}),l(n)!=="svelte-1g83s42"&&(n.innerHTML=g)},m(h,P){i(h,n,P)},p:ue,d(h){h&&a(n)}}}function we(I){let n,g,h,P,f,E,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.0.rc0/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.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> client. Let’s examine the pros and cons
of each approach.`,z,m,W,b,te=`At first, <code>huggingface_hub</code> was mostly built around the <a href="/docs/huggingface_hub/v0.19.0.rc0/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.`,j,_,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.0.rc0/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,y,B,w,ne=`The <a href="/docs/huggingface_hub/v0.19.0.rc0/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.0.rc0/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/v0.19.0.rc0/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.0.rc0/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.0.rc0/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.0.rc0/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,ce='This preference of the http-based <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi">HfApi</a> over the git-based <a href="/docs/huggingface_hub/v0.19.0.rc0/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 ve({props:{warning:!0,$$slots:{default:[ye]},$$scope:{ctx:I}}}),y=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(),h=r("p"),P=o(),L(f.$$.fragment),E=o(),u=r("p"),u.innerHTML=Z,G=o(),d=r("p"),d.innerHTML=ee,z=o(),L(m.$$.fragment),W=o(),b=r("p"),b.innerHTML=te,j=o(),_=r("p"),_.textContent=ae,F=o(),v=r("p"),v.innerHTML=ie,O=o(),L(p.$$.fragment),U=o(),L(y.$$.fragment),B=o(),w=r("p"),w.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(),x=r("p"),x.innerHTML=ce,V=o(),A=r("p"),this.h()},l(e){const t=be("svelte-u9bgzb",document.head);n=c(t,"META",{name:!0,content:!0}),t.forEach(a),g=s(e),h=c(e,"P",{}),le(h).forEach(a),P=s(e),M(f.$$.fragment,e),E=s(e),u=c(e,"P",{"data-svelte-h":!0}),l(u)!=="svelte-109fppz"&&(u.innerHTML=Z),G=s(e),d=c(e,"P",{"data-svelte-h":!0}),l(d)!=="svelte-b33nqm"&&(d.innerHTML=ee),z=s(e),M(m.$$.fragment,e),W=s(e),b=c(e,"P",{"data-svelte-h":!0}),l(b)!=="svelte-xo0zh5"&&(b.innerHTML=te),j=s(e),_=c(e,"P",{"data-svelte-h":!0}),l(_)!=="svelte-mpix11"&&(_.textContent=ae),F=s(e),v=c(e,"P",{"data-svelte-h":!0}),l(v)!=="svelte-nuvd7e"&&(v.innerHTML=ie),O=s(e),M(p.$$.fragment,e),U=s(e),M(y.$$.fragment,e),B=s(e),w=c(e,"P",{"data-svelte-h":!0}),l(w)!=="svelte-1xdu1yi"&&(w.innerHTML=ne),D=s(e),H=c(e,"P",{"data-svelte-h":!0}),l(H)!=="svelte-4eqthc"&&(H.innerHTML=oe),J=s(e),M(T.$$.fragment,e),K=s(e),$=c(e,"P",{"data-svelte-h":!0}),l($)!=="svelte-93i7fu"&&($.innerHTML=se),N=s(e),k=c(e,"P",{"data-svelte-h":!0}),l(k)!=="svelte-gnranv"&&(k.innerHTML=re),Q=s(e),x=c(e,"P",{"data-svelte-h":!0}),l(x)!=="svelte-1vy8huk"&&(x.innerHTML=ce),V=s(e),A=c(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,g,t),i(e,h,t),i(e,P,t),R(f,e,t),i(e,E,t),i(e,u,t),i(e,G,t),i(e,d,t),i(e,z,t),R(m,e,t),i(e,W,t),i(e,b,t),i(e,j,t),i(e,_,t),i(e,F,t),i(e,v,t),i(e,O,t),R(p,e,t),i(e,U,t),R(y,e,t),i(e,B,t),i(e,w,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,x,t),i(e,V,t),i(e,A,t),X=!0},p(e,[t]){const he={};t&2&&(he.$$scope={dirty:t,ctx:e}),p.$set(he)},i(e){X||(q(f.$$.fragment,e),q(m.$$.fragment,e),q(p.$$.fragment,e),q(y.$$.fragment,e),q(T.$$.fragment,e),X=!0)},o(e){C(f.$$.fragment,e),C(m.$$.fragment,e),C(p.$$.fragment,e),C(y.$$.fragment,e),C(T.$$.fragment,e),X=!1},d(e){e&&(a(g),a(h),a(P),a(E),a(u),a(G),a(d),a(z),a(W),a(b),a(j),a(_),a(F),a(v),a(O),a(U),a(B),a(w),a(D),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(y,e),S(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(I){return fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ae extends de{constructor(n){super(),me(this,n,Te,we,ge,{})}}export{Ae as component};
