import{s as ll,B as sl,o as nl,n as We}from"../chunks/scheduler.9991993c.js";import{S as al,i as rl,g as $,s as r,r as h,A as pl,h as c,f as l,c as p,j as Ht,u as b,x as d,k as G,y as il,a as s,v as w,d as _,t as M,w as T}from"../chunks/index.7fc9a5e7.js";import{T as ml}from"../chunks/Tip.9de92fc6.js";import{Y as ol}from"../chunks/Youtube.7934cf81.js";import{C as X}from"../chunks/CodeBlock.e11cba92.js";import{F as tl,M as Ze}from"../chunks/Markdown.87f31c7e.js";import{H as R,E as fl}from"../chunks/EditOnGithub.84ab7f0e.js";function ul(j){let n,o='要与社区共享模型，您需要在<a href="https://huggingface.co/join" rel="nofollow">huggingface.co</a>上拥有一个帐户。您还可以加入现有的组织或创建一个新的组织。';return{c(){n=$("p"),n.innerHTML=o},l(a){n=c(a,"P",{"data-svelte-h":!0}),d(n)!=="svelte-ono6xp"&&(n.innerHTML=o)},m(a,i){s(a,n,i)},p:We,d(a){a&&l(n)}}}function $l(j){let n,o="指定<code>from_tf=True</code>将checkpoint从TensorFlow转换为PyTorch。",a,i,u;return i=new X({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=$("p"),n.innerHTML=o,a=r(),h(i.$$.fragment)},l(m){n=c(m,"P",{"data-svelte-h":!0}),d(n)!=="svelte-xo84fy"&&(n.innerHTML=o),a=p(m),b(i.$$.fragment,m)},m(m,v){s(m,n,v),s(m,a,v),w(i,m,v),u=!0},p:We,i(m){u||(_(i.$$.fragment,m),u=!0)},o(m){M(i.$$.fragment,m),u=!1},d(m){m&&(l(n),l(a)),T(i,m)}}}function cl(j){let n,o;return n=new Ze({props:{$$slots:{default:[$l]},$$scope:{ctx:j}}}),{c(){h(n.$$.fragment)},l(a){b(n.$$.fragment,a)},m(a,i){w(n,a,i),o=!0},p(a,i){const u={};i&2&&(u.$$scope={dirty:i,ctx:a}),n.$set(u)},i(a){o||(_(n.$$.fragment,a),o=!0)},o(a){M(n.$$.fragment,a),o=!1},d(a){T(n,a)}}}function gl(j){let n,o="指定<code>from_pt=True</code>将checkpoint从PyTorch转换为TensorFlow。",a,i,u,m,v="然后，您可以使用新的checkpoint保存您的新TensorFlow模型：",C,k,Z;return i=new X({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}}),k=new X({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=$("p"),n.innerHTML=o,a=r(),h(i.$$.fragment),u=r(),m=$("p"),m.textContent=v,C=r(),h(k.$$.fragment)},l(g){n=c(g,"P",{"data-svelte-h":!0}),d(n)!=="svelte-6zl8ge"&&(n.innerHTML=o),a=p(g),b(i.$$.fragment,g),u=p(g),m=c(g,"P",{"data-svelte-h":!0}),d(m)!=="svelte-pq7zsz"&&(m.textContent=v),C=p(g),b(k.$$.fragment,g)},m(g,H){s(g,n,H),s(g,a,H),w(i,g,H),s(g,u,H),s(g,m,H),s(g,C,H),w(k,g,H),Z=!0},p:We,i(g){Z||(_(i.$$.fragment,g),_(k.$$.fragment,g),Z=!0)},o(g){M(i.$$.fragment,g),M(k.$$.fragment,g),Z=!1},d(g){g&&(l(n),l(a),l(u),l(m),l(C)),T(i,g),T(k,g)}}}function dl(j){let n,o;return n=new Ze({props:{$$slots:{default:[gl]},$$scope:{ctx:j}}}),{c(){h(n.$$.fragment)},l(a){b(n.$$.fragment,a)},m(a,i){w(n,a,i),o=!0},p(a,i){const u={};i&2&&(u.$$scope={dirty:i,ctx:a}),n.$set(u)},i(a){o||(_(n.$$.fragment,a),o=!0)},o(a){M(n.$$.fragment,a),o=!1},d(a){T(n,a)}}}function hl(j){let n,o="如果模型在Flax中可用，您还可以将PyTorch checkpoint转换为Flax：",a,i,u;return i=new X({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=$("p"),n.textContent=o,a=r(),h(i.$$.fragment)},l(m){n=c(m,"P",{"data-svelte-h":!0}),d(n)!=="svelte-4ux5nj"&&(n.textContent=o),a=p(m),b(i.$$.fragment,m)},m(m,v){s(m,n,v),s(m,a,v),w(i,m,v),u=!0},p:We,i(m){u||(_(i.$$.fragment,m),u=!0)},o(m){M(i.$$.fragment,m),u=!1},d(m){m&&(l(n),l(a)),T(i,m)}}}function bl(j){let n,o;return n=new Ze({props:{$$slots:{default:[hl]},$$scope:{ctx:j}}}),{c(){h(n.$$.fragment)},l(a){b(n.$$.fragment,a)},m(a,i){w(n,a,i),o=!0},p(a,i){const u={};i&2&&(u.$$scope={dirty:i,ctx:a}),n.$set(u)},i(a){o||(_(n.$$.fragment,a),o=!0)},o(a){M(n.$$.fragment,a),o=!1},d(a){T(n,a)}}}function wl(j){let n,o,a,i='将模型分享到Hub就像添加一个额外的参数或回调函数一样简单。请记住，在<a href="training">微调教程</a>中，<code>TrainingArguments</code>类是您指定超参数和附加训练选项的地方。其中一项训练选项包括直接将模型推送到Hub的能力。在您的<code>TrainingArguments</code>中设置<code>push_to_hub=True</code>：',u,m,v,C,k="像往常一样将您的训练参数传递给<code>Trainer</code>：",Z,g,H,x,y="在您微调完模型后，在<code>Trainer</code>上调用<code>push_to_hub()</code>将训练好的模型推送到Hub。🤗 Transformers甚至会自动将训练超参数、训练结果和框架版本添加到你的模型卡片中！",L,W,Y;return n=new ol({props:{id:"Z1-XMy-GNLQ"}}),m=new X({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}}),g=new X({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}}),W=new X({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){h(n.$$.fragment),o=r(),a=$("p"),a.innerHTML=i,u=r(),h(m.$$.fragment),v=r(),C=$("p"),C.innerHTML=k,Z=r(),h(g.$$.fragment),H=r(),x=$("p"),x.innerHTML=y,L=r(),h(W.$$.fragment)},l(f){b(n.$$.fragment,f),o=p(f),a=c(f,"P",{"data-svelte-h":!0}),d(a)!=="svelte-1rm1fnz"&&(a.innerHTML=i),u=p(f),b(m.$$.fragment,f),v=p(f),C=c(f,"P",{"data-svelte-h":!0}),d(C)!=="svelte-o485dv"&&(C.innerHTML=k),Z=p(f),b(g.$$.fragment,f),H=p(f),x=c(f,"P",{"data-svelte-h":!0}),d(x)!=="svelte-1ue1tej"&&(x.innerHTML=y),L=p(f),b(W.$$.fragment,f)},m(f,J){w(n,f,J),s(f,o,J),s(f,a,J),s(f,u,J),w(m,f,J),s(f,v,J),s(f,C,J),s(f,Z,J),w(g,f,J),s(f,H,J),s(f,x,J),s(f,L,J),w(W,f,J),Y=!0},p:We,i(f){Y||(_(n.$$.fragment,f),_(m.$$.fragment,f),_(g.$$.fragment,f),_(W.$$.fragment,f),Y=!0)},o(f){M(n.$$.fragment,f),M(m.$$.fragment,f),M(g.$$.fragment,f),M(W.$$.fragment,f),Y=!1},d(f){f&&(l(o),l(a),l(u),l(v),l(C),l(Z),l(H),l(x),l(L)),T(n,f),T(m,f),T(g,f),T(W,f)}}}function _l(j){let n,o;return n=new Ze({props:{$$slots:{default:[wl]},$$scope:{ctx:j}}}),{c(){h(n.$$.fragment)},l(a){b(n.$$.fragment,a)},m(a,i){w(n,a,i),o=!0},p(a,i){const u={};i&2&&(u.$$scope={dirty:i,ctx:a}),n.$set(u)},i(a){o||(_(n.$$.fragment,a),o=!0)},o(a){M(n.$$.fragment,a),o=!1},d(a){T(n,a)}}}function Ml(j){let n,o='使用<a href="/docs/transformers/pr_29969/zh/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>将模型分享到Hub。在<a href="/docs/transformers/pr_29969/zh/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>函数中，添加以下内容：',a,i,u="<li>一个用于存储模型的输出目录。</li> <li>一个tokenizer。</li> <li><code>hub_model_id</code>，即您的Hub用户名和模型名称。</li>",m,v,C,k,Z='将回调函数添加到 <a href="https://keras.io/api/models/model_training_apis/" rel="nofollow"><code>fit</code></a>中，然后🤗 Transformers 会将训练好的模型推送到 Hub：',g,H,x;return v=new X({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}}),H=new X({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=$("p"),n.innerHTML=o,a=r(),i=$("ul"),i.innerHTML=u,m=r(),h(v.$$.fragment),C=r(),k=$("p"),k.innerHTML=Z,g=r(),h(H.$$.fragment)},l(y){n=c(y,"P",{"data-svelte-h":!0}),d(n)!=="svelte-6ndf1e"&&(n.innerHTML=o),a=p(y),i=c(y,"UL",{"data-svelte-h":!0}),d(i)!=="svelte-fhkhez"&&(i.innerHTML=u),m=p(y),b(v.$$.fragment,y),C=p(y),k=c(y,"P",{"data-svelte-h":!0}),d(k)!=="svelte-1jsduku"&&(k.innerHTML=Z),g=p(y),b(H.$$.fragment,y)},m(y,L){s(y,n,L),s(y,a,L),s(y,i,L),s(y,m,L),w(v,y,L),s(y,C,L),s(y,k,L),s(y,g,L),w(H,y,L),x=!0},p:We,i(y){x||(_(v.$$.fragment,y),_(H.$$.fragment,y),x=!0)},o(y){M(v.$$.fragment,y),M(H.$$.fragment,y),x=!1},d(y){y&&(l(n),l(a),l(i),l(m),l(C),l(k),l(g)),T(v,y),T(H,y)}}}function Tl(j){let n,o;return n=new Ze({props:{$$slots:{default:[Ml]},$$scope:{ctx:j}}}),{c(){h(n.$$.fragment)},l(a){b(n.$$.fragment,a)},m(a,i){w(n,a,i),o=!0},p(a,i){const u={};i&2&&(u.$$scope={dirty:i,ctx:a}),n.$set(u)},i(a){o||(_(n.$$.fragment,a),o=!0)},o(a){M(n.$$.fragment,a),o=!1},d(a){T(n,a)}}}function yl(j){let n,o,a,i,u,m,v,C="最后两个教程展示了如何使用PyTorch、Keras和 🤗 Accelerate进行分布式设置来微调模型。下一步是将您的模型与社区分享！在Hugging Face，我们相信公开分享知识和资源，能实现人工智能的普及化，让每个人都能受益。我们鼓励您将您的模型与社区分享，以帮助他人节省时间和精力。",k,Z,g='在本教程中，您将学习两种在<a href="https://huggingface.co/models" rel="nofollow">Model Hub</a>上共享训练好的或微调的模型的方法：',H,x,y="<li>通过编程将文件推送到Hub。</li> <li>使用Web界面将文件拖放到Hub。</li>",L,W,Y,f,J,xe,I,Le,P,kt="Model Hub上的每个仓库都像是一个典型的GitHub仓库。我们的仓库提供版本控制、提交历史记录以及可视化差异的能力。",Xe,z,Jt='Model Hub的内置版本控制基于git和<a href="https://git-lfs.github.com/" rel="nofollow">git-lfs</a>。换句话说，您可以将一个模型视为一个仓库，从而实现更好的访问控制和可扩展性。版本控制允许使用<em>修订</em>方法来固定特定版本的模型，可以使用提交哈希值、标签或分支来标记。',Fe,V,jt="因此，您可以通过<code>revision</code>参数加载特定的模型版本：",Ue,B,Ge,E,Wt=`文件也可以轻松地在仓库中编辑，您可以查看提交历史记录以及差异：
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/vis_diff.png" alt="vis_diff"/>`,Re,q,Ye,Q,Ct="在将模型共享到Hub之前，您需要拥有Hugging Face的凭证。如果您有访问终端的权限，请在安装🤗 Transformers的虚拟环境中运行以下命令。这将在您的Hugging Face缓存文件夹（默认为<code>~/.cache/</code>）中存储您的<code>access token</code>：",Ie,S,Pe,N,Zt='如果您正在使用像Jupyter或Colaboratory这样的<code>notebook</code>，请确保您已安装了<a href="https://huggingface.co/docs/hub/adding-a-library" rel="nofollow"><code>huggingface_hub</code></a>库。该库允许您以编程方式与Hub进行交互。',ze,A,Ve,D,xt='然后使用<code>notebook_login</code>登录到Hub，并按照<a href="https://huggingface.co/settings/token" rel="nofollow">这里</a>的链接生成一个token进行登录：',Be,K,Ee,O,qe,ee,Lt="为确保您的模型可以被使用不同框架的人使用，我们建议您将PyTorch和TensorFlow <code>checkpoints</code>都转换并上传。如果您跳过此步骤，用户仍然可以从其他框架加载您的模型，但速度会变慢，因为🤗 Transformers需要实时转换<code>checkpoints</code>。",Qe,te,Xt='为另一个框架转换<code>checkpoints</code>很容易。确保您已安装PyTorch和TensorFlow（请参阅<a href="installation">此处</a>的安装说明），然后在其他框架中找到适合您任务的特定模型。',Se,F,Ne,le,Ae,U,De,se,Ke,ne,Ft="您可以直接在您的模型上调用<code>push_to_hub</code>来将其上传到Hub。",Oe,ae,Ut="在<code>push_to_hub</code>中指定你的模型名称：",et,re,tt,pe,Gt="这会在您的用户名下创建一个名为<code>my-awesome-model</code>的仓库。用户现在可以使用<code>from_pretrained</code>函数加载您的模型：",lt,ie,st,me,Rt="如果您属于一个组织，并希望将您的模型推送到组织名称下，只需将其添加到<code>repo_id</code>中：",nt,oe,at,fe,Yt="<code>push_to_hub</code>函数还可以用于向模型仓库添加其他文件。例如，向模型仓库中添加一个<code>tokenizer</code>：",rt,ue,pt,$e,It="或者，您可能希望将您的微调后的PyTorch模型的TensorFlow版本添加进去：",it,ce,mt,ge,Pt="现在，当您导航到您的Hugging Face个人资料时，您应该看到您新创建的模型仓库。点击<strong>文件</strong>选项卡将显示您已上传到仓库的所有文件。",ot,de,zt='有关如何创建和上传文件到仓库的更多详细信息，请参考Hub文档<a href="https://huggingface.co/docs/hub/how-to-upstream" rel="nofollow">这里</a>。',ft,he,ut,be,Vt='喜欢无代码方法的用户可以通过Hugging Face的Web界面上传模型。访问<a href="https://huggingface.co/new" rel="nofollow">huggingface.co/new</a>创建一个新的仓库：',$t,we,Bt='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/new_model_repo.png" alt="new_model_repo"/>',ct,_e,Et="从这里开始，添加一些关于您的模型的信息：",gt,Me,qt="<li>选择仓库的<strong>所有者</strong>。这可以是您本人或者您所属的任何组织。</li> <li>为您的项目选择一个名称，该名称也将成为仓库的名称。</li> <li>选择您的模型是公开还是私有。</li> <li>指定您的模型的许可证使用情况。</li>",dt,Te,Qt="现在点击<strong>文件</strong>选项卡，然后点击<strong>添加文件</strong>按钮将一个新文件上传到你的仓库。接着拖放一个文件进行上传，并添加提交信息。",ht,ye,St='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/upload_file.png" alt="upload_file"/>',bt,ve,wt,He,Nt="为了确保用户了解您的模型的能力、限制、潜在偏差和伦理考虑，请在仓库中添加一个模型卡片。模型卡片在<code>README.md</code>文件中定义。你可以通过以下方式添加模型卡片：",_t,ke,At="<li>手动创建并上传一个<code>README.md</code>文件。</li> <li>在你的模型仓库中点击<strong>编辑模型卡片</strong>按钮。</li>",Mt,Je,Dt='可以参考DistilBert的<a href="https://huggingface.co/distilbert/distilbert-base-uncased" rel="nofollow">模型卡片</a>来了解模型卡片应该包含的信息类型。有关您可以在<code>README.md</code>文件中控制的更多选项的细节，例如模型的碳足迹或小部件示例，请参考文档<a href="https://huggingface.co/docs/hub/models-cards" rel="nofollow">这里</a>。',Tt,je,yt,Ce,vt;return u=new R({props:{title:"分享模型",local:"分享模型",headingTag:"h1"}}),J=new ml({props:{$$slots:{default:[ul]},$$scope:{ctx:j}}}),I=new R({props:{title:"仓库功能",local:"仓库功能",headingTag:"h2"}}),B=new X({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 R({props:{title:"设置",local:"设置",headingTag:"h2"}}),S=new X({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:"huggingface-cli login",wrap:!1}}),A=new X({props:{code:"cGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1Yg==",highlighted:"pip install huggingface_hub",wrap:!1}}),K=new X({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}}),O=new R({props:{title:"转换模型适用于所有框架",local:"转换模型适用于所有框架",headingTag:"h2"}}),F=new tl({props:{pytorch:!0,tensorflow:!0,jax:!0,$$slots:{jax:[bl],tensorflow:[dl],pytorch:[cl]},$$scope:{ctx:j}}}),le=new R({props:{title:"在训练过程中推送模型",local:"在训练过程中推送模型",headingTag:"h2"}}),U=new tl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Tl],pytorch:[_l]},$$scope:{ctx:j}}}),se=new R({props:{title:"使用 push_to_hub 功能",local:"使用-pushtohub-功能",headingTag:"h2"}}),re=new X({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}}),ie=new X({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}}),oe=new X({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}}),ue=new X({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}}),ce=new X({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}}),he=new R({props:{title:"使用Web界面上传",local:"使用web界面上传",headingTag:"h2"}}),ve=new R({props:{title:"添加模型卡片",local:"添加模型卡片",headingTag:"h2"}}),je=new fl({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/model_sharing.md"}}),{c(){n=$("meta"),o=r(),a=$("p"),i=r(),h(u.$$.fragment),m=r(),v=$("p"),v.textContent=C,k=r(),Z=$("p"),Z.innerHTML=g,H=r(),x=$("ul"),x.innerHTML=y,L=r(),W=$("iframe"),f=r(),h(J.$$.fragment),xe=r(),h(I.$$.fragment),Le=r(),P=$("p"),P.textContent=kt,Xe=r(),z=$("p"),z.innerHTML=Jt,Fe=r(),V=$("p"),V.innerHTML=jt,Ue=r(),h(B.$$.fragment),Ge=r(),E=$("p"),E.innerHTML=Wt,Re=r(),h(q.$$.fragment),Ye=r(),Q=$("p"),Q.innerHTML=Ct,Ie=r(),h(S.$$.fragment),Pe=r(),N=$("p"),N.innerHTML=Zt,ze=r(),h(A.$$.fragment),Ve=r(),D=$("p"),D.innerHTML=xt,Be=r(),h(K.$$.fragment),Ee=r(),h(O.$$.fragment),qe=r(),ee=$("p"),ee.innerHTML=Lt,Qe=r(),te=$("p"),te.innerHTML=Xt,Se=r(),h(F.$$.fragment),Ne=r(),h(le.$$.fragment),Ae=r(),h(U.$$.fragment),De=r(),h(se.$$.fragment),Ke=r(),ne=$("p"),ne.innerHTML=Ft,Oe=r(),ae=$("p"),ae.innerHTML=Ut,et=r(),h(re.$$.fragment),tt=r(),pe=$("p"),pe.innerHTML=Gt,lt=r(),h(ie.$$.fragment),st=r(),me=$("p"),me.innerHTML=Rt,nt=r(),h(oe.$$.fragment),at=r(),fe=$("p"),fe.innerHTML=Yt,rt=r(),h(ue.$$.fragment),pt=r(),$e=$("p"),$e.textContent=It,it=r(),h(ce.$$.fragment),mt=r(),ge=$("p"),ge.innerHTML=Pt,ot=r(),de=$("p"),de.innerHTML=zt,ft=r(),h(he.$$.fragment),ut=r(),be=$("p"),be.innerHTML=Vt,$t=r(),we=$("p"),we.innerHTML=Bt,ct=r(),_e=$("p"),_e.textContent=Et,gt=r(),Me=$("ul"),Me.innerHTML=qt,dt=r(),Te=$("p"),Te.innerHTML=Qt,ht=r(),ye=$("p"),ye.innerHTML=St,bt=r(),h(ve.$$.fragment),wt=r(),He=$("p"),He.innerHTML=Nt,_t=r(),ke=$("ul"),ke.innerHTML=At,Mt=r(),Je=$("p"),Je.innerHTML=Dt,Tt=r(),h(je.$$.fragment),yt=r(),Ce=$("p"),this.h()},l(e){const t=pl("svelte-u9bgzb",document.head);n=c(t,"META",{name:!0,content:!0}),t.forEach(l),o=p(e),a=c(e,"P",{}),Ht(a).forEach(l),i=p(e),b(u.$$.fragment,e),m=p(e),v=c(e,"P",{"data-svelte-h":!0}),d(v)!=="svelte-1lrbw37"&&(v.textContent=C),k=p(e),Z=c(e,"P",{"data-svelte-h":!0}),d(Z)!=="svelte-1ngdd1j"&&(Z.innerHTML=g),H=p(e),x=c(e,"UL",{"data-svelte-h":!0}),d(x)!=="svelte-10ieul4"&&(x.innerHTML=y),L=p(e),W=c(e,"IFRAME",{width:!0,height:!0,src:!0,title:!0,frameborder:!0,allow:!0}),Ht(W).forEach(l),f=p(e),b(J.$$.fragment,e),xe=p(e),b(I.$$.fragment,e),Le=p(e),P=c(e,"P",{"data-svelte-h":!0}),d(P)!=="svelte-1tq2211"&&(P.textContent=kt),Xe=p(e),z=c(e,"P",{"data-svelte-h":!0}),d(z)!=="svelte-raj8tg"&&(z.innerHTML=Jt),Fe=p(e),V=c(e,"P",{"data-svelte-h":!0}),d(V)!=="svelte-18uingj"&&(V.innerHTML=jt),Ue=p(e),b(B.$$.fragment,e),Ge=p(e),E=c(e,"P",{"data-svelte-h":!0}),d(E)!=="svelte-1xr00h4"&&(E.innerHTML=Wt),Re=p(e),b(q.$$.fragment,e),Ye=p(e),Q=c(e,"P",{"data-svelte-h":!0}),d(Q)!=="svelte-i2egdw"&&(Q.innerHTML=Ct),Ie=p(e),b(S.$$.fragment,e),Pe=p(e),N=c(e,"P",{"data-svelte-h":!0}),d(N)!=="svelte-1478bsi"&&(N.innerHTML=Zt),ze=p(e),b(A.$$.fragment,e),Ve=p(e),D=c(e,"P",{"data-svelte-h":!0}),d(D)!=="svelte-13ab6wt"&&(D.innerHTML=xt),Be=p(e),b(K.$$.fragment,e),Ee=p(e),b(O.$$.fragment,e),qe=p(e),ee=c(e,"P",{"data-svelte-h":!0}),d(ee)!=="svelte-7eiomo"&&(ee.innerHTML=Lt),Qe=p(e),te=c(e,"P",{"data-svelte-h":!0}),d(te)!=="svelte-gmjuq7"&&(te.innerHTML=Xt),Se=p(e),b(F.$$.fragment,e),Ne=p(e),b(le.$$.fragment,e),Ae=p(e),b(U.$$.fragment,e),De=p(e),b(se.$$.fragment,e),Ke=p(e),ne=c(e,"P",{"data-svelte-h":!0}),d(ne)!=="svelte-ujezx5"&&(ne.innerHTML=Ft),Oe=p(e),ae=c(e,"P",{"data-svelte-h":!0}),d(ae)!=="svelte-1wb81no"&&(ae.innerHTML=Ut),et=p(e),b(re.$$.fragment,e),tt=p(e),pe=c(e,"P",{"data-svelte-h":!0}),d(pe)!=="svelte-1hzdr71"&&(pe.innerHTML=Gt),lt=p(e),b(ie.$$.fragment,e),st=p(e),me=c(e,"P",{"data-svelte-h":!0}),d(me)!=="svelte-1yu3blb"&&(me.innerHTML=Rt),nt=p(e),b(oe.$$.fragment,e),at=p(e),fe=c(e,"P",{"data-svelte-h":!0}),d(fe)!=="svelte-1xep3s3"&&(fe.innerHTML=Yt),rt=p(e),b(ue.$$.fragment,e),pt=p(e),$e=c(e,"P",{"data-svelte-h":!0}),d($e)!=="svelte-1pi5y8c"&&($e.textContent=It),it=p(e),b(ce.$$.fragment,e),mt=p(e),ge=c(e,"P",{"data-svelte-h":!0}),d(ge)!=="svelte-19x4nvo"&&(ge.innerHTML=Pt),ot=p(e),de=c(e,"P",{"data-svelte-h":!0}),d(de)!=="svelte-1v6g4m4"&&(de.innerHTML=zt),ft=p(e),b(he.$$.fragment,e),ut=p(e),be=c(e,"P",{"data-svelte-h":!0}),d(be)!=="svelte-1bqr08y"&&(be.innerHTML=Vt),$t=p(e),we=c(e,"P",{"data-svelte-h":!0}),d(we)!=="svelte-ahj3l9"&&(we.innerHTML=Bt),ct=p(e),_e=c(e,"P",{"data-svelte-h":!0}),d(_e)!=="svelte-smtcxl"&&(_e.textContent=Et),gt=p(e),Me=c(e,"UL",{"data-svelte-h":!0}),d(Me)!=="svelte-1v8tvof"&&(Me.innerHTML=qt),dt=p(e),Te=c(e,"P",{"data-svelte-h":!0}),d(Te)!=="svelte-az8tmc"&&(Te.innerHTML=Qt),ht=p(e),ye=c(e,"P",{"data-svelte-h":!0}),d(ye)!=="svelte-32sxm9"&&(ye.innerHTML=St),bt=p(e),b(ve.$$.fragment,e),wt=p(e),He=c(e,"P",{"data-svelte-h":!0}),d(He)!=="svelte-146w62k"&&(He.innerHTML=Nt),_t=p(e),ke=c(e,"UL",{"data-svelte-h":!0}),d(ke)!=="svelte-9wha7n"&&(ke.innerHTML=At),Mt=p(e),Je=c(e,"P",{"data-svelte-h":!0}),d(Je)!=="svelte-8av605"&&(Je.innerHTML=Dt),Tt=p(e),b(je.$$.fragment,e),yt=p(e),Ce=c(e,"P",{}),Ht(Ce).forEach(l),this.h()},h(){G(n,"name","hf:doc:metadata"),G(n,"content",vl),G(W,"width","560"),G(W,"height","315"),sl(W.src,Y="https://www.youtube.com/embed/XvSGPZFEjDY")||G(W,"src",Y),G(W,"title","YouTube video player"),G(W,"frameborder","0"),G(W,"allow",`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope;
picture-in-picture`),W.allowFullscreen=""},m(e,t){il(document.head,n),s(e,o,t),s(e,a,t),s(e,i,t),w(u,e,t),s(e,m,t),s(e,v,t),s(e,k,t),s(e,Z,t),s(e,H,t),s(e,x,t),s(e,L,t),s(e,W,t),s(e,f,t),w(J,e,t),s(e,xe,t),w(I,e,t),s(e,Le,t),s(e,P,t),s(e,Xe,t),s(e,z,t),s(e,Fe,t),s(e,V,t),s(e,Ue,t),w(B,e,t),s(e,Ge,t),s(e,E,t),s(e,Re,t),w(q,e,t),s(e,Ye,t),s(e,Q,t),s(e,Ie,t),w(S,e,t),s(e,Pe,t),s(e,N,t),s(e,ze,t),w(A,e,t),s(e,Ve,t),s(e,D,t),s(e,Be,t),w(K,e,t),s(e,Ee,t),w(O,e,t),s(e,qe,t),s(e,ee,t),s(e,Qe,t),s(e,te,t),s(e,Se,t),w(F,e,t),s(e,Ne,t),w(le,e,t),s(e,Ae,t),w(U,e,t),s(e,De,t),w(se,e,t),s(e,Ke,t),s(e,ne,t),s(e,Oe,t),s(e,ae,t),s(e,et,t),w(re,e,t),s(e,tt,t),s(e,pe,t),s(e,lt,t),w(ie,e,t),s(e,st,t),s(e,me,t),s(e,nt,t),w(oe,e,t),s(e,at,t),s(e,fe,t),s(e,rt,t),w(ue,e,t),s(e,pt,t),s(e,$e,t),s(e,it,t),w(ce,e,t),s(e,mt,t),s(e,ge,t),s(e,ot,t),s(e,de,t),s(e,ft,t),w(he,e,t),s(e,ut,t),s(e,be,t),s(e,$t,t),s(e,we,t),s(e,ct,t),s(e,_e,t),s(e,gt,t),s(e,Me,t),s(e,dt,t),s(e,Te,t),s(e,ht,t),s(e,ye,t),s(e,bt,t),w(ve,e,t),s(e,wt,t),s(e,He,t),s(e,_t,t),s(e,ke,t),s(e,Mt,t),s(e,Je,t),s(e,Tt,t),w(je,e,t),s(e,yt,t),s(e,Ce,t),vt=!0},p(e,[t]){const Kt={};t&2&&(Kt.$$scope={dirty:t,ctx:e}),J.$set(Kt);const Ot={};t&2&&(Ot.$$scope={dirty:t,ctx:e}),F.$set(Ot);const el={};t&2&&(el.$$scope={dirty:t,ctx:e}),U.$set(el)},i(e){vt||(_(u.$$.fragment,e),_(J.$$.fragment,e),_(I.$$.fragment,e),_(B.$$.fragment,e),_(q.$$.fragment,e),_(S.$$.fragment,e),_(A.$$.fragment,e),_(K.$$.fragment,e),_(O.$$.fragment,e),_(F.$$.fragment,e),_(le.$$.fragment,e),_(U.$$.fragment,e),_(se.$$.fragment,e),_(re.$$.fragment,e),_(ie.$$.fragment,e),_(oe.$$.fragment,e),_(ue.$$.fragment,e),_(ce.$$.fragment,e),_(he.$$.fragment,e),_(ve.$$.fragment,e),_(je.$$.fragment,e),vt=!0)},o(e){M(u.$$.fragment,e),M(J.$$.fragment,e),M(I.$$.fragment,e),M(B.$$.fragment,e),M(q.$$.fragment,e),M(S.$$.fragment,e),M(A.$$.fragment,e),M(K.$$.fragment,e),M(O.$$.fragment,e),M(F.$$.fragment,e),M(le.$$.fragment,e),M(U.$$.fragment,e),M(se.$$.fragment,e),M(re.$$.fragment,e),M(ie.$$.fragment,e),M(oe.$$.fragment,e),M(ue.$$.fragment,e),M(ce.$$.fragment,e),M(he.$$.fragment,e),M(ve.$$.fragment,e),M(je.$$.fragment,e),vt=!1},d(e){e&&(l(o),l(a),l(i),l(m),l(v),l(k),l(Z),l(H),l(x),l(L),l(W),l(f),l(xe),l(Le),l(P),l(Xe),l(z),l(Fe),l(V),l(Ue),l(Ge),l(E),l(Re),l(Ye),l(Q),l(Ie),l(Pe),l(N),l(ze),l(Ve),l(D),l(Be),l(Ee),l(qe),l(ee),l(Qe),l(te),l(Se),l(Ne),l(Ae),l(De),l(Ke),l(ne),l(Oe),l(ae),l(et),l(tt),l(pe),l(lt),l(st),l(me),l(nt),l(at),l(fe),l(rt),l(pt),l($e),l(it),l(mt),l(ge),l(ot),l(de),l(ft),l(ut),l(be),l($t),l(we),l(ct),l(_e),l(gt),l(Me),l(dt),l(Te),l(ht),l(ye),l(bt),l(wt),l(He),l(_t),l(ke),l(Mt),l(Je),l(Tt),l(yt),l(Ce)),l(n),T(u,e),T(J,e),T(I,e),T(B,e),T(q,e),T(S,e),T(A,e),T(K,e),T(O,e),T(F,e),T(le,e),T(U,e),T(se,e),T(re,e),T(ie,e),T(oe,e),T(ue,e),T(ce,e),T(he,e),T(ve,e),T(je,e)}}}const vl='{"title":"分享模型","local":"分享模型","sections":[{"title":"仓库功能","local":"仓库功能","sections":[],"depth":2},{"title":"设置","local":"设置","sections":[],"depth":2},{"title":"转换模型适用于所有框架","local":"转换模型适用于所有框架","sections":[],"depth":2},{"title":"在训练过程中推送模型","local":"在训练过程中推送模型","sections":[],"depth":2},{"title":"使用 push_to_hub 功能","local":"使用-pushtohub-功能","sections":[],"depth":2},{"title":"使用Web界面上传","local":"使用web界面上传","sections":[],"depth":2},{"title":"添加模型卡片","local":"添加模型卡片","sections":[],"depth":2}],"depth":1}';function Hl(j){return nl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ll extends al{constructor(n){super(),rl(this,n,Hl,yl,ll,{})}}export{Ll as component};
