import{S as Nm,i as Um,s as Rm,e as s,k as u,w as E,t as i,l as Gm,M as Wm,c as a,d as t,m as p,x as j,a as f,h as l,b as _,Z as Ge,G as o,g as n,y as z,o as b,p as ct,q as v,B as T,v as Bm,n as ut}from"../../chunks/vendor-hf-doc-builder.js";import{T as Lm}from"../../chunks/Tip-hf-doc-builder.js";import{Y as Yu}from"../../chunks/Youtube-hf-doc-builder.js";import{I as Xt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as q}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as Sm}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as Ym}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";function Vm(D){let c,d;return c=new Sm({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/chapter4/section3_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter4/section3_tf.ipynb"}]}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function Km(D){let c,d;return c=new Sm({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/chapter4/section3_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter4/section3_pt.ipynb"}]}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function Jm(D){let c,d;return c=new Yu({props:{id:"pUh5cGmNV8Y"}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function Zm(D){let c,d;return c=new Yu({props:{id:"Zh0FfmVrKX0"}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function Xm(D){let c,d,h,g,k,A,F,P,M,O,I,m,y,w,$,H,N,G,L,W,J,ie,B,le,ye,te,R,oe,re,Y,be,se;return O=new q({props:{code:`from transformers import PushToHubCallback

callback = PushToHubCallback(
    "bert-finetuned-mrpc", save_strategy="epoch", tokenizer=tokenizer
)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PushToHubCallback

callback = PushToHubCallback(
    <span class="hljs-string">&quot;bert-finetuned-mrpc&quot;</span>, save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>, tokenizer=tokenizer
)`}}),{c(){c=s("p"),d=i("If you are using Keras to train your model, the easiest way to upload it to the Hub is to pass along a "),h=s("code"),g=i("PushToHubCallback"),k=i(" when you call "),A=s("code"),F=i("model.fit()"),P=i(":"),M=u(),E(O.$$.fragment),I=u(),m=s("p"),y=i("Then you should add "),w=s("code"),$=i("callbacks=[callback]"),H=i(" in your call to "),N=s("code"),G=i("model.fit()"),L=i(". The callback will then upload your model to the Hub each time it is saved (here every epoch) in a repository in your namespace. That repository will be named like the output directory you picked (here "),W=s("code"),J=i("bert-finetuned-mrpc"),ie=i(") but you can choose a different name with "),B=s("code"),le=i('hub_model_id = "a_different_name"'),ye=i("."),te=u(),R=s("p"),oe=i("To upload you model to an organization you are a member of, just pass it with "),re=s("code"),Y=i('hub_model_id = "my_organization/my_repo_name"'),be=i(".")},l(x){c=a(x,"P",{});var U=f(c);d=l(U,"If you are using Keras to train your model, the easiest way to upload it to the Hub is to pass along a "),h=a(U,"CODE",{});var ve=f(h);g=l(ve,"PushToHubCallback"),ve.forEach(t),k=l(U," when you call "),A=a(U,"CODE",{});var Z=f(A);F=l(Z,"model.fit()"),Z.forEach(t),P=l(U,":"),U.forEach(t),M=p(x),j(O.$$.fragment,x),I=p(x),m=a(x,"P",{});var V=f(m);y=l(V,"Then you should add "),w=a(V,"CODE",{});var ue=f(w);$=l(ue,"callbacks=[callback]"),ue.forEach(t),H=l(V," in your call to "),N=a(V,"CODE",{});var Le=f(N);G=l(Le,"model.fit()"),Le.forEach(t),L=l(V,". The callback will then upload your model to the Hub each time it is saved (here every epoch) in a repository in your namespace. That repository will be named like the output directory you picked (here "),W=a(V,"CODE",{});var pe=f(W);J=l(pe,"bert-finetuned-mrpc"),pe.forEach(t),ie=l(V,") but you can choose a different name with "),B=a(V,"CODE",{});var we=f(B);le=l(we,'hub_model_id = "a_different_name"'),we.forEach(t),ye=l(V,"."),V.forEach(t),te=p(x),R=a(x,"P",{});var X=f(R);oe=l(X,"To upload you model to an organization you are a member of, just pass it with "),re=a(X,"CODE",{});var Q=f(re);Y=l(Q,'hub_model_id = "my_organization/my_repo_name"'),Q.forEach(t),be=l(X,"."),X.forEach(t)},m(x,U){n(x,c,U),o(c,d),o(c,h),o(h,g),o(c,k),o(c,A),o(A,F),o(c,P),n(x,M,U),z(O,x,U),n(x,I,U),n(x,m,U),o(m,y),o(m,w),o(w,$),o(m,H),o(m,N),o(N,G),o(m,L),o(m,W),o(W,J),o(m,ie),o(m,B),o(B,le),o(m,ye),n(x,te,U),n(x,R,U),o(R,oe),o(R,re),o(re,Y),o(R,be),se=!0},i(x){se||(v(O.$$.fragment,x),se=!0)},o(x){b(O.$$.fragment,x),se=!1},d(x){x&&t(c),x&&t(M),T(O,x),x&&t(I),x&&t(m),x&&t(te),x&&t(R)}}}function Qm(D){let c,d,h,g,k,A,F,P,M,O,I,m,y,w,$,H,N,G,L,W,J,ie,B,le,ye,te,R,oe,re,Y,be,se,x,U,ve,Z,V,ue,Le,pe,we,X,Q,pi,et;return y=new q({props:{code:`from transformers import TrainingArguments

training_args = TrainingArguments(
    "bert-finetuned-mrpc", save_strategy="epoch", push_to_hub=True
)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

training_args = TrainingArguments(
    <span class="hljs-string">&quot;bert-finetuned-mrpc&quot;</span>, save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>, push_to_hub=<span class="hljs-literal">True</span>
)`}}),{c(){c=s("p"),d=i("If you have played around with the "),h=s("code"),g=i("Trainer"),k=i(" API to train a model, the easiest way to upload it to the Hub is to set "),A=s("code"),F=i("push_to_hub=True"),P=i(" when you define your "),M=s("code"),O=i("TrainingArguments"),I=i(":"),m=u(),E(y.$$.fragment),w=u(),$=s("p"),H=i("When you call "),N=s("code"),G=i("trainer.train()"),L=i(", the "),W=s("code"),J=i("Trainer"),ie=i(" will then upload your model to the Hub each time it is saved (here every epoch) in a repository in your namespace. That repository will be named like the output directory you picked (here "),B=s("code"),le=i("bert-finetuned-mrpc"),ye=i(") but you can choose a different name with "),te=s("code"),R=i('hub_model_id = "a_different_name"'),oe=i("."),re=u(),Y=s("p"),be=i("To upload you model to an organization you are a member of, just pass it with "),se=s("code"),x=i('hub_model_id = "my_organization/my_repo_name"'),U=i("."),ve=u(),Z=s("p"),V=i("Once your training is finished, you should do a final "),ue=s("code"),Le=i("trainer.push_to_hub()"),pe=i(" to upload the last version of your model. It will also generate a model card with all the relevant metadata, reporting the hyperparameters used and the evaluation results! Here is an example of the content you might find in a such a model card:"),we=u(),X=s("div"),Q=s("img"),this.h()},l(C){c=a(C,"P",{});var S=f(c);d=l(S,"If you have played around with the "),h=a(S,"CODE",{});var pt=f(h);g=l(pt,"Trainer"),pt.forEach(t),k=l(S," API to train a model, the easiest way to upload it to the Hub is to set "),A=a(S,"CODE",{});var Se=f(A);F=l(Se,"push_to_hub=True"),Se.forEach(t),P=l(S," when you define your "),M=a(S,"CODE",{});var di=f(M);O=l(di,"TrainingArguments"),di.forEach(t),I=l(S,":"),S.forEach(t),m=p(C),j(y.$$.fragment,C),w=p(C),$=a(C,"P",{});var K=f($);H=l(K,"When you call "),N=a(K,"CODE",{});var mi=f(N);G=l(mi,"trainer.train()"),mi.forEach(t),L=l(K,", the "),W=a(K,"CODE",{});var dt=f(W);J=l(dt,"Trainer"),dt.forEach(t),ie=l(K," will then upload your model to the Hub each time it is saved (here every epoch) in a repository in your namespace. That repository will be named like the output directory you picked (here "),B=a(K,"CODE",{});var _i=f(B);le=l(_i,"bert-finetuned-mrpc"),_i.forEach(t),ye=l(K,") but you can choose a different name with "),te=a(K,"CODE",{});var gi=f(te);R=l(gi,'hub_model_id = "a_different_name"'),gi.forEach(t),oe=l(K,"."),K.forEach(t),re=p(C),Y=a(C,"P",{});var tt=f(Y);be=l(tt,"To upload you model to an organization you are a member of, just pass it with "),se=a(tt,"CODE",{});var ae=f(se);x=l(ae,'hub_model_id = "my_organization/my_repo_name"'),ae.forEach(t),U=l(tt,"."),tt.forEach(t),ve=p(C),Z=a(C,"P",{});var ee=f(Z);V=l(ee,"Once your training is finished, you should do a final "),ue=a(ee,"CODE",{});var ot=f(ue);Le=l(ot,"trainer.push_to_hub()"),ot.forEach(t),pe=l(ee," to upload the last version of your model. It will also generate a model card with all the relevant metadata, reporting the hyperparameters used and the evaluation results! Here is an example of the content you might find in a such a model card:"),ee.forEach(t),we=p(C),X=a(C,"DIV",{class:!0});var ke=f(X);Q=a(ke,"IMG",{src:!0,alt:!0,width:!0}),ke.forEach(t),this.h()},h(){Ge(Q.src,pi="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/model_card.png")||_(Q,"src",pi),_(Q,"alt","An example of an auto-generated model card."),_(Q,"width","100%"),_(X,"class","flex justify-center")},m(C,S){n(C,c,S),o(c,d),o(c,h),o(h,g),o(c,k),o(c,A),o(A,F),o(c,P),o(c,M),o(M,O),o(c,I),n(C,m,S),z(y,C,S),n(C,w,S),n(C,$,S),o($,H),o($,N),o(N,G),o($,L),o($,W),o(W,J),o($,ie),o($,B),o(B,le),o($,ye),o($,te),o(te,R),o($,oe),n(C,re,S),n(C,Y,S),o(Y,be),o(Y,se),o(se,x),o(Y,U),n(C,ve,S),n(C,Z,S),o(Z,V),o(Z,ue),o(ue,Le),o(Z,pe),n(C,we,S),n(C,X,S),o(X,Q),et=!0},i(C){et||(v(y.$$.fragment,C),et=!0)},o(C){b(y.$$.fragment,C),et=!1},d(C){C&&t(c),C&&t(m),T(y,C),C&&t(w),C&&t($),C&&t(re),C&&t(Y),C&&t(ve),C&&t(Z),C&&t(we),C&&t(X)}}}function e_(D){let c,d;return c=new q({props:{code:`from transformers import TFAutoModelForMaskedLM, AutoTokenizer

checkpoint = "camembert-base"

model = TFAutoModelForMaskedLM.from_pretrained(checkpoint)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM, AutoTokenizer

checkpoint = <span class="hljs-string">&quot;camembert-base&quot;</span>

model = TFAutoModelForMaskedLM.from_pretrained(checkpoint)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)`}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function t_(D){let c,d;return c=new q({props:{code:`from transformers import AutoModelForMaskedLM, AutoTokenizer

checkpoint = "camembert-base"

model = AutoModelForMaskedLM.from_pretrained(checkpoint)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM, AutoTokenizer

checkpoint = <span class="hljs-string">&quot;camembert-base&quot;</span>

model = AutoModelForMaskedLM.from_pretrained(checkpoint)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)`}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function o_(D){let c,d,h;return{c(){c=s("div"),d=s("img"),this.h()},l(g){c=a(g,"DIV",{class:!0});var k=f(c);d=a(k,"IMG",{src:!0,alt:!0,width:!0}),k.forEach(t),this.h()},h(){Ge(d.src,h="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/push_to_hub_dummy_model_tf.png")||_(d,"src",h),_(d,"alt","Dummy model containing both the tokenizer and model files."),_(d,"width","80%"),_(c,"class","flex justify-center")},m(g,k){n(g,c,k),o(c,d)},d(g){g&&t(c)}}}function i_(D){let c,d,h;return{c(){c=s("div"),d=s("img"),this.h()},l(g){c=a(g,"DIV",{class:!0});var k=f(c);d=a(k,"IMG",{src:!0,alt:!0,width:!0}),k.forEach(t),this.h()},h(){Ge(d.src,h="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/push_to_hub_dummy_model.png")||_(d,"src",h),_(d,"alt","Dummy model containing both the tokenizer and model files."),_(d,"width","80%"),_(c,"class","flex justify-center")},m(g,k){n(g,c,k),o(c,d)},d(g){g&&t(c)}}}function l_(D){let c,d,h,g,k,A,F,P,M,O,I;return{c(){c=s("p"),d=i("\u270F\uFE0F "),h=s("strong"),g=i("Try it out!"),k=i(" Take the model and tokenizer associated with the "),A=s("code"),F=i("bert-base-cased"),P=i(" checkpoint and upload them to a repo in your namespace using the "),M=s("code"),O=i("push_to_hub()"),I=i(" method. Double-check that the repo appears properly on your page before deleting it.")},l(m){c=a(m,"P",{});var y=f(c);d=l(y,"\u270F\uFE0F "),h=a(y,"STRONG",{});var w=f(h);g=l(w,"Try it out!"),w.forEach(t),k=l(y," Take the model and tokenizer associated with the "),A=a(y,"CODE",{});var $=f(A);F=l($,"bert-base-cased"),$.forEach(t),P=l(y," checkpoint and upload them to a repo in your namespace using the "),M=a(y,"CODE",{});var H=f(M);O=l(H,"push_to_hub()"),H.forEach(t),I=l(y," method. Double-check that the repo appears properly on your page before deleting it."),y.forEach(t)},m(m,y){n(m,c,y),o(c,d),o(c,h),o(h,g),o(c,k),o(c,A),o(A,F),o(c,P),o(c,M),o(M,O),o(c,I)},d(m){m&&t(c)}}}function r_(D){let c,d;return c=new q({props:{code:`from transformers import TFAutoModelForMaskedLM, AutoTokenizer

checkpoint = "camembert-base"

model = TFAutoModelForMaskedLM.from_pretrained(checkpoint)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)

# Do whatever with the model, train it, fine-tune it...

model.save_pretrained("<path_to_dummy_folder>")
tokenizer.save_pretrained("<path_to_dummy_folder>")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM, AutoTokenizer

checkpoint = <span class="hljs-string">&quot;camembert-base&quot;</span>

