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