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