model = TFAutoModelForMaskedLM.from_pretrained(checkpoint)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)

<span class="hljs-comment"># Do whatever with the model, train it, fine-tune it...</span>

model.save_pretrained(<span class="hljs-string">&quot;&lt;path_to_dummy_folder&gt;&quot;</span>)
tokenizer.save_pretrained(<span class="hljs-string">&quot;&lt;path_to_dummy_folder&gt;&quot;</span>)`}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function s_(D){let c,d;return c=new q({props:{code:`from transformers import AutoModelForMaskedLM, AutoTokenizer

checkpoint = "camembert-base"

model = AutoModelForMaskedLM.from_pretrained(checkpoint)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)

# Do whatever with the model, train it, fine-tune it...

model.save_pretrained("<path_to_dummy_folder>")
tokenizer.save_pretrained("<path_to_dummy_folder>")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM, AutoTokenizer

checkpoint = <span class="hljs-string">&quot;camembert-base&quot;</span>

model = AutoModelForMaskedLM.from_pretrained(checkpoint)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)

<span class="hljs-comment"># Do whatever with the model, train it, fine-tune it...</span>

model.save_pretrained(<span class="hljs-string">&quot;&lt;path_to_dummy_folder&gt;&quot;</span>)
tokenizer.save_pretrained(<span class="hljs-string">&quot;&lt;path_to_dummy_folder&gt;&quot;</span>)`}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function a_(D){let c,d,h,g,k,A,F,P,M,O,I;return c=new q({props:{code:"config.json  README.md  sentencepiece.bpe.model  special_tokens_map.json  tf_model.h5  tokenizer_config.json  tokenizer.json",highlighted:"config.json  README.md  sentencepiece.bpe.model  special_tokens_map.json  tf_model.h5  tokenizer_config.json  tokenizer.json"}}),{c(){E(c.$$.fragment),d=u(),h=s("p"),g=i("If you look at the file sizes (for example, with "),k=s("code"),A=i("ls -lh"),F=i("), you should see that the model state dict file ("),P=s("em"),M=i("t5_model.h5"),O=i(") is the only outlier, at more than 400 MB.")},l(m){j(c.$$.fragment,m),d=p(m),h=a(m,"P",{});var y=f(h);g=l(y,"If you look at the file sizes (for example, with "),k=a(y,"CODE",{});var w=f(k);A=l(w,"ls -lh"),w.forEach(t),F=l(y,"), you should see that the model state dict file ("),P=a(y,"EM",{});var $=f(P);M=l($,"t5_model.h5"),$.forEach(t),O=l(y,") is the only outlier, at more than 400 MB."),y.forEach(t)},m(m,y){z(c,m,y),n(m,d,y),n(m,h,y),o(h,g),o(h,k),o(k,A),o(h,F),o(h,P),o(P,M),o(h,O),I=!0},i(m){I||(v(c.$$.fragment,m),I=!0)},o(m){b(c.$$.fragment,m),I=!1},d(m){T(c,m),m&&t(d),m&&t(h)}}}function n_(D){let c,d,h,g,k,A,F,P,M,O,I;return c=new q({props:{code:"config.json  pytorch_model.bin  README.md  sentencepiece.bpe.model  special_tokens_map.json tokenizer_config.json  tokenizer.json",highlighted:"config.json  pytorch_model.bin  README.md  sentencepiece.bpe.model  special_tokens_map.json tokenizer_config.json  tokenizer.json"}}),{c(){E(c.$$.fragment),d=u(),h=s("p"),g=i("If you look at the file sizes (for example, with "),k=s("code"),A=i("ls -lh"),F=i("), you should see that the model state dict file ("),P=s("em"),M=i("pytorch_model.bin"),O=i(") is the only outlier, at more than 400 MB.")},l(m){j(c.$$.fragment,m),d=p(m),h=a(m,"P",{});var y=f(h);g=l(y,"If you look at the file sizes (for example, with "),k=a(y,"CODE",{});var w=f(k);A=l(w,"ls -lh"),w.forEach(t),F=l(y,"), you should see that the model state dict file ("),P=a(y,"EM",{});var $=f(P);M=l($,"pytorch_model.bin"),$.forEach(t),O=l(y,") is the only outlier, at more than 400 MB."),y.forEach(t)},m(m,y){z(c,m,y),n(m,d,y),n(m,h,y),o(h,g),o(h,k),o(k,A),o(h,F),o(h,P),o(P,M),o(h,O),I=!0},i(m){I||(v(c.$$.fragment,m),I=!0)},o(m){b(c.$$.fragment,m),I=!1},d(m){T(c,m),m&&t(d),m&&t(h)}}}function f_(D){let c;return{c(){c=i("\u270F\uFE0F When creating the repository from the web interface, the *.gitattributes* file is automatically set up to consider files with certain extensions, such as *.bin* and *.h5*, as large files, and git-lfs will track them with no necessary setup on your side.")},l(d){c=l(d,"\u270F\uFE0F When creating the repository from the web interface, the *.gitattributes* file is automatically set up to consider files with certain extensions, such as *.bin* and *.h5*, as large files, and git-lfs will track them with no necessary setup on your side.")},m(d,h){n(d,c,h)},d(d){d&&t(c)}}}function h_(D){let c,d;return c=new q({props:{code:`On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
  modified:   .gitattributes
  	new file:   config.json
	new file:   sentencepiece.bpe.model
	new file:   special_tokens_map.json
	new file:   tf_model.h5
	new file:   tokenizer.json
	new file:   tokenizer_config.json`,highlighted:`On branch main
Your branch is up to <span class="hljs-built_in">date</span> with <span class="hljs-string">&#x27;origin/main&#x27;</span>.

Changes to be committed:
  (use <span class="hljs-string">&quot;git restore --staged &lt;file&gt;...&quot;</span> to unstage)
  modified:   .gitattributes
  	new file:   config.json
	new file:   sentencepiece.bpe.model
	new file:   special_tokens_map.json
	new file:   tf_model.h5
	new file:   tokenizer.json
	new file:   tokenizer_config.json`}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function c_(D){let c,d;return c=new q({props:{code:`On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
  modified:   .gitattributes
	new file:   config.json
	new file:   pytorch_model.bin
	new file:   sentencepiece.bpe.model
	new file:   special_tokens_map.json
	new file:   tokenizer.json
	new file:   tokenizer_config.json`,highlighted:`On branch main
Your branch is up to <span class="hljs-built_in">date</span> with <span class="hljs-string">&#x27;origin/main&#x27;</span>.

Changes to be committed:
  (use <span class="hljs-string">&quot;git restore --staged &lt;file&gt;...&quot;</span> to unstage)
  modified:   .gitattributes
	new file:   config.json
	new file:   pytorch_model.bin
	new file:   sentencepiece.bpe.model
	new file:   special_tokens_map.json
	new file:   tokenizer.json
	new file:   tokenizer_config.json`}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function u_(D){let c,d,h,g,k,A,F,P,M,O,I,m,y,w;return c=new q({props:{code:`On branch main
Objects to be pushed to origin/main:


Objects to be committed:

	config.json (Git: bc20ff2)
	sentencepiece.bpe.model (LFS: 988bc5a)
	special_tokens_map.json (Git: cb23931)
	tf_model.h5 (LFS: 86fce29)
	tokenizer.json (Git: 851ff3e)
	tokenizer_config.json (Git: f0f7783)

Objects not staged for commit:

`,highlighted:`On branch main
Objects to be pushed to origin/main:


Objects to be committed:

	config.json (Git: bc20ff2)
	sentencepiece.bpe.model (LFS: 988bc5a)
	special_tokens_map.json (Git: cb23931)
	tf_model.h5 (LFS: 86fce29)
	tokenizer.json (Git: 851ff3e)
	tokenizer_config.json (Git: f0f7783)

Objects not staged <span class="hljs-keyword">for</span> commit:

`}}),{c(){E(c.$$.fragment),d=u(),h=s("p"),g=i("We can see that all files have "),k=s("code"),A=i("Git"),F=i(" as a handler, except "),P=s("em"),M=i("t5_model.h5"),O=i(", which has "),I=s("code"),m=i("LFS"),y=i(". Great!")},l($){j(c.$$.fragment,$),d=p($),h=a($,"P",{});var H=f(h);g=l(H,"We can see that all files have "),k=a(H,"CODE",{});var N=f(k);A=l(N,"Git"),N.forEach(t),F=l(H," as a handler, except "),P=a(H,"EM",{});var G=f(P);M=l(G,"t5_model.h5"),G.forEach(t),O=l(H,", which has "),I=a(H,"CODE",{});var L=f(I);m=l(L,"LFS"),L.forEach(t),y=l(H,". Great!"),H.forEach(t)},m($,H){z(c,$,H),n($,d,H),n($,h,H),o(h,g),o(h,k),o(k,A),o(h,F),o(h,P),o(P,M),o(h,O),o(h,I),o(I,m),o(h,y),w=!0},i($){w||(v(c.$$.fragment,$),w=!0)},o($){b(c.$$.fragment,$),w=!1},d($){T(c,$),$&&t(d),$&&t(h)}}}function p_(D){let c,d,h,g,k,A,F,P,M,O,I,m,y,w,$,H,N;return c=new q({props:{code:`On branch main
Objects to be pushed to origin/main:


Objects to be committed:

	config.json (Git: bc20ff2)
	pytorch_model.bin (LFS: 35686c2)
	sentencepiece.bpe.model (LFS: 988bc5a)
	special_tokens_map.json (Git: cb23931)
	tokenizer.json (Git: 851ff3e)
	tokenizer_config.json (Git: f0f7783)

Objects not staged for commit:

`,highlighted:`On branch main
Objects to be pushed to origin/main:


Objects to be committed:

	config.json (Git: bc20ff2)
	pytorch_model.bin (LFS: 35686c2)
	sentencepiece.bpe.model (LFS: 988bc5a)
	special_tokens_map.json (Git: cb23931)
	tokenizer.json (Git: 851ff3e)
	tokenizer_config.json (Git: f0f7783)

Objects not staged <span class="hljs-keyword">for</span> commit:

`}}),{c(){E(c.$$.fragment),d=u(),h=s("p"),g=i("We can see that all files have "),k=s("code"),A=i("Git"),F=i(" as a handler, except "),P=s("em"),M=i("pytorch_model.bin"),O=i(" and "),I=s("em"),m=i("sentencepiece.bpe.model"),y=i(", which have "),w=s("code"),$=i("LFS"),H=i(". Great!")},l(G){j(c.$$.fragment,G),d=p(G),h=a(G,"P",{});var L=f(h);g=l(L,"We can see that all files have "),k=a(L,"CODE",{});var W=f(k);A=l(W,"Git"),W.forEach(t),F=l(L," as a handler, except "),P=a(L,"EM",{});var J=f(P);M=l(J,"pytorch_model.bin"),J.forEach(t),O=l(L," and "),I=a(L,"EM",{});var ie=f(I);m=l(ie,"sentencepiece.bpe.model"),ie.forEach(t),y=l(L,", which have "),w=a(L,"CODE",{});var B=f(w);$=l(B,"LFS"),B.forEach(t),H=l(L,". Great!"),L.forEach(t)},m(G,L){z(c,G,L),n(G,d,L),n(G,h,L),o(h,g),o(h,k),o(k,A),o(h,F),o(h,P),o(P,M),o(h,O),o(h,I),o(I,m),o(h,y),o(h,w),o(w,$),o(h,H),N=!0},i(G){N||(v(c.$$.fragment,G),N=!0)},o(G){b(c.$$.fragment,G),N=!1},d(G){T(c,G),G&&t(d),G&&t(h)}}}function d_(D){let c,d;return c=new q({props:{code:`[main b08aab1] First model version
 6 files changed, 36 insertions(+)
 create mode 100644 config.json
 create mode 100644 sentencepiece.bpe.model
 create mode 100644 special_tokens_map.json
 create mode 100644 tf_model.h5
 create mode 100644 tokenizer.json
 create mode 100644 tokenizer_config.json`,highlighted:`[main b08aab1] First model version
 6 files changed, 36 insertions(+)
 create mode 100644 config.json
 create mode 100644 sentencepiece.bpe.model
 create mode 100644 special_tokens_map.json
 create mode 100644 tf_model.h5
 create mode 100644 tokenizer.json
 create mode 100644 tokenizer_config.json`}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function m_(D){let c,d;return c=new q({props:{code:`[main b08aab1] First model version
 7 files changed, 29027 insertions(+)
  6 files changed, 36 insertions(+)
 create mode 100644 config.json
 create mode 100644 pytorch_model.bin
 create mode 100644 sentencepiece.bpe.model
 create mode 100644 special_tokens_map.json
 create mode 100644 tokenizer.json
 create mode 100644 tokenizer_config.json`,highlighted:`[main b08aab1] First model version
 7 files changed, 29027 insertions(+)
  6 files changed, 36 insertions(+)
 create mode 100644 config.json
 create mode 100644 pytorch_model.bin
 create mode 100644 sentencepiece.bpe.model
 create mode 100644 special_tokens_map.json
 create mode 100644 tokenizer.json
 create mode 100644 tokenizer_config.json`}}),{c(){E(c.$$.fragment)},l(h){j(c.$$.fragment,h)},m(h,g){z(c,h,g),d=!0},i(h){d||(v(c.$$.fragment,h),d=!0)},o(h){b(c.$$.fragment,h),d=!1},d(h){T(c,h)}}}function __(D){let c,d,h,g,k,A,F,P,M,O,I;return{c(){c=i(`If we take a look at the model repository when this is finished, we can see all the recently added files:
