import{S as Is,i as Os,s as Ns,e as l,k as h,w as E,t as r,M as zs,c as s,d as t,m,a as i,x as T,h as a,b as c,N as Ir,G as o,g as f,y as P,q as A,o as j,B as H,v as Rs,L as wo}from"../chunks/vendor-hf-doc-builder.js";import{T as Ls}from"../chunks/Tip-hf-doc-builder.js";import{Y as Us}from"../chunks/Youtube-hf-doc-builder.js";import{I as We}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as V}from"../chunks/CodeBlock-hf-doc-builder.js";import{F as Ms,M as vo}from"../chunks/Markdown-hf-doc-builder.js";function Bs(I){let p,$,n,d,w;return{c(){p=l("p"),$=r("To share a model with the community, you need an account on "),n=l("a"),d=r("huggingface.co"),w=r(". You can also join an existing organization or create a new one."),this.h()},l(y){p=s(y,"P",{});var b=i(p);$=a(b,"To share a model with the community, you need an account on "),n=s(b,"A",{href:!0,rel:!0});var F=i(n);d=a(F,"huggingface.co"),F.forEach(t),w=a(b,". You can also join an existing organization or create a new one."),b.forEach(t),this.h()},h(){c(n,"href","https://huggingface.co/join"),c(n,"rel","nofollow")},m(y,b){f(y,p,b),o(p,$),o(p,n),o(n,d),o(p,w)},d(y){y&&t(p)}}}function Gs(I){let p,$,n,d,w,y,b,F;return b=new V({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>)`}}),{c(){p=l("p"),$=r("Specify "),n=l("code"),d=r("from_tf=True"),w=r(" to convert a checkpoint from TensorFlow to PyTorch:"),y=h(),E(b.$$.fragment)},l(k){p=s(k,"P",{});var C=i(p);$=a(C,"Specify "),n=s(C,"CODE",{});var x=i(n);d=a(x,"from_tf=True"),x.forEach(t),w=a(C," to convert a checkpoint from TensorFlow to PyTorch:"),C.forEach(t),y=m(k),T(b.$$.fragment,k)},m(k,C){f(k,p,C),o(p,$),o(p,n),o(n,d),o(p,w),f(k,y,C),P(b,k,C),F=!0},p:wo,i(k){F||(A(b.$$.fragment,k),F=!0)},o(k){j(b.$$.fragment,k),F=!1},d(k){k&&t(p),k&&t(y),H(b,k)}}}function Ys(I){let p,$;return p=new vo({props:{$$slots:{default:[Gs]},$$scope:{ctx:I}}}),{c(){E(p.$$.fragment)},l(n){T(p.$$.fragment,n)},m(n,d){P(p,n,d),$=!0},p(n,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:n}),p.$set(w)},i(n){$||(A(p.$$.fragment,n),$=!0)},o(n){j(p.$$.fragment,n),$=!1},d(n){H(p,n)}}}function Vs(I){let p,$,n,d,w,y,b,F,k,C,x,R,W;return b=new V({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>)'}}),R=new V({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>)'}}),{c(){p=l("p"),$=r("Specify "),n=l("code"),d=r("from_pt=True"),w=r(" to convert a checkpoint from PyTorch to TensorFlow:"),y=h(),E(b.$$.fragment),F=h(),k=l("p"),C=r("Then you can save your new TensorFlow model with it\u2019s new checkpoint:"),x=h(),E(R.$$.fragment)},l(g){p=s(g,"P",{});var M=i(p);$=a(M,"Specify "),n=s(M,"CODE",{});var G=i(n);d=a(G,"from_pt=True"),G.forEach(t),w=a(M," to convert a checkpoint from PyTorch to TensorFlow:"),M.forEach(t),y=m(g),T(b.$$.fragment,g),F=m(g),k=s(g,"P",{});var L=i(k);C=a(L,"Then you can save your new TensorFlow model with it\u2019s new checkpoint:"),L.forEach(t),x=m(g),T(R.$$.fragment,g)},m(g,M){f(g,p,M),o(p,$),o(p,n),o(n,d),o(p,w),f(g,y,M),P(b,g,M),f(g,F,M),f(g,k,M),o(k,C),f(g,x,M),P(R,g,M),W=!0},p:wo,i(g){W||(A(b.$$.fragment,g),A(R.$$.fragment,g),W=!0)},o(g){j(b.$$.fragment,g),j(R.$$.fragment,g),W=!1},d(g){g&&t(p),g&&t(y),H(b,g),g&&t(F),g&&t(k),g&&t(x),H(R,g)}}}function Ws(I){let p,$;return p=new vo({props:{$$slots:{default:[Vs]},$$scope:{ctx:I}}}),{c(){E(p.$$.fragment)},l(n){T(p.$$.fragment,n)},m(n,d){P(p,n,d),$=!0},p(n,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:n}),p.$set(w)},i(n){$||(A(p.$$.fragment,n),$=!0)},o(n){j(p.$$.fragment,n),$=!1},d(n){H(p,n)}}}function Js(I){let p,$,n,d,w;return d=new V({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>)`}}),{c(){p=l("p"),$=r("If a model is available in Flax, you can also convert a checkpoint from PyTorch to Flax:"),n=h(),E(d.$$.fragment)},l(y){p=s(y,"P",{});var b=i(p);$=a(b,"If a model is available in Flax, you can also convert a checkpoint from PyTorch to Flax:"),b.forEach(t),n=m(y),T(d.$$.fragment,y)},m(y,b){f(y,p,b),o(p,$),f(y,n,b),P(d,y,b),w=!0},p:wo,i(y){w||(A(d.$$.fragment,y),w=!0)},o(y){j(d.$$.fragment,y),w=!1},d(y){y&&t(p),y&&t(n),H(d,y)}}}function Ks(I){let p,$;return p=new vo({props:{$$slots:{default:[Js]},$$scope:{ctx:I}}}),{c(){E(p.$$.fragment)},l(n){T(p.$$.fragment,n)},m(n,d){P(p,n,d),$=!0},p(n,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:n}),p.$set(w)},i(n){$||(A(p.$$.fragment,n),$=!0)},o(n){j(p.$$.fragment,n),$=!1},d(n){H(p,n)}}}function Xs(I){let p,$,n,d,w,y,b,F,k,C,x,R,W,g,M,G,L,Z,Q,O,le,ee,te,ae,J,K,D,U,ie,B,se,N,z,v,q,ue,X,oe;return p=new Us({props:{id:"Z1-XMy-GNLQ"}}),Z=new V({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>)'}}),K=new V({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>)`}}),X=new V({props:{code:"trainer.push_to_hub()",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()'}}),{c(){E(p.$$.fragment),$=h(),n=l("p"),d=r("Sharing a model to the Hub is as simple as adding an extra parameter or callback. Remember from the "),w=l("a"),y=r("fine-tuning tutorial"),b=r(", the "),F=l("a"),k=r("TrainingArguments"),C=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 "),x=l("code"),R=r("push_to_hub=True"),W=r(" in your "),g=l("a"),M=r("TrainingArguments"),G=r(":"),L=h(),E(Z.$$.fragment),Q=h(),O=l("p"),le=r("Pass your training arguments as usual to "),ee=l("a"),te=r("Trainer"),ae=r(":"),J=h(),E(K.$$.fragment),D=h(),U=l("p"),ie=r("After you fine-tune your model, call "),B=l("a"),se=r("push_to_hub()"),N=r(" on "),z=l("a"),v=r("Trainer"),q=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!"),ue=h(),E(X.$$.fragment),this.h()},l(_){T(p.$$.fragment,_),$=m(_),n=s(_,"P",{});var S=i(n);d=a(S,"Sharing a model to the Hub is as simple as adding an extra parameter or callback. Remember from the "),w=s(S,"A",{href:!0});var pe=i(w);y=a(pe,"fine-tuning tutorial"),pe.forEach(t),b=a(S,", the "),F=s(S,"A",{href:!0});var he=i(F);k=a(he,"TrainingArguments"),he.forEach(t),C=a(S," 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 "),x=s(S,"CODE",{});var Y=i(x);R=a(Y,"push_to_hub=True"),Y.forEach(t),W=a(S," in your "),g=s(S,"A",{href:!0});var $e=i(g);M=a($e,"TrainingArguments"),$e.forEach(t),G=a(S,":"),S.forEach(t),L=m(_),T(Z.$$.fragment,_),Q=m(_),O=s(_,"P",{});var re=i(O);le=a(re,"Pass your training arguments as usual to "),ee=s(re,"A",{href:!0});var vt=i(ee);te=a(vt,"Trainer"),vt.forEach(t),ae=a(re,":"),re.forEach(t),J=m(_),T(K.$$.fragment,_),D=m(_),U=s(_,"P",{});var me=i(U);ie=a(me,"After you fine-tune your model, call "),B=s(me,"A",{href:!0});var Ee=i(B);se=a(Ee,"push_to_hub()"),Ee.forEach(t),N=a(me," on "),z=s(me,"A",{href:!0});var bt=i(z);v=a(bt,"Trainer"),bt.forEach(t),q=a(me," 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!"),me.forEach(t),ue=m(_),T(X.$$.fragment,_),this.h()},h(){c(w,"href","training"),c(F,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),c(g,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),c(ee,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),c(B,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer.push_to_hub"),c(z,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer")},m(_,S){P(p,_,S),f(_,$,S),f(_,n,S),o(n,d),o(n,w),o(w,y),o(n,b),o(n,F),o(F,k),o(n,C),o(n,x),o(x,R),o(n,W),o(n,g),o(g,M),o(n,G),f(_,L,S),P(Z,_,S),f(_,Q,S),f(_,O,S),o(O,le),o(O,ee),o(ee,te),o(O,ae),f(_,J,S),P(K,_,S),f(_,D,S),f(_,U,S),o(U,ie),o(U,B),o(B,se),o(U,N),o(U,z),o(z,v),o(U,q),f(_,ue,S),P(X,_,S),oe=!0},p:wo,i(_){oe||(A(p.$$.fragment,_),A(Z.$$.fragment,_),A(K.$$.fragment,_),A(X.$$.fragment,_),oe=!0)},o(_){j(p.$$.fragment,_),j(Z.$$.fragment,_),j(K.$$.fragment,_),j(X.$$.fragment,_),oe=!1},d(_){H(p,_),_&&t($),_&&t(n),_&&t(L),H(Z,_),_&&t(Q),_&&t(O),_&&t(J),H(K,_),_&&t(D),_&&t(U),_&&t(ue),H(X,_)}}}function Zs(I){let p,$;return p=new vo({props:{$$slots:{default:[Xs]},$$scope:{ctx:I}}}),{c(){E(p.$$.fragment)},l(n){T(p.$$.fragment,n)},m(n,d){P(p,n,d),$=!0},p(n,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:n}),p.$set(w)},i(n){$||(A(p.$$.fragment,n),$=!0)},o(n){j(p.$$.fragment,n),$=!1},d(n){H(p,n)}}}function Qs(I){let p,$,n,d,w,y,b,F,k,C,x,R,W,g,M,G,L,Z,Q,O,le,ee,te,ae,J,K,D,U,ie,B,se,N,z;return te=new V({props:{code:`from transformers 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 <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>)`}}),N=new V({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)'}}),{c(){p=l("p"),$=r("Share a model to the Hub with "),n=l("a"),d=r("PushToHubCallback"),w=r(". In the "),y=l("a"),b=r("PushToHubCallback"),F=r(" function, add:"),k=h(),C=l("ul"),x=l("li"),R=r("An output directory for your model."),W=h(),g=l("li"),M=r("A tokenizer."),G=h(),L=l("li"),Z=r("The "),Q=l("code"),O=r("hub_model_id"),le=r(", which is your Hub username and model name."),ee=h(),E(te.$$.fragment),ae=h(),J=l("p"),K=r("Add the callback to "),D=l("a"),U=l("code"),ie=r("fit"),B=r(", and \u{1F917} Transformers will push the trained model to the Hub:"),se=h(),E(N.$$.fragment),this.h()},l(v){p=s(v,"P",{});var q=i(p);$=a(q,"Share a model to the Hub with "),n=s(q,"A",{href:!0});var ue=i(n);d=a(ue,"PushToHubCallback"),ue.forEach(t),w=a(q,". In the "),y=s(q,"A",{href:!0});var X=i(y);b=a(X,"PushToHubCallback"),X.forEach(t),F=a(q," function, add:"),q.forEach(t),k=m(v),C=s(v,"UL",{});var oe=i(C);x=s(oe,"LI",{});var _=i(x);R=a(_,"An output directory for your model."),_.forEach(t),W=m(oe),g=s(oe,"LI",{});var S=i(g);M=a(S,"A tokenizer."),S.forEach(t),G=m(oe),L=s(oe,"LI",{});var pe=i(L);Z=a(pe,"The "),Q=s(pe,"CODE",{});var he=i(Q);O=a(he,"hub_model_id"),he.forEach(t),le=a(pe,", which is your Hub username and model name."),pe.forEach(t),oe.forEach(t),ee=m(v),T(te.$$.fragment,v),ae=m(v),J=s(v,"P",{});var Y=i(J);K=a(Y,"Add the callback to "),D=s(Y,"A",{href:!0,rel:!0});var $e=i(D);U=s($e,"CODE",{});var re=i(U);ie=a(re,"fit"),re.forEach(t),$e.forEach(t),B=a(Y,", and \u{1F917} Transformers will push the trained model to the Hub:"),Y.forEach(t),se=m(v),T(N.$$.fragment,v),this.h()},h(){c(n,"href","/docs/transformers/v4.29.0/en/main_classes/keras_callbacks#transformers.PushToHubCallback"),c(y,"href","/docs/transformers/v4.29.0/en/main_classes/keras_callbacks#transformers.PushToHubCallback"),c(D,"href","https://keras.io/api/models/model_training_apis/"),c(D,"rel","nofollow")},m(v,q){f(v,p,q),o(p,$),o(p,n),o(n,d),o(p,w),o(p,y),o(y,b),o(p,F),f(v,k,q),f(v,C,q),o(C,x),o(x,R),o(C,W),o(C,g),o(g,M),o(C,G),o(C,L),o(L,Z),o(L,Q),o(Q,O),o(L,le),f(v,ee,q),P(te,v,q),f(v,ae,q),f(v,J,q),o(J,K),o(J,D),o(D,U),o(U,ie),o(J,B),f(v,se,q),P(N,v,q),z=!0},p:wo,i(v){z||(A(te.$$.fragment,v),A(N.$$.fragment,v),z=!0)},o(v){j(te.$$.fragment,v),j(N.$$.fragment,v),z=!1},d(v){v&&t(p),v&&t(k),v&&t(C),v&&t(ee),H(te,v),v&&t(ae),v&&t(J),v&&t(se),H(N,v)}}}function ei(I){let p,$;return p=new vo({props:{$$slots:{default:[Qs]},$$scope:{ctx:I}}}),{c(){E(p.$$.fragment)},l(n){T(p.$$.fragment,n)},m(n,d){P(p,n,d),$=!0},p(n,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:n}),p.$set(w)},i(n){$||(A(p.$$.fragment,n),$=!0)},o(n){j(p.$$.fragment,n),$=!1},d(n){H(p,n)}}}function ti(I){let p,$,n,d,w,y,b,F,k,C,x,R,W,g,M,G,L,Z,Q,O,le,ee,te,ae,J,K,D,U,ie,B,se,N,z,v,q,ue,X,oe,_,S,pe,he,Y,$e,re,vt,me,Ee,bt,Or,bo,Te,Nr,Ot,zr,Rr,ko,Je,Eo,kt,Lr,To,Et,Tt,kl,Po,ge,Pe,Nt,Ke,Ur,zt,Br,Ao,Ae,Gr,Rt,Yr,Vr,jo,Xe,Ho,je,Wr,Ze,Lt,Jr,Kr,So,Qe,Co,ce,Xr,Ut,Zr,Qr,et,ea,ta,Fo,tt,qo,ye,He,Bt,ot,oa,Gt,ra,xo,Pt,aa,Do,Se,la,At,sa,ia,Mo,Ce,Io,we,Fe,Yt,rt,na,Vt,fa,Oo,qe,No,ve,xe,Wt,at,ua,lt,pa,Jt,ha,ma,zo,De,ca,Kt,da,_a,Ro,Me,$a,Xt,ga,ya,Lo,st,Uo,de,wa,Zt,va,ba,Qt,ka,Ea,Bo,it,Go,Ie,Ta,eo,Pa,Aa,Yo,nt,Vo,Oe,ja,to,Ha,Sa,Wo,ft,Jo,jt,Ca,Ko,ut,Xo,Ne,Fa,oo,qa,xa,Zo,ze,Da,pt,Ma,Ia,Qo,be,Re,ro,ht,Oa,ao,Na,er,Le,za,mt,Ra,La,tr,Ht,St,El,or,Ct,Ua,rr,ne,ct,Ba,lo,Ga,Ya,Va,so,Wa,Ja,io,Ka,Xa,no,Za,ar,_e,Qa,fo,el,tl,uo,ol,rl,lr,Ft,qt,Tl,sr,ke,Ue,po,dt,al,ho,ll,ir,Be,sl,mo,il,nl,nr,Ge,_t,fl,co,ul,pl,hl,$t,ml,_o,cl,dl,fr,fe,_l,gt,$l,gl,$o,yl,wl,yt,vl,bl,ur;return y=new We({}),B=new Ls({props:{$$slots:{default:[Bs]},$$scope:{ctx:I}}}),q=new We({}),Je=new V({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>)`}}),Ke=new We({}),Xe=new V({props:{code:"huggingface-cli login",highlighted:"huggingface-cli login"}}),Qe=new V({props:{code:"pip install huggingface_hub",highlighted:"pip install huggingface_hub"}}),tt=new V({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()`}}),ot=new We({}),Ce=new Ms({props:{pytorch:!0,tensorflow:!0,jax:!0,$$slots:{jax:[Ks],tensorflow:[Ws],pytorch:[Ys]},$$scope:{ctx:I}}}),rt=new We({}),qe=new Ms({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ei],pytorch:[Zs]},$$scope:{ctx:I}}}),at=new We({}),st=new V({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>)'}}),it=new V({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>)`}}),nt=new V({props:{code:'pt_model.push_to_hub("my-awesome-org/my-awesome-model")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.push_to_hub(<span class="hljs-string">&quot;my-awesome-org/my-awesome-model&quot;</span>)'}}),ft=new V({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>)'}}),ut=new V({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>)'}}),ht=new We({}),dt=new We({}),{c(){p=l("meta"),$=h(),n=l("h1"),d=l("a"),w=l("span"),E(y.$$.fragment),b=h(),F=l("span"),k=r("Share a model"),C=h(),x=l("p"),R=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."),W=h(),g=l("p"),M=r("In this tutorial, you will learn two methods for sharing a trained or fine-tuned model on the "),G=l("a"),L=r("Model Hub"),Z=r(":"),Q=h(),O=l("ul"),le=l("li"),ee=r("Programmatically push your files to the Hub."),te=h(),ae=l("li"),J=r("Drag-and-drop your files to the Hub with the web interface."),K=h(),D=l("iframe"),ie=h(),E(B.$$.fragment),se=h(),N=l("h2"),z=l("a"),v=l("span"),E(q.$$.fragment),ue=h(),X=l("span"),oe=r("Repository features"),_=h(),S=l("p"),pe=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."),he=h(),Y=l("p"),$e=r("The Model Hub\u2019s built-in versioning is based on git and "),re=l("a"),vt=r("git-lfs"),me=r(". In other words, you can treat one model as one repository, enabling greater access control and scalability. Version control allows "),Ee=l("em"),bt=r("revisions"),Or=r(", a method for pinning a specific version of a model with a commit hash, tag or branch."),bo=h(),Te=l("p"),Nr=r("As a result, you can load a specific model version with the "),Ot=l("code"),zr=r("revision"),Rr=r(" parameter:"),ko=h(),E(Je.$$.fragment),Eo=h(),kt=l("p"),Lr=r("Files are also easily edited in a repository, and you can view the commit history as well as the difference:"),To=h(),Et=l("p"),Tt=l("img"),Po=h(),ge=l("h2"),Pe=l("a"),Nt=l("span"),E(Ke.$$.fragment),Ur=h(),zt=l("span"),Br=r("Setup"),Ao=h(),Ae=l("p"),Gr=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 ("),Rt=l("code"),Yr=r("~/.cache/"),Vr=r(" by default):"),jo=h(),E(Xe.$$.fragment),Ho=h(),je=l("p"),Wr=r("If you are using a notebook like Jupyter or Colaboratory, make sure you have the "),Ze=l("a"),Lt=l("code"),Jr=r("huggingface_hub"),Kr=r(" library installed. This library allows you to programmatically interact with the Hub."),So=h(),E(Qe.$$.fragment),Co=h(),ce=l("p"),Xr=r("Then use "),Ut=l("code"),Zr=r("notebook_login"),Qr=r(" to sign-in to the Hub, and follow the link "),et=l("a"),ea=r("here"),ta=r(" to generate a token to login with:"),Fo=h(),E(tt.$$.fragment),qo=h(),ye=l("h2"),He=l("a"),Bt=l("span"),E(ot.$$.fragment),oa=h(),Gt=l("span"),ra=r("Convert a model for all frameworks"),xo=h(),Pt=l("p"),aa=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."),Do=h(),Se=l("p"),la=r("Converting a checkpoint for another framework is easy. Make sure you have PyTorch and TensorFlow installed (see "),At=l("a"),sa=r("here"),ia=r(" for installation instructions), and then find the specific model for your task in the other framework."),Mo=h(),E(Ce.$$.fragment),Io=h(),we=l("h2"),Fe=l("a"),Yt=l("span"),E(rt.$$.fragment),na=h(),Vt=l("span"),fa=r("Push a model during training"),Oo=h(),E(qe.$$.fragment),No=h(),ve=l("h2"),xe=l("a"),Wt=l("span"),E(at.$$.fragment),ua=h(),lt=l("span"),pa=r("Use the "),Jt=l("code"),ha=r("push_to_hub"),ma=r(" function"),zo=h(),De=l("p"),ca=r("You can also call "),Kt=l("code"),da=r("push_to_hub"),_a=r(" directly on your model to upload it to the Hub."),Ro=h(),Me=l("p"),$a=r("Specify your model name in "),Xt=l("code"),ga=r("push_to_hub"),ya=r(":"),Lo=h(),E(st.$$.fragment),Uo=h(),de=l("p"),wa=r("This creates a repository under your username with the model name "),Zt=l("code"),va=r("my-awesome-model"),ba=r(". Users can now load your model with the "),Qt=l("code"),ka=r("from_pretrained"),Ea=r(" function:"),Bo=h(),E(it.$$.fragment),Go=h(),Ie=l("p"),Ta=r("If you belong to an organization and want to push your model under the organization name instead, just add it to the "),eo=l("code"),Pa=r("repo_id"),Aa=r(":"),Yo=h(),E(nt.$$.fragment),Vo=h(),Oe=l("p"),ja=r("The "),to=l("code"),Ha=r("push_to_hub"),Sa=r(" function can also be used to add other files to a model repository. For example, add a tokenizer to a model repository:"),Wo=h(),E(ft.$$.fragment),Jo=h(),jt=l("p"),Ca=r("Or perhaps you\u2019d like to add the TensorFlow version of your fine-tuned PyTorch model:"),Ko=h(),E(ut.$$.fragment),Xo=h(),Ne=l("p"),Fa=r("Now when you navigate to the your Hugging Face profile, you should see your newly created model repository. Clicking on the "),oo=l("strong"),qa=r("Files"),xa=r(" tab will display all the files you\u2019ve uploaded to the repository."),Zo=h(),ze=l("p"),Da=r("For more details on how to create and upload files to a repository, refer to the Hub documentation "),pt=l("a"),Ma=r("here"),Ia=r("."),Qo=h(),be=l("h2"),Re=l("a"),ro=l("span"),E(ht.$$.fragment),Oa=h(),ao=l("span"),Na=r("Upload with the web interface"),er=h(),Le=l("p"),za=r("Users who prefer a no-code approach are able to upload a model through the Hub\u2019s web interface. Visit "),mt=l("a"),Ra=r("huggingface.co/new"),La=r(" to create a new repository:"),tr=h(),Ht=l("p"),St=l("img"),or=h(),Ct=l("p"),Ua=r("From here, add some information about your model:"),rr=h(),ne=l("ul"),ct=l("li"),Ba=r("Select the "),lo=l("strong"),Ga=r("owner"),Ya=r(" of the repository. This can be yourself or any of the organizations you belong to."),Va=h(),so=l("li"),Wa=r("Pick a name for your model, which will also be the repository name."),Ja=h(),io=l("li"),Ka=r("Choose whether your model is public or private."),Xa=h(),no=l("li"),Za=r("Specify the license usage for your model."),ar=h(),_e=l("p"),Qa=r("Now click on the "),fo=l("strong"),el=r("Files"),tl=r(" tab and click on the "),uo=l("strong"),ol=r("Add file"),rl=r(" button to upload a new file to your repository. Then drag-and-drop a file to upload and add a commit message."),lr=h(),Ft=l("p"),qt=l("img"),sr=h(),ke=l("h2"),Ue=l("a"),po=l("span"),E(dt.$$.fragment),al=h(),ho=l("span"),ll=r("Add a model card"),ir=h(),Be=l("p"),sl=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 "),mo=l("code"),il=r("README.md"),nl=r(" file. You can add a model card by:"),nr=h(),Ge=l("ul"),_t=l("li"),fl=r("Manually creating and uploading a "),co=l("code"),ul=r("README.md"),pl=r(" file."),hl=h(),$t=l("li"),ml=r("Clicking on the "),_o=l("strong"),cl=r("Edit model card"),dl=r(" button in your model repository."),fr=h(),fe=l("p"),_l=r("Take a look at the DistilBert "),gt=l("a"),$l=r("model card"),gl=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 "),$o=l("code"),yl=r("README.md"),wl=r(" file such as a model\u2019s carbon footprint or widget examples, refer to the documentation "),yt=l("a"),vl=r("here"),bl=r("."),this.h()},l(e){const u=zs('[data-svelte="svelte-1phssyn"]',document.head);p=s(u,"META",{name:!0,content:!0}),u.forEach(t),$=m(e),n=s(e,"H1",{class:!0});var wt=i(n);d=s(wt,"A",{id:!0,class:!0,href:!0});var go=i(d);w=s(go,"SPAN",{});var yo=i(w);T(y.$$.fragment,yo),yo.forEach(t),go.forEach(t),b=m(wt),F=s(wt,"SPAN",{});var Pl=i(F);k=a(Pl,"Share a model"),Pl.forEach(t),wt.forEach(t),C=m(e),x=s(e,"P",{});var Al=i(x);R=a(Al,"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."),Al.forEach(t),W=m(e),g=s(e,"P",{});var pr=i(g);M=a(pr,"In this tutorial, you will learn two methods for sharing a trained or fine-tuned model on the "),G=s(pr,"A",{href:!0,rel:!0});var jl=i(G);L=a(jl,"Model Hub"),jl.forEach(t),Z=a(pr,":"),pr.forEach(t),Q=m(e),O=s(e,"UL",{});var hr=i(O);le=s(hr,"LI",{});var Hl=i(le);ee=a(Hl,"Programmatically push your files to the Hub."),Hl.forEach(t),te=m(hr),ae=s(hr,"LI",{});var Sl=i(ae);J=a(Sl,"Drag-and-drop your files to the Hub with the web interface."),Sl.forEach(t),hr.forEach(t),K=m(e),D=s(e,"IFRAME",{width:!0,height:!0,src:!0,title:!0,frameborder:!0,allow:!0}),i(D).forEach(t),ie=m(e),T(B.$$.fragment,e),se=m(e),N=s(e,"H2",{class:!0});var mr=i(N);z=s(mr,"A",{id:!0,class:!0,href:!0});var Cl=i(z);v=s(Cl,"SPAN",{});var Fl=i(v);T(q.$$.fragment,Fl),Fl.forEach(t),Cl.forEach(t),ue=m(mr),X=s(mr,"SPAN",{});var ql=i(X);oe=a(ql,"Repository features"),ql.forEach(t),mr.forEach(t),_=m(e),S=s(e,"P",{});var xl=i(S);pe=a(xl,"Each repository on the Model Hub behaves like a typical GitHub repository. Our repositories offer versioning, commit history, and the ability to visualize differences."),xl.forEach(t),he=m(e),Y=s(e,"P",{});var xt=i(Y);$e=a(xt,"The Model Hub\u2019s built-in versioning is based on git and "),re=s(xt,"A",{href:!0,rel:!0});var Dl=i(re);vt=a(Dl,"git-lfs"),Dl.forEach(t),me=a(xt,". In other words, you can treat one model as one repository, enabling greater access control and scalability. Version control allows "),Ee=s(xt,"EM",{});var Ml=i(Ee);bt=a(Ml,"revisions"),Ml.forEach(t),Or=a(xt,", a method for pinning a specific version of a model with a commit hash, tag or branch."),xt.forEach(t),bo=m(e),Te=s(e,"P",{});var cr=i(Te);Nr=a(cr,"As a result, you can load a specific model version with the "),Ot=s(cr,"CODE",{});var Il=i(Ot);zr=a(Il,"revision"),Il.forEach(t),Rr=a(cr," parameter:"),cr.forEach(t),ko=m(e),T(Je.$$.fragment,e),Eo=m(e),kt=s(e,"P",{});var Ol=i(kt);Lr=a(Ol,"Files are also easily edited in a repository, and you can view the commit history as well as the difference:"),Ol.forEach(t),To=m(e),Et=s(e,"P",{});var Nl=i(Et);Tt=s(Nl,"IMG",{src:!0,alt:!0}),Nl.forEach(t),Po=m(e),ge=s(e,"H2",{class:!0});var dr=i(ge);Pe=s(dr,"A",{id:!0,class:!0,href:!0});var zl=i(Pe);Nt=s(zl,"SPAN",{});var Rl=i(Nt);T(Ke.$$.fragment,Rl),Rl.forEach(t),zl.forEach(t),Ur=m(dr),zt=s(dr,"SPAN",{});var Ll=i(zt);Br=a(Ll,"Setup"),Ll.forEach(t),dr.forEach(t),Ao=m(e),Ae=s(e,"P",{});var _r=i(Ae);Gr=a(_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 ("),Rt=s(_r,"CODE",{});var Ul=i(Rt);Yr=a(Ul,"~/.cache/"),Ul.forEach(t),Vr=a(_r," by default):"),_r.forEach(t),jo=m(e),T(Xe.$$.fragment,e),Ho=m(e),je=s(e,"P",{});var $r=i(je);Wr=a($r,"If you are using a notebook like Jupyter or Colaboratory, make sure you have the "),Ze=s($r,"A",{href:!0,rel:!0});var Bl=i(Ze);Lt=s(Bl,"CODE",{});var Gl=i(Lt);Jr=a(Gl,"huggingface_hub"),Gl.forEach(t),Bl.forEach(t),Kr=a($r," library installed. This library allows you to programmatically interact with the Hub."),$r.forEach(t),So=m(e),T(Qe.$$.fragment,e),Co=m(e),ce=s(e,"P",{});var Dt=i(ce);Xr=a(Dt,"Then use "),Ut=s(Dt,"CODE",{});var Yl=i(Ut);Zr=a(Yl,"notebook_login"),Yl.forEach(t),Qr=a(Dt," to sign-in to the Hub, and follow the link "),et=s(Dt,"A",{href:!0,rel:!0});var Vl=i(et);ea=a(Vl,"here"),Vl.forEach(t),ta=a(Dt," to generate a token to login with:"),Dt.forEach(t),Fo=m(e),T(tt.$$.fragment,e),qo=m(e),ye=s(e,"H2",{class:!0});var gr=i(ye);He=s(gr,"A",{id:!0,class:!0,href:!0});var Wl=i(He);Bt=s(Wl,"SPAN",{});var Jl=i(Bt);T(ot.$$.fragment,Jl),Jl.forEach(t),Wl.forEach(t),oa=m(gr),Gt=s(gr,"SPAN",{});var Kl=i(Gt);ra=a(Kl,"Convert a model for all frameworks"),Kl.forEach(t),gr.forEach(t),xo=m(e),Pt=s(e,"P",{});var Xl=i(Pt);aa=a(Xl,"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."),Xl.forEach(t),Do=m(e),Se=s(e,"P",{});var yr=i(Se);la=a(yr,"Converting a checkpoint for another framework is easy. Make sure you have PyTorch and TensorFlow installed (see "),At=s(yr,"A",{href:!0});var Zl=i(At);sa=a(Zl,"here"),Zl.forEach(t),ia=a(yr," for installation instructions), and then find the specific model for your task in the other framework."),yr.forEach(t),Mo=m(e),T(Ce.$$.fragment,e),Io=m(e),we=s(e,"H2",{class:!0});var wr=i(we);Fe=s(wr,"A",{id:!0,class:!0,href:!0});var Ql=i(Fe);Yt=s(Ql,"SPAN",{});var es=i(Yt);T(rt.$$.fragment,es),es.forEach(t),Ql.forEach(t),na=m(wr),Vt=s(wr,"SPAN",{});var ts=i(Vt);fa=a(ts,"Push a model during training"),ts.forEach(t),wr.forEach(t),Oo=m(e),T(qe.$$.fragment,e),No=m(e),ve=s(e,"H2",{class:!0});var vr=i(ve);xe=s(vr,"A",{id:!0,class:!0,href:!0});var os=i(xe);Wt=s(os,"SPAN",{});var rs=i(Wt);T(at.$$.fragment,rs),rs.forEach(t),os.forEach(t),ua=m(vr),lt=s(vr,"SPAN",{});var br=i(lt);pa=a(br,"Use the "),Jt=s(br,"CODE",{});var as=i(Jt);ha=a(as,"push_to_hub"),as.forEach(t),ma=a(br," function"),br.forEach(t),vr.forEach(t),zo=m(e),De=s(e,"P",{});var kr=i(De);ca=a(kr,"You can also call "),Kt=s(kr,"CODE",{});var ls=i(Kt);da=a(ls,"push_to_hub"),ls.forEach(t),_a=a(kr," directly on your model to upload it to the Hub."),kr.forEach(t),Ro=m(e),Me=s(e,"P",{});var Er=i(Me);$a=a(Er,"Specify your model name in "),Xt=s(Er,"CODE",{});var ss=i(Xt);ga=a(ss,"push_to_hub"),ss.forEach(t),ya=a(Er,":"),Er.forEach(t),Lo=m(e),T(st.$$.fragment,e),Uo=m(e),de=s(e,"P",{});var Mt=i(de);wa=a(Mt,"This creates a repository under your username with the model name "),Zt=s(Mt,"CODE",{});var is=i(Zt);va=a(is,"my-awesome-model"),is.forEach(t),ba=a(Mt,". Users can now load your model with the "),Qt=s(Mt,"CODE",{});var ns=i(Qt);ka=a(ns,"from_pretrained"),ns.forEach(t),Ea=a(Mt," function:"),Mt.forEach(t),Bo=m(e),T(it.$$.fragment,e),Go=m(e),Ie=s(e,"P",{});var Tr=i(Ie);Ta=a(Tr,"If you belong to an organization and want to push your model under the organization name instead, just add it to the "),eo=s(Tr,"CODE",{});var fs=i(eo);Pa=a(fs,"repo_id"),fs.forEach(t),Aa=a(Tr,":"),Tr.forEach(t),Yo=m(e),T(nt.$$.fragment,e),Vo=m(e),Oe=s(e,"P",{});var Pr=i(Oe);ja=a(Pr,"The "),to=s(Pr,"CODE",{});var us=i(to);Ha=a(us,"push_to_hub"),us.forEach(t),Sa=a(Pr," function can also be used to add other files to a model repository. For example, add a tokenizer to a model repository:"),Pr.forEach(t),Wo=m(e),T(ft.$$.fragment,e),Jo=m(e),jt=s(e,"P",{});var ps=i(jt);Ca=a(ps,"Or perhaps you\u2019d like to add the TensorFlow version of your fine-tuned PyTorch model:"),ps.forEach(t),Ko=m(e),T(ut.$$.fragment,e),Xo=m(e),Ne=s(e,"P",{});var Ar=i(Ne);Fa=a(Ar,"Now when you navigate to the your Hugging Face profile, you should see your newly created model repository. Clicking on the "),oo=s(Ar,"STRONG",{});var hs=i(oo);qa=a(hs,"Files"),hs.forEach(t),xa=a(Ar," tab will display all the files you\u2019ve uploaded to the repository."),Ar.forEach(t),Zo=m(e),ze=s(e,"P",{});var jr=i(ze);Da=a(jr,"For more details on how to create and upload files to a repository, refer to the Hub documentation "),pt=s(jr,"A",{href:!0,rel:!0});var ms=i(pt);Ma=a(ms,"here"),ms.forEach(t),Ia=a(jr,"."),jr.forEach(t),Qo=m(e),be=s(e,"H2",{class:!0});var Hr=i(be);Re=s(Hr,"A",{id:!0,class:!0,href:!0});var cs=i(Re);ro=s(cs,"SPAN",{});var ds=i(ro);T(ht.$$.fragment,ds),ds.forEach(t),cs.forEach(t),Oa=m(Hr),ao=s(Hr,"SPAN",{});var _s=i(ao);Na=a(_s,"Upload with the web interface"),_s.forEach(t),Hr.forEach(t),er=m(e),Le=s(e,"P",{});var Sr=i(Le);za=a(Sr,"Users who prefer a no-code approach are able to upload a model through the Hub\u2019s web interface. Visit "),mt=s(Sr,"A",{href:!0,rel:!0});var $s=i(mt);Ra=a($s,"huggingface.co/new"),$s.forEach(t),La=a(Sr," to create a new repository:"),Sr.forEach(t),tr=m(e),Ht=s(e,"P",{});var gs=i(Ht);St=s(gs,"IMG",{src:!0,alt:!0}),gs.forEach(t),or=m(e),Ct=s(e,"P",{});var ys=i(Ct);Ua=a(ys,"From here, add some information about your model:"),ys.forEach(t),rr=m(e),ne=s(e,"UL",{});var Ye=i(ne);ct=s(Ye,"LI",{});var Cr=i(ct);Ba=a(Cr,"Select the "),lo=s(Cr,"STRONG",{});var ws=i(lo);Ga=a(ws,"owner"),ws.forEach(t),Ya=a(Cr," of the repository. This can be yourself or any of the organizations you belong to."),Cr.forEach(t),Va=m(Ye),so=s(Ye,"LI",{});var vs=i(so);Wa=a(vs,"Pick a name for your model, which will also be the repository name."),vs.forEach(t),Ja=m(Ye),io=s(Ye,"LI",{});var bs=i(io);Ka=a(bs,"Choose whether your model is public or private."),bs.forEach(t),Xa=m(Ye),no=s(Ye,"LI",{});var ks=i(no);Za=a(ks,"Specify the license usage for your model."),ks.forEach(t),Ye.forEach(t),ar=m(e),_e=s(e,"P",{});var It=i(_e);Qa=a(It,"Now click on the "),fo=s(It,"STRONG",{});var Es=i(fo);el=a(Es,"Files"),Es.forEach(t),tl=a(It," tab and click on the "),uo=s(It,"STRONG",{});var Ts=i(uo);ol=a(Ts,"Add file"),Ts.forEach(t),rl=a(It," button to upload a new file to your repository. Then drag-and-drop a file to upload and add a commit message."),It.forEach(t),lr=m(e),Ft=s(e,"P",{});var Ps=i(Ft);qt=s(Ps,"IMG",{src:!0,alt:!0}),Ps.forEach(t),sr=m(e),ke=s(e,"H2",{class:!0});var Fr=i(ke);Ue=s(Fr,"A",{id:!0,class:!0,href:!0});var As=i(Ue);po=s(As,"SPAN",{});var js=i(po);T(dt.$$.fragment,js),js.forEach(t),As.forEach(t),al=m(Fr),ho=s(Fr,"SPAN",{});var Hs=i(ho);ll=a(Hs,"Add a model card"),Hs.forEach(t),Fr.forEach(t),ir=m(e),Be=s(e,"P",{});var qr=i(Be);sl=a(qr,"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 "),mo=s(qr,"CODE",{});var Ss=i(mo);il=a(Ss,"README.md"),Ss.forEach(t),nl=a(qr," file. You can add a model card by:"),qr.forEach(t),nr=m(e),Ge=s(e,"UL",{});var xr=i(Ge);_t=s(xr,"LI",{});var Dr=i(_t);fl=a(Dr,"Manually creating and uploading a "),co=s(Dr,"CODE",{});var Cs=i(co);ul=a(Cs,"README.md"),Cs.forEach(t),pl=a(Dr," file."),Dr.forEach(t),hl=m(xr),$t=s(xr,"LI",{});var Mr=i($t);ml=a(Mr,"Clicking on the "),_o=s(Mr,"STRONG",{});var Fs=i(_o);cl=a(Fs,"Edit model card"),Fs.forEach(t),dl=a(Mr," button in your model repository."),Mr.forEach(t),xr.forEach(t),fr=m(e),fe=s(e,"P",{});var Ve=i(fe);_l=a(Ve,"Take a look at the DistilBert "),gt=s(Ve,"A",{href:!0,rel:!0});var qs=i(gt);$l=a(qs,"model card"),qs.forEach(t),gl=a(Ve," 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 "),$o=s(Ve,"CODE",{});var xs=i($o);yl=a(xs,"README.md"),xs.forEach(t),wl=a(Ve," file such as a model\u2019s carbon footprint or widget examples, refer to the documentation "),yt=s(Ve,"A",{href:!0,rel:!0});var Ds=i(yt);vl=a(Ds,"here"),Ds.forEach(t),bl=a(Ve,"."),Ve.forEach(t),this.h()},h(){c(p,"name","hf:doc:metadata"),c(p,"content",JSON.stringify(oi)),c(d,"id","share-a-model"),c(d,"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"),c(d,"href","#share-a-model"),c(n,"class","relative group"),c(G,"href","https://huggingface.co/models"),c(G,"rel","nofollow"),c(D,"width","560"),c(D,"height","315"),Ir(D.src,U="https://www.youtube.com/embed/XvSGPZFEjDY")||c(D,"src",U),c(D,"title","YouTube video player"),c(D,"frameborder","0"),c(D,"allow",`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope;
picture-in-picture`),D.allowFullscreen=!0,c(z,"id","repository-features"),c(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"),c(z,"href","#repository-features"),c(N,"class","relative group"),c(re,"href","https://git-lfs.github.com/"),c(re,"rel","nofollow"),Ir(Tt.src,kl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/vis_diff.png")||c(Tt,"src",kl),c(Tt,"alt","vis_diff"),c(Pe,"id","setup"),c(Pe,"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"),c(Pe,"href","#setup"),c(ge,"class","relative group"),c(Ze,"href","https://huggingface.co/docs/hub/adding-a-library"),c(Ze,"rel","nofollow"),c(et,"href","https://huggingface.co/settings/token"),c(et,"rel","nofollow"),c(He,"id","convert-a-model-for-all-frameworks"),c(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"),c(He,"href","#convert-a-model-for-all-frameworks"),c(ye,"class","relative group"),c(At,"href","installation"),c(Fe,"id","push-a-model-during-training"),c(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"),c(Fe,"href","#push-a-model-during-training"),c(we,"class","relative group"),c(xe,"id","use-the-pushtohub-function"),c(xe,"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"),c(xe,"href","#use-the-pushtohub-function"),c(ve,"class","relative group"),c(pt,"href","https://huggingface.co/docs/hub/how-to-upstream"),c(pt,"rel","nofollow"),c(Re,"id","upload-with-the-web-interface"),c(Re,"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"),c(Re,"href","#upload-with-the-web-interface"),c(be,"class","relative group"),c(mt,"href","https://huggingface.co/new"),c(mt,"rel","nofollow"),Ir(St.src,El="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/new_model_repo.png")||c(St,"src",El),c(St,"alt","new_model_repo"),Ir(qt.src,Tl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/upload_file.png")||c(qt,"src",Tl),c(qt,"alt","upload_file"),c(Ue,"id","add-a-model-card"),c(Ue,"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"),c(Ue,"href","#add-a-model-card"),c(ke,"class","relative group"),c(gt,"href","https://huggingface.co/distilbert-base-uncased"),c(gt,"rel","nofollow"),c(yt,"href","https://huggingface.co/docs/hub/models-cards"),c(yt,"rel","nofollow")},m(e,u){o(document.head,p),f(e,$,u),f(e,n,u),o(n,d),o(d,w),P(y,w,null),o(n,b),o(n,F),o(F,k),f(e,C,u),f(e,x,u),o(x,R),f(e,W,u),f(e,g,u),o(g,M),o(g,G),o(G,L),o(g,Z),f(e,Q,u),f(e,O,u),o(O,le),o(le,ee),o(O,te),o(O,ae),o(ae,J),f(e,K,u),f(e,D,u),f(e,ie,u),P(B,e,u),f(e,se,u),f(e,N,u),o(N,z),o(z,v),P(q,v,null),o(N,ue),o(N,X),o(X,oe),f(e,_,u),f(e,S,u),o(S,pe),f(e,he,u),f(e,Y,u),o(Y,$e),o(Y,re),o(re,vt),o(Y,me),o(Y,Ee),o(Ee,bt),o(Y,Or),f(e,bo,u),f(e,Te,u),o(Te,Nr),o(Te,Ot),o(Ot,zr),o(Te,Rr),f(e,ko,u),P(Je,e,u),f(e,Eo,u),f(e,kt,u),o(kt,Lr),f(e,To,u),f(e,Et,u),o(Et,Tt),f(e,Po,u),f(e,ge,u),o(ge,Pe),o(Pe,Nt),P(Ke,Nt,null),o(ge,Ur),o(ge,zt),o(zt,Br),f(e,Ao,u),f(e,Ae,u),o(Ae,Gr),o(Ae,Rt),o(Rt,Yr),o(Ae,Vr),f(e,jo,u),P(Xe,e,u),f(e,Ho,u),f(e,je,u),o(je,Wr),o(je,Ze),o(Ze,Lt),o(Lt,Jr),o(je,Kr),f(e,So,u),P(Qe,e,u),f(e,Co,u),f(e,ce,u),o(ce,Xr),o(ce,Ut),o(Ut,Zr),o(ce,Qr),o(ce,et),o(et,ea),o(ce,ta),f(e,Fo,u),P(tt,e,u),f(e,qo,u),f(e,ye,u),o(ye,He),o(He,Bt),P(ot,Bt,null),o(ye,oa),o(ye,Gt),o(Gt,ra),f(e,xo,u),f(e,Pt,u),o(Pt,aa),f(e,Do,u),f(e,Se,u),o(Se,la),o(Se,At),o(At,sa),o(Se,ia),f(e,Mo,u),P(Ce,e,u),f(e,Io,u),f(e,we,u),o(we,Fe),o(Fe,Yt),P(rt,Yt,null),o(we,na),o(we,Vt),o(Vt,fa),f(e,Oo,u),P(qe,e,u),f(e,No,u),f(e,ve,u),o(ve,xe),o(xe,Wt),P(at,Wt,null),o(ve,ua),o(ve,lt),o(lt,pa),o(lt,Jt),o(Jt,ha),o(lt,ma),f(e,zo,u),f(e,De,u),o(De,ca),o(De,Kt),o(Kt,da),o(De,_a),f(e,Ro,u),f(e,Me,u),o(Me,$a),o(Me,Xt),o(Xt,ga),o(Me,ya),f(e,Lo,u),P(st,e,u),f(e,Uo,u),f(e,de,u),o(de,wa),o(de,Zt),o(Zt,va),o(de,ba),o(de,Qt),o(Qt,ka),o(de,Ea),f(e,Bo,u),P(it,e,u),f(e,Go,u),f(e,Ie,u),o(Ie,Ta),o(Ie,eo),o(eo,Pa),o(Ie,Aa),f(e,Yo,u),P(nt,e,u),f(e,Vo,u),f(e,Oe,u),o(Oe,ja),o(Oe,to),o(to,Ha),o(Oe,Sa),f(e,Wo,u),P(ft,e,u),f(e,Jo,u),f(e,jt,u),o(jt,Ca),f(e,Ko,u),P(ut,e,u),f(e,Xo,u),f(e,Ne,u),o(Ne,Fa),o(Ne,oo),o(oo,qa),o(Ne,xa),f(e,Zo,u),f(e,ze,u),o(ze,Da),o(ze,pt),o(pt,Ma),o(ze,Ia),f(e,Qo,u),f(e,be,u),o(be,Re),o(Re,ro),P(ht,ro,null),o(be,Oa),o(be,ao),o(ao,Na),f(e,er,u),f(e,Le,u),o(Le,za),o(Le,mt),o(mt,Ra),o(Le,La),f(e,tr,u),f(e,Ht,u),o(Ht,St),f(e,or,u),f(e,Ct,u),o(Ct,Ua),f(e,rr,u),f(e,ne,u),o(ne,ct),o(ct,Ba),o(ct,lo),o(lo,Ga),o(ct,Ya),o(ne,Va),o(ne,so),o(so,Wa),o(ne,Ja),o(ne,io),o(io,Ka),o(ne,Xa),o(ne,no),o(no,Za),f(e,ar,u),f(e,_e,u),o(_e,Qa),o(_e,fo),o(fo,el),o(_e,tl),o(_e,uo),o(uo,ol),o(_e,rl),f(e,lr,u),f(e,Ft,u),o(Ft,qt),f(e,sr,u),f(e,ke,u),o(ke,Ue),o(Ue,po),P(dt,po,null),o(ke,al),o(ke,ho),o(ho,ll),f(e,ir,u),f(e,Be,u),o(Be,sl),o(Be,mo),o(mo,il),o(Be,nl),f(e,nr,u),f(e,Ge,u),o(Ge,_t),o(_t,fl),o(_t,co),o(co,ul),o(_t,pl),o(Ge,hl),o(Ge,$t),o($t,ml),o($t,_o),o(_o,cl),o($t,dl),f(e,fr,u),f(e,fe,u),o(fe,_l),o(fe,gt),o(gt,$l),o(fe,gl),o(fe,$o),o($o,yl),o(fe,wl),o(fe,yt),o(yt,vl),o(fe,bl),ur=!0},p(e,[u]){const wt={};u&2&&(wt.$$scope={dirty:u,ctx:e}),B.$set(wt);const go={};u&2&&(go.$$scope={dirty:u,ctx:e}),Ce.$set(go);const yo={};u&2&&(yo.$$scope={dirty:u,ctx:e}),qe.$set(yo)},i(e){ur||(A(y.$$.fragment,e),A(B.$$.fragment,e),A(q.$$.fragment,e),A(Je.$$.fragment,e),A(Ke.$$.fragment,e),A(Xe.$$.fragment,e),A(Qe.$$.fragment,e),A(tt.$$.fragment,e),A(ot.$$.fragment,e),A(Ce.$$.fragment,e),A(rt.$$.fragment,e),A(qe.$$.fragment,e),A(at.$$.fragment,e),A(st.$$.fragment,e),A(it.$$.fragment,e),A(nt.$$.fragment,e),A(ft.$$.fragment,e),A(ut.$$.fragment,e),A(ht.$$.fragment,e),A(dt.$$.fragment,e),ur=!0)},o(e){j(y.$$.fragment,e),j(B.$$.fragment,e),j(q.$$.fragment,e),j(Je.$$.fragment,e),j(Ke.$$.fragment,e),j(Xe.$$.fragment,e),j(Qe.$$.fragment,e),j(tt.$$.fragment,e),j(ot.$$.fragment,e),j(Ce.$$.fragment,e),j(rt.$$.fragment,e),j(qe.$$.fragment,e),j(at.$$.fragment,e),j(st.$$.fragment,e),j(it.$$.fragment,e),j(nt.$$.fragment,e),j(ft.$$.fragment,e),j(ut.$$.fragment,e),j(ht.$$.fragment,e),j(dt.$$.fragment,e),ur=!1},d(e){t(p),e&&t($),e&&t(n),H(y),e&&t(C),e&&t(x),e&&t(W),e&&t(g),e&&t(Q),e&&t(O),e&&t(K),e&&t(D),e&&t(ie),H(B,e),e&&t(se),e&&t(N),H(q),e&&t(_),e&&t(S),e&&t(he),e&&t(Y),e&&t(bo),e&&t(Te),e&&t(ko),H(Je,e),e&&t(Eo),e&&t(kt),e&&t(To),e&&t(Et),e&&t(Po),e&&t(ge),H(Ke),e&&t(Ao),e&&t(Ae),e&&t(jo),H(Xe,e),e&&t(Ho),e&&t(je),e&&t(So),H(Qe,e),e&&t(Co),e&&t(ce),e&&t(Fo),H(tt,e),e&&t(qo),e&&t(ye),H(ot),e&&t(xo),e&&t(Pt),e&&t(Do),e&&t(Se),e&&t(Mo),H(Ce,e),e&&t(Io),e&&t(we),H(rt),e&&t(Oo),H(qe,e),e&&t(No),e&&t(ve),H(at),e&&t(zo),e&&t(De),e&&t(Ro),e&&t(Me),e&&t(Lo),H(st,e),e&&t(Uo),e&&t(de),e&&t(Bo),H(it,e),e&&t(Go),e&&t(Ie),e&&t(Yo),H(nt,e),e&&t(Vo),e&&t(Oe),e&&t(Wo),H(ft,e),e&&t(Jo),e&&t(jt),e&&t(Ko),H(ut,e),e&&t(Xo),e&&t(Ne),e&&t(Zo),e&&t(ze),e&&t(Qo),e&&t(be),H(ht),e&&t(er),e&&t(Le),e&&t(tr),e&&t(Ht),e&&t(or),e&&t(Ct),e&&t(rr),e&&t(ne),e&&t(ar),e&&t(_e),e&&t(lr),e&&t(Ft),e&&t(sr),e&&t(ke),H(dt),e&&t(ir),e&&t(Be),e&&t(nr),e&&t(Ge),e&&t(fr),e&&t(fe)}}}const oi={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-during-training",title:"Push a model during training"},{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 ri(I){return Rs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ui extends Is{constructor(p){super();Os(this,p,ri,ti,Ns,{})}}export{ui as default,oi as metadata};
