import{S as uo,i as co,s as po,e as a,k as u,w as m,t as b,M as fo,c as i,d as t,m as c,x as g,a as n,h as _,b as h,G as o,g as l,y as $,o as f,p as mo,q as d,B as w,v as go,n as $o}from"../../chunks/vendor-hf-doc-builder.js";import{I as q}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as wo}from"../../chunks/CourseFloatingBanner-hf-doc-builder.js";import{Q as W}from"../../chunks/Question-hf-doc-builder.js";import{F as vo}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";function bo(G){let p,v;return p=new W({props:{choices:[{text:"A tokenizer",explain:"Correct! All tokenizers have the <code>push_to_hub</code> method, and using it will push all the tokenizer files (vocabulary, architecture of the tokenizer, etc.) to a given repo. That's not the only right answer, though!",correct:!0},{text:"A model configuration",explain:"Right! All model configurations have the <code>push_to_hub</code> method, and using it will push them to a given repo. What else can you share?",correct:!0},{text:"A model",explain:"Correct! All models have the <code>push_to_hub</code> method, and using it will push them and their configuration files to a given repo. That's not all you can share, though.",correct:!0},{text:"All of the above with a dedicated callback",explain:"That's right \u2014 the <code>PushToHubCallback</code> will regularly send all of those objects to a repo during training.",correct:!0}]}}),{c(){m(p.$$.fragment)},l(s){g(p.$$.fragment,s)},m(s,k){$(p,s,k),v=!0},i(s){v||(d(p.$$.fragment,s),v=!0)},o(s){f(p.$$.fragment,s),v=!1},d(s){w(p,s)}}}function _o(G){let p,v;return p=new W({props:{choices:[{text:"A tokenizer",explain:"Correct! All tokenizers have the <code>push_to_hub</code> method, and using it will push all the tokenizer files (vocabulary, architecture of the tokenizer, etc.) to a given repo. That's not the only right answer, though!",correct:!0},{text:"A model configuration",explain:"Right! All model configurations have the <code>push_to_hub</code> method, and using it will push them to a given repo. What else can you share?",correct:!0},{text:"A model",explain:"Correct! All models have the <code>push_to_hub</code> method, and using it will push them and their configuration files to a given repo. That's not all you can share, though.",correct:!0},{text:"A Trainer",explain:"That's right \u2014 the <code>Trainer</code> also implements the <code>push_to_hub</code> method, and using it will upload the model, its configuration, the tokenizer, and a model card draft to a given repo. Try another answer!",correct:!0}]}}),{c(){m(p.$$.fragment)},l(s){g(p.$$.fragment,s)},m(s,k){$(p,s,k),v=!0},i(s){v||(d(p.$$.fragment,s),v=!0)},o(s){f(p.$$.fragment,s),v=!1},d(s){w(p,s)}}}function yo(G){let p,v,s,k,A,F,$e,Q,ut,we,ct,We,U,Fe,de,pt,Me,E,M,ve,Y,ft,be,dt,Re,J,Ie,H,R,_e,K,mt,ye,gt,Le,V,je,T,I,xe,X,$t,ke,wt,Be,Z,Oe,P,L,Ae,ee,vt,Ee,bt,De,te,Ge,C,j,He,oe,_t,re,yt,Te,xt,kt,Qe,y,x,me,N,B,Pe,ae,At,ie,Et,Ce,Ht,Tt,Ue,ne,Ye,S,O,Ne,he,Pt,Se,Ct,Je,se,Ke,z,D,ze,le,Nt,ue,St,qe,zt,qt,Ve,ce,Xe;s=new vo({props:{fw:G[0]}}),Q=new q({}),U=new wo({props:{chapter:4,classNames:"absolute z-10 right-0 top-0"}}),Y=new q({}),J=new W({props:{choices:[{text:"Models from the \u{1F917} Transformers library.",explain:"While models from the \u{1F917} Transformers library are supported on the Hugging Face Hub, they're not the only ones!"},{text:"All models with a similar interface to \u{1F917} Transformers.",explain:"No interface requirement is set when uploading models to the Hugging Face Hub. "},{text:"There are no limits.",explain:"Right! There are no limits when uploading models to the Hub.",correct:!0},{text:"Models that are in some way related to NLP.",explain:"No requirement is set regarding the field of application!"}]}}),K=new q({}),V=new W({props:{choices:[{text:"Through a GCP account.",explain:"Incorrect!"},{text:"Through peer-to-peer distribution.",explain:"Incorrect!"},{text:"Through git and git-lfs.",explain:"Correct! Models on the Hub are simple Git repositories, leveraging <code>git-lfs</code> for large files.",correct:!0}]}}),X=new q({}),Z=new W({props:{choices:[{text:"Fork an existing repository.",explain:"Forking a repository is not possible on the Hugging Face Hub."},{text:"Create a new model repository.",explain:"Correct! That's not all you can do, though.",correct:!0},{text:"Manage and edit files.",explain:"Correct! That's not the only right answer, though.",correct:!0},{text:"Upload files.",explain:"Right! But that's not all.",correct:!0},{text:"See diffs across versions.",explain:"Correct! That's not all you can do, though.",correct:!0}]}}),ee=new q({}),te=new W({props:{choices:[{text:"A rough description of the model, therefore less important than the model and tokenizer files.",explain:"It is indeed a description of the model, but it's an important piece: if it's incomplete or absent the model's utility is drastically reduced."},{text:"A way to ensure reproducibility, reusability, and fairness.",explain:"Correct! Sharing the right information in the model card will help users leverage your model and be aware of its limits and biases. ",correct:!0},{text:"A Python file that can be run to retrieve information about the model.",explain:"Model cards are simple Markdown files."}]}}),oe=new q({});const Wt=[_o,bo],pe=[];function Ft(e,r){return e[0]==="pt"?0:1}return y=Ft(G),x=pe[y]=Wt[y](G),ae=new q({}),ne=new W({props:{choices:[{text:"Log in on the website.",explain:"This won't help you on your local machine."},{text:"Run 'huggingface-cli login' in a terminal.",explain:"Correct \u2014 this will download and cache your personal token.",correct:!0},{text:"Run 'notebook_login()' in a notebook.",explain:"Correct \u2014 this will display a widget to let you authenticate.",correct:!0}]}}),he=new q({}),se=new W({props:{choices:[{text:"By calling the push_to_hub method directly on the model and the tokenizer.",explain:"Correct!",correct:!0},{text:"Within the Python runtime, by wrapping them in a <code>huggingface_hub</code> utility.",explain:"Models and tokenizers already benefit from <code>huggingface_hub</code> utilities: no need for additional wrapping!"},{text:"By saving them to disk and calling <code>transformers-cli upload-model</code>",explain:"The command <code>upload-model</code> does not exist."}]}}),le=new q({}),ce=new W({props:{choices:[{text:"A commit.",explain:"Correct, the <code>git_commit()</code> method is there for that.",correct:!0},{text:"A pull",explain:"That is the purpose of the <code>git_pull()</code> method.",correct:!0},{text:"A push",explain:"The method <code>git_push()</code> does this.",correct:!0},{text:"A merge",explain:"No, that operation will never be possible with this API."}]}}),{c(){p=a("meta"),v=u(),m(s.$$.fragment),k=u(),A=a("h1"),F=a("a"),$e=a("span"),m(Q.$$.fragment),ut=u(),we=a("span"),ct=b("End-of-chapter quiz"),We=u(),m(U.$$.fragment),Fe=u(),de=a("p"),pt=b("Let\u2019s test what you learned in this chapter!"),Me=u(),E=a("h3"),M=a("a"),ve=a("span"),m(Y.$$.fragment),ft=u(),be=a("span"),dt=b("1. What are models on the Hub limited to?"),Re=u(),m(J.$$.fragment),Ie=u(),H=a("h3"),R=a("a"),_e=a("span"),m(K.$$.fragment),mt=u(),ye=a("span"),gt=b("2. How can you manage models on the Hub?"),Le=u(),m(V.$$.fragment),je=u(),T=a("h3"),I=a("a"),xe=a("span"),m(X.$$.fragment),$t=u(),ke=a("span"),wt=b("3. What can you do using the Hugging Face Hub web interface?"),Be=u(),m(Z.$$.fragment),Oe=u(),P=a("h3"),L=a("a"),Ae=a("span"),m(ee.$$.fragment),vt=u(),Ee=a("span"),bt=b("4. What is a model card?"),De=u(),m(te.$$.fragment),Ge=u(),C=a("h3"),j=a("a"),He=a("span"),m(oe.$$.fragment),_t=u(),re=a("span"),yt=b("5. Which of these objects of the \u{1F917} Transformers library can be directly shared on the Hub with "),Te=a("code"),xt=b("push_to_hub()"),kt=b("?"),Qe=u(),x.c(),me=u(),N=a("h3"),B=a("a"),Pe=a("span"),m(ae.$$.fragment),At=u(),ie=a("span"),Et=b("6. What is the first step when using the "),Ce=a("code"),Ht=b("push_to_hub()"),Tt=b(" method or the CLI tools?"),Ue=u(),m(ne.$$.fragment),Ye=u(),S=a("h3"),O=a("a"),Ne=a("span"),m(he.$$.fragment),Pt=u(),Se=a("span"),Ct=b("7. You\u2019re using a model and a tokenizer \u2014 how can you upload them to the Hub?"),Je=u(),m(se.$$.fragment),Ke=u(),z=a("h3"),D=a("a"),ze=a("span"),m(le.$$.fragment),Nt=u(),ue=a("span"),St=b("8. Which git operations can you do with the "),qe=a("code"),zt=b("Repository"),qt=b(" class?"),Ve=u(),m(ce.$$.fragment),this.h()},l(e){const r=fo('[data-svelte="svelte-1phssyn"]',document.head);p=i(r,"META",{name:!0,content:!0}),r.forEach(t),v=c(e),g(s.$$.fragment,e),k=c(e),A=i(e,"H1",{class:!0});var fe=n(A);F=i(fe,"A",{id:!0,class:!0,href:!0});var ge=n(F);$e=i(ge,"SPAN",{});var Mt=n($e);g(Q.$$.fragment,Mt),Mt.forEach(t),ge.forEach(t),ut=c(fe),we=i(fe,"SPAN",{});var Rt=n(we);ct=_(Rt,"End-of-chapter quiz"),Rt.forEach(t),fe.forEach(t),We=c(e),g(U.$$.fragment,e),Fe=c(e),de=i(e,"P",{});var It=n(de);pt=_(It,"Let\u2019s test what you learned in this chapter!"),It.forEach(t),Me=c(e),E=i(e,"H3",{class:!0});var Ze=n(E);M=i(Ze,"A",{id:!0,class:!0,href:!0});var Lt=n(M);ve=i(Lt,"SPAN",{});var jt=n(ve);g(Y.$$.fragment,jt),jt.forEach(t),Lt.forEach(t),ft=c(Ze),be=i(Ze,"SPAN",{});var Bt=n(be);dt=_(Bt,"1. What are models on the Hub limited to?"),Bt.forEach(t),Ze.forEach(t),Re=c(e),g(J.$$.fragment,e),Ie=c(e),H=i(e,"H3",{class:!0});var et=n(H);R=i(et,"A",{id:!0,class:!0,href:!0});var Ot=n(R);_e=i(Ot,"SPAN",{});var Dt=n(_e);g(K.$$.fragment,Dt),Dt.forEach(t),Ot.forEach(t),mt=c(et),ye=i(et,"SPAN",{});var Gt=n(ye);gt=_(Gt,"2. How can you manage models on the Hub?"),Gt.forEach(t),et.forEach(t),Le=c(e),g(V.$$.fragment,e),je=c(e),T=i(e,"H3",{class:!0});var tt=n(T);I=i(tt,"A",{id:!0,class:!0,href:!0});var Qt=n(I);xe=i(Qt,"SPAN",{});var Ut=n(xe);g(X.$$.fragment,Ut),Ut.forEach(t),Qt.forEach(t),$t=c(tt),ke=i(tt,"SPAN",{});var Yt=n(ke);wt=_(Yt,"3. What can you do using the Hugging Face Hub web interface?"),Yt.forEach(t),tt.forEach(t),Be=c(e),g(Z.$$.fragment,e),Oe=c(e),P=i(e,"H3",{class:!0});var ot=n(P);L=i(ot,"A",{id:!0,class:!0,href:!0});var Jt=n(L);Ae=i(Jt,"SPAN",{});var Kt=n(Ae);g(ee.$$.fragment,Kt),Kt.forEach(t),Jt.forEach(t),vt=c(ot),Ee=i(ot,"SPAN",{});var Vt=n(Ee);bt=_(Vt,"4. What is a model card?"),Vt.forEach(t),ot.forEach(t),De=c(e),g(te.$$.fragment,e),Ge=c(e),C=i(e,"H3",{class:!0});var rt=n(C);j=i(rt,"A",{id:!0,class:!0,href:!0});var Xt=n(j);He=i(Xt,"SPAN",{});var Zt=n(He);g(oe.$$.fragment,Zt),Zt.forEach(t),Xt.forEach(t),_t=c(rt),re=i(rt,"SPAN",{});var at=n(re);yt=_(at,"5. Which of these objects of the \u{1F917} Transformers library can be directly shared on the Hub with "),Te=i(at,"CODE",{});var eo=n(Te);xt=_(eo,"push_to_hub()"),eo.forEach(t),kt=_(at,"?"),at.forEach(t),rt.forEach(t),Qe=c(e),x.l(e),me=c(e),N=i(e,"H3",{class:!0});var it=n(N);B=i(it,"A",{id:!0,class:!0,href:!0});var to=n(B);Pe=i(to,"SPAN",{});var oo=n(Pe);g(ae.$$.fragment,oo),oo.forEach(t),to.forEach(t),At=c(it),ie=i(it,"SPAN",{});var nt=n(ie);Et=_(nt,"6. What is the first step when using the "),Ce=i(nt,"CODE",{});var ro=n(Ce);Ht=_(ro,"push_to_hub()"),ro.forEach(t),Tt=_(nt," method or the CLI tools?"),nt.forEach(t),it.forEach(t),Ue=c(e),g(ne.$$.fragment,e),Ye=c(e),S=i(e,"H3",{class:!0});var ht=n(S);O=i(ht,"A",{id:!0,class:!0,href:!0});var ao=n(O);Ne=i(ao,"SPAN",{});var io=n(Ne);g(he.$$.fragment,io),io.forEach(t),ao.forEach(t),Pt=c(ht),Se=i(ht,"SPAN",{});var no=n(Se);Ct=_(no,"7. You\u2019re using a model and a tokenizer \u2014 how can you upload them to the Hub?"),no.forEach(t),ht.forEach(t),Je=c(e),g(se.$$.fragment,e),Ke=c(e),z=i(e,"H3",{class:!0});var st=n(z);D=i(st,"A",{id:!0,class:!0,href:!0});var ho=n(D);ze=i(ho,"SPAN",{});var so=n(ze);g(le.$$.fragment,so),so.forEach(t),ho.forEach(t),Nt=c(st),ue=i(st,"SPAN",{});var lt=n(ue);St=_(lt,"8. Which git operations can you do with the "),qe=i(lt,"CODE",{});var lo=n(qe);zt=_(lo,"Repository"),lo.forEach(t),qt=_(lt," class?"),lt.forEach(t),st.forEach(t),Ve=c(e),g(ce.$$.fragment,e),this.h()},h(){h(p,"name","hf:doc:metadata"),h(p,"content",JSON.stringify(xo)),h(F,"id","endofchapter-quiz"),h(F,"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"),h(F,"href","#endofchapter-quiz"),h(A,"class","relative group"),h(M,"id","1.-what-are-models-on-the-hub-limited-to?"),h(M,"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"),h(M,"href","#1.-what-are-models-on-the-hub-limited-to?"),h(E,"class","relative group"),h(R,"id","2.-how-can-you-manage-models-on-the-hub?"),h(R,"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"),h(R,"href","#2.-how-can-you-manage-models-on-the-hub?"),h(H,"class","relative group"),h(I,"id","3.-what-can-you-do-using-the-hugging-face-hub-web-interface?"),h(I,"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"),h(I,"href","#3.-what-can-you-do-using-the-hugging-face-hub-web-interface?"),h(T,"class","relative group"),h(L,"id","4.-what-is-a-model-card?"),h(L,"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"),h(L,"href","#4.-what-is-a-model-card?"),h(P,"class","relative group"),h(j,"id","5.-which-of-these-objects-of-the-\u{1F917}-transformers-library-can-be-directly-shared-on-the-hub-with-<code>push_to_hub()</code>?"),h(j,"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"),h(j,"href","#5.-which-of-these-objects-of-the-\u{1F917}-transformers-library-can-be-directly-shared-on-the-hub-with-<code>push_to_hub()</code>?"),h(C,"class","relative group"),h(B,"id","6.-what-is-the-first-step-when-using-the-<code>push_to_hub()</code>-method-or-the-cli-tools?"),h(B,"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"),h(B,"href","#6.-what-is-the-first-step-when-using-the-<code>push_to_hub()</code>-method-or-the-cli-tools?"),h(N,"class","relative group"),h(O,"id","7.-you\u2019re-using-a-model-and-a-tokenizer-\u2014-how-can-you-upload-them-to-the-hub?"),h(O,"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"),h(O,"href","#7.-you\u2019re-using-a-model-and-a-tokenizer-\u2014-how-can-you-upload-them-to-the-hub?"),h(S,"class","relative group"),h(D,"id","8.-which-git-operations-can-you-do-with-the-<code>repository</code>-class?"),h(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(D,"href","#8.-which-git-operations-can-you-do-with-the-<code>repository</code>-class?"),h(z,"class","relative group")},m(e,r){o(document.head,p),l(e,v,r),$(s,e,r),l(e,k,r),l(e,A,r),o(A,F),o(F,$e),$(Q,$e,null),o(A,ut),o(A,we),o(we,ct),l(e,We,r),$(U,e,r),l(e,Fe,r),l(e,de,r),o(de,pt),l(e,Me,r),l(e,E,r),o(E,M),o(M,ve),$(Y,ve,null),o(E,ft),o(E,be),o(be,dt),l(e,Re,r),$(J,e,r),l(e,Ie,r),l(e,H,r),o(H,R),o(R,_e),$(K,_e,null),o(H,mt),o(H,ye),o(ye,gt),l(e,Le,r),$(V,e,r),l(e,je,r),l(e,T,r),o(T,I),o(I,xe),$(X,xe,null),o(T,$t),o(T,ke),o(ke,wt),l(e,Be,r),$(Z,e,r),l(e,Oe,r),l(e,P,r),o(P,L),o(L,Ae),$(ee,Ae,null),o(P,vt),o(P,Ee),o(Ee,bt),l(e,De,r),$(te,e,r),l(e,Ge,r),l(e,C,r),o(C,j),o(j,He),$(oe,He,null),o(C,_t),o(C,re),o(re,yt),o(re,Te),o(Te,xt),o(re,kt),l(e,Qe,r),pe[y].m(e,r),l(e,me,r),l(e,N,r),o(N,B),o(B,Pe),$(ae,Pe,null),o(N,At),o(N,ie),o(ie,Et),o(ie,Ce),o(Ce,Ht),o(ie,Tt),l(e,Ue,r),$(ne,e,r),l(e,Ye,r),l(e,S,r),o(S,O),o(O,Ne),$(he,Ne,null),o(S,Pt),o(S,Se),o(Se,Ct),l(e,Je,r),$(se,e,r),l(e,Ke,r),l(e,z,r),o(z,D),o(D,ze),$(le,ze,null),o(z,Nt),o(z,ue),o(ue,St),o(ue,qe),o(qe,zt),o(ue,qt),l(e,Ve,r),$(ce,e,r),Xe=!0},p(e,[r]){const fe={};r&1&&(fe.fw=e[0]),s.$set(fe);let ge=y;y=Ft(e),y!==ge&&($o(),f(pe[ge],1,1,()=>{pe[ge]=null}),mo(),x=pe[y],x||(x=pe[y]=Wt[y](e),x.c()),d(x,1),x.m(me.parentNode,me))},i(e){Xe||(d(s.$$.fragment,e),d(Q.$$.fragment,e),d(U.$$.fragment,e),d(Y.$$.fragment,e),d(J.$$.fragment,e),d(K.$$.fragment,e),d(V.$$.fragment,e),d(X.$$.fragment,e),d(Z.$$.fragment,e),d(ee.$$.fragment,e),d(te.$$.fragment,e),d(oe.$$.fragment,e),d(x),d(ae.$$.fragment,e),d(ne.$$.fragment,e),d(he.$$.fragment,e),d(se.$$.fragment,e),d(le.$$.fragment,e),d(ce.$$.fragment,e),Xe=!0)},o(e){f(s.$$.fragment,e),f(Q.$$.fragment,e),f(U.$$.fragment,e),f(Y.$$.fragment,e),f(J.$$.fragment,e),f(K.$$.fragment,e),f(V.$$.fragment,e),f(X.$$.fragment,e),f(Z.$$.fragment,e),f(ee.$$.fragment,e),f(te.$$.fragment,e),f(oe.$$.fragment,e),f(x),f(ae.$$.fragment,e),f(ne.$$.fragment,e),f(he.$$.fragment,e),f(se.$$.fragment,e),f(le.$$.fragment,e),f(ce.$$.fragment,e),Xe=!1},d(e){t(p),e&&t(v),w(s,e),e&&t(k),e&&t(A),w(Q),e&&t(We),w(U,e),e&&t(Fe),e&&t(de),e&&t(Me),e&&t(E),w(Y),e&&t(Re),w(J,e),e&&t(Ie),e&&t(H),w(K),e&&t(Le),w(V,e),e&&t(je),e&&t(T),w(X),e&&t(Be),w(Z,e),e&&t(Oe),e&&t(P),w(ee),e&&t(De),w(te,e),e&&t(Ge),e&&t(C),w(oe),e&&t(Qe),pe[y].d(e),e&&t(me),e&&t(N),w(ae),e&&t(Ue),w(ne,e),e&&t(Ye),e&&t(S),w(he),e&&t(Je),w(se,e),e&&t(Ke),e&&t(z),w(le),e&&t(Ve),w(ce,e)}}}const xo={local:"endofchapter-quiz",title:"End-of-chapter quiz"};function ko(G,p,v){let s="pt";return go(()=>{const k=new URLSearchParams(window.location.search);v(0,s=k.get("fw")||"pt")}),[s]}class Co extends uo{constructor(p){super();co(this,p,ko,yo,po,{})}}export{Co as default,xo as metadata};