`),d=s("div"),h=s("img"),k=u(),A=s("p"),F=i("The UI allows you to explore the model files and commits and to see the diff introduced by each commit:"),P=u(),M=s("div"),O=s("img"),this.h()},l(m){c=l(m,`If we take a look at the model repository when this is finished, we can see all the recently added files:
`),d=a(m,"DIV",{class:!0});var y=f(d);h=a(y,"IMG",{src:!0,alt:!0,width:!0}),y.forEach(t),k=p(m),A=a(m,"P",{});var w=f(A);F=l(w,"The UI allows you to explore the model files and commits and to see the diff introduced by each commit:"),w.forEach(t),P=p(m),M=a(m,"DIV",{class:!0});var $=f(M);O=a($,"IMG",{src:!0,alt:!0,width:!0}),$.forEach(t),this.h()},h(){Ge(h.src,g="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/full_model_tf.png")||_(h,"src",g),_(h,"alt","The 'Files and versions' tab now contains all the recently uploaded files."),_(h,"width","80%"),_(d,"class","flex justify-center"),Ge(O.src,I="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/diffstf.gif")||_(O,"src",I),_(O,"alt","The diff introduced by the recent commit."),_(O,"width","80%"),_(M,"class","flex justify-center")},m(m,y){n(m,c,y),n(m,d,y),o(d,h),n(m,k,y),n(m,A,y),o(A,F),n(m,P,y),n(m,M,y),o(M,O)},d(m){m&&t(c),m&&t(d),m&&t(k),m&&t(A),m&&t(P),m&&t(M)}}}function g_(D){let c,d,h,g,k,A,F,P,M,O,I,m,y;return{c(){c=s("p"),d=i("If we take a look at the model repository when this is finished, we can see all the recently added files:"),h=u(),g=s("div"),k=s("img"),F=u(),P=s("p"),M=i("The UI allows you to explore the model files and commits and to see the diff introduced by each commit:"),O=u(),I=s("div"),m=s("img"),this.h()},l(w){c=a(w,"P",{});var $=f(c);d=l($,"If we take a look at the model repository when this is finished, we can see all the recently added files:"),$.forEach(t),h=p(w),g=a(w,"DIV",{class:!0});var H=f(g);k=a(H,"IMG",{src:!0,alt:!0,width:!0}),H.forEach(t),F=p(w),P=a(w,"P",{});var N=f(P);M=l(N,"The UI allows you to explore the model files and commits and to see the diff introduced by each commit:"),N.forEach(t),O=p(w),I=a(w,"DIV",{class:!0});var G=f(I);m=a(G,"IMG",{src:!0,alt:!0,width:!0}),G.forEach(t),this.h()},h(){Ge(k.src,A="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/full_model.png")||_(k,"src",A),_(k,"alt","The 'Files and versions' tab now contains all the recently uploaded files."),_(k,"width","80%"),_(g,"class","flex justify-center"),Ge(m.src,y="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/diffs.gif")||_(m,"src",y),_(m,"alt","The diff introduced by the recent commit."),_(m,"width","80%"),_(I,"class","flex justify-center")},m(w,$){n(w,c,$),o(c,d),n(w,h,$),n(w,g,$),o(g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r,Mu,qu,Oa,Jo,Ia,Zi,Fu,Ca,Zo,Ma,Oe,Ie,Xi,Wt,Hu,Lr,xu,Gu,qa,Xo,Fa,Ce,Me,Qi,Bt,Lu,Sr,Su,Nu,Ha,Qo,xa,qe,Fe,el,tl,Uu,Ga,ei,La,ti,Sa,ol,Na;h=new Ym({props:{fw:D[0]}}),P=new Xt({});const Xu=[Km,Vm],oi=[];function Qu(e,r){return e[0]==="pt"?0:1}y=Qu(D),w=oi[y]=Xu[y](D),L=new Yu({props:{id:"9yY3RB_GSPM"}}),Se=new Xt({});const ep=[Zm,Jm],ii=[];function tp(e,r){return e[0]==="pt"?0:1}ae=tp(D),ee=ii[ae]=ep[ae](D),Qt=new q({props:{code:`from huggingface_hub import notebook_login

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

