import{S as pf,i as mf,s as df,e as s,k as u,w as m,t as r,M as cf,c as i,d as t,m as h,a as n,x as d,h as l,b as p,N as Dr,F as o,g as f,y as c,q as _,o as y,B as w}from"../chunks/vendor-4833417e.js";import{T as _f}from"../chunks/Tip-fffd6df1.js";import{Y as yf}from"../chunks/Youtube-27813aed.js";import{I as V}from"../chunks/IconCopyLink-4b81c553.js";import{C as b}from"../chunks/CodeBlock-6a3d1b46.js";import"../chunks/CopyButton-dacfbfaf.js";function wf(Gt){let g,j,v,$,M;return{c(){g=s("p"),j=r("To share a model with the community, you need an account on "),v=s("a"),$=r("huggingface.co"),M=r(". You can also join an existing organization or create a new one."),this.h()},l(E){g=i(E,"P",{});var H=n(g);j=l(H,"To share a model with the community, you need an account on "),v=i(H,"A",{href:!0,rel:!0});var W=n(v);$=l(W,"huggingface.co"),W.forEach(t),M=l(H,". You can also join an existing organization or create a new one."),H.forEach(t),this.h()},h(){p(v,"href","https://huggingface.co/join"),p(v,"rel","nofollow")},m(E,H){f(E,g,H),o(g,j),o(g,v),o(v,$),o(g,M)},d(E){E&&t(g)}}}function vf(Gt){let g,j,v,$,M,E,H,W,xr,zo,mt,Or,Lo,J,Ir,Te,Mr,Nr,Ro,K,Yt,zr,Lr,Vt,Rr,Bo,T,Ai,Uo,X,Go,N,Z,Wt,Pe,Br,Jt,Ur,Yo,dt,Gr,Vo,F,Yr,Ae,Vr,Wr,Kt,Jr,Kr,Wo,Q,Xr,Xt,Zr,Qr,Jo,je,Ko,ct,el,Xo,_t,yt,ji,Zo,z,ee,Zt,He,tl,Qt,ol,Qo,te,al,eo,rl,ll,ea,Fe,ta,oe,sl,Ce,to,il,nl,oa,Se,aa,C,fl,oo,ul,hl,qe,pl,ml,ra,De,la,L,ae,ao,xe,dl,ro,cl,sa,wt,_l,ia,re,yl,vt,wl,vl,na,le,gl,lo,bl,$l,fa,Oe,ua,gt,kl,ha,Ie,pa,se,El,so,Tl,Pl,ma,Me,da,bt,Al,ca,Ne,_a,R,ie,io,ze,jl,$t,Hl,no,Fl,ya,Le,wa,k,Cl,kt,Sl,ql,Et,Dl,xl,fo,Ol,Il,Tt,Ml,Nl,va,Re,ga,ne,zl,Pt,Ll,Rl,ba,Be,$a,S,Bl,At,Ul,Gl,jt,Yl,Vl,ka,Ue,Ea,B,fe,uo,Ge,Wl,Ht,Jl,ho,Kl,Ta,q,Xl,Ft,Zl,Ql,Ct,es,ts,Pa,D,po,os,as,mo,rs,ls,Ye,ss,co,is,ns,Aa,Ve,ja,ue,fs,We,_o,us,hs,Ha,Je,Fa,U,he,yo,Ke,ps,Xe,ms,wo,ds,cs,Ca,pe,_s,vo,ys,ws,Sa,me,vs,go,gs,bs,qa,Ze,Da,x,$s,bo,ks,Es,$o,Ts,Ps,xa,Qe,Oa,de,As,ko,js,Hs,Ia,et,Ma,ce,Fs,Eo,Cs,Ss,Na,tt,za,St,qs,La,ot,Ra,_e,Ds,To,xs,Os,Ba,ye,Is,at,Ms,Ns,Ua,G,we,Po,rt,zs,Ao,Ls,Ga,ve,Rs,lt,Bs,Us,Ya,qt,Dt,Hi,Va,xt,Gs,Wa,P,st,Ys,jo,Vs,Ws,Js,Ho,Ks,Xs,Fo,Zs,Qs,Co,ei,Ja,O,ti,So,oi,ai,qo,ri,li,Ka,Ot,It,Fi,Xa,Y,ge,Do,it,si,xo,ii,Za,be,ni,Oo,fi,ui,Qa,$e,nt,hi,Io,pi,mi,di,ft,ci,Mo,_i,yi,er,A,wi,ut,vi,gi,No,bi,$i,ht,ki,Ei,tr;return E=new V({}),X=new _f({props:{$$slots:{default:[wf]},$$scope:{ctx:Gt}}}),Pe=new V({}),je=new b({props:{code:`model = AutoModel.from_pretrained(
    "julien-c/EsperBERTo-small", revision="v2.0.1"  # tag name, or branch name, or commit hash
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;julien-c/EsperBERTo-small&quot;</span>, revision=<span class="hljs-string">&quot;v2.0.1&quot;</span>  <span class="hljs-comment"># tag name, or branch name, or commit hash</span>
<span class="hljs-meta">... </span>)`}}),He=new V({}),Fe=new b({props:{code:"huggingface-cli login",highlighted:"huggingface-cli login"}}),Se=new b({props:{code:"pip install huggingface_hub",highlighted:"pip install huggingface_hub"}}),De=new b({props:{code:`from huggingface_hub import notebook_login

notebook_login()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`}}),xe=new V({}),Oe=new b({props:{code:'tf_model = TFDistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_pt=True)',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>, from_pt=<span class="hljs-literal">True</span>)'}}),Ie=new b({props:{code:'tf_model.save_pretrained("path/to/awesome-name-you-picked")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model.save_pretrained(<span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>)'}}),Me=new b({props:{code:`pt_model = DistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_tf=True)
pt_model.save_pretrained("path/to/awesome-name-you-picked")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model = DistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>, from_tf=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.save_pretrained(<span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>)`}}),Ne=new b({props:{code:`flax_model = FlaxDistilBertForSequenceClassification.from_pretrained(
    "path/to/awesome-name-you-picked", from_pt=True
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>flax_model = FlaxDistilBertForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>, from_pt=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)`}}),ze=new V({}),Le=new yf({props:{id:"Z1-XMy-GNLQ"}}),Re=new b({props:{code:'training_args = TrainingArguments(output_dir="my-awesome-model", push_to_hub=True)',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(output_dir=<span class="hljs-string">&quot;my-awesome-model&quot;</span>, push_to_hub=<span class="hljs-literal">True</span>)'}}),Be=new b({props:{code:`trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=small_train_dataset,
    eval_dataset=small_eval_dataset,
    compute_metrics=compute_metrics,
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>trainer = Trainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    train_dataset=small_train_dataset,
<span class="hljs-meta">... </span>    eval_dataset=small_eval_dataset,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)`}}),Ue=new b({props:{code:"trainer.push_to_hub()",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()'}}),Ge=new V({}),Ve=new b({props:{code:`from transformers.keras.callbacks import PushToHubCallback

push_to_hub_callback = PushToHubCallback(
    output_dir="./your_model_save_path", tokenizer=tokenizer, hub_model_id="your-username/my-awesome-model"
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras.callbacks <span class="hljs-keyword">import</span> PushToHubCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>push_to_hub_callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;./your_model_save_path&quot;</span>, tokenizer=tokenizer, hub_model_id=<span class="hljs-string">&quot;your-username/my-awesome-model&quot;</span>
<span class="hljs-meta">... </span>)`}}),Je=new b({props:{code:"model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3, callbacks=push_to_hub_callback)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=<span class="hljs-number">3</span>, callbacks=push_to_hub_callback)'}}),Ke=new V({}),Ze=new b({props:{code:'pt_model.push_to_hub("my-awesome-model")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.push_to_hub(<span class="hljs-string">&quot;my-awesome-model&quot;</span>)'}}),Qe=new b({props:{code:`from transformers import AutoModel

model = AutoModel.from_pretrained("your_username/my-awesome-model")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;your_username/my-awesome-model&quot;</span>)`}}),et=new b({props:{code:'pt_model.push_to_hub("my-awesome-model", organization="my-awesome-org")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.push_to_hub(<span class="hljs-string">&quot;my-awesome-model&quot;</span>, organization=<span class="hljs-string">&quot;my-awesome-org&quot;</span>)'}}),tt=new b({props:{code:'tokenizer.push_to_hub("my-awesome-model")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.push_to_hub(<span class="hljs-string">&quot;my-awesome-model&quot;</span>)'}}),ot=new b({props:{code:'tf_model.push_to_hub("my-awesome-model")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model.push_to_hub(<span class="hljs-string">&quot;my-awesome-model&quot;</span>)'}}),rt=new V({}),it=new V({}),{c(){g=s("meta"),j=u(),v=s("h1"),$=s("a"),M=s("span"),m(E.$$.fragment),H=u(),W=s("span"),xr=r("Share a model"),zo=u(),mt=s("p"),Or=r("The last two tutorials showed how you can fine-tune a model with PyTorch, Keras, and \u{1F917} Accelerate for distributed setups. The next step is to share your model with the community! At Hugging Face, we believe in openly sharing knowledge and resources to democratize artificial intelligence for everyone. We encourage you to consider sharing your model with the community to help others save time and resources."),Lo=u(),J=s("p"),Ir=r("In this tutorial, you will learn two methods for sharing a trained or fine-tuned model on the "),Te=s("a"),Mr=r("Model Hub"),Nr=r(":"),Ro=u(),K=s("ul"),Yt=s("li"),zr=r("Programmatically push your files to the Hub."),Lr=u(),Vt=s("li"),Rr=r("Drag-and-drop your files to the Hub with the web interface."),Bo=u(),T=s("iframe"),Uo=u(),m(X.$$.fragment),Go=u(),N=s("h2"),Z=s("a"),Wt=s("span"),m(Pe.$$.fragment),Br=u(),Jt=s("span"),Ur=r("Repository features"),Yo=u(),dt=s("p"),Gr=r("Each repository on the Model Hub behaves like a typical GitHub repository. Our repositories offer versioning, commit history, and the ability to visualize differences."),Vo=u(),F=s("p"),Yr=r("The Model Hub\u2019s built-in versioning is based on git and "),Ae=s("a"),Vr=r("git-lfs"),Wr=r(". In other words, you can treat one model as one repository, enabling greater access control and scalability. Version control allows "),Kt=s("em"),Jr=r("revisions"),Kr=r(", a method for pinning a specific version of a model with a commit hash, tag or branch."),Wo=u(),Q=s("p"),Xr=r("As a result, you can load a specific model version with the "),Xt=s("code"),Zr=r("revision"),Qr=r(" parameter:"),Jo=u(),m(je.$$.fragment),Ko=u(),ct=s("p"),el=r("Files are also easily edited in a repository, and you can view the commit history as well as the difference:"),Xo=u(),_t=s("p"),yt=s("img"),Zo=u(),z=s("h2"),ee=s("a"),Zt=s("span"),m(He.$$.fragment),tl=u(),Qt=s("span"),ol=r("Setup"),Qo=u(),te=s("p"),al=r("Before sharing a model to the Hub, you will need your Hugging Face credentials. If you have access to a terminal, run the following command in the virtual environment where \u{1F917} Transformers is installed. This will store your access token in your Hugging Face cache folder ("),eo=s("code"),rl=r("~/.cache/"),ll=r(" by default):"),ea=u(),m(Fe.$$.fragment),ta=u(),oe=s("p"),sl=r("If you are using a notebook like Jupyter or Colaboratory, make sure you have the "),Ce=s("a"),to=s("code"),il=r("huggingface_hub"),nl=r(" library installed. This library allows you to programmatically interact with the Hub."),oa=u(),m(Se.$$.fragment),aa=u(),C=s("p"),fl=r("Then use "),oo=s("code"),ul=r("notebook_login"),hl=r(" to sign-in to the Hub, and follow the link "),qe=s("a"),pl=r("here"),ml=r(" to generate a token to login with:"),ra=u(),m(De.$$.fragment),la=u(),L=s("h2"),ae=s("a"),ao=s("span"),m(xe.$$.fragment),dl=u(),ro=s("span"),cl=r("Convert a model for all frameworks"),sa=u(),wt=s("p"),_l=r("To ensure your model can be used by someone working with a different framework, we recommend you convert and upload your model with both PyTorch and TensorFlow checkpoints. While users are still able to load your model from a different framework if you skip this step, it will be slower because \u{1F917} Transformers will need to convert the checkpoint on-the-fly."),ia=u(),re=s("p"),yl=r("Converting a checkpoint for another framework is easy. Make sure you have PyTorch and TensorFlow installed (see "),vt=s("a"),wl=r("here"),vl=r(" for installation instructions), and then find the specific model for your task in the other framework."),na=u(),le=s("p"),gl=r("For example, suppose you trained DistilBert for sequence classification in PyTorch and want to convert it to it\u2019s TensorFlow equivalent. Load the TensorFlow equivalent of your model for your task, and specify "),lo=s("code"),bl=r("from_pt=True"),$l=r(" so \u{1F917} Transformers will convert the PyTorch checkpoint to a TensorFlow checkpoint:"),fa=u(),m(Oe.$$.fragment),ua=u(),gt=s("p"),kl=r("Then save your new TensorFlow model with it\u2019s new checkpoint:"),ha=u(),m(Ie.$$.fragment),pa=u(),se=s("p"),El=r("Similarly, specify "),so=s("code"),Tl=r("from_tf=True"),Pl=r(" to convert a checkpoint from TensorFlow to PyTorch:"),ma=u(),m(Me.$$.fragment),da=u(),bt=s("p"),Al=r("If a model is available in Flax, you can also convert a checkpoint from PyTorch to Flax:"),ca=u(),m(Ne.$$.fragment),_a=u(),R=s("h2"),ie=s("a"),io=s("span"),m(ze.$$.fragment),jl=u(),$t=s("span"),Hl=r("Push a model with "),no=s("code"),Fl=r("Trainer"),ya=u(),m(Le.$$.fragment),wa=u(),k=s("p"),Cl=r("Sharing a model to the Hub is as simple as adding an extra parameter or callback. Remember from the "),kt=s("a"),Sl=r("fine-tuning tutorial"),ql=r(", the "),Et=s("a"),Dl=r("TrainingArguments"),xl=r(" class is where you specify hyperparameters and additional training options. One of these training options includes the ability to push a model directly to the Hub. Set "),fo=s("code"),Ol=r("push_to_hub=True"),Il=r(" in your "),Tt=s("a"),Ml=r("TrainingArguments"),Nl=r(":"),va=u(),m(Re.$$.fragment),ga=u(),ne=s("p"),zl=r("Pass your training arguments as usual to "),Pt=s("a"),Ll=r("Trainer"),Rl=r(":"),ba=u(),m(Be.$$.fragment),$a=u(),S=s("p"),Bl=r("After you fine-tune your model, call "),At=s("a"),Ul=r("push_to_hub()"),Gl=r(" on "),jt=s("a"),Yl=r("Trainer"),Vl=r(" to push the trained model to the Hub. \u{1F917} Transformers will even automatically add training hyperparameters, training results and framework versions to your model card!"),ka=u(),m(Ue.$$.fragment),Ea=u(),B=s("h2"),fe=s("a"),uo=s("span"),m(Ge.$$.fragment),Wl=u(),Ht=s("span"),Jl=r("Push a model with "),ho=s("code"),Kl=r("PushToHubCallback"),Ta=u(),q=s("p"),Xl=r("TensorFlow users can enable the same functionality with "),Ft=s("a"),Zl=r("PushToHubCallback"),Ql=r(". In the "),Ct=s("a"),es=r("PushToHubCallback"),ts=r(" function, add:"),Pa=u(),D=s("ul"),po=s("li"),os=r("An output directory for your model."),as=u(),mo=s("li"),rs=r("A tokenizer."),ls=u(),Ye=s("li"),ss=r("The "),co=s("code"),is=r("hub_model_id"),ns=r(", which is your Hub username and model name."),Aa=u(),m(Ve.$$.fragment),ja=u(),ue=s("p"),fs=r("Add the callback to "),We=s("a"),_o=s("code"),us=r("fit"),hs=r(", and \u{1F917} Transformers will push the trained model to the Hub:"),Ha=u(),m(Je.$$.fragment),Fa=u(),U=s("h2"),he=s("a"),yo=s("span"),m(Ke.$$.fragment),ps=u(),Xe=s("span"),ms=r("Use the "),wo=s("code"),ds=r("push_to_hub"),cs=r(" function"),Ca=u(),pe=s("p"),_s=r("You can also call "),vo=s("code"),ys=r("push_to_hub"),ws=r(" directly on your model to upload it to the Hub."),Sa=u(),me=s("p"),vs=r("Specify your model name in "),go=s("code"),gs=r("push_to_hub"),bs=r(":"),qa=u(),m(Ze.$$.fragment),Da=u(),x=s("p"),$s=r("This creates a repository under your username with the model name "),bo=s("code"),ks=r("my-awesome-model"),Es=r(". Users can now load your model with the "),$o=s("code"),Ts=r("from_pretrained"),Ps=r(" function:"),xa=u(),m(Qe.$$.fragment),Oa=u(),de=s("p"),As=r("If you belong to an organization and want to push your model under the organization name instead, add the "),ko=s("code"),js=r("organization"),Hs=r(" parameter:"),Ia=u(),m(et.$$.fragment),Ma=u(),ce=s("p"),Fs=r("The "),Eo=s("code"),Cs=r("push_to_hub"),Ss=r(" function can also be used to add other files to a model repository. For example, add a tokenizer to a model repository:"),Na=u(),m(tt.$$.fragment),za=u(),St=s("p"),qs=r("Or perhaps you\u2019d like to add the TensorFlow version of your fine-tuned PyTorch model:"),La=u(),m(ot.$$.fragment),Ra=u(),_e=s("p"),Ds=r("Now when you navigate to the your Hugging Face profile, you should see your newly created model repository. Clicking on the "),To=s("strong"),xs=r("Files"),Os=r(" tab will display all the files you\u2019ve uploaded to the repository."),Ba=u(),ye=s("p"),Is=r("For more details on how to create and upload files to a repository, refer to the Hub documentation "),at=s("a"),Ms=r("here"),Ns=r("."),Ua=u(),G=s("h2"),we=s("a"),Po=s("span"),m(rt.$$.fragment),zs=u(),Ao=s("span"),Ls=r("Upload with the web interface"),Ga=u(),ve=s("p"),Rs=r("Users who prefer a no-code approach are able to upload a model through the Hub\u2019s web interface. Visit "),lt=s("a"),Bs=r("huggingface.co/new"),Us=r(" to create a new repository:"),Ya=u(),qt=s("p"),Dt=s("img"),Va=u(),xt=s("p"),Gs=r("From here, add some information about your model:"),Wa=u(),P=s("ul"),st=s("li"),Ys=r("Select the "),jo=s("strong"),Vs=r("owner"),Ws=r(" of the repository. This can be yourself or any of the organizations you belong to."),Js=u(),Ho=s("li"),Ks=r("Pick a name for your model, which will also be the repository name."),Xs=u(),Fo=s("li"),Zs=r("Choose whether your model is public or private."),Qs=u(),Co=s("li"),ei=r("Specify the license usage for your model."),Ja=u(),O=s("p"),ti=r("Now click on the "),So=s("strong"),oi=r("Files"),ai=r(" tab and click on the "),qo=s("strong"),ri=r("Add file"),li=r(" button to upload a new file to your repository. Then drag-and-drop a file to upload and add a commit message."),Ka=u(),Ot=s("p"),It=s("img"),Xa=u(),Y=s("h2"),ge=s("a"),Do=s("span"),m(it.$$.fragment),si=u(),xo=s("span"),ii=r("Add a model card"),Za=u(),be=s("p"),ni=r("To make sure users understand your model\u2019s capabilities, limitations, potential biases and ethical considerations, please add a model card to your repository. The model card is defined in the "),Oo=s("code"),fi=r("README.md"),ui=r(" file. You can add a model card by:"),Qa=u(),$e=s("ul"),nt=s("li"),hi=r("Manually creating and uploading a "),Io=s("code"),pi=r("README.md"),mi=r(" file."),di=u(),ft=s("li"),ci=r("Clicking on the "),Mo=s("strong"),_i=r("Edit model card"),yi=r(" button in your model repository."),er=u(),A=s("p"),wi=r("Take a look at the DistilBert "),ut=s("a"),vi=r("model card"),gi=r(" for a good example of the type of information a model card should include. For more details about other options you can control in the "),No=s("code"),bi=r("README.md"),$i=r(" file such as a model\u2019s carbon footprint or widget examples, refer to the documentation "),ht=s("a"),ki=r("here"),Ei=r("."),this.h()},l(e){const a=cf('[data-svelte="svelte-1phssyn"]',document.head);g=i(a,"META",{name:!0,content:!0}),a.forEach(t),j=h(e),v=i(e,"H1",{class:!0});var pt=n(v);$=i(pt,"A",{id:!0,class:!0,href:!0});var Ci=n($);M=i(Ci,"SPAN",{});var Si=n(M);d(E.$$.fragment,Si),Si.forEach(t),Ci.forEach(t),H=h(pt),W=i(pt,"SPAN",{});var qi=n(W);xr=l(qi,"Share a model"),qi.forEach(t),pt.forEach(t),zo=h(e),mt=i(e,"P",{});var Di=n(mt);Or=l(Di,"The last two tutorials showed how you can fine-tune a model with PyTorch, Keras, and \u{1F917} Accelerate for distributed setups. The next step is to share your model with the community! At Hugging Face, we believe in openly sharing knowledge and resources to democratize artificial intelligence for everyone. We encourage you to consider sharing your model with the community to help others save time and resources."),Di.forEach(t),Lo=h(e),J=i(e,"P",{});var or=n(J);Ir=l(or,"In this tutorial, you will learn two methods for sharing a trained or fine-tuned model on the "),Te=i(or,"A",{href:!0,rel:!0});var xi=n(Te);Mr=l(xi,"Model Hub"),xi.forEach(t),Nr=l(or,":"),or.forEach(t),Ro=h(e),K=i(e,"UL",{});var ar=n(K);Yt=i(ar,"LI",{});var Oi=n(Yt);zr=l(Oi,"Programmatically push your files to the Hub."),Oi.forEach(t),Lr=h(ar),Vt=i(ar,"LI",{});var Ii=n(Vt);Rr=l(Ii,"Drag-and-drop your files to the Hub with the web interface."),Ii.forEach(t),ar.forEach(t),Bo=h(e),T=i(e,"IFRAME",{width:!0,height:!0,src:!0,title:!0,frameborder:!0,allow:!0}),n(T).forEach(t),Uo=h(e),d(X.$$.fragment,e),Go=h(e),N=i(e,"H2",{class:!0});var rr=n(N);Z=i(rr,"A",{id:!0,class:!0,href:!0});var Mi=n(Z);Wt=i(Mi,"SPAN",{});var Ni=n(Wt);d(Pe.$$.fragment,Ni),Ni.forEach(t),Mi.forEach(t),Br=h(rr),Jt=i(rr,"SPAN",{});var zi=n(Jt);Ur=l(zi,"Repository features"),zi.forEach(t),rr.forEach(t),Yo=h(e),dt=i(e,"P",{});var Li=n(dt);Gr=l(Li,"Each repository on the Model Hub behaves like a typical GitHub repository. Our repositories offer versioning, commit history, and the ability to visualize differences."),Li.forEach(t),Vo=h(e),F=i(e,"P",{});var Mt=n(F);Yr=l(Mt,"The Model Hub\u2019s built-in versioning is based on git and "),Ae=i(Mt,"A",{href:!0,rel:!0});var Ri=n(Ae);Vr=l(Ri,"git-lfs"),Ri.forEach(t),Wr=l(Mt,". In other words, you can treat one model as one repository, enabling greater access control and scalability. Version control allows "),Kt=i(Mt,"EM",{});var Bi=n(Kt);Jr=l(Bi,"revisions"),Bi.forEach(t),Kr=l(Mt,", a method for pinning a specific version of a model with a commit hash, tag or branch."),Mt.forEach(t),Wo=h(e),Q=i(e,"P",{});var lr=n(Q);Xr=l(lr,"As a result, you can load a specific model version with the "),Xt=i(lr,"CODE",{});var Ui=n(Xt);Zr=l(Ui,"revision"),Ui.forEach(t),Qr=l(lr," parameter:"),lr.forEach(t),Jo=h(e),d(je.$$.fragment,e),Ko=h(e),ct=i(e,"P",{});var Gi=n(ct);el=l(Gi,"Files are also easily edited in a repository, and you can view the commit history as well as the difference:"),Gi.forEach(t),Xo=h(e),_t=i(e,"P",{});var Yi=n(_t);yt=i(Yi,"IMG",{src:!0,alt:!0}),Yi.forEach(t),Zo=h(e),z=i(e,"H2",{class:!0});var sr=n(z);ee=i(sr,"A",{id:!0,class:!0,href:!0});var Vi=n(ee);Zt=i(Vi,"SPAN",{});var Wi=n(Zt);d(He.$$.fragment,Wi),Wi.forEach(t),Vi.forEach(t),tl=h(sr),Qt=i(sr,"SPAN",{});var Ji=n(Qt);ol=l(Ji,"Setup"),Ji.forEach(t),sr.forEach(t),Qo=h(e),te=i(e,"P",{});var ir=n(te);al=l(ir,"Before sharing a model to the Hub, you will need your Hugging Face credentials. If you have access to a terminal, run the following command in the virtual environment where \u{1F917} Transformers is installed. This will store your access token in your Hugging Face cache folder ("),eo=i(ir,"CODE",{});var Ki=n(eo);rl=l(Ki,"~/.cache/"),Ki.forEach(t),ll=l(ir," by default):"),ir.forEach(t),ea=h(e),d(Fe.$$.fragment,e),ta=h(e),oe=i(e,"P",{});var nr=n(oe);sl=l(nr,"If you are using a notebook like Jupyter or Colaboratory, make sure you have the "),Ce=i(nr,"A",{href:!0,rel:!0});var Xi=n(Ce);to=i(Xi,"CODE",{});var Zi=n(to);il=l(Zi,"huggingface_hub"),Zi.forEach(t),Xi.forEach(t),nl=l(nr," library installed. This library allows you to programmatically interact with the Hub."),nr.forEach(t),oa=h(e),d(Se.$$.fragment,e),aa=h(e),C=i(e,"P",{});var Nt=n(C);fl=l(Nt,"Then use "),oo=i(Nt,"CODE",{});var Qi=n(oo);ul=l(Qi,"notebook_login"),Qi.forEach(t),hl=l(Nt," to sign-in to the Hub, and follow the link "),qe=i(Nt,"A",{href:!0,rel:!0});var en=n(qe);pl=l(en,"here"),en.forEach(t),ml=l(Nt," to generate a token to login with:"),Nt.forEach(t),ra=h(e),d(De.$$.fragment,e),la=h(e),L=i(e,"H2",{class:!0});var fr=n(L);ae=i(fr,"A",{id:!0,class:!0,href:!0});var tn=n(ae);ao=i(tn,"SPAN",{});var on=n(ao);d(xe.$$.fragment,on),on.forEach(t),tn.forEach(t),dl=h(fr),ro=i(fr,"SPAN",{});var an=n(ro);cl=l(an,"Convert a model for all frameworks"),an.forEach(t),fr.forEach(t),sa=h(e),wt=i(e,"P",{});var rn=n(wt);_l=l(rn,"To ensure your model can be used by someone working with a different framework, we recommend you convert and upload your model with both PyTorch and TensorFlow checkpoints. While users are still able to load your model from a different framework if you skip this step, it will be slower because \u{1F917} Transformers will need to convert the checkpoint on-the-fly."),rn.forEach(t),ia=h(e),re=i(e,"P",{});var ur=n(re);yl=l(ur,"Converting a checkpoint for another framework is easy. Make sure you have PyTorch and TensorFlow installed (see "),vt=i(ur,"A",{href:!0});var ln=n(vt);wl=l(ln,"here"),ln.forEach(t),vl=l(ur," for installation instructions), and then find the specific model for your task in the other framework."),ur.forEach(t),na=h(e),le=i(e,"P",{});var hr=n(le);gl=l(hr,"For example, suppose you trained DistilBert for sequence classification in PyTorch and want to convert it to it\u2019s TensorFlow equivalent. Load the TensorFlow equivalent of your model for your task, and specify "),lo=i(hr,"CODE",{});var sn=n(lo);bl=l(sn,"from_pt=True"),sn.forEach(t),$l=l(hr," so \u{1F917} Transformers will convert the PyTorch checkpoint to a TensorFlow checkpoint:"),hr.forEach(t),fa=h(e),d(Oe.$$.fragment,e),ua=h(e),gt=i(e,"P",{});var nn=n(gt);kl=l(nn,"Then save your new TensorFlow model with it\u2019s new checkpoint:"),nn.forEach(t),ha=h(e),d(Ie.$$.fragment,e),pa=h(e),se=i(e,"P",{});var pr=n(se);El=l(pr,"Similarly, specify "),so=i(pr,"CODE",{});var fn=n(so);Tl=l(fn,"from_tf=True"),fn.forEach(t),Pl=l(pr," to convert a checkpoint from TensorFlow to PyTorch:"),pr.forEach(t),ma=h(e),d(Me.$$.fragment,e),da=h(e),bt=i(e,"P",{});var un=n(bt);Al=l(un,"If a model is available in Flax, you can also convert a checkpoint from PyTorch to Flax:"),un.forEach(t),ca=h(e),d(Ne.$$.fragment,e),_a=h(e),R=i(e,"H2",{class:!0});var mr=n(R);ie=i(mr,"A",{id:!0,class:!0,href:!0});var hn=n(ie);io=i(hn,"SPAN",{});var pn=n(io);d(ze.$$.fragment,pn),pn.forEach(t),hn.forEach(t),jl=h(mr),$t=i(mr,"SPAN",{});var Ti=n($t);Hl=l(Ti,"Push a model with "),no=i(Ti,"CODE",{});var mn=n(no);Fl=l(mn,"Trainer"),mn.forEach(t),Ti.forEach(t),mr.forEach(t),ya=h(e),d(Le.$$.fragment,e),wa=h(e),k=i(e,"P",{});var I=n(k);Cl=l(I,"Sharing a model to the Hub is as simple as adding an extra parameter or callback. Remember from the "),kt=i(I,"A",{href:!0});var dn=n(kt);Sl=l(dn,"fine-tuning tutorial"),dn.forEach(t),ql=l(I,", the "),Et=i(I,"A",{href:!0});var cn=n(Et);Dl=l(cn,"TrainingArguments"),cn.forEach(t),xl=l(I," class is where you specify hyperparameters and additional training options. One of these training options includes the ability to push a model directly to the Hub. Set "),fo=i(I,"CODE",{});var _n=n(fo);Ol=l(_n,"push_to_hub=True"),_n.forEach(t),Il=l(I," in your "),Tt=i(I,"A",{href:!0});var yn=n(Tt);Ml=l(yn,"TrainingArguments"),yn.forEach(t),Nl=l(I,":"),I.forEach(t),va=h(e),d(Re.$$.fragment,e),ga=h(e),ne=i(e,"P",{});var dr=n(ne);zl=l(dr,"Pass your training arguments as usual to "),Pt=i(dr,"A",{href:!0});var wn=n(Pt);Ll=l(wn,"Trainer"),wn.forEach(t),Rl=l(dr,":"),dr.forEach(t),ba=h(e),d(Be.$$.fragment,e),$a=h(e),S=i(e,"P",{});var zt=n(S);Bl=l(zt,"After you fine-tune your model, call "),At=i(zt,"A",{href:!0});var vn=n(At);Ul=l(vn,"push_to_hub()"),vn.forEach(t),Gl=l(zt," on "),jt=i(zt,"A",{href:!0});var gn=n(jt);Yl=l(gn,"Trainer"),gn.forEach(t),Vl=l(zt," to push the trained model to the Hub. \u{1F917} Transformers will even automatically add training hyperparameters, training results and framework versions to your model card!"),zt.forEach(t),ka=h(e),d(Ue.$$.fragment,e),Ea=h(e),B=i(e,"H2",{class:!0});var cr=n(B);fe=i(cr,"A",{id:!0,class:!0,href:!0});var bn=n(fe);uo=i(bn,"SPAN",{});var $n=n(uo);d(Ge.$$.fragment,$n),$n.forEach(t),bn.forEach(t),Wl=h(cr),Ht=i(cr,"SPAN",{});var Pi=n(Ht);Jl=l(Pi,"Push a model with "),ho=i(Pi,"CODE",{});var kn=n(ho);Kl=l(kn,"PushToHubCallback"),kn.forEach(t),Pi.forEach(t),cr.forEach(t),Ta=h(e),q=i(e,"P",{});var Lt=n(q);Xl=l(Lt,"TensorFlow users can enable the same functionality with "),Ft=i(Lt,"A",{href:!0});var En=n(Ft);Zl=l(En,"PushToHubCallback"),En.forEach(t),Ql=l(Lt,". In the "),Ct=i(Lt,"A",{href:!0});var Tn=n(Ct);es=l(Tn,"PushToHubCallback"),Tn.forEach(t),ts=l(Lt," function, add:"),Lt.forEach(t),Pa=h(e),D=i(e,"UL",{});var Rt=n(D);po=i(Rt,"LI",{});var Pn=n(po);os=l(Pn,"An output directory for your model."),Pn.forEach(t),as=h(Rt),mo=i(Rt,"LI",{});var An=n(mo);rs=l(An,"A tokenizer."),An.forEach(t),ls=h(Rt),Ye=i(Rt,"LI",{});var _r=n(Ye);ss=l(_r,"The "),co=i(_r,"CODE",{});var jn=n(co);is=l(jn,"hub_model_id"),jn.forEach(t),ns=l(_r,", which is your Hub username and model name."),_r.forEach(t),Rt.forEach(t),Aa=h(e),d(Ve.$$.fragment,e),ja=h(e),ue=i(e,"P",{});var yr=n(ue);fs=l(yr,"Add the callback to "),We=i(yr,"A",{href:!0,rel:!0});var Hn=n(We);_o=i(Hn,"CODE",{});var Fn=n(_o);us=l(Fn,"fit"),Fn.forEach(t),Hn.forEach(t),hs=l(yr,", and \u{1F917} Transformers will push the trained model to the Hub:"),yr.forEach(t),Ha=h(e),d(Je.$$.fragment,e),Fa=h(e),U=i(e,"H2",{class:!0});var wr=n(U);he=i(wr,"A",{id:!0,class:!0,href:!0});var Cn=n(he);yo=i(Cn,"SPAN",{});var Sn=n(yo);d(Ke.$$.fragment,Sn),Sn.forEach(t),Cn.forEach(t),ps=h(wr),Xe=i(wr,"SPAN",{});var vr=n(Xe);ms=l(vr,"Use the "),wo=i(vr,"CODE",{});var qn=n(wo);ds=l(qn,"push_to_hub"),qn.forEach(t),cs=l(vr," function"),vr.forEach(t),wr.forEach(t),Ca=h(e),pe=i(e,"P",{});var gr=n(pe);_s=l(gr,"You can also call "),vo=i(gr,"CODE",{});var Dn=n(vo);ys=l(Dn,"push_to_hub"),Dn.forEach(t),ws=l(gr," directly on your model to upload it to the Hub."),gr.forEach(t),Sa=h(e),me=i(e,"P",{});var br=n(me);vs=l(br,"Specify your model name in "),go=i(br,"CODE",{});var xn=n(go);gs=l(xn,"push_to_hub"),xn.forEach(t),bs=l(br,":"),br.forEach(t),qa=h(e),d(Ze.$$.fragment,e),Da=h(e),x=i(e,"P",{});var Bt=n(x);$s=l(Bt,"This creates a repository under your username with the model name "),bo=i(Bt,"CODE",{});var On=n(bo);ks=l(On,"my-awesome-model"),On.forEach(t),Es=l(Bt,". Users can now load your model with the "),$o=i(Bt,"CODE",{});var In=n($o);Ts=l(In,"from_pretrained"),In.forEach(t),Ps=l(Bt," function:"),Bt.forEach(t),xa=h(e),d(Qe.$$.fragment,e),Oa=h(e),de=i(e,"P",{});var $r=n(de);As=l($r,"If you belong to an organization and want to push your model under the organization name instead, add the "),ko=i($r,"CODE",{});var Mn=n(ko);js=l(Mn,"organization"),Mn.forEach(t),Hs=l($r," parameter:"),$r.forEach(t),Ia=h(e),d(et.$$.fragment,e),Ma=h(e),ce=i(e,"P",{});var kr=n(ce);Fs=l(kr,"The "),Eo=i(kr,"CODE",{});var Nn=n(Eo);Cs=l(Nn,"push_to_hub"),Nn.forEach(t),Ss=l(kr," function can also be used to add other files to a model repository. For example, add a tokenizer to a model repository:"),kr.forEach(t),Na=h(e),d(tt.$$.fragment,e),za=h(e),St=i(e,"P",{});var zn=n(St);qs=l(zn,"Or perhaps you\u2019d like to add the TensorFlow version of your fine-tuned PyTorch model:"),zn.forEach(t),La=h(e),d(ot.$$.fragment,e),Ra=h(e),_e=i(e,"P",{});var Er=n(_e);Ds=l(Er,"Now when you navigate to the your Hugging Face profile, you should see your newly created model repository. Clicking on the "),To=i(Er,"STRONG",{});var Ln=n(To);xs=l(Ln,"Files"),Ln.forEach(t),Os=l(Er," tab will display all the files you\u2019ve uploaded to the repository."),Er.forEach(t),Ba=h(e),ye=i(e,"P",{});var Tr=n(ye);Is=l(Tr,"For more details on how to create and upload files to a repository, refer to the Hub documentation "),at=i(Tr,"A",{href:!0,rel:!0});var Rn=n(at);Ms=l(Rn,"here"),Rn.forEach(t),Ns=l(Tr,"."),Tr.forEach(t),Ua=h(e),G=i(e,"H2",{class:!0});var Pr=n(G);we=i(Pr,"A",{id:!0,class:!0,href:!0});var Bn=n(we);Po=i(Bn,"SPAN",{});var Un=n(Po);d(rt.$$.fragment,Un),Un.forEach(t),Bn.forEach(t),zs=h(Pr),Ao=i(Pr,"SPAN",{});var Gn=n(Ao);Ls=l(Gn,"Upload with the web interface"),Gn.forEach(t),Pr.forEach(t),Ga=h(e),ve=i(e,"P",{});var Ar=n(ve);Rs=l(Ar,"Users who prefer a no-code approach are able to upload a model through the Hub\u2019s web interface. Visit "),lt=i(Ar,"A",{href:!0,rel:!0});var Yn=n(lt);Bs=l(Yn,"huggingface.co/new"),Yn.forEach(t),Us=l(Ar," to create a new repository:"),Ar.forEach(t),Ya=h(e),qt=i(e,"P",{});var Vn=n(qt);Dt=i(Vn,"IMG",{src:!0,alt:!0}),Vn.forEach(t),Va=h(e),xt=i(e,"P",{});var Wn=n(xt);Gs=l(Wn,"From here, add some information about your model:"),Wn.forEach(t),Wa=h(e),P=i(e,"UL",{});var ke=n(P);st=i(ke,"LI",{});var jr=n(st);Ys=l(jr,"Select the "),jo=i(jr,"STRONG",{});var Jn=n(jo);Vs=l(Jn,"owner"),Jn.forEach(t),Ws=l(jr," of the repository. This can be yourself or any of the organizations you belong to."),jr.forEach(t),Js=h(ke),Ho=i(ke,"LI",{});var Kn=n(Ho);Ks=l(Kn,"Pick a name for your model, which will also be the repository name."),Kn.forEach(t),Xs=h(ke),Fo=i(ke,"LI",{});var Xn=n(Fo);Zs=l(Xn,"Choose whether your model is public or private."),Xn.forEach(t),Qs=h(ke),Co=i(ke,"LI",{});var Zn=n(Co);ei=l(Zn,"Specify the license usage for your model."),Zn.forEach(t),ke.forEach(t),Ja=h(e),O=i(e,"P",{});var Ut=n(O);ti=l(Ut,"Now click on the "),So=i(Ut,"STRONG",{});var Qn=n(So);oi=l(Qn,"Files"),Qn.forEach(t),ai=l(Ut," tab and click on the "),qo=i(Ut,"STRONG",{});var ef=n(qo);ri=l(ef,"Add file"),ef.forEach(t),li=l(Ut," button to upload a new file to your repository. Then drag-and-drop a file to upload and add a commit message."),Ut.forEach(t),Ka=h(e),Ot=i(e,"P",{});var tf=n(Ot);It=i(tf,"IMG",{src:!0,alt:!0}),tf.forEach(t),Xa=h(e),Y=i(e,"H2",{class:!0});var Hr=n(Y);ge=i(Hr,"A",{id:!0,class:!0,href:!0});var of=n(ge);Do=i(of,"SPAN",{});var af=n(Do);d(it.$$.fragment,af),af.forEach(t),of.forEach(t),si=h(Hr),xo=i(Hr,"SPAN",{});var rf=n(xo);ii=l(rf,"Add a model card"),rf.forEach(t),Hr.forEach(t),Za=h(e),be=i(e,"P",{});var Fr=n(be);ni=l(Fr,"To make sure users understand your model\u2019s capabilities, limitations, potential biases and ethical considerations, please add a model card to your repository. The model card is defined in the "),Oo=i(Fr,"CODE",{});var lf=n(Oo);fi=l(lf,"README.md"),lf.forEach(t),ui=l(Fr," file. You can add a model card by:"),Fr.forEach(t),Qa=h(e),$e=i(e,"UL",{});var Cr=n($e);nt=i(Cr,"LI",{});var Sr=n(nt);hi=l(Sr,"Manually creating and uploading a "),Io=i(Sr,"CODE",{});var sf=n(Io);pi=l(sf,"README.md"),sf.forEach(t),mi=l(Sr," file."),Sr.forEach(t),di=h(Cr),ft=i(Cr,"LI",{});var qr=n(ft);ci=l(qr,"Clicking on the "),Mo=i(qr,"STRONG",{});var nf=n(Mo);_i=l(nf,"Edit model card"),nf.forEach(t),yi=l(qr," button in your model repository."),qr.forEach(t),Cr.forEach(t),er=h(e),A=i(e,"P",{});var Ee=n(A);wi=l(Ee,"Take a look at the DistilBert "),ut=i(Ee,"A",{href:!0,rel:!0});var ff=n(ut);vi=l(ff,"model card"),ff.forEach(t),gi=l(Ee," for a good example of the type of information a model card should include. For more details about other options you can control in the "),No=i(Ee,"CODE",{});var uf=n(No);bi=l(uf,"README.md"),uf.forEach(t),$i=l(Ee," file such as a model\u2019s carbon footprint or widget examples, refer to the documentation "),ht=i(Ee,"A",{href:!0,rel:!0});var hf=n(ht);ki=l(hf,"here"),hf.forEach(t),Ei=l(Ee,"."),Ee.forEach(t),this.h()},h(){p(g,"name","hf:doc:metadata"),p(g,"content",JSON.stringify(gf)),p($,"id","share-a-model"),p($,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p($,"href","#share-a-model"),p(v,"class","relative group"),p(Te,"href","https://huggingface.co/models"),p(Te,"rel","nofollow"),p(T,"width","560"),p(T,"height","315"),Dr(T.src,Ai="https://www.youtube.com/embed/XvSGPZFEjDY")||p(T,"src",Ai),p(T,"title","YouTube video player"),p(T,"frameborder","0"),p(T,"allow",`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope;
picture-in-picture`),T.allowFullscreen=!0,p(Z,"id","repository-features"),p(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Z,"href","#repository-features"),p(N,"class","relative group"),p(Ae,"href","https://git-lfs.github.com/"),p(Ae,"rel","nofollow"),Dr(yt.src,ji="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/vis_diff.png")||p(yt,"src",ji),p(yt,"alt","vis_diff"),p(ee,"id","setup"),p(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ee,"href","#setup"),p(z,"class","relative group"),p(Ce,"href","https://huggingface.co/docs/hub/adding-a-library"),p(Ce,"rel","nofollow"),p(qe,"href","https://huggingface.co/settings/token"),p(qe,"rel","nofollow"),p(ae,"id","convert-a-model-for-all-frameworks"),p(ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ae,"href","#convert-a-model-for-all-frameworks"),p(L,"class","relative group"),p(vt,"href","installation"),p(ie,"id","push-a-model-with-trainer"),p(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ie,"href","#push-a-model-with-trainer"),p(R,"class","relative group"),p(kt,"href","training"),p(Et,"href","/docs/transformers/pr_15839/en/main_classes/trainer#transformers.TrainingArguments"),p(Tt,"href","/docs/transformers/pr_15839/en/main_classes/trainer#transformers.TrainingArguments"),p(Pt,"href","/docs/transformers/pr_15839/en/main_classes/trainer#transformers.Trainer"),p(At,"href","/docs/transformers/pr_15839/en/main_classes/trainer#transformers.Trainer.push_to_hub"),p(jt,"href","/docs/transformers/pr_15839/en/main_classes/trainer#transformers.Trainer"),p(fe,"id","push-a-model-with-pushtohubcallback"),p(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(fe,"href","#push-a-model-with-pushtohubcallback"),p(B,"class","relative group"),p(Ft,"href","/docs/transformers/pr_15839/en/main_classes/keras_callbacks#transformers.PushToHubCallback"),p(Ct,"href","/docs/transformers/pr_15839/en/main_classes/keras_callbacks#transformers.PushToHubCallback"),p(We,"href","https://keras.io/api/models/model_training_apis/"),p(We,"rel","nofollow"),p(he,"id","use-the-pushtohub-function"),p(he,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(he,"href","#use-the-pushtohub-function"),p(U,"class","relative group"),p(at,"href","https://huggingface.co/docs/hub/how-to-upstream"),p(at,"rel","nofollow"),p(we,"id","upload-with-the-web-interface"),p(we,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(we,"href","#upload-with-the-web-interface"),p(G,"class","relative group"),p(lt,"href","https://huggingface.co/new"),p(lt,"rel","nofollow"),Dr(Dt.src,Hi="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/new_model_repo.png")||p(Dt,"src",Hi),p(Dt,"alt","new_model_repo"),Dr(It.src,Fi="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/upload_file.png")||p(It,"src",Fi),p(It,"alt","upload_file"),p(ge,"id","add-a-model-card"),p(ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ge,"href","#add-a-model-card"),p(Y,"class","relative group"),p(ut,"href","https://huggingface.co/distilbert-base-uncased"),p(ut,"rel","nofollow"),p(ht,"href","https://huggingface.co/docs/hub/model-repos"),p(ht,"rel","nofollow")},m(e,a){o(document.head,g),f(e,j,a),f(e,v,a),o(v,$),o($,M),c(E,M,null),o(v,H),o(v,W),o(W,xr),f(e,zo,a),f(e,mt,a),o(mt,Or),f(e,Lo,a),f(e,J,a),o(J,Ir),o(J,Te),o(Te,Mr),o(J,Nr),f(e,Ro,a),f(e,K,a),o(K,Yt),o(Yt,zr),o(K,Lr),o(K,Vt),o(Vt,Rr),f(e,Bo,a),f(e,T,a),f(e,Uo,a),c(X,e,a),f(e,Go,a),f(e,N,a),o(N,Z),o(Z,Wt),c(Pe,Wt,null),o(N,Br),o(N,Jt),o(Jt,Ur),f(e,Yo,a),f(e,dt,a),o(dt,Gr),f(e,Vo,a),f(e,F,a),o(F,Yr),o(F,Ae),o(Ae,Vr),o(F,Wr),o(F,Kt),o(Kt,Jr),o(F,Kr),f(e,Wo,a),f(e,Q,a),o(Q,Xr),o(Q,Xt),o(Xt,Zr),o(Q,Qr),f(e,Jo,a),c(je,e,a),f(e,Ko,a),f(e,ct,a),o(ct,el),f(e,Xo,a),f(e,_t,a),o(_t,yt),f(e,Zo,a),f(e,z,a),o(z,ee),o(ee,Zt),c(He,Zt,null),o(z,tl),o(z,Qt),o(Qt,ol),f(e,Qo,a),f(e,te,a),o(te,al),o(te,eo),o(eo,rl),o(te,ll),f(e,ea,a),c(Fe,e,a),f(e,ta,a),f(e,oe,a),o(oe,sl),o(oe,Ce),o(Ce,to),o(to,il),o(oe,nl),f(e,oa,a),c(Se,e,a),f(e,aa,a),f(e,C,a),o(C,fl),o(C,oo),o(oo,ul),o(C,hl),o(C,qe),o(qe,pl),o(C,ml),f(e,ra,a),c(De,e,a),f(e,la,a),f(e,L,a),o(L,ae),o(ae,ao),c(xe,ao,null),o(L,dl),o(L,ro),o(ro,cl),f(e,sa,a),f(e,wt,a),o(wt,_l),f(e,ia,a),f(e,re,a),o(re,yl),o(re,vt),o(vt,wl),o(re,vl),f(e,na,a),f(e,le,a),o(le,gl),o(le,lo),o(lo,bl),o(le,$l),f(e,fa,a),c(Oe,e,a),f(e,ua,a),f(e,gt,a),o(gt,kl),f(e,ha,a),c(Ie,e,a),f(e,pa,a),f(e,se,a),o(se,El),o(se,so),o(so,Tl),o(se,Pl),f(e,ma,a),c(Me,e,a),f(e,da,a),f(e,bt,a),o(bt,Al),f(e,ca,a),c(Ne,e,a),f(e,_a,a),f(e,R,a),o(R,ie),o(ie,io),c(ze,io,null),o(R,jl),o(R,$t),o($t,Hl),o($t,no),o(no,Fl),f(e,ya,a),c(Le,e,a),f(e,wa,a),f(e,k,a),o(k,Cl),o(k,kt),o(kt,Sl),o(k,ql),o(k,Et),o(Et,Dl),o(k,xl),o(k,fo),o(fo,Ol),o(k,Il),o(k,Tt),o(Tt,Ml),o(k,Nl),f(e,va,a),c(Re,e,a),f(e,ga,a),f(e,ne,a),o(ne,zl),o(ne,Pt),o(Pt,Ll),o(ne,Rl),f(e,ba,a),c(Be,e,a),f(e,$a,a),f(e,S,a),o(S,Bl),o(S,At),o(At,Ul),o(S,Gl),o(S,jt),o(jt,Yl),o(S,Vl),f(e,ka,a),c(Ue,e,a),f(e,Ea,a),f(e,B,a),o(B,fe),o(fe,uo),c(Ge,uo,null),o(B,Wl),o(B,Ht),o(Ht,Jl),o(Ht,ho),o(ho,Kl),f(e,Ta,a),f(e,q,a),o(q,Xl),o(q,Ft),o(Ft,Zl),o(q,Ql),o(q,Ct),o(Ct,es),o(q,ts),f(e,Pa,a),f(e,D,a),o(D,po),o(po,os),o(D,as),o(D,mo),o(mo,rs),o(D,ls),o(D,Ye),o(Ye,ss),o(Ye,co),o(co,is),o(Ye,ns),f(e,Aa,a),c(Ve,e,a),f(e,ja,a),f(e,ue,a),o(ue,fs),o(ue,We),o(We,_o),o(_o,us),o(ue,hs),f(e,Ha,a),c(Je,e,a),f(e,Fa,a),f(e,U,a),o(U,he),o(he,yo),c(Ke,yo,null),o(U,ps),o(U,Xe),o(Xe,ms),o(Xe,wo),o(wo,ds),o(Xe,cs),f(e,Ca,a),f(e,pe,a),o(pe,_s),o(pe,vo),o(vo,ys),o(pe,ws),f(e,Sa,a),f(e,me,a),o(me,vs),o(me,go),o(go,gs),o(me,bs),f(e,qa,a),c(Ze,e,a),f(e,Da,a),f(e,x,a),o(x,$s),o(x,bo),o(bo,ks),o(x,Es),o(x,$o),o($o,Ts),o(x,Ps),f(e,xa,a),c(Qe,e,a),f(e,Oa,a),f(e,de,a),o(de,As),o(de,ko),o(ko,js),o(de,Hs),f(e,Ia,a),c(et,e,a),f(e,Ma,a),f(e,ce,a),o(ce,Fs),o(ce,Eo),o(Eo,Cs),o(ce,Ss),f(e,Na,a),c(tt,e,a),f(e,za,a),f(e,St,a),o(St,qs),f(e,La,a),c(ot,e,a),f(e,Ra,a),f(e,_e,a),o(_e,Ds),o(_e,To),o(To,xs),o(_e,Os),f(e,Ba,a),f(e,ye,a),o(ye,Is),o(ye,at),o(at,Ms),o(ye,Ns),f(e,Ua,a),f(e,G,a),o(G,we),o(we,Po),c(rt,Po,null),o(G,zs),o(G,Ao),o(Ao,Ls),f(e,Ga,a),f(e,ve,a),o(ve,Rs),o(ve,lt),o(lt,Bs),o(ve,Us),f(e,Ya,a),f(e,qt,a),o(qt,Dt),f(e,Va,a),f(e,xt,a),o(xt,Gs),f(e,Wa,a),f(e,P,a),o(P,st),o(st,Ys),o(st,jo),o(jo,Vs),o(st,Ws),o(P,Js),o(P,Ho),o(Ho,Ks),o(P,Xs),o(P,Fo),o(Fo,Zs),o(P,Qs),o(P,Co),o(Co,ei),f(e,Ja,a),f(e,O,a),o(O,ti),o(O,So),o(So,oi),o(O,ai),o(O,qo),o(qo,ri),o(O,li),f(e,Ka,a),f(e,Ot,a),o(Ot,It),f(e,Xa,a),f(e,Y,a),o(Y,ge),o(ge,Do),c(it,Do,null),o(Y,si),o(Y,xo),o(xo,ii),f(e,Za,a),f(e,be,a),o(be,ni),o(be,Oo),o(Oo,fi),o(be,ui),f(e,Qa,a),f(e,$e,a),o($e,nt),o(nt,hi),o(nt,Io),o(Io,pi),o(nt,mi),o($e,di),o($e,ft),o(ft,ci),o(ft,Mo),o(Mo,_i),o(ft,yi),f(e,er,a),f(e,A,a),o(A,wi),o(A,ut),o(ut,vi),o(A,gi),o(A,No),o(No,bi),o(A,$i),o(A,ht),o(ht,ki),o(A,Ei),tr=!0},p(e,[a]){const pt={};a&2&&(pt.$$scope={dirty:a,ctx:e}),X.$set(pt)},i(e){tr||(_(E.$$.fragment,e),_(X.$$.fragment,e),_(Pe.$$.fragment,e),_(je.$$.fragment,e),_(He.$$.fragment,e),_(Fe.$$.fragment,e),_(Se.$$.fragment,e),_(De.$$.fragment,e),_(xe.$$.fragment,e),_(Oe.$$.fragment,e),_(Ie.$$.fragment,e),_(Me.$$.fragment,e),_(Ne.$$.fragment,e),_(ze.$$.fragment,e),_(Le.$$.fragment,e),_(Re.$$.fragment,e),_(Be.$$.fragment,e),_(Ue.$$.fragment,e),_(Ge.$$.fragment,e),_(Ve.$$.fragment,e),_(Je.$$.fragment,e),_(Ke.$$.fragment,e),_(Ze.$$.fragment,e),_(Qe.$$.fragment,e),_(et.$$.fragment,e),_(tt.$$.fragment,e),_(ot.$$.fragment,e),_(rt.$$.fragment,e),_(it.$$.fragment,e),tr=!0)},o(e){y(E.$$.fragment,e),y(X.$$.fragment,e),y(Pe.$$.fragment,e),y(je.$$.fragment,e),y(He.$$.fragment,e),y(Fe.$$.fragment,e),y(Se.$$.fragment,e),y(De.$$.fragment,e),y(xe.$$.fragment,e),y(Oe.$$.fragment,e),y(Ie.$$.fragment,e),y(Me.$$.fragment,e),y(Ne.$$.fragment,e),y(ze.$$.fragment,e),y(Le.$$.fragment,e),y(Re.$$.fragment,e),y(Be.$$.fragment,e),y(Ue.$$.fragment,e),y(Ge.$$.fragment,e),y(Ve.$$.fragment,e),y(Je.$$.fragment,e),y(Ke.$$.fragment,e),y(Ze.$$.fragment,e),y(Qe.$$.fragment,e),y(et.$$.fragment,e),y(tt.$$.fragment,e),y(ot.$$.fragment,e),y(rt.$$.fragment,e),y(it.$$.fragment,e),tr=!1},d(e){t(g),e&&t(j),e&&t(v),w(E),e&&t(zo),e&&t(mt),e&&t(Lo),e&&t(J),e&&t(Ro),e&&t(K),e&&t(Bo),e&&t(T),e&&t(Uo),w(X,e),e&&t(Go),e&&t(N),w(Pe),e&&t(Yo),e&&t(dt),e&&t(Vo),e&&t(F),e&&t(Wo),e&&t(Q),e&&t(Jo),w(je,e),e&&t(Ko),e&&t(ct),e&&t(Xo),e&&t(_t),e&&t(Zo),e&&t(z),w(He),e&&t(Qo),e&&t(te),e&&t(ea),w(Fe,e),e&&t(ta),e&&t(oe),e&&t(oa),w(Se,e),e&&t(aa),e&&t(C),e&&t(ra),w(De,e),e&&t(la),e&&t(L),w(xe),e&&t(sa),e&&t(wt),e&&t(ia),e&&t(re),e&&t(na),e&&t(le),e&&t(fa),w(Oe,e),e&&t(ua),e&&t(gt),e&&t(ha),w(Ie,e),e&&t(pa),e&&t(se),e&&t(ma),w(Me,e),e&&t(da),e&&t(bt),e&&t(ca),w(Ne,e),e&&t(_a),e&&t(R),w(ze),e&&t(ya),w(Le,e),e&&t(wa),e&&t(k),e&&t(va),w(Re,e),e&&t(ga),e&&t(ne),e&&t(ba),w(Be,e),e&&t($a),e&&t(S),e&&t(ka),w(Ue,e),e&&t(Ea),e&&t(B),w(Ge),e&&t(Ta),e&&t(q),e&&t(Pa),e&&t(D),e&&t(Aa),w(Ve,e),e&&t(ja),e&&t(ue),e&&t(Ha),w(Je,e),e&&t(Fa),e&&t(U),w(Ke),e&&t(Ca),e&&t(pe),e&&t(Sa),e&&t(me),e&&t(qa),w(Ze,e),e&&t(Da),e&&t(x),e&&t(xa),w(Qe,e),e&&t(Oa),e&&t(de),e&&t(Ia),w(et,e),e&&t(Ma),e&&t(ce),e&&t(Na),w(tt,e),e&&t(za),e&&t(St),e&&t(La),w(ot,e),e&&t(Ra),e&&t(_e),e&&t(Ba),e&&t(ye),e&&t(Ua),e&&t(G),w(rt),e&&t(Ga),e&&t(ve),e&&t(Ya),e&&t(qt),e&&t(Va),e&&t(xt),e&&t(Wa),e&&t(P),e&&t(Ja),e&&t(O),e&&t(Ka),e&&t(Ot),e&&t(Xa),e&&t(Y),w(it),e&&t(Za),e&&t(be),e&&t(Qa),e&&t($e),e&&t(er),e&&t(A)}}}const gf={local:"share-a-model",sections:[{local:"repository-features",title:"Repository features"},{local:"setup",title:"Setup"},{local:"convert-a-model-for-all-frameworks",title:"Convert a model for all frameworks"},{local:"push-a-model-with-trainer",title:"Push a model with `Trainer`"},{local:"push-a-model-with-pushtohubcallback",title:"Push a model with `PushToHubCallback`"},{local:"use-the-pushtohub-function",title:"Use the `push_to_hub` function"},{local:"upload-with-the-web-interface",title:"Upload with the web interface"},{local:"add-a-model-card",title:"Add a model card"}],title:"Share a model"};function bf(Gt,g,j){let{fw:v}=g;return Gt.$$set=$=>{"fw"in $&&j(0,v=$.fw)},[v]}class jf extends pf{constructor(g){super();mf(this,g,bf,vf,df,{fw:0})}}export{jf as default,gf as metadata};
