import{s as sl,f as ol,o as rl,n as We}from"../chunks/scheduler.25b97de1.js";import{S as il,i as ml,g as d,s as o,r as g,A as pl,h as c,f as l,c as r,j as Jt,u as w,x as $,k as R,y as ul,a,v as y,d as b,t as T,w as _}from"../chunks/index.d9030fc9.js";import{T as fl}from"../chunks/Tip.baa67368.js";import{Y as dl}from"../chunks/Youtube.eaf1a617.js";import{C as F}from"../chunks/CodeBlock.e6cd0d95.js";import{F as nl,M as xe}from"../chunks/Markdown.7217f838.js";import{H as G,E as cl}from"../chunks/EditOnGithub.91d95064.js";function hl(j){let n,p='To share a model with the community, you need an account on <a href="https://huggingface.co/join" rel="nofollow">huggingface.co</a>. You can also join an existing organization or create a new one.';return{c(){n=d("p"),n.innerHTML=p},l(s){n=c(s,"P",{"data-svelte-h":!0}),$(n)!=="svelte-n70tme"&&(n.innerHTML=p)},m(s,i){a(s,n,i)},p:We,d(s){s&&l(n)}}}function $l(j){let n,p="Specify <code>from_tf=True</code> to convert a checkpoint from TensorFlow to PyTorch:",s,i,f;return i=new F({props:{code:"cHRfbW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIycGF0aCUyRnRvJTJGYXdlc29tZS1uYW1lLXlvdS1waWNrZWQlMjIlMkMlMjBmcm9tX3RmJTNEVHJ1ZSklMEFwdF9tb2RlbC5zYXZlX3ByZXRyYWluZWQoJTIycGF0aCUyRnRvJTJGYXdlc29tZS1uYW1lLXlvdS1waWNrZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model = DistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>, from_tf=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.save_pretrained(<span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>)`,wrap:!1}}),{c(){n=d("p"),n.innerHTML=p,s=o(),g(i.$$.fragment)},l(m){n=c(m,"P",{"data-svelte-h":!0}),$(n)!=="svelte-t2b4fg"&&(n.innerHTML=p),s=r(m),w(i.$$.fragment,m)},m(m,v){a(m,n,v),a(m,s,v),y(i,m,v),f=!0},p:We,i(m){f||(b(i.$$.fragment,m),f=!0)},o(m){T(i.$$.fragment,m),f=!1},d(m){m&&(l(n),l(s)),_(i,m)}}}function gl(j){let n,p;return n=new xe({props:{$$slots:{default:[$l]},$$scope:{ctx:j}}}),{c(){g(n.$$.fragment)},l(s){w(n.$$.fragment,s)},m(s,i){y(n,s,i),p=!0},p(s,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:s}),n.$set(f)},i(s){p||(b(n.$$.fragment,s),p=!0)},o(s){T(n.$$.fragment,s),p=!1},d(s){_(n,s)}}}function wl(j){let n,p="Specify <code>from_pt=True</code> to convert a checkpoint from PyTorch to TensorFlow:",s,i,f,m,v="Then you can save your new TensorFlow model with its new checkpoint:",W,H,Z;return i=new F({props:{code:"dGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJwYXRoJTJGdG8lMkZhd2Vzb21lLW5hbWUteW91LXBpY2tlZCUyMiUyQyUyMGZyb21fcHQlM0RUcnVlKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>, from_pt=<span class="hljs-literal">True</span>)',wrap:!1}}),H=new F({props:{code:"dGZfbW9kZWwuc2F2ZV9wcmV0cmFpbmVkKCUyMnBhdGglMkZ0byUyRmF3ZXNvbWUtbmFtZS15b3UtcGlja2VkJTIyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model.save_pretrained(<span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>)',wrap:!1}}),{c(){n=d("p"),n.innerHTML=p,s=o(),g(i.$$.fragment),f=o(),m=d("p"),m.textContent=v,W=o(),g(H.$$.fragment)},l(h){n=c(h,"P",{"data-svelte-h":!0}),$(n)!=="svelte-17l9qm6"&&(n.innerHTML=p),s=r(h),w(i.$$.fragment,h),f=r(h),m=c(h,"P",{"data-svelte-h":!0}),$(m)!=="svelte-4w3hzs"&&(m.textContent=v),W=r(h),w(H.$$.fragment,h)},m(h,k){a(h,n,k),a(h,s,k),y(i,h,k),a(h,f,k),a(h,m,k),a(h,W,k),y(H,h,k),Z=!0},p:We,i(h){Z||(b(i.$$.fragment,h),b(H.$$.fragment,h),Z=!0)},o(h){T(i.$$.fragment,h),T(H.$$.fragment,h),Z=!1},d(h){h&&(l(n),l(s),l(f),l(m),l(W)),_(i,h),_(H,h)}}}function yl(j){let n,p;return n=new xe({props:{$$slots:{default:[wl]},$$scope:{ctx:j}}}),{c(){g(n.$$.fragment)},l(s){w(n.$$.fragment,s)},m(s,i){y(n,s,i),p=!0},p(s,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:s}),n.$set(f)},i(s){p||(b(n.$$.fragment,s),p=!0)},o(s){T(n.$$.fragment,s),p=!1},d(s){_(n,s)}}}function bl(j){let n,p="If a model is available in Flax, you can also convert a checkpoint from PyTorch to Flax:",s,i,f;return i=new F({props:{code:"ZmxheF9tb2RlbCUyMCUzRCUyMEZsYXhEaXN0aWxCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIycGF0aCUyRnRvJTJGYXdlc29tZS1uYW1lLXlvdS1waWNrZWQlMjIlMkMlMjBmcm9tX3B0JTNEVHJ1ZSUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>flax_model = FlaxDistilBertForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;path/to/awesome-name-you-picked&quot;</span>, from_pt=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)`,wrap:!1}}),{c(){n=d("p"),n.textContent=p,s=o(),g(i.$$.fragment)},l(m){n=c(m,"P",{"data-svelte-h":!0}),$(n)!=="svelte-1wdqh65"&&(n.textContent=p),s=r(m),w(i.$$.fragment,m)},m(m,v){a(m,n,v),a(m,s,v),y(i,m,v),f=!0},p:We,i(m){f||(b(i.$$.fragment,m),f=!0)},o(m){T(i.$$.fragment,m),f=!1},d(m){m&&(l(n),l(s)),_(i,m)}}}function Tl(j){let n,p;return n=new xe({props:{$$slots:{default:[bl]},$$scope:{ctx:j}}}),{c(){g(n.$$.fragment)},l(s){w(n.$$.fragment,s)},m(s,i){y(n,s,i),p=!0},p(s,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:s}),n.$set(f)},i(s){p||(b(n.$$.fragment,s),p=!0)},o(s){T(n.$$.fragment,s),p=!1},d(s){_(n,s)}}}function _l(j){let n,p,s,i='Sharing a model to the Hub is as simple as adding an extra parameter or callback. Remember from the <a href="training">fine-tuning tutorial</a>, the <a href="/docs/transformers/pr_29969/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> class is where you specify hyperparameters and additional training options. One of these training options includes the ability to push a model directly to the Hub. Set <code>push_to_hub=True</code> in your <a href="/docs/transformers/pr_29969/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>:',f,m,v,W,H='Pass your training arguments as usual to <a href="/docs/transformers/pr_29969/en/main_classes/trainer#transformers.Trainer">Trainer</a>:',Z,h,k,x,M='After you fine-tune your model, call <a href="/docs/transformers/pr_29969/en/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> on <a href="/docs/transformers/pr_29969/en/main_classes/trainer#transformers.Trainer">Trainer</a> to push the trained model to the Hub. 🤗 Transformers will even automatically add training hyperparameters, training results and framework versions to your model card!',L,C,I;return n=new dl({props:{id:"Z1-XMy-GNLQ"}}),m=new F({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKG91dHB1dF9kaXIlM0QlMjJteS1hd2Vzb21lLW1vZGVsJTIyJTJDJTIwcHVzaF90b19odWIlM0RUcnVlKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(output_dir=<span class="hljs-string">&quot;my-awesome-model&quot;</span>, push_to_hub=<span class="hljs-literal">True</span>)',wrap:!1}}),h=new F({props:{code:"dHJhaW5lciUyMCUzRCUyMFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRHNtYWxsX3RyYWluX2RhdGFzZXQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RzbWFsbF9ldmFsX2RhdGFzZXQlMkMlMEElMjAlMjAlMjAlMjBjb21wdXRlX21ldHJpY3MlM0Rjb21wdXRlX21ldHJpY3MlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>trainer = Trainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    train_dataset=small_train_dataset,
<span class="hljs-meta">... </span>    eval_dataset=small_eval_dataset,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)`,wrap:!1}}),C=new F({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){g(n.$$.fragment),p=o(),s=d("p"),s.innerHTML=i,f=o(),g(m.$$.fragment),v=o(),W=d("p"),W.innerHTML=H,Z=o(),g(h.$$.fragment),k=o(),x=d("p"),x.innerHTML=M,L=o(),g(C.$$.fragment)},l(u){w(n.$$.fragment,u),p=r(u),s=c(u,"P",{"data-svelte-h":!0}),$(s)!=="svelte-4esi01"&&(s.innerHTML=i),f=r(u),w(m.$$.fragment,u),v=r(u),W=c(u,"P",{"data-svelte-h":!0}),$(W)!=="svelte-18vlivs"&&(W.innerHTML=H),Z=r(u),w(h.$$.fragment,u),k=r(u),x=c(u,"P",{"data-svelte-h":!0}),$(x)!=="svelte-1pb4goz"&&(x.innerHTML=M),L=r(u),w(C.$$.fragment,u)},m(u,J){y(n,u,J),a(u,p,J),a(u,s,J),a(u,f,J),y(m,u,J),a(u,v,J),a(u,W,J),a(u,Z,J),y(h,u,J),a(u,k,J),a(u,x,J),a(u,L,J),y(C,u,J),I=!0},p:We,i(u){I||(b(n.$$.fragment,u),b(m.$$.fragment,u),b(h.$$.fragment,u),b(C.$$.fragment,u),I=!0)},o(u){T(n.$$.fragment,u),T(m.$$.fragment,u),T(h.$$.fragment,u),T(C.$$.fragment,u),I=!1},d(u){u&&(l(p),l(s),l(f),l(v),l(W),l(Z),l(k),l(x),l(L)),_(n,u),_(m,u),_(h,u),_(C,u)}}}function Ml(j){let n,p;return n=new xe({props:{$$slots:{default:[_l]},$$scope:{ctx:j}}}),{c(){g(n.$$.fragment)},l(s){w(n.$$.fragment,s)},m(s,i){y(n,s,i),p=!0},p(s,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:s}),n.$set(f)},i(s){p||(b(n.$$.fragment,s),p=!0)},o(s){T(n.$$.fragment,s),p=!1},d(s){_(n,s)}}}function vl(j){let n,p='Share a model to the Hub with <a href="/docs/transformers/pr_29969/en/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>. In the <a href="/docs/transformers/pr_29969/en/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a> function, add:',s,i,f="<li>An output directory for your model.</li> <li>A tokenizer.</li> <li>The <code>hub_model_id</code>, which is your Hub username and model name.</li>",m,v,W,H,Z='Add the callback to <a href="https://keras.io/api/models/model_training_apis/" rel="nofollow"><code>fit</code></a>, and 🤗 Transformers will push the trained model to the Hub:',h,k,x;return v=new F({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFB1c2hUb0h1YkNhbGxiYWNrJTBBJTBBcHVzaF90b19odWJfY2FsbGJhY2slMjAlM0QlMjBQdXNoVG9IdWJDYWxsYmFjayglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIyLiUyRnlvdXJfbW9kZWxfc2F2ZV9wYXRoJTIyJTJDJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyJTJDJTIwaHViX21vZGVsX2lkJTNEJTIyeW91ci11c2VybmFtZSUyRm15LWF3ZXNvbWUtbW9kZWwlMjIlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PushToHubCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>push_to_hub_callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;./your_model_save_path&quot;</span>, tokenizer=tokenizer, hub_model_id=<span class="hljs-string">&quot;your-username/my-awesome-model&quot;</span>
<span class="hljs-meta">... </span>)`,wrap:!1}}),k=new F({props:{code:"bW9kZWwuZml0KHRmX3RyYWluX2RhdGFzZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl92YWxpZGF0aW9uX2RhdGFzZXQlMkMlMjBlcG9jaHMlM0QzJTJDJTIwY2FsbGJhY2tzJTNEcHVzaF90b19odWJfY2FsbGJhY2sp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=<span class="hljs-number">3</span>, callbacks=push_to_hub_callback)',wrap:!1}}),{c(){n=d("p"),n.innerHTML=p,s=o(),i=d("ul"),i.innerHTML=f,m=o(),g(v.$$.fragment),W=o(),H=d("p"),H.innerHTML=Z,h=o(),g(k.$$.fragment)},l(M){n=c(M,"P",{"data-svelte-h":!0}),$(n)!=="svelte-wv0bv9"&&(n.innerHTML=p),s=r(M),i=c(M,"UL",{"data-svelte-h":!0}),$(i)!=="svelte-165fubm"&&(i.innerHTML=f),m=r(M),w(v.$$.fragment,M),W=r(M),H=c(M,"P",{"data-svelte-h":!0}),$(H)!=="svelte-1f8ao70"&&(H.innerHTML=Z),h=r(M),w(k.$$.fragment,M)},m(M,L){a(M,n,L),a(M,s,L),a(M,i,L),a(M,m,L),y(v,M,L),a(M,W,L),a(M,H,L),a(M,h,L),y(k,M,L),x=!0},p:We,i(M){x||(b(v.$$.fragment,M),b(k.$$.fragment,M),x=!0)},o(M){T(v.$$.fragment,M),T(k.$$.fragment,M),x=!1},d(M){M&&(l(n),l(s),l(i),l(m),l(W),l(H),l(h)),_(v,M),_(k,M)}}}function kl(j){let n,p;return n=new xe({props:{$$slots:{default:[vl]},$$scope:{ctx:j}}}),{c(){g(n.$$.fragment)},l(s){w(n.$$.fragment,s)},m(s,i){y(n,s,i),p=!0},p(s,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:s}),n.$set(f)},i(s){p||(b(n.$$.fragment,s),p=!0)},o(s){T(n.$$.fragment,s),p=!1},d(s){_(n,s)}}}function Hl(j){let n,p,s,i,f,m,v,W="The last two tutorials showed how you can fine-tune a model with PyTorch, Keras, and 🤗 Accelerate for distributed setups. The next step is to share your model with the community! At Hugging Face, we believe in openly sharing knowledge and resources to democratize artificial intelligence for everyone. We encourage you to consider sharing your model with the community to help others save time and resources.",H,Z,h='In this tutorial, you will learn two methods for sharing a trained or fine-tuned model on the <a href="https://huggingface.co/models" rel="nofollow">Model Hub</a>:',k,x,M="<li>Programmatically push your files to the Hub.</li> <li>Drag-and-drop your files to the Hub with the web interface.</li>",L,C,I,u,J,Le,P,Fe,Y,jt="Each repository on the Model Hub behaves like a typical GitHub repository. Our repositories offer versioning, commit history, and the ability to visualize differences.",Ue,z,Ct='The Model Hub’s built-in versioning is based on git and <a href="https://git-lfs.github.com/" rel="nofollow">git-lfs</a>. In other words, you can treat one model as one repository, enabling greater access control and scalability. Version control allows <em>revisions</em>, a method for pinning a specific version of a model with a commit hash, tag or branch.',Xe,V,Wt="As a result, you can load a specific model version with the <code>revision</code> parameter:",Re,S,Ge,E,Zt="Files are also easily edited in a repository, and you can view the commit history as well as the difference:",Ie,B,xt='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/vis_diff.png" alt="vis_diff"/>',Pe,q,Ye,Q,Lt="Before sharing a model to the Hub, you will need your Hugging Face credentials. If you have access to a terminal, run the following command in the virtual environment where 🤗 Transformers is installed. This will store your access token in your Hugging Face cache folder (<code>~/.cache/</code> by default):",ze,A,Ve,N,Ft='If you are using a notebook like Jupyter or Colaboratory, make sure you have the <a href="https://huggingface.co/docs/hub/adding-a-library" rel="nofollow"><code>huggingface_hub</code></a> library installed. This library allows you to programmatically interact with the Hub.',Se,D,Ee,K,Ut='Then use <code>notebook_login</code> to sign-in to the Hub, and follow the link <a href="https://huggingface.co/settings/token" rel="nofollow">here</a> to generate a token to login with:',Be,O,qe,ee,Qe,te,Xt="To ensure your model can be used by someone working with a different framework, we recommend you convert and upload your model with both PyTorch and TensorFlow checkpoints. While users are still able to load your model from a different framework if you skip this step, it will be slower because 🤗 Transformers will need to convert the checkpoint on-the-fly.",Ae,le,Rt='Converting a checkpoint for another framework is easy. Make sure you have PyTorch and TensorFlow installed (see <a href="installation">here</a> for installation instructions), and then find the specific model for your task in the other framework.',Ne,U,De,ae,Ke,X,Oe,ne,et,se,Gt="You can also call <code>push_to_hub</code> directly on your model to upload it to the Hub.",tt,oe,It="Specify your model name in <code>push_to_hub</code>:",lt,re,at,ie,Pt="This creates a repository under your username with the model name <code>my-awesome-model</code>. Users can now load your model with the <code>from_pretrained</code> function:",nt,me,st,pe,Yt="If you belong to an organization and want to push your model under the organization name instead, just add it to the <code>repo_id</code>:",ot,ue,rt,fe,zt="The <code>push_to_hub</code> function can also be used to add other files to a model repository. For example, add a tokenizer to a model repository:",it,de,mt,ce,Vt="Or perhaps you’d like to add the TensorFlow version of your fine-tuned PyTorch model:",pt,he,ut,$e,St="Now when you navigate to your Hugging Face profile, you should see your newly created model repository. Clicking on the <strong>Files</strong> tab will display all the files you’ve uploaded to the repository.",ft,ge,Et='For more details on how to create and upload files to a repository, refer to the Hub documentation <a href="https://huggingface.co/docs/hub/how-to-upstream" rel="nofollow">here</a>.',dt,we,ct,ye,Bt='Users who prefer a no-code approach are able to upload a model through the Hub’s web interface. Visit <a href="https://huggingface.co/new" rel="nofollow">huggingface.co/new</a> to create a new repository:',ht,be,qt='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/new_model_repo.png" alt="new_model_repo"/>',$t,Te,Qt="From here, add some information about your model:",gt,_e,At="<li>Select the <strong>owner</strong> of the repository. This can be yourself or any of the organizations you belong to.</li> <li>Pick a name for your model, which will also be the repository name.</li> <li>Choose whether your model is public or private.</li> <li>Specify the license usage for your model.</li>",wt,Me,Nt="Now click on the <strong>Files</strong> tab and click on the <strong>Add file</strong> button to upload a new file to your repository. Then drag-and-drop a file to upload and add a commit message.",yt,ve,Dt='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/upload_file.png" alt="upload_file"/>',bt,ke,Tt,He,Kt="To make sure users understand your model’s capabilities, limitations, potential biases and ethical considerations, please add a model card to your repository. The model card is defined in the <code>README.md</code> file. You can add a model card by:",_t,Je,Ot="<li>Manually creating and uploading a <code>README.md</code> file.</li> <li>Clicking on the <strong>Edit model card</strong> button in your model repository.</li>",Mt,je,el='Take a look at the DistilBert <a href="https://huggingface.co/distilbert/distilbert-base-uncased" rel="nofollow">model card</a> for a good example of the type of information a model card should include. For more details about other options you can control in the <code>README.md</code> file such as a model’s carbon footprint or widget examples, refer to the documentation <a href="https://huggingface.co/docs/hub/models-cards" rel="nofollow">here</a>.',vt,Ce,kt,Ze,Ht;return f=new G({props:{title:"Share a model",local:"share-a-model",headingTag:"h1"}}),J=new fl({props:{$$slots:{default:[hl]},$$scope:{ctx:j}}}),P=new G({props:{title:"Repository features",local:"repository-features",headingTag:"h2"}}),S=new F({props:{code:"bW9kZWwlMjAlM0QlMjBBdXRvTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmp1bGllbi1jJTJGRXNwZXJCRVJUby1zbWFsbCUyMiUyQyUyMHJldmlzaW9uJTNEJTIydjIuMC4xJTIyJTIwJTIwJTIzJTIwdGFnJTIwbmFtZSUyQyUyMG9yJTIwYnJhbmNoJTIwbmFtZSUyQyUyMG9yJTIwY29tbWl0JTIwaGFzaCUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;julien-c/EsperBERTo-small&quot;</span>, revision=<span class="hljs-string">&quot;v2.0.1&quot;</span>  <span class="hljs-comment"># tag name, or branch name, or commit hash</span>
<span class="hljs-meta">... </span>)`,wrap:!1}}),q=new G({props:{title:"Setup",local:"setup",headingTag:"h2"}}),A=new F({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:"huggingface-cli login",wrap:!1}}),D=new F({props:{code:"cGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1Yg==",highlighted:"pip install huggingface_hub",wrap:!1}}),O=new F({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`,wrap:!1}}),ee=new G({props:{title:"Convert a model for all frameworks",local:"convert-a-model-for-all-frameworks",headingTag:"h2"}}),U=new nl({props:{pytorch:!0,tensorflow:!0,jax:!0,$$slots:{jax:[Tl],tensorflow:[yl],pytorch:[gl]},$$scope:{ctx:j}}}),ae=new G({props:{title:"Push a model during training",local:"push-a-model-during-training",headingTag:"h2"}}),X=new nl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[kl],pytorch:[Ml]},$$scope:{ctx:j}}}),ne=new G({props:{title:"Use the push_to_hub function",local:"use-the-pushtohub-function",headingTag:"h2"}}),re=new F({props:{code:"cHRfbW9kZWwucHVzaF90b19odWIoJTIybXktYXdlc29tZS1tb2RlbCUyMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.push_to_hub(<span class="hljs-string">&quot;my-awesome-model&quot;</span>)',wrap:!1}}),me=new F({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZCglMjJ5b3VyX3VzZXJuYW1lJTJGbXktYXdlc29tZS1tb2RlbCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;your_username/my-awesome-model&quot;</span>)`,wrap:!1}}),ue=new F({props:{code:"cHRfbW9kZWwucHVzaF90b19odWIoJTIybXktYXdlc29tZS1vcmclMkZteS1hd2Vzb21lLW1vZGVsJTIyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.push_to_hub(<span class="hljs-string">&quot;my-awesome-org/my-awesome-model&quot;</span>)',wrap:!1}}),de=new F({props:{code:"dG9rZW5pemVyLnB1c2hfdG9faHViKCUyMm15LWF3ZXNvbWUtbW9kZWwlMjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.push_to_hub(<span class="hljs-string">&quot;my-awesome-model&quot;</span>)',wrap:!1}}),he=new F({props:{code:"dGZfbW9kZWwucHVzaF90b19odWIoJTIybXktYXdlc29tZS1tb2RlbCUyMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model.push_to_hub(<span class="hljs-string">&quot;my-awesome-model&quot;</span>)',wrap:!1}}),we=new G({props:{title:"Upload with the web interface",local:"upload-with-the-web-interface",headingTag:"h2"}}),ke=new G({props:{title:"Add a model card",local:"add-a-model-card",headingTag:"h2"}}),Ce=new cl({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_sharing.md"}}),{c(){n=d("meta"),p=o(),s=d("p"),i=o(),g(f.$$.fragment),m=o(),v=d("p"),v.textContent=W,H=o(),Z=d("p"),Z.innerHTML=h,k=o(),x=d("ul"),x.innerHTML=M,L=o(),C=d("iframe"),u=o(),g(J.$$.fragment),Le=o(),g(P.$$.fragment),Fe=o(),Y=d("p"),Y.textContent=jt,Ue=o(),z=d("p"),z.innerHTML=Ct,Xe=o(),V=d("p"),V.innerHTML=Wt,Re=o(),g(S.$$.fragment),Ge=o(),E=d("p"),E.textContent=Zt,Ie=o(),B=d("p"),B.innerHTML=xt,Pe=o(),g(q.$$.fragment),Ye=o(),Q=d("p"),Q.innerHTML=Lt,ze=o(),g(A.$$.fragment),Ve=o(),N=d("p"),N.innerHTML=Ft,Se=o(),g(D.$$.fragment),Ee=o(),K=d("p"),K.innerHTML=Ut,Be=o(),g(O.$$.fragment),qe=o(),g(ee.$$.fragment),Qe=o(),te=d("p"),te.textContent=Xt,Ae=o(),le=d("p"),le.innerHTML=Rt,Ne=o(),g(U.$$.fragment),De=o(),g(ae.$$.fragment),Ke=o(),g(X.$$.fragment),Oe=o(),g(ne.$$.fragment),et=o(),se=d("p"),se.innerHTML=Gt,tt=o(),oe=d("p"),oe.innerHTML=It,lt=o(),g(re.$$.fragment),at=o(),ie=d("p"),ie.innerHTML=Pt,nt=o(),g(me.$$.fragment),st=o(),pe=d("p"),pe.innerHTML=Yt,ot=o(),g(ue.$$.fragment),rt=o(),fe=d("p"),fe.innerHTML=zt,it=o(),g(de.$$.fragment),mt=o(),ce=d("p"),ce.textContent=Vt,pt=o(),g(he.$$.fragment),ut=o(),$e=d("p"),$e.innerHTML=St,ft=o(),ge=d("p"),ge.innerHTML=Et,dt=o(),g(we.$$.fragment),ct=o(),ye=d("p"),ye.innerHTML=Bt,ht=o(),be=d("p"),be.innerHTML=qt,$t=o(),Te=d("p"),Te.textContent=Qt,gt=o(),_e=d("ul"),_e.innerHTML=At,wt=o(),Me=d("p"),Me.innerHTML=Nt,yt=o(),ve=d("p"),ve.innerHTML=Dt,bt=o(),g(ke.$$.fragment),Tt=o(),He=d("p"),He.innerHTML=Kt,_t=o(),Je=d("ul"),Je.innerHTML=Ot,Mt=o(),je=d("p"),je.innerHTML=el,vt=o(),g(Ce.$$.fragment),kt=o(),Ze=d("p"),this.h()},l(e){const t=pl("svelte-u9bgzb",document.head);n=c(t,"META",{name:!0,content:!0}),t.forEach(l),p=r(e),s=c(e,"P",{}),Jt(s).forEach(l),i=r(e),w(f.$$.fragment,e),m=r(e),v=c(e,"P",{"data-svelte-h":!0}),$(v)!=="svelte-15mf9cm"&&(v.textContent=W),H=r(e),Z=c(e,"P",{"data-svelte-h":!0}),$(Z)!=="svelte-1oy12p9"&&(Z.innerHTML=h),k=r(e),x=c(e,"UL",{"data-svelte-h":!0}),$(x)!=="svelte-1yyi6js"&&(x.innerHTML=M),L=r(e),C=c(e,"IFRAME",{width:!0,height:!0,src:!0,title:!0,frameborder:!0,allow:!0}),Jt(C).forEach(l),u=r(e),w(J.$$.fragment,e),Le=r(e),w(P.$$.fragment,e),Fe=r(e),Y=c(e,"P",{"data-svelte-h":!0}),$(Y)!=="svelte-1cn28ug"&&(Y.textContent=jt),Ue=r(e),z=c(e,"P",{"data-svelte-h":!0}),$(z)!=="svelte-1ws64pt"&&(z.innerHTML=Ct),Xe=r(e),V=c(e,"P",{"data-svelte-h":!0}),$(V)!=="svelte-19e11vj"&&(V.innerHTML=Wt),Re=r(e),w(S.$$.fragment,e),Ge=r(e),E=c(e,"P",{"data-svelte-h":!0}),$(E)!=="svelte-1p8nvr9"&&(E.textContent=Zt),Ie=r(e),B=c(e,"P",{"data-svelte-h":!0}),$(B)!=="svelte-hnu2bf"&&(B.innerHTML=xt),Pe=r(e),w(q.$$.fragment,e),Ye=r(e),Q=c(e,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-16kxv5p"&&(Q.innerHTML=Lt),ze=r(e),w(A.$$.fragment,e),Ve=r(e),N=c(e,"P",{"data-svelte-h":!0}),$(N)!=="svelte-tjzd4u"&&(N.innerHTML=Ft),Se=r(e),w(D.$$.fragment,e),Ee=r(e),K=c(e,"P",{"data-svelte-h":!0}),$(K)!=="svelte-obyz8o"&&(K.innerHTML=Ut),Be=r(e),w(O.$$.fragment,e),qe=r(e),w(ee.$$.fragment,e),Qe=r(e),te=c(e,"P",{"data-svelte-h":!0}),$(te)!=="svelte-9ao4c4"&&(te.textContent=Xt),Ae=r(e),le=c(e,"P",{"data-svelte-h":!0}),$(le)!=="svelte-1d2jdhy"&&(le.innerHTML=Rt),Ne=r(e),w(U.$$.fragment,e),De=r(e),w(ae.$$.fragment,e),Ke=r(e),w(X.$$.fragment,e),Oe=r(e),w(ne.$$.fragment,e),et=r(e),se=c(e,"P",{"data-svelte-h":!0}),$(se)!=="svelte-1ajv3us"&&(se.innerHTML=Gt),tt=r(e),oe=c(e,"P",{"data-svelte-h":!0}),$(oe)!=="svelte-1k2vywi"&&(oe.innerHTML=It),lt=r(e),w(re.$$.fragment,e),at=r(e),ie=c(e,"P",{"data-svelte-h":!0}),$(ie)!=="svelte-1t06m9y"&&(ie.innerHTML=Pt),nt=r(e),w(me.$$.fragment,e),st=r(e),pe=c(e,"P",{"data-svelte-h":!0}),$(pe)!=="svelte-mi63rk"&&(pe.innerHTML=Yt),ot=r(e),w(ue.$$.fragment,e),rt=r(e),fe=c(e,"P",{"data-svelte-h":!0}),$(fe)!=="svelte-gpmj4u"&&(fe.innerHTML=zt),it=r(e),w(de.$$.fragment,e),mt=r(e),ce=c(e,"P",{"data-svelte-h":!0}),$(ce)!=="svelte-zov16a"&&(ce.textContent=Vt),pt=r(e),w(he.$$.fragment,e),ut=r(e),$e=c(e,"P",{"data-svelte-h":!0}),$($e)!=="svelte-1j1dvvi"&&($e.innerHTML=St),ft=r(e),ge=c(e,"P",{"data-svelte-h":!0}),$(ge)!=="svelte-1nvaa8l"&&(ge.innerHTML=Et),dt=r(e),w(we.$$.fragment,e),ct=r(e),ye=c(e,"P",{"data-svelte-h":!0}),$(ye)!=="svelte-fcl9f1"&&(ye.innerHTML=Bt),ht=r(e),be=c(e,"P",{"data-svelte-h":!0}),$(be)!=="svelte-ahj3l9"&&(be.innerHTML=qt),$t=r(e),Te=c(e,"P",{"data-svelte-h":!0}),$(Te)!=="svelte-xicbqw"&&(Te.textContent=Qt),gt=r(e),_e=c(e,"UL",{"data-svelte-h":!0}),$(_e)!=="svelte-lokm6g"&&(_e.innerHTML=At),wt=r(e),Me=c(e,"P",{"data-svelte-h":!0}),$(Me)!=="svelte-zmzt5c"&&(Me.innerHTML=Nt),yt=r(e),ve=c(e,"P",{"data-svelte-h":!0}),$(ve)!=="svelte-32sxm9"&&(ve.innerHTML=Dt),bt=r(e),w(ke.$$.fragment,e),Tt=r(e),He=c(e,"P",{"data-svelte-h":!0}),$(He)!=="svelte-11tnibt"&&(He.innerHTML=Kt),_t=r(e),Je=c(e,"UL",{"data-svelte-h":!0}),$(Je)!=="svelte-1rmq5mo"&&(Je.innerHTML=Ot),Mt=r(e),je=c(e,"P",{"data-svelte-h":!0}),$(je)!=="svelte-y7wqhm"&&(je.innerHTML=el),vt=r(e),w(Ce.$$.fragment,e),kt=r(e),Ze=c(e,"P",{}),Jt(Ze).forEach(l),this.h()},h(){R(n,"name","hf:doc:metadata"),R(n,"content",Jl),R(C,"width","560"),R(C,"height","315"),ol(C.src,I="https://www.youtube.com/embed/XvSGPZFEjDY")||R(C,"src",I),R(C,"title","YouTube video player"),R(C,"frameborder","0"),R(C,"allow",`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope;
picture-in-picture`),C.allowFullscreen=""},m(e,t){ul(document.head,n),a(e,p,t),a(e,s,t),a(e,i,t),y(f,e,t),a(e,m,t),a(e,v,t),a(e,H,t),a(e,Z,t),a(e,k,t),a(e,x,t),a(e,L,t),a(e,C,t),a(e,u,t),y(J,e,t),a(e,Le,t),y(P,e,t),a(e,Fe,t),a(e,Y,t),a(e,Ue,t),a(e,z,t),a(e,Xe,t),a(e,V,t),a(e,Re,t),y(S,e,t),a(e,Ge,t),a(e,E,t),a(e,Ie,t),a(e,B,t),a(e,Pe,t),y(q,e,t),a(e,Ye,t),a(e,Q,t),a(e,ze,t),y(A,e,t),a(e,Ve,t),a(e,N,t),a(e,Se,t),y(D,e,t),a(e,Ee,t),a(e,K,t),a(e,Be,t),y(O,e,t),a(e,qe,t),y(ee,e,t),a(e,Qe,t),a(e,te,t),a(e,Ae,t),a(e,le,t),a(e,Ne,t),y(U,e,t),a(e,De,t),y(ae,e,t),a(e,Ke,t),y(X,e,t),a(e,Oe,t),y(ne,e,t),a(e,et,t),a(e,se,t),a(e,tt,t),a(e,oe,t),a(e,lt,t),y(re,e,t),a(e,at,t),a(e,ie,t),a(e,nt,t),y(me,e,t),a(e,st,t),a(e,pe,t),a(e,ot,t),y(ue,e,t),a(e,rt,t),a(e,fe,t),a(e,it,t),y(de,e,t),a(e,mt,t),a(e,ce,t),a(e,pt,t),y(he,e,t),a(e,ut,t),a(e,$e,t),a(e,ft,t),a(e,ge,t),a(e,dt,t),y(we,e,t),a(e,ct,t),a(e,ye,t),a(e,ht,t),a(e,be,t),a(e,$t,t),a(e,Te,t),a(e,gt,t),a(e,_e,t),a(e,wt,t),a(e,Me,t),a(e,yt,t),a(e,ve,t),a(e,bt,t),y(ke,e,t),a(e,Tt,t),a(e,He,t),a(e,_t,t),a(e,Je,t),a(e,Mt,t),a(e,je,t),a(e,vt,t),y(Ce,e,t),a(e,kt,t),a(e,Ze,t),Ht=!0},p(e,[t]){const tl={};t&2&&(tl.$$scope={dirty:t,ctx:e}),J.$set(tl);const ll={};t&2&&(ll.$$scope={dirty:t,ctx:e}),U.$set(ll);const al={};t&2&&(al.$$scope={dirty:t,ctx:e}),X.$set(al)},i(e){Ht||(b(f.$$.fragment,e),b(J.$$.fragment,e),b(P.$$.fragment,e),b(S.$$.fragment,e),b(q.$$.fragment,e),b(A.$$.fragment,e),b(D.$$.fragment,e),b(O.$$.fragment,e),b(ee.$$.fragment,e),b(U.$$.fragment,e),b(ae.$$.fragment,e),b(X.$$.fragment,e),b(ne.$$.fragment,e),b(re.$$.fragment,e),b(me.$$.fragment,e),b(ue.$$.fragment,e),b(de.$$.fragment,e),b(he.$$.fragment,e),b(we.$$.fragment,e),b(ke.$$.fragment,e),b(Ce.$$.fragment,e),Ht=!0)},o(e){T(f.$$.fragment,e),T(J.$$.fragment,e),T(P.$$.fragment,e),T(S.$$.fragment,e),T(q.$$.fragment,e),T(A.$$.fragment,e),T(D.$$.fragment,e),T(O.$$.fragment,e),T(ee.$$.fragment,e),T(U.$$.fragment,e),T(ae.$$.fragment,e),T(X.$$.fragment,e),T(ne.$$.fragment,e),T(re.$$.fragment,e),T(me.$$.fragment,e),T(ue.$$.fragment,e),T(de.$$.fragment,e),T(he.$$.fragment,e),T(we.$$.fragment,e),T(ke.$$.fragment,e),T(Ce.$$.fragment,e),Ht=!1},d(e){e&&(l(p),l(s),l(i),l(m),l(v),l(H),l(Z),l(k),l(x),l(L),l(C),l(u),l(Le),l(Fe),l(Y),l(Ue),l(z),l(Xe),l(V),l(Re),l(Ge),l(E),l(Ie),l(B),l(Pe),l(Ye),l(Q),l(ze),l(Ve),l(N),l(Se),l(Ee),l(K),l(Be),l(qe),l(Qe),l(te),l(Ae),l(le),l(Ne),l(De),l(Ke),l(Oe),l(et),l(se),l(tt),l(oe),l(lt),l(at),l(ie),l(nt),l(st),l(pe),l(ot),l(rt),l(fe),l(it),l(mt),l(ce),l(pt),l(ut),l($e),l(ft),l(ge),l(dt),l(ct),l(ye),l(ht),l(be),l($t),l(Te),l(gt),l(_e),l(wt),l(Me),l(yt),l(ve),l(bt),l(Tt),l(He),l(_t),l(Je),l(Mt),l(je),l(vt),l(kt),l(Ze)),l(n),_(f,e),_(J,e),_(P,e),_(S,e),_(q,e),_(A,e),_(D,e),_(O,e),_(ee,e),_(U,e),_(ae,e),_(X,e),_(ne,e),_(re,e),_(me,e),_(ue,e),_(de,e),_(he,e),_(we,e),_(ke,e),_(Ce,e)}}}const Jl='{"title":"Share a model","local":"share-a-model","sections":[{"title":"Repository features","local":"repository-features","sections":[],"depth":2},{"title":"Setup","local":"setup","sections":[],"depth":2},{"title":"Convert a model for all frameworks","local":"convert-a-model-for-all-frameworks","sections":[],"depth":2},{"title":"Push a model during training","local":"push-a-model-during-training","sections":[],"depth":2},{"title":"Use the push_to_hub function","local":"use-the-pushtohub-function","sections":[],"depth":2},{"title":"Upload with the web interface","local":"upload-with-the-web-interface","sections":[],"depth":2},{"title":"Add a model card","local":"add-a-model-card","sections":[],"depth":2}],"depth":1}';function jl(j){return rl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xl extends il{constructor(n){super(),ml(this,n,jl,Hl,sl,{})}}export{Xl as component};