notebook_login()`}}),eo=new q({props:{code:"huggingface-cli login",highlighted:"huggingface-cli login"}});const op=[Qm,Xm],li=[];function ip(e,r){return e[0]==="pt"?0:1}$e=ip(D),Ee=li[$e]=op[$e](D);const lp=[t_,e_],ri=[];function rp(e,r){return e[0]==="pt"?0:1}je=rp(D),ze=ri[je]=lp[je](D),oo=new q({props:{code:'model.push_to_hub("dummy-model")',highlighted:'model.push_to_hub(<span class="hljs-string">&quot;dummy-model&quot;</span>)'}}),io=new q({props:{code:'tokenizer.push_to_hub("dummy-model")',highlighted:'tokenizer.push_to_hub(<span class="hljs-string">&quot;dummy-model&quot;</span>)'}}),lo=new q({props:{code:'tokenizer.push_to_hub("dummy-model", organization="huggingface")',highlighted:'tokenizer.push_to_hub(<span class="hljs-string">&quot;dummy-model&quot;</span>, organization=<span class="hljs-string">&quot;huggingface&quot;</span>)'}}),ro=new q({props:{code:'tokenizer.push_to_hub("dummy-model", organization="huggingface", use_auth_token="<TOKEN>")',highlighted:'tokenizer.push_to_hub(<span class="hljs-string">&quot;dummy-model&quot;</span>, organization=<span class="hljs-string">&quot;huggingface&quot;</span>, use_auth_token=<span class="hljs-string">&quot;&lt;TOKEN&gt;&quot;</span>)'}});function sp(e,r){return e[0]==="pt"?i_:o_}let Ua=sp(D),ft=Ua(D);wt=new Lm({props:{$$slots:{default:[l_]},$$scope:{ctx:D}}}),ho=new Xt({}),uo=new q({props:{code:"huggingface-cli login",highlighted:"huggingface-cli login"}}),po=new q({props:{code:`from huggingface_hub import (
    # User management
    login,
    logout,
    whoami,

    # Repository creation and management
    create_repo,
    delete_repo,
    update_repo_visibility,

    # And some methods to retrieve/change information about the content
    list_models,
    list_datasets,
    list_metrics,
    list_repo_files,
    upload_file,
    delete_file,
)`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> (
    <span class="hljs-comment"># User management</span>
    login,
    logout,
    whoami,

    <span class="hljs-comment"># Repository creation and management</span>
    create_repo,
    delete_repo,
    update_repo_visibility,

    <span class="hljs-comment"># And some methods to retrieve/change information about the content</span>
    list_models,
    list_datasets,
    list_metrics,
    list_repo_files,
    upload_file,
    delete_file,
)`}}),mo=new q({props:{code:`from huggingface_hub import create_repo

create_repo("dummy-model")`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> create_repo

create_repo(<span class="hljs-string">&quot;dummy-model&quot;</span>)`}}),_o=new q({props:{code:`from huggingface_hub import create_repo

create_repo("dummy-model", organization="huggingface")`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> create_repo

create_repo(<span class="hljs-string">&quot;dummy-model&quot;</span>, organization=<span class="hljs-string">&quot;huggingface&quot;</span>)`}}),go=new Xt({}),To=new Xt({}),Ao=new Xt({}),Oo=new q({props:{code:`from huggingface_hub import upload_file

upload_file(
    "<path_to_file>/config.json",
    path_in_repo="config.json",
    repo_id="<namespace>/dummy-model",
)`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> upload_file

upload_file(
    <span class="hljs-string">&quot;&lt;path_to_file&gt;/config.json&quot;</span>,
    path_in_repo=<span class="hljs-string">&quot;config.json&quot;</span>,
    repo_id=<span class="hljs-string">&quot;&lt;namespace&gt;/dummy-model&quot;</span>,
)`}}),Io=new Xt({}),qo=new q({props:{code:`from huggingface_hub import Repository

repo = Repository("<path_to_dummy_folder>", clone_from="<namespace>/dummy-model")`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> Repository

repo = Repository(<span class="hljs-string">&quot;&lt;path_to_dummy_folder&gt;&quot;</span>, clone_from=<span class="hljs-string">&quot;&lt;namespace&gt;/dummy-model&quot;</span>)`}}),Fo=new q({props:{code:`repo.git_pull()
repo.git_add()
repo.git_commit()
repo.git_push()
repo.git_tag()`,highlighted:`repo.git_pull()
repo.git_add()
repo.git_commit()
repo.git_push()
repo.git_tag()`}}),xo=new q({props:{code:"repo.git_pull()",highlighted:"repo.git_pull()"}}),Go=new q({props:{code:`model.save_pretrained("<path_to_dummy_folder>")
tokenizer.save_pretrained("<path_to_dummy_folder>")`,highlighted:`model.save_pretrained(<span class="hljs-string">&quot;&lt;path_to_dummy_folder&gt;&quot;</span>)
tokenizer.save_pretrained(<span class="hljs-string">&quot;&lt;path_to_dummy_folder&gt;&quot;</span>)`}}),Lo=new q({props:{code:`repo.git_add()
repo.git_commit("Add model and tokenizer files")
repo.git_push()`,highlighted:`repo.git_add()
repo.git_commit(<span class="hljs-string">&quot;Add model and tokenizer files&quot;</span>)
repo.git_push()`}}),So=new Xt({}),Uo=new q({props:{code:"git lfs install",highlighted:"git lfs install"}}),Ro=new q({props:{code:`Updated git hooks.
Git LFS initialized.`,highlighted:`Updated git hooks.
Git LFS initialized.`}}),Wo=new q({props:{code:"git clone https://huggingface.co/<namespace>/<your-model-id>",highlighted:'git <span class="hljs-built_in">clone</span> https://huggingface.co/&lt;namespace&gt;/&lt;your-model-id&gt;'}}),Bo=new q({props:{code:"git clone https://huggingface.co/lysandre/dummy",highlighted:'git clone https:<span class="hljs-regexp">//</span>huggingface.co<span class="hljs-regexp">/lysandre/</span>dummy'}}),Yo=new q({props:{code:"cd dummy && ls",highlighted:'<span class="hljs-built_in">cd</span> dummy &amp;&amp; <span class="hljs-built_in">ls</span>'}}),Vo=new q({props:{code:"README.md",highlighted:"README.md"}});const ap=[s_,r_],si=[];function np(e,r){return e[0]==="pt"?0:1}Te=np(D),Pe=si[Te]=ap[Te](D),Ko=new q({props:{code:"ls",highlighted:'<span class="hljs-built_in">ls</span>'}});const fp=[n_,a_],ai=[];function hp(e,r){return e[0]==="pt"?0:1}Ae=hp(D),De=ai[Ae]=fp[Ae](D),Ut=new Lm({props:{$$slots:{default:[f_]},$$scope:{ctx:D}}}),Jo=new q({props:{code:"git add .",highlighted:"git add ."}}),Zo=new q({props:{code:"git status",highlighted:"git status"}});const cp=[c_,h_],ni=[];function up(e,r){return e[0]==="pt"?0:1}Oe=up(D),Ie=ni[Oe]=cp[Oe](D),Xo=new q({props:{code:"git lfs status",highlighted:"git lfs status"}});const pp=[p_,u_],fi=[];function dp(e,r){return e[0]==="pt"?0:1}Ce=dp(D),Me=fi[Ce]=pp[Ce](D),Qo=new q({props:{code:'git commit -m "First model version"',highlighted:'git commit -m <span class="hljs-string">&quot;First model version&quot;</span>'}});const mp=[m_,d_],hi=[];function _p(e,r){return e[0]==="pt"?0:1}qe=_p(D),Fe=hi[qe]=mp[qe](D),ei=new q({props:{code:"git push",highlighted:"git push"}}),ti=new q({props:{code:`Uploading LFS objects: 100% (1/1), 433 MB | 1.3 MB/s, done.
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 12 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 288.27 KiB | 6.27 MiB/s, done.
Total 9 (delta 1), reused 0 (delta 0), pack-reused 0
To https://huggingface.co/lysandre/dummy
   891b41d..b08aab1  main -> main`,highlighted:`Uploading LFS objects: 100% (1/1), 433 MB | 1.3 MB/s, <span class="hljs-keyword">done</span>.
Enumerating objects: 11, <span class="hljs-keyword">done</span>.
Counting objects: 100% (11/11), <span class="hljs-keyword">done</span>.
Delta compression using up to 12 threads
Compressing objects: 100% (9/9), <span class="hljs-keyword">done</span>.
Writing objects: 100% (9/9), 288.27 KiB | 6.27 MiB/s, <span class="hljs-keyword">done</span>.
Total 9 (delta 1), reused 0 (delta 0), pack-reused 0
To https://huggingface.co/lysandre/dummy
   891b41d..b08aab1  main -&gt; main`}});function gp(e,r){return e[0]==="pt"?g_:__}let Ra=gp(D),ht=Ra(D);return{c(){c=s("meta"),d=u(),E(h.$$.fragment),g=u(),k=s("h1"),A=s("a"),F=s("span"),E(P.$$.fragment),M=u(),O=s("span"),I=i("Sharing pretrained models"),m=u(),w.c(),$=u(),H=s("p"),N=i("In the steps below, we\u2019ll take a look at the easiest ways to share pretrained models to the \u{1F917} Hub. There are tools and utilities available that make it simple to share and update models directly on the Hub, which we will explore below."),G=u(),E(L.$$.fragment),W=u(),J=s("p"),ie=i("We encourage all users that train models to contribute by sharing them with the community \u2014 sharing models, even when trained on very specific datasets, will help others, saving them time and compute resources and providing access to useful trained artifacts. In turn, you can benefit from the work that others have done!"),B=u(),le=s("p"),ye=i("There are three ways to go about creating new model repositories:"),te=u(),R=s("ul"),oe=s("li"),re=i("Using the "),Y=s("code"),be=i("push_to_hub"),se=i(" API"),x=u(),U=s("li"),ve=i("Using the "),Z=s("code"),V=i("huggingface_hub"),ue=i(" Python library"),Le=u(),pe=s("li"),we=i("Using the web interface"),X=u(),Q=s("p"),pi=i("Once you\u2019ve created a repository, you can upload files to it via git and git-lfs. We\u2019ll walk you through creating model repositories and uploading files to them in the following sections."),et=u(),C=s("h2"),S=s("a"),pt=s("span"),E(Se.$$.fragment),di=u(),K=s("span"),mi=i("Using the "),dt=s("code"),_i=i("push_to_hub"),gi=i(" API"),tt=u(),ee.c(),ot=u(),ke=s("p"),Pn=i("The simplest way to upload files to the Hub is by leveraging the "),bl=s("code"),An=i("push_to_hub"),Dn=i(" API."),Ur=u(),de=s("p"),On=i("Before going further, you\u2019ll need to generate an authentication token so that the "),vl=s("code"),In=i("huggingface_hub"),Cn=i(" API knows who you are and what namespaces you have write access to. Make sure you are in an environment where you have "),wl=s("code"),Mn=i("transformers"),qn=i(" installed (see "),yi=s("a"),Fn=i("Setup"),Hn=i("). If you are in a notebook, you can use the following function to login:"),Rr=u(),E(Qt.$$.fragment),Wr=u(),bi=s("p"),xn=i("In a terminal, you can run:"),Br=u(),E(eo.$$.fragment),Yr=u(),mt=s("p"),Gn=i("In both cases, you should be prompted for your username and password, which are the same ones you use to log in to the Hub. If you do not have a Hub profile yet, you should create one "),to=s("a"),Ln=i("here"),Sn=i("."),Vr=u(),vi=s("p"),Nn=i("Great! You now have your authentication token stored in your cache folder. Let\u2019s create some repositories!"),Kr=u(),Ee.c(),wi=u(),_t=s("p"),Un=i("At a lower level, accessing the Model Hub can be done directly on models, tokenizers, and configuration objects via their "),kl=s("code"),Rn=i("push_to_hub()"),Wn=i(" method. This method takes care of both the repository creation and pushing the model and tokenizer files directly to the repository. No manual handling is required, unlike with the API we\u2019ll see below."),Jr=u(),ki=s("p"),Bn=i("To get an idea of how it works, let\u2019s first initialize a model and a tokenizer:"),Zr=u(),ze.c(),$i=u(),Ne=s("p"),Yn=i("You\u2019re free to do whatever you want with these \u2014 add tokens to the tokenizer, train the model, fine-tune it. Once you\u2019re happy with the resulting model, weights, and tokenizer, you can leverage the "),$l=s("code"),Vn=i("push_to_hub()"),Kn=i(" method directly available on the "),El=s("code"),Jn=i("model"),Zn=i(" object:"),Xr=u(),E(oo.$$.fragment),Qr=u(),gt=s("p"),Xn=i("This will create the new repository "),jl=s("code"),Qn=i("dummy-model"),ef=i(` in your profile, and populate it with your model files.
Do the same with the tokenizer, so that all the files are now available in this repository:`),es=u(),E(io.$$.fragment),ts=u(),yt=s("p"),tf=i("If you belong to an organization, simply specify the "),zl=s("code"),of=i("organization"),lf=i(" argument to upload to that organization\u2019s namespace:"),os=u(),E(lo.$$.fragment),is=u(),bt=s("p"),rf=i("If you wish to use a specific Hugging Face token, you\u2019re free to specify it to the "),Tl=s("code"),sf=i("push_to_hub()"),af=i(" method as well:"),ls=u(),E(ro.$$.fragment),rs=u(),vt=s("p"),nf=i("Now head to the Model Hub to find your newly uploaded model: "),Pl=s("em"),so=s("a"),ff=i("https://huggingface.co/user-or-organization/dummy-model"),hf=i("."),ss=u(),Ei=s("p"),cf=i("Click on the \u201CFiles and versions\u201D tab, and you should see the files visible in the following screenshot:"),as=u(),ft.c(),ji=u(),E(wt.$$.fragment),ns=u(),Ue=s("p"),uf=i("As you\u2019ve seen, the "),Al=s("code"),pf=i("push_to_hub()"),df=i(" method accepts several arguments, making it possible to upload to a specific repository or organization namespace, or to use a different API token. We recommend you take a look at the method specification available directly in the "),ao=s("a"),mf=i("\u{1F917} Transformers documentation"),_f=i(" to get an idea of what is possible."),fs=u(),me=s("p"),gf=i("The "),Dl=s("code"),yf=i("push_to_hub()"),bf=i(" method is backed by the "),no=s("a"),Ol=s("code"),vf=i("huggingface_hub"),wf=i(" Python package, which offers a direct API to the Hugging Face Hub. It\u2019s integrated within \u{1F917} Transformers and several other machine learning libraries, like "),fo=s("a"),Il=s("code"),kf=i("allenlp"),$f=i(". Although we focus on the \u{1F917} Transformers integration in this chapter, integrating it into your own code or library is simple."),hs=u(),zi=s("p"),Ef=i("Jump to the last section to see how to upload files to your newly created repository!"),cs=u(),it=s("h2"),kt=s("a"),Cl=s("span"),E(ho.$$.fragment),jf=u(),co=s("span"),zf=i("Using the "),Ml=s("code"),Tf=i("huggingface_hub"),Pf=i(" Python library"),us=u(),$t=s("p"),Af=i("The "),ql=s("code"),Df=i("huggingface_hub"),Of=i(` Python library is a package which offers a set of tools for the model and datasets hubs. It provides simple methods and classes for common tasks like
getting information about repositories on the hub and managing them. It provides simple APIs that work on top of git to manage those repositories\u2019 content and to integrate the Hub
in your projects and libraries.`),ps=u(),_e=s("p"),If=i("Similarly to using the "),Fl=s("code"),Cf=i("push_to_hub"),Mf=i(" API, this will require you to have your API token saved in your cache. In order to do this, you will need to use the "),Hl=s("code"),qf=i("login"),Ff=i(" command from the CLI, as mentioned in the previous section (again, make sure to prepend these commands with the "),xl=s("code"),Hf=i("!"),xf=i(" character if running in Google Colab):"),ds=u(),E(uo.$$.fragment),ms=u(),Et=s("p"),Gf=i("The "),Gl=s("code"),Lf=i("huggingface_hub"),Sf=i(" package offers several methods and classes which are useful for our purpose. Firstly, there are a few methods to manage repository creation, deletion, and others:"),_s=u(),E(po.$$.fragment),gs=u(),jt=s("p"),Nf=i("Additionally, it offers the very powerful "),Ll=s("code"),Uf=i("Repository"),Rf=i(" class to manage a local repository. We will explore these methods and that class in the next few section to understand how to leverage them."),ys=u(),zt=s("p"),Wf=i("The "),Sl=s("code"),Bf=i("create_repo"),Yf=i(" method can be used to create a new repository on the hub:"),bs=u(),E(mo.$$.fragment),vs=u(),Re=s("p"),Vf=i("This will create the repository "),Nl=s("code"),Kf=i("dummy-model"),Jf=i(" in your namespace. If you like, you can specify which organization the repository should belong to using the "),Ul=s("code"),Zf=i("organization"),Xf=i(" argument:"),ws=u(),E(_o.$$.fragment),ks=u(),We=s("p"),Qf=i("This will create the "),Rl=s("code"),eh=i("dummy-model"),th=i(" repository in the "),Wl=s("code"),oh=i("huggingface"),ih=i(` namespace, assuming you belong to that organization.
Other arguments which may be useful are:`),$s=u(),Be=s("ul"),Ti=s("li"),Bl=s("code"),lh=i("private"),rh=i(", in order to specify if the repository should be visible from others or not."),sh=u(),Pi=s("li"),Yl=s("code"),ah=i("token"),nh=i(", if you would like to override the token stored in your cache by a given token."),fh=u(),ne=s("li"),Vl=s("code"),hh=i("repo_type"),ch=i(", if you would like to create a "),Kl=s("code"),uh=i("dataset"),ph=i(" or a "),Jl=s("code"),dh=i("space"),mh=i(" instead of a model. Accepted values are "),Zl=s("code"),_h=i('"dataset"'),gh=i(" and "),Xl=s("code"),yh=i('"space"'),bh=i("."),Es=u(),Ai=s("p"),vh=i("Once the repository is created, we should add files to it! Jump to the next section to see the three ways this can be handled."),js=u(),lt=s("h2"),Tt=s("a"),Ql=s("span"),E(go.$$.fragment),wh=u(),er=s("span"),kh=i("Using the web interface"),zs=u(),Di=s("p"),$h=i("The web interface offers tools to manage repositories directly in the Hub. Using the interface, you can easily create repositories, add files (even large ones!), explore models, visualize diffs, and much more."),Ts=u(),Pt=s("p"),Eh=i("To create a new repository, visit "),yo=s("a"),jh=i("huggingface.co/new"),zh=i(":"),Ps=u(),bo=s("div"),vo=s("img"),As=u(),Oi=s("p"),Th=i("First, specify the owner of the repository: this can be either you or any of the organizations you\u2019re affiliated with. If you choose an organization, the model will be featured on the organization\u2019s page and every member of the organization will have the ability to contribute to the repository."),Ds=u(),Ii=s("p"),Ph=i("Next, enter your model\u2019s name. This will also be the name of the repository. Finally, you can specify whether you want your model to be public or private. Private models are hidden from public view."),Os=u(),Ci=s("p"),Ah=i("After creating your model repository, you should see a page like this:"),Is=u(),wo=s("div"),ko=s("img"),Cs=u(),Mi=s("p"),Dh=i("This is where your model will be hosted. To start populating it, you can add a README file directly from the web interface."),Ms=u(),$o=s("div"),Eo=s("img"),qs=u(),qi=s("p"),Oh=i("The README file is in Markdown \u2014 feel free to go wild with it! The third part of this chapter is dedicated to building a model card. These are of prime importance in bringing value to your model, as they\u2019re where you tell others what it can do."),Fs=u(),Ye=s("p"),Ih=i("If you look at the \u201CFiles and versions\u201D tab, you\u2019ll see that there aren\u2019t many files there yet \u2014 just the "),tr=s("em"),Ch=i("README.md"),Mh=i(" you just created and the "),or=s("em"),qh=i(".gitattributes"),Fh=i(" file that keeps track of large files."),Hs=u(),jo=s("div"),zo=s("img"),xs=u(),Fi=s("p"),Hh=i("We\u2019ll take a look at how to add some new files next."),Gs=u(),rt=s("h2"),At=s("a"),ir=s("span"),E(To.$$.fragment),xh=u(),lr=s("span"),Gh=i("Uploading the model files"),Ls=u(),Dt=s("p"),Lh=i("The system to manage files on the Hugging Face Hub is based on git for regular files, and git-lfs (which stands for "),Po=s("a"),Sh=i("Git Large File Storage"),Nh=i(") for larger files."),Ss=u(),Ot=s("p"),Uh=i("In the next section, we go over three different ways of uploading files to the Hub: through "),rr=s("code"),Rh=i("huggingface_hub"),Wh=i(" and through git commands."),Ns=u(),st=s("h3"),It=s("a"),sr=s("span"),E(Ao.$$.fragment),Bh=u(),Do=s("span"),Yh=i("The "),ar=s("code"),Vh=i("upload_file"),Kh=i(" approach"),Us=u(),Ct=s("p"),Jh=i("Using "),nr=s("code"),Zh=i("upload_file"),Xh=i(` does not require git and git-lfs to be installed on your system. It pushes files directly to the \u{1F917} Hub using HTTP POST requests. A limitation of this approach is that it doesn\u2019t handle files that are larger than 5GB in size.
If your files are larger than 5GB, please follow the two other methods detailed below.`),Rs=u(),Hi=s("p"),Qh=i("The API may be used as follows:"),Ws=u(),E(Oo.$$.fragment),Bs=u(),fe=s("p"),ec=i("This will upload the file "),fr=s("code"),tc=i("config.json"),oc=i(" available at "),hr=s("code"),ic=i("<path_to_file>"),lc=i(" to the root of the repository as "),cr=s("code"),rc=i("config.json"),sc=i(", to the "),ur=s("code"),ac=i("dummy-model"),nc=i(` repository.
Other arguments which may be useful are:`),Ys=u(),Mt=s("ul"),xi=s("li"),pr=s("code"),fc=i("token"),hc=i(", if you would like to override the token stored in your cache by a given token."),cc=u(),he=s("li"),dr=s("code"),uc=i("repo_type"),pc=i(", if you would like to upload to a "),mr=s("code"),dc=i("dataset"),mc=i(" or a "),_r=s("code"),_c=i("space"),gc=i(" instead of a model. Accepted values are "),gr=s("code"),yc=i('"dataset"'),bc=i(" and "),yr=s("code"),vc=i('"space"'),wc=i("."),Vs=u(),at=s("h3"),qt=s("a"),br=s("span"),E(Io.$$.fragment),kc=u(),Co=s("span"),$c=i("The "),vr=s("code"),Ec=i("Repository"),jc=i(" class"),Ks=u(),Ft=s("p"),zc=i("The "),wr=s("code"),Tc=i("Repository"),Pc=i(" class manages a local repository in a git-like manner. It abstracts most of the pain points one may have with git to provide all features that we require."),Js=u(),Ht=s("p"),Ac=i("Using this class requires having git and git-lfs installed, so make sure you have git-lfs installed (see "),Mo=s("a"),Dc=i("here"),Oc=i(" for installation instructions) and set up before you begin."),Zs=u(),Gi=s("p"),Ic=i("In order to start playing around with the repository we have just created, we can start by initialising it into a local folder by cloning the remote repository:"),Xs=u(),E(qo.$$.fragment),Qs=u(),ge=s("p"),Cc=i("This created the folder "),kr=s("code"),Mc=i("<path_to_dummy_folder>"),qc=i(" in our working directory. This folder only contains the "),$r=s("code"),Fc=i(".gitattributes"),Hc=i(" file as that\u2019s the only file created when instantiating the repository through "),Er=s("code"),xc=i("create_repo"),Gc=i("."),ea=u(),Li=s("p"),Lc=i("From this point on, we may leverage several of the traditional git methods:"),ta=u(),E(Fo.$$.fragment),oa=u(),Ve=s("p"),Sc=i("And others! We recommend taking a look at the "),jr=s("code"),Nc=i("Repository"),Uc=i(" documentation available "),Ho=s("a"),Rc=i("here"),Wc=i(" for an overview of all available methods."),ia=u(),Si=s("p"),Bc=i("At present, we have a model and a tokenizer that we would like to push to the hub. We have successfully cloned the repository, we can therefore save the files within that repository."),la=u(),Ni=s("p"),Yc=i("We first make sure that our local clone is up to date by pulling the latest changes:"),ra=u(),E(xo.$$.fragment),sa=u(),Ui=s("p"),Vc=i("Once that is done, we save the model and tokenizer files:"),aa=u(),E(Go.$$.fragment),na=u(),xt=s("p"),Kc=i("The "),zr=s("code"),Jc=i("<path_to_dummy_folder>"),Zc=i(" now contains all the model and tokenizer files. We follow the usual git workflow by adding files to the staging area, committing them and pushing them to the hub:"),fa=u(),E(Lo.$$.fragment),ha=u(),Ri=s("p"),Xc=i("Congratulations! You just pushed your first files on the hub."),ca=u(),nt=s("h3"),Gt=s("a"),Tr=s("span"),E(So.$$.fragment),Qc=u(),Pr=s("span"),eu=i("The git-based approach"),ua=u(),Wi=s("p"),tu=i("This is the very barebones approach to uploading files: we\u2019ll do so with git and git-lfs directly. Most of the difficulty is abstracted away by previous approaches, but there are a few caveats with the following method so we\u2019ll follow a more complex use-case."),pa=u(),Lt=s("p"),ou=i("Using this class requires having git and git-lfs installed, so make sure you have "),No=s("a"),iu=i("git-lfs"),lu=i(" installed (see here for installation instructions) and set up before you begin."),da=u(),Bi=s("p"),ru=i("First start by initializing git-lfs:"),ma=u(),E(Uo.$$.fragment),_a=u(),E(Ro.$$.fragment),ga=u(),Yi=s("p"),su=i("Once that\u2019s done, the first step is to clone your model repository:"),ya=u(),E(Wo.$$.fragment),ba=u(),Ke=s("p"),au=i("My username is "),Ar=s("code"),nu=i("lysandre"),fu=i(" and I\u2019ve used the model name "),Dr=s("code"),hu=i("dummy"),cu=i(", so for me the command ends up looking like the following:"),va=u(),E(Bo.$$.fragment),wa=u(),Je=s("p"),uu=i("I now have a folder named "),Or=s("em"),pu=i("dummy"),du=i(" in my working directory. I can "),Ir=s("code"),mu=i("cd"),_u=i(" into the folder and have a look at the contents:"),ka=u(),E(Yo.$$.fragment),$a=u(),E(Vo.$$.fragment),Ea=u(),ce=s("p"),gu=i("If you just created your repository using Hugging Face Hub\u2019s "),Cr=s("code"),yu=i("create_repo"),bu=i(" method, this folder should only contain a hidden "),Mr=s("code"),vu=i(".gitattributes"),wu=i(" file. If you followed the instructions in the previous section to create a repository using the web interface, the folder should contain a single "),qr=s("em"),ku=i("README.md"),$u=i(" file alongside the hidden "),Fr=s("code"),Eu=i(".gitattributes"),ju=i(" file, as shown here."),ja=u(),St=s("p"),zu=i("Adding a regular-sized file, such as a configuration file, a vocabulary file, or basically any file under a few megabytes, is done exactly as one would do it in any git-based system. However, bigger files must be registered through git-lfs in order to push them to "),Hr=s("em"),Tu=i("huggingface.co"),Pu=i("."),za=u(),Vi=s("p"),Au=i("Let\u2019s go back to Python for a bit to generate a model and tokenizer that we\u2019d like to commit to our dummy repository:"),Ta=u(),Pe.c(),Ki=u(),Nt=s("p"),Du=i("Now that we\u2019ve saved some model and tokenizer artifacts, let\u2019s take another look at the "),xr=s("em"),Ou=i("dummy"),Iu=i(" folder:"),Pa=u(),E(Ko.$$.fragment),Aa=u(),De.c(),Ji=u(),E(Ut.$$.fragment),Da=u(),Rt=s("p"),Cu=i("We can now go ahead and proceed like we would usually do with traditional Git repositories. We can add all the files to Git\u2019s staging environment using the "),Gr=s("code"),Mu=i("git add"),qu=i(" command:"),Oa=u(),E(Jo.$$.fragment),Ia=u(),Zi=s("p"),Fu=i("We can then have a look at the files that are currently staged:"),Ca=u(),E(Zo.$$.fragment),Ma=u(),Ie.c(),Xi=u(),Wt=s("p"),Hu=i("Similarly, we can make sure that git-lfs is tracking the correct files by using its "),Lr=s("code"),xu=i("status"),Gu=i(" command:"),qa=u(),E(Xo.$$.fragment),Fa=u(),Me.c(),Qi=u(),Bt=s("p"),Lu=i("Let\u2019s proceed to the final steps, committing and pushing to the "),Sr=s("em"),Su=i("huggingface.co"),Nu=i(" remote repository:"),Ha=u(),E(Qo.$$.fragment),xa=u(),Fe.c(),el=u(),tl=s("p"),Uu=i("Pushing can take a bit of time, depending on the speed of your internet connection and the size of your files:"),Ga=u(),E(ei.$$.fragment),La=u(),E(ti.$$.fragment),Sa=u(),ht.c(),ol=Gm(),this.h()},l(e){const r=Wm('[data-svelte="svelte-1phssyn"]',document.head);c=a(r,"META",{name:!0,content:!0}),r.forEach(t),d=p(e),j(h.$$.fragment,e),g=p(e),k=a(e,"H1",{class:!0});var ci=f(k);A=a(ci,"A",{id:!0,class:!0,href:!0});var il=f(A);F=a(il,"SPAN",{});var ll=f(F);j(P.$$.fragment,ll),ll.forEach(t),il.forEach(t),M=p(ci),O=a(ci,"SPAN",{});var rl=f(O);I=l(rl,"Sharing pretrained models"),rl.forEach(t),ci.forEach(t),m=p(e),w.l(e),$=p(e),H=a(e,"P",{});var sl=f(H);N=l(sl,"In the steps below, we\u2019ll take a look at the easiest ways to share pretrained models to the \u{1F917} Hub. There are tools and utilities available that make it simple to share and update models directly on the Hub, which we will explore below."),sl.forEach(t),G=p(e),j(L.$$.fragment,e),W=p(e),J=a(e,"P",{});var Nr=f(J);ie=l(Nr,"We encourage all users that train models to contribute by sharing them with the community \u2014 sharing models, even when trained on very specific datasets, will help others, saving them time and compute resources and providing access to useful trained artifacts. In turn, you can benefit from the work that others have done!"),Nr.forEach(t),B=p(e),le=a(e,"P",{});var al=f(le);ye=l(al,"There are three ways to go about creating new model repositories:"),al.forEach(t),te=p(e),R=a(e,"UL",{});var Ze=f(R);oe=a(Ze,"LI",{});var ui=f(oe);re=l(ui,"Using the "),Y=a(ui,"CODE",{});var nl=f(Y);be=l(nl,"push_to_hub"),nl.forEach(t),se=l(ui," API"),ui.forEach(t),x=p(Ze),U=a(Ze,"LI",{});var Yt=f(U);ve=l(Yt,"Using the "),Z=a(Yt,"CODE",{});var fl=f(Z);V=l(fl,"huggingface_hub"),fl.forEach(t),ue=l(Yt," Python library"),Yt.forEach(t),Le=p(Ze),pe=a(Ze,"LI",{});var yp=f(pe);we=l(yp,"Using the web interface"),yp.forEach(t),Ze.forEach(t),X=p(e),Q=a(e,"P",{});var bp=f(Q);pi=l(bp,"Once you\u2019ve created a repository, you can upload files to it via git and git-lfs. We\u2019ll walk you through creating model repositories and uploading files to them in the following sections."),bp.forEach(t),et=p(e),C=a(e,"H2",{class:!0});var Wa=f(C);S=a(Wa,"A",{id:!0,class:!0,href:!0});var vp=f(S);pt=a(vp,"SPAN",{});var wp=f(pt);j(Se.$$.fragment,wp),wp.forEach(t),vp.forEach(t),di=p(Wa),K=a(Wa,"SPAN",{});var Ba=f(K);mi=l(Ba,"Using the "),dt=a(Ba,"CODE",{});var kp=f(dt);_i=l(kp,"push_to_hub"),kp.forEach(t),gi=l(Ba," API"),Ba.forEach(t),Wa.forEach(t),tt=p(e),ee.l(e),ot=p(e),ke=a(e,"P",{});var Ya=f(ke);Pn=l(Ya,"The simplest way to upload files to the Hub is by leveraging the "),bl=a(Ya,"CODE",{});var $p=f(bl);An=l($p,"push_to_hub"),$p.forEach(t),Dn=l(Ya," API."),Ya.forEach(t),Ur=p(e),de=a(e,"P",{});var Vt=f(de);On=l(Vt,"Before going further, you\u2019ll need to generate an authentication token so that the "),vl=a(Vt,"CODE",{});var Ep=f(vl);In=l(Ep,"huggingface_hub"),Ep.forEach(t),Cn=l(Vt," API knows who you are and what namespaces you have write access to. Make sure you are in an environment where you have "),wl=a(Vt,"CODE",{});var jp=f(wl);Mn=l(jp,"transformers"),jp.forEach(t),qn=l(Vt," installed (see "),yi=a(Vt,"A",{href:!0});var zp=f(yi);Fn=l(zp,"Setup"),zp.forEach(t),Hn=l(Vt,"). If you are in a notebook, you can use the following function to login:"),Vt.forEach(t),Rr=p(e),j(Qt.$$.fragment,e),Wr=p(e),bi=a(e,"P",{});var Tp=f(bi);xn=l(Tp,"In a terminal, you can run:"),Tp.forEach(t),Br=p(e),j(eo.$$.fragment,e),Yr=p(e),mt=a(e,"P",{});var Va=f(mt);Gn=l(Va,"In both cases, you should be prompted for your username and password, which are the same ones you use to log in to the Hub. If you do not have a Hub profile yet, you should create one "),to=a(Va,"A",{href:!0,rel:!0});var Pp=f(to);Ln=l(Pp,"here"),Pp.forEach(t),Sn=l(Va,"."),Va.forEach(t),Vr=p(e),vi=a(e,"P",{});var Ap=f(vi);Nn=l(Ap,"Great! You now have your authentication token stored in your cache folder. Let\u2019s create some repositories!"),Ap.forEach(t),Kr=p(e),Ee.l(e),wi=p(e),_t=a(e,"P",{});var Ka=f(_t);Un=l(Ka,"At a lower level, accessing the Model Hub can be done directly on models, tokenizers, and configuration objects via their "),kl=a(Ka,"CODE",{});var Dp=f(kl);Rn=l(Dp,"push_to_hub()"),Dp.forEach(t),Wn=l(Ka," method. This method takes care of both the repository creation and pushing the model and tokenizer files directly to the repository. No manual handling is required, unlike with the API we\u2019ll see below."),Ka.forEach(t),Jr=p(e),ki=a(e,"P",{});var Op=f(ki);Bn=l(Op,"To get an idea of how it works, let\u2019s first initialize a model and a tokenizer:"),Op.forEach(t),Zr=p(e),ze.l(e),$i=p(e),Ne=a(e,"P",{});var hl=f(Ne);Yn=l(hl,"You\u2019re free to do whatever you want with these \u2014 add tokens to the tokenizer, train the model, fine-tune it. Once you\u2019re happy with the resulting model, weights, and tokenizer, you can leverage the "),$l=a(hl,"CODE",{});var Ip=f($l);Vn=l(Ip,"push_to_hub()"),Ip.forEach(t),Kn=l(hl," method directly available on the "),El=a(hl,"CODE",{});var Cp=f(El);Jn=l(Cp,"model"),Cp.forEach(t),Zn=l(hl," object:"),hl.forEach(t),Xr=p(e),j(oo.$$.fragment,e),Qr=p(e),gt=a(e,"P",{});var Ja=f(gt);Xn=l(Ja,"This will create the new repository "),jl=a(Ja,"CODE",{});var Mp=f(jl);Qn=l(Mp,"dummy-model"),Mp.forEach(t),ef=l(Ja,` in your profile, and populate it with your model files.
Do the same with the tokenizer, so that all the files are now available in this repository:`),Ja.forEach(t),es=p(e),j(io.$$.fragment,e),ts=p(e),yt=a(e,"P",{});var Za=f(yt);tf=l(Za,"If you belong to an organization, simply specify the "),zl=a(Za,"CODE",{});var qp=f(zl);of=l(qp,"organization"),qp.forEach(t),lf=l(Za," argument to upload to that organization\u2019s namespace:"),Za.forEach(t),os=p(e),j(lo.$$.fragment,e),is=p(e),bt=a(e,"P",{});var Xa=f(bt);rf=l(Xa,"If you wish to use a specific Hugging Face token, you\u2019re free to specify it to the "),Tl=a(Xa,"CODE",{});var Fp=f(Tl);sf=l(Fp,"push_to_hub()"),Fp.forEach(t),af=l(Xa," method as well:"),Xa.forEach(t),ls=p(e),j(ro.$$.fragment,e),rs=p(e),vt=a(e,"P",{});var Qa=f(vt);nf=l(Qa,"Now head to the Model Hub to find your newly uploaded model: "),Pl=a(Qa,"EM",{});var Hp=f(Pl);so=a(Hp,"A",{href:!0,rel:!0});var xp=f(so);ff=l(xp,"https://huggingface.co/user-or-organization/dummy-model"),xp.forEach(t),Hp.forEach(t),hf=l(Qa,"."),Qa.forEach(t),ss=p(e),Ei=a(e,"P",{});var Gp=f(Ei);cf=l(Gp,"Click on the \u201CFiles and versions\u201D tab, and you should see the files visible in the following screenshot:"),Gp.forEach(t),as=p(e),ft.l(e),ji=p(e),j(wt.$$.fragment,e),ns=p(e),Ue=a(e,"P",{});var cl=f(Ue);uf=l(cl,"As you\u2019ve seen, the "),Al=a(cl,"CODE",{});var Lp=f(Al);pf=l(Lp,"push_to_hub()"),Lp.forEach(t),df=l(cl," method accepts several arguments, making it possible to upload to a specific repository or organization namespace, or to use a different API token. We recommend you take a look at the method specification available directly in the "),ao=a(cl,"A",{href:!0,rel:!0});var Sp=f(ao);mf=l(Sp,"\u{1F917} Transformers documentation"),Sp.forEach(t),_f=l(cl," to get an idea of what is possible."),cl.forEach(t),fs=p(e),me=a(e,"P",{});var Kt=f(me);gf=l(Kt,"The "),Dl=a(Kt,"CODE",{});var Np=f(Dl);yf=l(Np,"push_to_hub()"),Np.forEach(t),bf=l(Kt," method is backed by the "),no=a(Kt,"A",{href:!0,rel:!0});var Up=f(no);Ol=a(Up,"CODE",{});var Rp=f(Ol);vf=l(Rp,"huggingface_hub"),Rp.forEach(t),Up.forEach(t),wf=l(Kt," Python package, which offers a direct API to the Hugging Face Hub. It\u2019s integrated within \u{1F917} Transformers and several other machine learning libraries, like "),fo=a(Kt,"A",{href:!0,rel:!0});var Wp=f(fo);Il=a(Wp,"CODE",{});var Bp=f(Il);kf=l(Bp,"allenlp"),Bp.forEach(t),Wp.forEach(t),$f=l(Kt,". Although we focus on the \u{1F917} Transformers integration in this chapter, integrating it into your own code or library is simple."),Kt.forEach(t),hs=p(e),zi=a(e,"P",{});var Yp=f(zi);Ef=l(Yp,"Jump to the last section to see how to upload files to your newly created repository!"),Yp.forEach(t),cs=p(e),it=a(e,"H2",{class:!0});var en=f(it);kt=a(en,"A",{id:!0,class:!0,href:!0});var Vp=f(kt);Cl=a(Vp,"SPAN",{});var Kp=f(Cl);j(ho.$$.fragment,Kp),Kp.forEach(t),Vp.forEach(t),jf=p(en),co=a(en,"SPAN",{});var tn=f(co);zf=l(tn,"Using the "),Ml=a(tn,"CODE",{});var Jp=f(Ml);Tf=l(Jp,"huggingface_hub"),Jp.forEach(t),Pf=l(tn," Python library"),tn.forEach(t),en.forEach(t),us=p(e),$t=a(e,"P",{});var on=f($t);Af=l(on,"The "),ql=a(on,"CODE",{});var Zp=f(ql);Df=l(Zp,"huggingface_hub"),Zp.forEach(t),Of=l(on,` Python library is a package which offers a set of tools for the model and datasets hubs. It provides simple methods and classes for common tasks like
getting information about repositories on the hub and managing them. It provides simple APIs that work on top of git to manage those repositories\u2019 content and to integrate the Hub
in your projects and libraries.`),on.forEach(t),ps=p(e),_e=a(e,"P",{});var Jt=f(_e);If=l(Jt,"Similarly to using the "),Fl=a(Jt,"CODE",{});var Xp=f(Fl);Cf=l(Xp,"push_to_hub"),Xp.forEach(t),Mf=l(Jt," API, this will require you to have your API token saved in your cache. In order to do this, you will need to use the "),Hl=a(Jt,"CODE",{});var Qp=f(Hl);qf=l(Qp,"login"),Qp.forEach(t),Ff=l(Jt," command from the CLI, as mentioned in the previous section (again, make sure to prepend these commands with the "),xl=a(Jt,"CODE",{});var ed=f(xl);Hf=l(ed,"!"),ed.forEach(t),xf=l(Jt," character if running in Google Colab):"),Jt.forEach(t),ds=p(e),j(uo.$$.fragment,e),ms=p(e),Et=a(e,"P",{});var ln=f(Et);Gf=l(ln,"The "),Gl=a(ln,"CODE",{});var td=f(Gl);Lf=l(td,"huggingface_hub"),td.forEach(t),Sf=l(ln," package offers several methods and classes which are useful for our purpose. Firstly, there are a few methods to manage repository creation, deletion, and others:"),ln.forEach(t),_s=p(e),j(po.$$.fragment,e),gs=p(e),jt=a(e,"P",{});var rn=f(jt);Nf=l(rn,"Additionally, it offers the very powerful "),Ll=a(rn,"CODE",{});var od=f(Ll);Uf=l(od,"Repository"),od.forEach(t),Rf=l(rn," class to manage a local repository. We will explore these methods and that class in the next few section to understand how to leverage them."),rn.forEach(t),ys=p(e),zt=a(e,"P",{});var sn=f(zt);Wf=l(sn,"The "),Sl=a(sn,"CODE",{});var id=f(Sl);Bf=l(id,"create_repo"),id.forEach(t),Yf=l(sn," method can be used to create a new repository on the hub:"),sn.forEach(t),bs=p(e),j(mo.$$.fragment,e),vs=p(e),Re=a(e,"P",{});var ul=f(Re);Vf=l(ul,"This will create the repository "),Nl=a(ul,"CODE",{});var ld=f(Nl);Kf=l(ld,"dummy-model"),ld.forEach(t),Jf=l(ul," in your namespace. If you like, you can specify which organization the repository should belong to using the "),Ul=a(ul,"CODE",{});var rd=f(Ul);Zf=l(rd,"organization"),rd.forEach(t),Xf=l(ul," argument:"),ul.forEach(t),ws=p(e),j(_o.$$.fragment,e),ks=p(e),We=a(e,"P",{});var pl=f(We);Qf=l(pl,"This will create the "),Rl=a(pl,"CODE",{});var sd=f(Rl);eh=l(sd,"dummy-model"),sd.forEach(t),th=l(pl," repository in the "),Wl=a(pl,"CODE",{});var ad=f(Wl);oh=l(ad,"huggingface"),ad.forEach(t),ih=l(pl,` namespace, assuming you belong to that organization.
Other arguments which may be useful are:`),pl.forEach(t),$s=p(e),Be=a(e,"UL",{});var dl=f(Be);Ti=a(dl,"LI",{});var Ru=f(Ti);Bl=a(Ru,"CODE",{});var nd=f(Bl);lh=l(nd,"private"),nd.forEach(t),rh=l(Ru,", in order to specify if the repository should be visible from others or not."),Ru.forEach(t),sh=p(dl),Pi=a(dl,"LI",{});var Wu=f(Pi);Yl=a(Wu,"CODE",{});var fd=f(Yl);ah=l(fd,"token"),fd.forEach(t),nh=l(Wu,", if you would like to override the token stored in your cache by a given token."),Wu.forEach(t),fh=p(dl),ne=a(dl,"LI",{});var He=f(ne);Vl=a(He,"CODE",{});var hd=f(Vl);hh=l(hd,"repo_type"),hd.forEach(t),ch=l(He,", if you would like to create a "),Kl=a(He,"CODE",{});var cd=f(Kl);uh=l(cd,"dataset"),cd.forEach(t),ph=l(He," or a "),Jl=a(He,"CODE",{});var ud=f(Jl);dh=l(ud,"space"),ud.forEach(t),mh=l(He," instead of a model. Accepted values are "),Zl=a(He,"CODE",{});var pd=f(Zl);_h=l(pd,'"dataset"'),pd.forEach(t),gh=l(He," and "),Xl=a(He,"CODE",{});var dd=f(Xl);yh=l(dd,'"space"'),dd.forEach(t),bh=l(He,"."),He.forEach(t),dl.forEach(t),Es=p(e),Ai=a(e,"P",{});var md=f(Ai);vh=l(md,"Once the repository is created, we should add files to it! Jump to the next section to see the three ways this can be handled."),md.forEach(t),js=p(e),lt=a(e,"H2",{class:!0});var an=f(lt);Tt=a(an,"A",{id:!0,class:!0,href:!0});var _d=f(Tt);Ql=a(_d,"SPAN",{});var gd=f(Ql);j(go.$$.fragment,gd),gd.forEach(t),_d.forEach(t),wh=p(an),er=a(an,"SPAN",{});var yd=f(er);kh=l(yd,"Using the web interface"),yd.forEach(t),an.forEach(t),zs=p(e),Di=a(e,"P",{});var bd=f(Di);$h=l(bd,"The web interface offers tools to manage repositories directly in the Hub. Using the interface, you can easily create repositories, add files (even large ones!), explore models, visualize diffs, and much more."),bd.forEach(t),Ts=p(e),Pt=a(e,"P",{});var nn=f(Pt);Eh=l(nn,"To create a new repository, visit "),yo=a(nn,"A",{href:!0,rel:!0});var vd=f(yo);jh=l(vd,"huggingface.co/new"),vd.forEach(t),zh=l(nn,":"),nn.forEach(t),Ps=p(e),bo=a(e,"DIV",{class:!0});var wd=f(bo);vo=a(wd,"IMG",{src:!0,alt:!0,width:!0}),wd.forEach(t),As=p(e),Oi=a(e,"P",{});var kd=f(Oi);Th=l(kd,"First, specify the owner of the repository: this can be either you or any of the organizations you\u2019re affiliated with. If you choose an organization, the model will be featured on the organization\u2019s page and every member of the organization will have the ability to contribute to the repository."),kd.forEach(t),Ds=p(e),Ii=a(e,"P",{});var $d=f(Ii);Ph=l($d,"Next, enter your model\u2019s name. This will also be the name of the repository. Finally, you can specify whether you want your model to be public or private. Private models are hidden from public view."),$d.forEach(t),Os=p(e),Ci=a(e,"P",{});var Ed=f(Ci);Ah=l(Ed,"After creating your model repository, you should see a page like this:"),Ed.forEach(t),Is=p(e),wo=a(e,"DIV",{class:!0});var jd=f(wo);ko=a(jd,"IMG",{src:!0,alt:!0,width:!0}),jd.forEach(t),Cs=p(e),Mi=a(e,"P",{});var zd=f(Mi);Dh=l(zd,"This is where your model will be hosted. To start populating it, you can add a README file directly from the web interface."),zd.forEach(t),Ms=p(e),$o=a(e,"DIV",{class:!0});var Td=f($o);Eo=a(Td,"IMG",{src:!0,alt:!0,width:!0}),Td.forEach(t),qs=p(e),qi=a(e,"P",{});var Pd=f(qi);Oh=l(Pd,"The README file is in Markdown \u2014 feel free to go wild with it! The third part of this chapter is dedicated to building a model card. These are of prime importance in bringing value to your model, as they\u2019re where you tell others what it can do."),Pd.forEach(t),Fs=p(e),Ye=a(e,"P",{});var ml=f(Ye);Ih=l(ml,"If you look at the \u201CFiles and versions\u201D tab, you\u2019ll see that there aren\u2019t many files there yet \u2014 just the "),tr=a(ml,"EM",{});var Ad=f(tr);Ch=l(Ad,"README.md"),Ad.forEach(t),Mh=l(ml," you just created and the "),or=a(ml,"EM",{});var Dd=f(or);qh=l(Dd,".gitattributes"),Dd.forEach(t),Fh=l(ml," file that keeps track of large files."),ml.forEach(t),Hs=p(e),jo=a(e,"DIV",{class:!0});var Od=f(jo);zo=a(Od,"IMG",{src:!0,alt:!0,width:!0}),Od.forEach(t),xs=p(e),Fi=a(e,"P",{});var Id=f(Fi);Hh=l(Id,"We\u2019ll take a look at how to add some new files next."),Id.forEach(t),Gs=p(e),rt=a(e,"H2",{class:!0});var fn=f(rt);At=a(fn,"A",{id:!0,class:!0,href:!0});var Cd=f(At);ir=a(Cd,"SPAN",{});var Md=f(ir);j(To.$$.fragment,Md),Md.forEach(t),Cd.forEach(t),xh=p(fn),lr=a(fn,"SPAN",{});var qd=f(lr);Gh=l(qd,"Uploading the model files"),qd.forEach(t),fn.forEach(t),Ls=p(e),Dt=a(e,"P",{});var hn=f(Dt);Lh=l(hn,"The system to manage files on the Hugging Face Hub is based on git for regular files, and git-lfs (which stands for "),Po=a(hn,"A",{href:!0,rel:!0});var Fd=f(Po);Sh=l(Fd,"Git Large File Storage"),Fd.forEach(t),Nh=l(hn,") for larger files."),hn.forEach(t),Ss=p(e),Ot=a(e,"P",{});var cn=f(Ot);Uh=l(cn,"In the next section, we go over three different ways of uploading files to the Hub: through "),rr=a(cn,"CODE",{});var Hd=f(rr);Rh=l(Hd,"huggingface_hub"),Hd.forEach(t),Wh=l(cn," and through git commands."),cn.forEach(t),Ns=p(e),st=a(e,"H3",{class:!0});var un=f(st);It=a(un,"A",{id:!0,class:!0,href:!0});var xd=f(It);sr=a(xd,"SPAN",{});var Gd=f(sr);j(Ao.$$.fragment,Gd),Gd.forEach(t),xd.forEach(t),Bh=p(un),Do=a(un,"SPAN",{});var pn=f(Do);Yh=l(pn,"The "),ar=a(pn,"CODE",{});var Ld=f(ar);Vh=l(Ld,"upload_file"),Ld.forEach(t),Kh=l(pn," approach"),pn.forEach(t),un.forEach(t),Us=p(e),Ct=a(e,"P",{});var dn=f(Ct);Jh=l(dn,"Using "),nr=a(dn,"CODE",{});var Sd=f(nr);Zh=l(Sd,"upload_file"),Sd.forEach(t),Xh=l(dn,` does not require git and git-lfs to be installed on your system. It pushes files directly to the \u{1F917} Hub using HTTP POST requests. A limitation of this approach is that it doesn\u2019t handle files that are larger than 5GB in size.
If your files are larger than 5GB, please follow the two other methods detailed below.`),dn.forEach(t),Rs=p(e),Hi=a(e,"P",{});var Nd=f(Hi);Qh=l(Nd,"The API may be used as follows:"),Nd.forEach(t),Ws=p(e),j(Oo.$$.fragment,e),Bs=p(e),fe=a(e,"P",{});var Xe=f(fe);ec=l(Xe,"This will upload the file "),fr=a(Xe,"CODE",{});var Ud=f(fr);tc=l(Ud,"config.json"),Ud.forEach(t),oc=l(Xe," available at "),hr=a(Xe,"CODE",{});var Rd=f(hr);ic=l(Rd,"<path_to_file>"),Rd.forEach(t),lc=l(Xe," to the root of the repository as "),cr=a(Xe,"CODE",{});var Wd=f(cr);rc=l(Wd,"config.json"),Wd.forEach(t),sc=l(Xe,", to the "),ur=a(Xe,"CODE",{});var Bd=f(ur);ac=l(Bd,"dummy-model"),Bd.forEach(t),nc=l(Xe,` repository.
Other arguments which may be useful are:`),Xe.forEach(t),Ys=p(e),Mt=a(e,"UL",{});var mn=f(Mt);xi=a(mn,"LI",{});var Bu=f(xi);pr=a(Bu,"CODE",{});var Yd=f(pr);fc=l(Yd,"token"),Yd.forEach(t),hc=l(Bu,", if you would like to override the token stored in your cache by a given token."),Bu.forEach(t),cc=p(mn),he=a(mn,"LI",{});var xe=f(he);dr=a(xe,"CODE",{});var Vd=f(dr);uc=l(Vd,"repo_type"),Vd.forEach(t),pc=l(xe,", if you would like to upload to a "),mr=a(xe,"CODE",{});var Kd=f(mr);dc=l(Kd,"dataset"),Kd.forEach(t),mc=l(xe," or a "),_r=a(xe,"CODE",{});var Jd=f(_r);_c=l(Jd,"space"),Jd.forEach(t),gc=l(xe," instead of a model. Accepted values are "),gr=a(xe,"CODE",{});var Zd=f(gr);yc=l(Zd,'"dataset"'),Zd.forEach(t),bc=l(xe," and "),yr=a(xe,"CODE",{});var Xd=f(yr);vc=l(Xd,'"space"'),Xd.forEach(t),wc=l(xe,"."),xe.forEach(t),mn.forEach(t),Vs=p(e),at=a(e,"H3",{class:!0});var _n=f(at);qt=a(_n,"A",{id:!0,class:!0,href:!0});var Qd=f(qt);br=a(Qd,"SPAN",{});var em=f(br);j(Io.$$.fragment,em),em.forEach(t),Qd.forEach(t),kc=p(_n),Co=a(_n,"SPAN",{});var gn=f(Co);$c=l(gn,"The "),vr=a(gn,"CODE",{});var tm=f(vr);Ec=l(tm,"Repository"),tm.forEach(t),jc=l(gn," class"),gn.forEach(t),_n.forEach(t),Ks=p(e),Ft=a(e,"P",{});var yn=f(Ft);zc=l(yn,"The "),wr=a(yn,"CODE",{});var om=f(wr);Tc=l(om,"Repository"),om.forEach(t),Pc=l(yn," class manages a local repository in a git-like manner. It abstracts most of the pain points one may have with git to provide all features that we require."),yn.forEach(t),Js=p(e),Ht=a(e,"P",{});var bn=f(Ht);Ac=l(bn,"Using this class requires having git and git-lfs installed, so make sure you have git-lfs installed (see "),Mo=a(bn,"A",{href:!0,rel:!0});var im=f(Mo);Dc=l(im,"here"),im.forEach(t),Oc=l(bn," for installation instructions) and set up before you begin."),bn.forEach(t),Zs=p(e),Gi=a(e,"P",{});var lm=f(Gi);Ic=l(lm,"In order to start playing around with the repository we have just created, we can start by initialising it into a local folder by cloning the remote repository:"),lm.forEach(t),Xs=p(e),j(qo.$$.fragment,e),Qs=p(e),ge=a(e,"P",{});var Zt=f(ge);Cc=l(Zt,"This created the folder "),kr=a(Zt,"CODE",{});var rm=f(kr);Mc=l(rm,"<path_to_dummy_folder>"),rm.forEach(t),qc=l(Zt," in our working directory. This folder only contains the "),$r=a(Zt,"CODE",{});var sm=f($r);Fc=l(sm,".gitattributes"),sm.forEach(t),Hc=l(Zt," file as that\u2019s the only file created when instantiating the repository through "),Er=a(Zt,"CODE",{});var am=f(Er);xc=l(am,"create_repo"),am.forEach(t),Gc=l(Zt,"."),Zt.forEach(t),ea=p(e),Li=a(e,"P",{});var nm=f(Li);Lc=l(nm,"From this point on, we may leverage several of the traditional git methods:"),nm.forEach(t),ta=p(e),j(Fo.$$.fragment,e),oa=p(e),Ve=a(e,"P",{});var _l=f(Ve);Sc=l(_l,"And others! We recommend taking a look at the "),jr=a(_l,"CODE",{});var fm=f(jr);Nc=l(fm,"Repository"),fm.forEach(t),Uc=l(_l," documentation available "),Ho=a(_l,"A",{href:!0,rel:!0});var hm=f(Ho);Rc=l(hm,"here"),hm.forEach(t),Wc=l(_l," for an overview of all available methods."),_l.forEach(t),ia=p(e),Si=a(e,"P",{});var cm=f(Si);Bc=l(cm,"At present, we have a model and a tokenizer that we would like to push to the hub. We have successfully cloned the repository, we can therefore save the files within that repository."),cm.forEach(t),la=p(e),Ni=a(e,"P",{});var um=f(Ni);Yc=l(um,"We first make sure that our local clone is up to date by pulling the latest changes:"),um.forEach(t),ra=p(e),j(xo.$$.fragment,e),sa=p(e),Ui=a(e,"P",{});var pm=f(Ui);Vc=l(pm,"Once that is done, we save the model and tokenizer files:"),pm.forEach(t),aa=p(e),j(Go.$$.fragment,e),na=p(e),xt=a(e,"P",{});var vn=f(xt);Kc=l(vn,"The "),zr=a(vn,"CODE",{});var dm=f(zr);Jc=l(dm,"<path_to_dummy_folder>"),dm.forEach(t),Zc=l(vn," now contains all the model and tokenizer files. We follow the usual git workflow by adding files to the staging area, committing them and pushing them to the hub:"),vn.forEach(t),fa=p(e),j(Lo.$$.fragment,e),ha=p(e),Ri=a(e,"P",{});var mm=f(Ri);Xc=l(mm,"Congratulations! You just pushed your first files on the hub."),mm.forEach(t),ca=p(e),nt=a(e,"H3",{class:!0});var wn=f(nt);Gt=a(wn,"A",{id:!0,class:!0,href:!0});var _m=f(Gt);Tr=a(_m,"SPAN",{});var gm=f(Tr);j(So.$$.fragment,gm),gm.forEach(t),_m.forEach(t),Qc=p(wn),Pr=a(wn,"SPAN",{});var ym=f(Pr);eu=l(ym,"The git-based approach"),ym.forEach(t),wn.forEach(t),ua=p(e),Wi=a(e,"P",{});var bm=f(Wi);tu=l(bm,"This is the very barebones approach to uploading files: we\u2019ll do so with git and git-lfs directly. Most of the difficulty is abstracted away by previous approaches, but there are a few caveats with the following method so we\u2019ll follow a more complex use-case."),bm.forEach(t),pa=p(e),Lt=a(e,"P",{});var kn=f(Lt);ou=l(kn,"Using this class requires having git and git-lfs installed, so make sure you have "),No=a(kn,"A",{href:!0,rel:!0});var vm=f(No);iu=l(vm,"git-lfs"),vm.forEach(t),lu=l(kn," installed (see here for installation instructions) and set up before you begin."),kn.forEach(t),da=p(e),Bi=a(e,"P",{});var wm=f(Bi);ru=l(wm,"First start by initializing git-lfs:"),wm.forEach(t),ma=p(e),j(Uo.$$.fragment,e),_a=p(e),j(Ro.$$.fragment,e),ga=p(e),Yi=a(e,"P",{});var km=f(Yi);su=l(km,"Once that\u2019s done, the first step is to clone your model repository:"),km.forEach(t),ya=p(e),j(Wo.$$.fragment,e),ba=p(e),Ke=a(e,"P",{});var gl=f(Ke);au=l(gl,"My username is "),Ar=a(gl,"CODE",{});var $m=f(Ar);nu=l($m,"lysandre"),$m.forEach(t),fu=l(gl," and I\u2019ve used the model name "),Dr=a(gl,"CODE",{});var Em=f(Dr);hu=l(Em,"dummy"),Em.forEach(t),cu=l(gl,", so for me the command ends up looking like the following:"),gl.forEach(t),va=p(e),j(Bo.$$.fragment,e),wa=p(e),Je=a(e,"P",{});var yl=f(Je);uu=l(yl,"I now have a folder named "),Or=a(yl,"EM",{});var jm=f(Or);pu=l(jm,"dummy"),jm.forEach(t),du=l(yl," in my working directory. I can "),Ir=a(yl,"CODE",{});var zm=f(Ir);mu=l(zm,"cd"),zm.forEach(t),_u=l(yl," into the folder and have a look at the contents:"),yl.forEach(t),ka=p(e),j(Yo.$$.fragment,e),$a=p(e),j(Vo.$$.fragment,e),Ea=p(e),ce=a(e,"P",{});var Qe=f(ce);gu=l(Qe,"If you just created your repository using Hugging Face Hub\u2019s "),Cr=a(Qe,"CODE",{});var Tm=f(Cr);yu=l(Tm,"create_repo"),Tm.forEach(t),bu=l(Qe," method, this folder should only contain a hidden "),Mr=a(Qe,"CODE",{});var Pm=f(Mr);vu=l(Pm,".gitattributes"),Pm.forEach(t),wu=l(Qe," file. If you followed the instructions in the previous section to create a repository using the web interface, the folder should contain a single "),qr=a(Qe,"EM",{});var Am=f(qr);ku=l(Am,"README.md"),Am.forEach(t),$u=l(Qe," file alongside the hidden "),Fr=a(Qe,"CODE",{});var Dm=f(Fr);Eu=l(Dm,".gitattributes"),Dm.forEach(t),ju=l(Qe," file, as shown here."),Qe.forEach(t),ja=p(e),St=a(e,"P",{});var $n=f(St);zu=l($n,"Adding a regular-sized file, such as a configuration file, a vocabulary file, or basically any file under a few megabytes, is done exactly as one would do it in any git-based system. However, bigger files must be registered through git-lfs in order to push them to "),Hr=a($n,"EM",{});var Om=f(Hr);Tu=l(Om,"huggingface.co"),Om.forEach(t),Pu=l($n,"."),$n.forEach(t),za=p(e),Vi=a(e,"P",{});var Im=f(Vi);Au=l(Im,"Let\u2019s go back to Python for a bit to generate a model and tokenizer that we\u2019d like to commit to our dummy repository:"),Im.forEach(t),Ta=p(e),Pe.l(e),Ki=p(e),Nt=a(e,"P",{});var En=f(Nt);Du=l(En,"Now that we\u2019ve saved some model and tokenizer artifacts, let\u2019s take another look at the "),xr=a(En,"EM",{});var Cm=f(xr);Ou=l(Cm,"dummy"),Cm.forEach(t),Iu=l(En," folder:"),En.forEach(t),Pa=p(e),j(Ko.$$.fragment,e),Aa=p(e),De.l(e),Ji=p(e),j(Ut.$$.fragment,e),Da=p(e),Rt=a(e,"P",{});var jn=f(Rt);Cu=l(jn,"We can now go ahead and proceed like we would usually do with traditional Git repositories. We can add all the files to Git\u2019s staging environment using the "),Gr=a(jn,"CODE",{});var Mm=f(Gr);Mu=l(Mm,"git add"),Mm.forEach(t),qu=l(jn," command:"),jn.forEach(t),Oa=p(e),j(Jo.$$.fragment,e),Ia=p(e),Zi=a(e,"P",{});var qm=f(Zi);Fu=l(qm,"We can then have a look at the files that are currently staged:"),qm.forEach(t),Ca=p(e),j(Zo.$$.fragment,e),Ma=p(e),Ie.l(e),Xi=p(e),Wt=a(e,"P",{});var zn=f(Wt);Hu=l(zn,"Similarly, we can make sure that git-lfs is tracking the correct files by using its "),Lr=a(zn,"CODE",{});var Fm=f(Lr);xu=l(Fm,"status"),Fm.forEach(t),Gu=l(zn," command:"),zn.forEach(t),qa=p(e),j(Xo.$$.fragment,e),Fa=p(e),Me.l(e),Qi=p(e),Bt=a(e,"P",{});var Tn=f(Bt);Lu=l(Tn,"Let\u2019s proceed to the final steps, committing and pushing to the "),Sr=a(Tn,"EM",{});var Hm=f(Sr);Su=l(Hm,"huggingface.co"),Hm.forEach(t),Nu=l(Tn," remote repository:"),Tn.forEach(t),Ha=p(e),j(Qo.$$.fragment,e),xa=p(e),Fe.l(e),el=p(e),tl=a(e,"P",{});var xm=f(tl);Uu=l(xm,"Pushing can take a bit of time, depending on the speed of your internet connection and the size of your files:"),xm.forEach(t),Ga=p(e),j(ei.$$.fragment,e),La=p(e),j(ti.$$.fragment,e),Sa=p(e),ht.l(e),ol=Gm(),this.h()},h(){_(c,"name","hf:doc:metadata"),_(c,"content",JSON.stringify(b_)),_(A,"id","sharing-pretrained-models"),_(A,"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"),_(A,"href","#sharing-pretrained-models"),_(k,"class","relative group"),_(S,"id","using-the-pushtohub-api"),_(S,"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"),_(S,"href","#using-the-pushtohub-api"),_(C,"class","relative group"),_(yi,"href","/course/chapter0"),_(to,"href","https://huggingface.co/join"),_(to,"rel","nofollow"),_(so,"href","https://huggingface.co/user-or-organization/dummy-model"),_(so,"rel","nofollow"),_(ao,"href","https://huggingface.co/transformers/model_sharing.html"),_(ao,"rel","nofollow"),_(no,"href","https://github.com/huggingface/huggingface_hub"),_(no,"rel","nofollow"),_(fo,"href","https://github.com/allenai/allennlp"),_(fo,"rel","nofollow"),_(kt,"id","using-the-huggingfacehub-python-library"),_(kt,"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"),_(kt,"href","#using-the-huggingfacehub-python-library"),_(it,"class","relative group"),_(Tt,"id","using-the-web-interface"),_(Tt,"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"),_(Tt,"href","#using-the-web-interface"),_(lt,"class","relative group"),_(yo,"href","https://huggingface.co/new"),_(yo,"rel","nofollow"),Ge(vo.src,Vu="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/new_model.png")||_(vo,"src",Vu),_(vo,"alt","Page showcasing the model used for the creation of a new model repository."),_(vo,"width","80%"),_(bo,"class","flex justify-center"),Ge(ko.src,Ku="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/empty_model.png")||_(ko,"src",Ku),_(ko,"alt","An empty model page after creating a new repository."),_(ko,"width","80%"),_(wo,"class","flex justify-center"),Ge(Eo.src,Ju="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/dummy_model.png")||_(Eo,"src",Ju),_(Eo,"alt","The README file showing the Markdown capabilities."),_(Eo,"width","80%"),_($o,"class","flex justify-center"),Ge(zo.src,Zu="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter4/files.png")||_(zo,"src",Zu),_(zo,"alt","The 'Files and versions' tab only shows the .gitattributes and README.md files."),_(zo,"width","80%"),_(jo,"class","flex justify-center"),_(At,"id","uploading-the-model-files"),_(At,"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"),_(At,"href","#uploading-the-model-files"),_(rt,"class","relative group"),_(Po,"href","https://git-lfs.github.com/"),_(Po,"rel","nofollow"),_(It,"id","the-uploadfile-approach"),_(It,"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"),_(It,"href","#the-uploadfile-approach"),_(st,"class","relative group"),_(qt,"id","the-repository-class"),_(qt,"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"),_(qt,"href","#the-repository-class"),_(at,"class","relative group"),_(Mo,"href","https://git-lfs.github.com/"),_(Mo,"rel","nofollow"),_(Ho,"href","https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub#advanced-programmatic-repository-management"),_(Ho,"rel","nofollow"),_(Gt,"id","the-gitbased-approach"),_(Gt,"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"),_(Gt,"href","#the-gitbased-approach"),_(nt,"class","relative group"),_(No,"href","https://git-lfs.github.com/"),_(No,"rel","nofollow")},m(e,r){o(document.head,c),n(e,d,r),z(h,e,r),n(e,g,r),n(e,k,r),o(k,A),o(A,F),z(P,F,null),o(k,M),o(k,O),o(O,I),n(e,m,r),oi[y].m(e,r),n(e,$,r),n(e,H,r),o(H,N),n(e,G,r),z(L,e,r),n(e,W,r),n(e,J,r),o(J,ie),n(e,B,r),n(e,le,r),o(le,ye),n(e,te,r),n(e,R,r),o(R,oe),o(oe,re),o(oe,Y),o(Y,be),o(oe,se),o(R,x),o(R,U),o(U,ve),o(U,Z),o(Z,V),o(U,ue),o(R,Le),o(R,pe),o(pe,we),n(e,X,r),n(e,Q,r),o(Q,pi),n(e,et,r),n(e,C,r),o(C,S),o(S,pt),z(Se,pt,null),o(C,di),o(C,K),o(K,mi),o(K,dt),o(dt,_i),o(K,gi),n(e,tt,r),ii[ae].m(e,r),n(e,ot,r),n(e,ke,r),o(ke,Pn),o(ke,bl),o(bl,An),o(ke,Dn),n(e,Ur,r),n(e,de,r),o(de,On),o(de,vl),o(vl,In),o(de,Cn),o(de,wl),o(wl,Mn),o(de,qn),o(de,yi),o(yi,Fn),o(de,Hn),n(e,Rr,r),z(Qt,e,r),n(e,Wr,r),n(e,bi,r),o(bi,xn),n(e,Br,r),z(eo,e,r),n(e,Yr,r),n(e,mt,r),o(mt,Gn),o(mt,to),o(to,Ln),o(mt,Sn),n(e,Vr,r),n(e,vi,r),o(vi,Nn),n(e,Kr,r),li[$e].m(e,r),n(e,wi,r),n(e,_t,r),o(_t,Un),o(_t,kl),o(kl,Rn),o(_t,Wn),n(e,Jr,r),n(e,ki,r),o(ki,Bn),n(e,Zr,r),ri[je].m(e,r),n(e,$i,r),n(e,Ne,r),o(Ne,Yn),o(Ne,$l),o($l,Vn),o(Ne,Kn),o(Ne,El),o(El,Jn),o(Ne,Zn),n(e,Xr,r),z(oo,e,r),n(e,Qr,r),n(e,gt,r),o(gt,Xn),o(gt,jl),o(jl,Qn),o(gt,ef),n(e,es,r),z(io,e,r),n(e,ts,r),n(e,yt,r),o(yt,tf),o(yt,zl),o(zl,of),o(yt,lf),n(e,os,r),z(lo,e,r),n(e,is,r),n(e,bt,r),o(bt,rf),o(bt,Tl),o(Tl,sf),o(bt,af),n(e,ls,r),z(ro,e,r),n(e,rs,r),n(e,vt,r),o(vt,nf),o(vt,Pl),o(Pl,so),o(so,ff),o(vt,hf),n(e,ss,r),n(e,Ei,r),o(Ei,cf),n(e,as,r),ft.m(e,r),n(e,ji,r),z(wt,e,r),n(e,ns,r),n(e,Ue,r),o(Ue,uf),o(Ue,Al),o(Al,pf),o(Ue,df),o(Ue,ao),o(ao,mf),o(Ue,_f),n(e,fs,r),n(e,me,r),o(me,gf),o(me,Dl),o(Dl,yf),o(me,bf),o(me,no),o(no,Ol),o(Ol,vf),o(me,wf),o(me,fo),o(fo,Il),o(Il,kf),o(me,$f),n(e,hs,r),n(e,zi,r),o(zi,Ef),n(e,cs,r),n(e,it,r),o(it,kt),o(kt,Cl),z(ho,Cl,null),o(it,jf),o(it,co),o(co,zf),o(co,Ml),o(Ml,Tf),o(co,Pf),n(e,us,r),n(e,$t,r),o($t,Af),o($t,ql),o(ql,Df),o($t,Of),n(e,ps,r),n(e,_e,r),o(_e,If),o(_e,Fl),o(Fl,Cf),o(_e,Mf),o(_e,Hl),o(Hl,qf),o(_e,Ff),o(_e,xl),o(xl,Hf),o(_e,xf),n(e,ds,r),z(uo,e,r),n(e,ms,r),n(e,Et,r),o(Et,Gf),o(Et,Gl),o(Gl,Lf),o(Et,Sf),n(e,_s,r),z(po,e,r),n(e,gs,r),n(e,jt,r),o(jt,Nf),o(jt,Ll),o(Ll,Uf),o(jt,Rf),n(e,ys,r),n(e,zt,r),o(zt,Wf),o(zt,Sl),o(Sl,Bf),o(zt,Yf),n(e,bs,r),z(mo,e,r),n(e,vs,r),n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Nt,Du),o(Nt,xr),o(xr,Ou),o(Nt,Iu),n(e,Pa,r),z(Ko,e,r),n(e,Aa,r),ai[Ae].m(e,r),n(e,Ji,r),z(Ut,e,r),n(e,Da,r),n(e,Rt,r),o(Rt,Cu),o(Rt,Gr),o(Gr,Mu),o(Rt,qu),n(e,Oa,r),z(Jo,e,r),n(e,Ia,r),n(e,Zi,r),o(Zi,Fu),n(e,Ca,r),z(Zo,e,r),n(e,Ma,r),ni[Oe].m(e,r),n(e,Xi,r),n(e,Wt,r),o(Wt,Hu),o(Wt,Lr),o(Lr,xu),o(Wt,Gu),n(e,qa,r),z(Xo,e,r),n(e,Fa,r),fi[Ce].m(e,r),n(e,Qi,r),n(e,Bt,r),o(Bt,Lu),o(Bt,Sr),o(Sr,Su),o(Bt,Nu),n(e,Ha,r),z(Qo,e,r),n(e,xa,r),hi[qe].m(e,r),n(e,el,r),n(e,tl,r),o(tl,Uu),n(e,Ga,r),z(ei,e,r),n(e,La,r),z(ti,e,r),n(e,Sa,r),ht.m(e,r),n(e,ol,r),Na=!0},p(e,[r]){const ci={};r&1&&(ci.fw=e[0]),h.$set(ci);let il=y;y=Qu(e),y!==il&&(ut(),b(oi[il],1,1,()=>{oi[il]=null}),ct(),w=oi[y],w||(w=oi[y]=Xu[y](e),w.c()),v(w,1),w.m($.parentNode,$));let ll=ae;ae=tp(e),ae!==ll&&(ut(),b(ii[ll],1,1,()=>{ii[ll]=null}),ct(),ee=ii[ae],ee||(ee=ii[ae]=ep[ae](e),ee.c()),v(ee,1),ee.m(ot.parentNode,ot));let rl=$e;$e=ip(e),$e!==rl&&(ut(),b(li[rl],1,1,()=>{li[rl]=null}),ct(),Ee=li[$e],Ee||(Ee=li[$e]=op[$e](e),Ee.c()),v(Ee,1),Ee.m(wi.parentNode,wi));let sl=je;je=rp(e),je!==sl&&(ut(),b(ri[sl],1,1,()=>{ri[sl]=null}),ct(),ze=ri[je],ze||(ze=ri[je]=lp[je](e),ze.c()),v(ze,1),ze.m($i.parentNode,$i)),Ua!==(Ua=sp(e))&&(ft.d(1),ft=Ua(e),ft&&(ft.c(),ft.m(ji.parentNode,ji)));const Nr={};r&2&&(Nr.$$scope={dirty:r,ctx:e}),wt.$set(Nr);let al=Te;Te=np(e),Te!==al&&(ut(),b(si[al],1,1,()=>{si[al]=null}),ct(),Pe=si[Te],Pe||(Pe=si[Te]=ap[Te](e),Pe.c()),v(Pe,1),Pe.m(Ki.parentNode,Ki));let Ze=Ae;Ae=hp(e),Ae!==Ze&&(ut(),b(ai[Ze],1,1,()=>{ai[Ze]=null}),ct(),De=ai[Ae],De||(De=ai[Ae]=fp[Ae](e),De.c()),v(De,1),De.m(Ji.parentNode,Ji));const ui={};r&2&&(ui.$$scope={dirty:r,ctx:e}),Ut.$set(ui);let nl=Oe;Oe=up(e),Oe!==nl&&(ut(),b(ni[nl],1,1,()=>{ni[nl]=null}),ct(),Ie=ni[Oe],Ie||(Ie=ni[Oe]=cp[Oe](e),Ie.c()),v(Ie,1),Ie.m(Xi.parentNode,Xi));let Yt=Ce;Ce=dp(e),Ce!==Yt&&(ut(),b(fi[Yt],1,1,()=>{fi[Yt]=null}),ct(),Me=fi[Ce],Me||(Me=fi[Ce]=pp[Ce](e),Me.c()),v(Me,1),Me.m(Qi.parentNode,Qi));let fl=qe;qe=_p(e),qe!==fl&&(ut(),b(hi[fl],1,1,()=>{hi[fl]=null}),ct(),Fe=hi[qe],Fe||(Fe=hi[qe]=mp[qe](e),Fe.c()),v(Fe,1),Fe.m(el.parentNode,el)),Ra!==(Ra=gp(e))&&(ht.d(1),ht=Ra(e),ht&&(ht.c(),ht.m(ol.parentNode,ol)))},i(e){Na||(v(h.$$.fragment,e),v(P.$$.fragment,e),v(w),v(L.$$.fragment,e),v(Se.$$.fragment,e),v(ee),v(Qt.$$.fragment,e),v(eo.$$.fragment,e),v(Ee),v(ze),v(oo.$$.fragment,e),v(io.$$.fragment,e),v(lo.$$.fragment,e),v(ro.$$.fragment,e),v(wt.$$.fragment,e),v(ho.$$.fragment,e),v(uo.$$.fragment,e),v(po.$$.fragment,e),v(mo.$$.fragment,e),v(_o.$$.fragment,e),v(go.$$.fragment,e),v(To.$$.fragment,e),v(Ao.$$.fragment,e),v(Oo.$$.fragment,e),v(Io.$$.fragment,e),v(qo.$$.fragment,e),v(Fo.$$.fragment,e),v(xo.$$.fragment,e),v(Go.$$.fragment,e),v(Lo.$$.fragment,e),v(So.$$.fragment,e),v(Uo.$$.fragment,e),v(Ro.$$.fragment,e),v(Wo.$$.fragment,e),v(Bo.$$.fragment,e),v(Yo.$$.fragment,e),v(Vo.$$.fragment,e),v(Pe),v(Ko.$$.fragment,e),v(De),v(Ut.$$.fragment,e),v(Jo.$$.fragment,e),v(Zo.$$.fragment,e),v(Ie),v(Xo.$$.fragment,e),v(Me),v(Qo.$$.fragment,e),v(Fe),v(ei.$$.fragment,e),v(ti.$$.fragment,e),Na=!0)},o(e){b(h.$$.fragment,e),b(P.$$.fragment,e),b(w),b(L.$$.fragment,e),b(Se.$$.fragment,e),b(ee),b(Qt.$$.fragment,e),b(eo.$$.fragment,e),b(Ee),b(ze),b(oo.$$.fragment,e),b(io.$$.fragment,e),b(lo.$$.fragment,e),b(ro.$$.fragment,e),b(wt.$$.fragment,e),b(ho.$$.fragment,e),b(uo.$$.fragment,e),b(po.$$.fragment,e),b(mo.$$.fragment,e),b(_o.$$.fragment,e),b(go.$$.fragment,e),b(To.$$.fragment,e),b(Ao.$$.fragment,e),b(Oo.$$.fragment,e),b(Io.$$.fragment,e),b(qo.$$.fragment,e),b(Fo.$$.fragment,e),b(xo.$$.fragment,e),b(Go.$$.fragment,e),b(Lo.$$.fragment,e),b(So.$$.fragment,e),b(Uo.$$.fragment,e),b(Ro.$$.fragment,e),b(Wo.$$.fragment,e),b(Bo.$$.fragment,e),b(Yo.$$.fragment,e),b(Vo.$$.fragment,e),b(Pe),b(Ko.$$.fragment,e),b(De),b(Ut.$$.fragment,e),b(Jo.$$.fragment,e),b(Zo.$$.fragment,e),b(Ie),b(Xo.$$.fragment,e),b(Me),b(Qo.$$.fragment,e),b(Fe),b(ei.$$.fragment,e),b(ti.$$.fragment,e),Na=!1},d(e){t(c),e&&t(d),T(h,e),e&&t(g),e&&t(k),T(P),e&&t(m),oi[y].d(e),e&&t($),e&&t(H),e&&t(G),T(L,e),e&&t(W),e&&t(J),e&&t(B),e&&t(le),e&&t(te),e&&t(R),e&&t(X),e&&t(Q),e&&t(et),e&&t(C),T(Se),e&&t(tt),ii[ae].d(e),e&&t(ot),e&&t(ke),e&&t(Ur),e&&t(de),e&&t(Rr),T(Qt,e),e&&t(Wr),e&&t(bi),e&&t(Br),T(eo,e),e&&t(Yr),e&&t(mt),e&&t(Vr),e&&t(vi),e&&t(Kr),li[$e].d(e),e&&t(wi),e&&t(_t),e&&t(Jr),e&&t(ki),e&&t(Zr),ri[je].d(e),e&&t($i),e&&t(Ne),e&&t(Xr),T(oo,e),e&&t(Qr),e&&t(gt),e&&t(es),T(io,e),e&&t(ts),e&&t(yt),e&&t(os),T(lo,e),e&&t(is),e&&t(bt),e&&t(ls),T(ro,e),e&&t(rs),e&&t(vt),e&&t(ss),e&&t(Ei),e&&t(as),ft.d(e),e&&t(ji),T(wt,e),e&&t(ns),e&&t(Ue),e&&t(fs),e&&t(me),e&&t(hs),e&&t(zi),e&&t(cs),e&&t(it),T(ho),e&&t(us),e&&t($t),e&&t(ps),e&&t(_e),e&&t(ds),T(uo,e),e&&t(ms),e&&t(Et),e&&t(_s),T(po,e),e&&t(gs),e&&t(jt),e&&t(ys),e&&t(zt),e&&t(bs),T(mo,e),e&&t(vs),e&&t(Re),e&&t(ws),T(_o,e),e&&t(ks),e&&t(We),e&&t($s),e&&t(Be),e&&t(Es),e&&t(Ai),e&&t(js),e&&t(lt),T(go),e&&t(zs),e&&t(Di),e&&t(Ts),e&&t(Pt),e&&t(Ps),e&&t(bo),e&&t(As),e&&t(Oi),e&&t(Ds),e&&t(Ii),e&&t(Os),e&&t(Ci),e&&t(Is),e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),T(Xo,e),e&&t(Fa),fi[Ce].d(e),e&&t(Qi),e&&t(Bt),e&&t(Ha),T(Qo,e),e&&t(xa),hi[qe].d(e),e&&t(el),e&&t(tl),e&&t(Ga),T(ei,e),e&&t(La),T(ti,e),e&&t(Sa),ht.d(e),e&&t(ol)}}}const b_={local:"sharing-pretrained-models",sections:[{local:"using-the-pushtohub-api",title:"Using the `push_to_hub` API"},{local:"using-the-huggingfacehub-python-library",title:"Using the `huggingface_hub` Python library"},{local:"using-the-web-interface",title:"Using the web interface"},{local:"uploading-the-model-files",sections:[{local:"the-uploadfile-approach",title:"The `upload_file` approach"},{local:"the-repository-class",title:"The `Repository` class"},{local:"the-gitbased-approach",title:"The git-based approach"}],title:"Uploading the model files"}],title:"Sharing pretrained models"};function v_(D,c,d){let h="pt";return Bm(()=>{const g=new URLSearchParams(window.location.search);d(0,h=g.get("fw")||"pt")}),[h]}class P_ extends Nm{constructor(c){super();Um(this,c,v_,y_,Rm,{})}}export{P_ as default,b_ as metadata};
