import{s as yl,o as hl,n as Ge}from"../chunks/scheduler.9991993c.js";import{S as dl,i as Ul,g as o,s as r,r as c,A as _l,h as f,f as l,c as s,j as wl,u as w,x as d,k as Jl,y as jl,a,v as J,d as T,t as y,w as h}from"../chunks/index.ed60ef0f.js";import{C as _}from"../chunks/CodeBlock.a73b7ee1.js";import{F as Tl,M as Le}from"../chunks/Markdown.ebaf2587.js";import{H as g,E as gl}from"../chunks/EditOnGithub.ba269039.js";function $l(j){let n,u='示例脚本从🤗 <a href="https://huggingface.co/docs/datasets/" rel="nofollow">Datasets</a>库下载并预处理数据集。然后，脚本通过<a href="https://huggingface.co/docs/transformers/main_classes/trainer" rel="nofollow">Trainer</a>使用支持摘要任务的架构对数据集进行微调。以下示例展示了如何在<a href="https://huggingface.co/datasets/cnn_dailymail" rel="nofollow">CNN/DailyMail</a>数据集上微调<a href="https://huggingface.co/google-t5/t5-small" rel="nofollow">T5-small</a>。由于T5模型的训练方式，它需要一个额外的<code>source_prefix</code>参数。这个提示让T5知道这是一个摘要任务。',i,m,p;return m=new _({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfbmFtZSUyMGNubl9kYWlseW1haWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfY29uZmlnJTIwJTIyMy4wLjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXNvdXJjZV9wcmVmaXglMjAlMjJzdW1tYXJpemUlM0ElMjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW91dHB1dF9kaXIlMjAlMkZ0bXAlMkZ0c3Qtc3VtbWFyaXphdGlvbiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0Q0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdmVyd3JpdGVfb3V0cHV0X2RpciUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHJlZGljdF93aXRoX2dlbmVyYXRl",highlighted:`python examples/pytorch/summarization/run_summarization.py \\
    --model_name_or_path google-t5/t5-small \\
    --do_train \\
    --do_eval \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --output_dir /tmp/tst-summarization \\
    --per_device_train_batch_size=4 \\
    --per_device_eval_batch_size=4 \\
    --overwrite_output_dir \\
    --predict_with_generate`,wrap:!1}}),{c(){n=o("p"),n.innerHTML=u,i=r(),c(m.$$.fragment)},l(M){n=f(M,"P",{"data-svelte-h":!0}),d(n)!=="svelte-1nzsvd0"&&(n.innerHTML=u),i=s(M),w(m.$$.fragment,M)},m(M,U){a(M,n,U),a(M,i,U),J(m,M,U),p=!0},p:Ge,i(M){p||(T(m.$$.fragment,M),p=!0)},o(M){y(m.$$.fragment,M),p=!1},d(M){M&&(l(n),l(i)),h(m,M)}}}function bl(j){let n,u;return n=new Le({props:{$$slots:{default:[$l]},$$scope:{ctx:j}}}),{c(){c(n.$$.fragment)},l(i){w(n.$$.fragment,i)},m(i,m){J(n,i,m),u=!0},p(i,m){const p={};m&2&&(p.$$scope={dirty:m,ctx:i}),n.$set(p)},i(i){u||(T(n.$$.fragment,i),u=!0)},o(i){y(n.$$.fragment,i),u=!1},d(i){h(n,i)}}}function Cl(j){let n,u='示例脚本从  🤗 <a href="https://huggingface.co/docs/datasets/" rel="nofollow">Datasets</a> 库下载并预处理数据集。然后，脚本使用 Keras 在支持摘要的架构上微调数据集。以下示例展示了如何在 <a href="https://huggingface.co/datasets/cnn_dailymail" rel="nofollow">CNN/DailyMail</a> 数据集上微调 <a href="https://huggingface.co/google-t5/t5-small" rel="nofollow">T5-small</a>。T5 模型由于训练方式需要额外的 <code>source_prefix</code> 参数。这个提示让 T5 知道这是一个摘要任务。',i,m,p;return m=new _({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZ0ZW5zb3JmbG93JTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9uYW1lJTIwY25uX2RhaWx5bWFpbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9jb25maWclMjAlMjIzLjAuMCUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3V0cHV0X2RpciUyMCUyRnRtcCUyRnRzdC1zdW1tYXJpemF0aW9uJTIwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlMjA4JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUyMDE2JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1udW1fdHJhaW5fZXBvY2hzJTIwMyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWw=",highlighted:`python examples/tensorflow/summarization/run_summarization.py  \\
    --model_name_or_path google-t5/t5-small \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --output_dir /tmp/tst-summarization  \\
    --per_device_train_batch_size 8 \\
    --per_device_eval_batch_size 16 \\
    --num_train_epochs 3 \\
    --do_train \\
    --do_eval`,wrap:!1}}),{c(){n=o("p"),n.innerHTML=u,i=r(),c(m.$$.fragment)},l(M){n=f(M,"P",{"data-svelte-h":!0}),d(n)!=="svelte-l86hpd"&&(n.innerHTML=u),i=s(M),w(m.$$.fragment,M)},m(M,U){a(M,n,U),a(M,i,U),J(m,M,U),p=!0},p:Ge,i(M){p||(T(m.$$.fragment,M),p=!0)},o(M){y(m.$$.fragment,M),p=!1},d(M){M&&(l(n),l(i)),h(m,M)}}}function Xl(j){let n,u;return n=new Le({props:{$$slots:{default:[Cl]},$$scope:{ctx:j}}}),{c(){c(n.$$.fragment)},l(i){w(n.$$.fragment,i)},m(i,m){J(n,i,m),u=!0},p(i,m){const p={};m&2&&(p.$$scope={dirty:m,ctx:i}),n.$set(p)},i(i){u||(T(n.$$.fragment,i),u=!0)},o(i){y(n.$$.fragment,i),u=!1},d(i){h(n,i)}}}function Il(j){let n,u='张量处理单元（TPUs）是专门设计用于加速性能的。PyTorch使用<a href="https://www.tensorflow.org/xla" rel="nofollow">XLA</a>深度学习编译器支持TPU（更多细节请参见<a href="https://github.com/pytorch/xla/blob/master/README.md" rel="nofollow">这里</a>）。要使用TPU，请启动<code>xla_spawn.py</code>脚本并使用<code>num_cores</code>参数设置要使用的TPU核心数量。',i,m,p;return m=new _({props:{code:"cHl0aG9uJTIweGxhX3NwYXduLnB5JTIwLS1udW1fY29yZXMlMjA4JTIwJTVDJTBBJTIwJTIwJTIwJTIwc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfbmFtZSUyMGNubl9kYWlseW1haWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfY29uZmlnJTIwJTIyMy4wLjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXNvdXJjZV9wcmVmaXglMjAlMjJzdW1tYXJpemUlM0ElMjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW91dHB1dF9kaXIlMjAlMkZ0bXAlMkZ0c3Qtc3VtbWFyaXphdGlvbiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0Q0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdmVyd3JpdGVfb3V0cHV0X2RpciUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHJlZGljdF93aXRoX2dlbmVyYXRl",highlighted:`python xla_spawn.py --num_cores 8 \\
    summarization/run_summarization.py \\
    --model_name_or_path google-t5/t5-small \\
    --do_train \\
    --do_eval \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --output_dir /tmp/tst-summarization \\
    --per_device_train_batch_size=4 \\
    --per_device_eval_batch_size=4 \\
    --overwrite_output_dir \\
    --predict_with_generate`,wrap:!1}}),{c(){n=o("p"),n.innerHTML=u,i=r(),c(m.$$.fragment)},l(M){n=f(M,"P",{"data-svelte-h":!0}),d(n)!=="svelte-1a7iv41"&&(n.innerHTML=u),i=s(M),w(m.$$.fragment,M)},m(M,U){a(M,n,U),a(M,i,U),J(m,M,U),p=!0},p:Ge,i(M){p||(T(m.$$.fragment,M),p=!0)},o(M){y(m.$$.fragment,M),p=!1},d(M){M&&(l(n),l(i)),h(m,M)}}}function Al(j){let n,u;return n=new Le({props:{$$slots:{default:[Il]},$$scope:{ctx:j}}}),{c(){c(n.$$.fragment)},l(i){w(n.$$.fragment,i)},m(i,m){J(n,i,m),u=!0},p(i,m){const p={};m&2&&(p.$$scope={dirty:m,ctx:i}),n.$set(p)},i(i){u||(T(n.$$.fragment,i),u=!0)},o(i){y(n.$$.fragment,i),u=!1},d(i){h(n,i)}}}function vl(j){let n,u='张量处理单元（TPUs）是专门设计用于加速性能的。TensorFlow脚本使用<a href="https://www.tensorflow.org/guide/distributed_training#tpustrategy" rel="nofollow"><code>TPUStrategy</code></a>在TPU上进行训练。要使用TPU，请将TPU资源的名称传递给<code>tpu</code>参数。',i,m,p;return m=new _({props:{code:"cHl0aG9uJTIwcnVuX3N1bW1hcml6YXRpb24ucHklMjAlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRwdSUyMG5hbWVfb2ZfdHB1X3Jlc291cmNlJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9uYW1lJTIwY25uX2RhaWx5bWFpbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9jb25maWclMjAlMjIzLjAuMCUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3V0cHV0X2RpciUyMCUyRnRtcCUyRnRzdC1zdW1tYXJpemF0aW9uJTIwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlMjA4JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUyMDE2JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1udW1fdHJhaW5fZXBvY2hzJTIwMyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWw=",highlighted:`python run_summarization.py  \\
    --tpu name_of_tpu_resource \\
    --model_name_or_path google-t5/t5-small \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --output_dir /tmp/tst-summarization  \\
    --per_device_train_batch_size 8 \\
    --per_device_eval_batch_size 16 \\
    --num_train_epochs 3 \\
    --do_train \\
    --do_eval`,wrap:!1}}),{c(){n=o("p"),n.innerHTML=u,i=r(),c(m.$$.fragment)},l(M){n=f(M,"P",{"data-svelte-h":!0}),d(n)!=="svelte-1aunkch"&&(n.innerHTML=u),i=s(M),w(m.$$.fragment,M)},m(M,U){a(M,n,U),a(M,i,U),J(m,M,U),p=!0},p:Ge,i(M){p||(T(m.$$.fragment,M),p=!0)},o(M){y(m.$$.fragment,M),p=!1},d(M){M&&(l(n),l(i)),h(m,M)}}}function Wl(j){let n,u;return n=new Le({props:{$$slots:{default:[vl]},$$scope:{ctx:j}}}),{c(){c(n.$$.fragment)},l(i){w(n.$$.fragment,i)},m(i,m){J(n,i,m),u=!0},p(i,m){const p={};m&2&&(p.$$scope={dirty:m,ctx:i}),n.$set(p)},i(i){u||(T(n.$$.fragment,i),u=!0)},o(i){y(n.$$.fragment,i),u=!1},d(i){h(n,i)}}}function Zl(j){let n,u,i,m,p,M,U,Re='除了 🤗 Transformers <a href="./notebooks">notebooks</a>，还有示例脚本演示了如何使用<a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch" rel="nofollow">PyTorch</a>、<a href="https://github.com/huggingface/transformers/tree/main/examples/tensorflow" rel="nofollow">TensorFlow</a>或<a href="https://github.com/huggingface/transformers/tree/main/examples/flax" rel="nofollow">JAX/Flax</a>训练模型以解决特定任务。',It,C,xe='您还可以在这些示例中找到我们在<a href="https://github.com/huggingface/transformers/tree/main/examples/research_projects" rel="nofollow">研究项目</a>和<a href="https://github.com/huggingface/transformers/tree/main/examples/legacy" rel="nofollow">遗留示例</a>中使用过的脚本，这些脚本主要是由社区贡献的。这些脚本已不再被积极维护，需要使用特定版本的🤗 Transformers， 可能与库的最新版本不兼容。',At,X,Ve="示例脚本可能无法在初始配置下直接解决每个问题，您可能需要根据要解决的问题调整脚本。为了帮助您，大多数脚本都完全暴露了数据预处理的方式，允许您根据需要对其进行编辑。",vt,I,Ne='如果您想在示例脚本中实现任何功能，请在<a href="https://discuss.huggingface.co/" rel="nofollow">论坛</a>或<a href="https://github.com/huggingface/transformers/issues" rel="nofollow">issue</a>上讨论，然后再提交Pull Request。虽然我们欢迎修复错误，但不太可能合并添加更多功能的Pull Request，因为这会降低可读性。',Wt,A,Be='本指南将向您展示如何在<a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization" rel="nofollow">PyTorch</a>和<a href="https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization" rel="nofollow">TensorFlow</a>中运行示例摘要训练脚本。除非另有说明，否则所有示例都可以在两个框架中工作。',Zt,v,Gt,W,ze="要成功运行示例脚本的最新版本，您必须在新虚拟环境中<strong>从源代码安装 🤗 Transformers</strong>：",Lt,Z,Rt,G,Fe="对于旧版本的示例脚本，请点击下面的切换按钮：",xt,L,Ye='<summary>老版本🤗 Transformers示例</summary> <ul><li><a href="https://github.com/huggingface/transformers/tree/v4.5.1/examples">v4.5.1</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v4.4.2/examples">v4.4.2</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v4.3.3/examples">v4.3.3</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v4.2.2/examples">v4.2.2</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v4.1.1/examples">v4.1.1</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v4.0.1/examples">v4.0.1</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v3.5.1/examples">v3.5.1</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v3.4.0/examples">v3.4.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v3.3.1/examples">v3.3.1</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v3.2.0/examples">v3.2.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v3.1.0/examples">v3.1.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v3.0.2/examples">v3.0.2</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.11.0/examples">v2.11.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.10.0/examples">v2.10.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.9.1/examples">v2.9.1</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.8.0/examples">v2.8.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.7.0/examples">v2.7.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.6.0/examples">v2.6.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.5.1/examples">v2.5.1</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.4.0/examples">v2.4.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.3.0/examples">v2.3.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.2.0/examples">v2.2.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.1.0/examples">v2.1.1</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v2.0.0/examples">v2.0.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v1.2.0/examples">v1.2.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v1.1.0/examples">v1.1.0</a></li> <li><a href="https://github.com/huggingface/transformers/tree/v1.0.0/examples">v1.0.0</a></li></ul>',Vt,R,Se="然后切换您clone的 🤗 Transformers 仓到特定的版本，例如v3.5.1：",Nt,x,Bt,V,He="在安装了正确的库版本后，进入您选择的版本的<code>example</code>文件夹并安装例子要求的环境：",zt,N,Ft,B,Yt,$,St,z,Ht,F,Ee='<a href="https://huggingface.co/docs/transformers/main_classes/trainer" rel="nofollow">Trainer</a> 支持分布式训练和混合精度，这意味着你也可以在脚本中使用它。要启用这两个功能，可以做如下设置：',Et,Y,ke="<li>添加 <code>fp16</code> 参数以启用混合精度。</li> <li>使用 <code>nproc_per_node</code> 参数设置使用的GPU数量。</li>",kt,S,Qt,H,Qe='TensorFlow脚本使用<a href="https://www.tensorflow.org/guide/distributed_training#mirroredstrategy" rel="nofollow"><code>MirroredStrategy</code></a>进行分布式训练，您无需在训练脚本中添加任何其他参数。如果可用，TensorFlow脚本将默认使用多个GPU。',Dt,E,Pt,b,qt,k,Ot,Q,De='🤗 <a href="https://huggingface.co/docs/accelerate" rel="nofollow">Accelerate</a> 是一个仅支持 PyTorch 的库，它提供了一种统一的方法来在不同类型的设置（仅 CPU、多个 GPU、多个TPU）上训练模型，同时保持对 PyTorch 训练循环的完全可见性。如果你还没有安装 🤗 Accelerate，请确保你已经安装了它：',Kt,D,Pe="<p>注意：由于 Accelerate 正在快速发展，因此必须安装 git 版本的 accelerate 来运行脚本。</p>",te,P,ee,q,qe="你需要使用<code>run_summarization_no_trainer.py</code>脚本，而不是<code>run_summarization.py</code>脚本。🤗 Accelerate支持的脚本需要在文件夹中有一个<code>task_no_trainer.py</code>文件。首先运行以下命令以创建并保存配置文件：",le,O,ae,K,Oe="检测您的设置以确保配置正确：",ne,tt,ie,et,Ke="现在您可以开始训练模型了：",re,lt,se,at,Me,nt,tl="摘要脚本支持自定义数据集，只要它们是CSV或JSON Line文件。当你使用自己的数据集时，需要指定一些额外的参数：",me,it,el="<li><code>train_file</code> 和 <code>validation_file</code> 分别指定您的训练和验证文件的路径。</li> <li><code>text_column</code> 是输入要进行摘要的文本。</li> <li><code>summary_column</code> 是目标输出的文本。</li>",pe,rt,ll="使用自定义数据集的摘要脚本看起来是这样的：",oe,st,fe,Mt,ue,mt,al="通常，在提交整个数据集之前，最好先在较少的数据集示例上运行脚本，以确保一切按预期工作,因为完整数据集的处理可能需要花费几个小时的时间。使用以下参数将数据集截断为最大样本数：",ce,pt,nl="<li><code>max_train_samples</code></li> <li><code>max_eval_samples</code></li> <li><code>max_predict_samples</code></li>",we,ot,Je,ft,il="并非所有示例脚本都支持<code>max_predict_samples</code>参数。如果您不确定您的脚本是否支持此参数，请添加<code>-h</code>参数进行检查：",Te,ut,ye,ct,he,wt,rl="另一个有用的选项是从之前的checkpoint恢复训练。这将确保在训练中断时，您可以从之前停止的地方继续进行，而无需重新开始。有两种方法可以从checkpoint恢复训练。",de,Jt,sl="第一种方法使用<code>output_dir previous_output_dir</code>参数从存储在<code>output_dir</code>中的最新的checkpoint恢复训练。在这种情况下，您应该删除<code>overwrite_output_dir</code>：",Ue,Tt,_e,yt,Ml="第二种方法使用<code>resume_from_checkpoint path_to_specific_checkpoint</code>参数从特定的checkpoint文件夹恢复训练。",je,ht,ge,dt,$e,Ut,ml='所有脚本都可以将您的最终模型上传到<a href="https://huggingface.co/models" rel="nofollow">Model Hub</a>。在开始之前，请确保您已登录Hugging Face：',be,_t,Ce,jt,pl="然后，在脚本中添加<code>push_to_hub</code>参数。这个参数会创建一个带有您Hugging Face用户名和<code>output_dir</code>中指定的文件夹名称的仓库。",Xe,gt,ol="为了给您的仓库指定一个特定的名称，使用<code>push_to_hub_model_id</code>参数来添加它。该仓库将自动列出在您的命名空间下。",Ie,$t,fl="以下示例展示了如何上传具有特定仓库名称的模型：",Ae,bt,ve,Ct,We,Xt,Ze;return p=new g({props:{title:"使用脚本进行训练",local:"使用脚本进行训练",headingTag:"h1"}}),v=new g({props:{title:"设置",local:"设置",headingTag:"h2"}}),Z=new _({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRnRyYW5zZm9ybWVycyUwQWNkJTIwdHJhbnNmb3JtZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC4=",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/transformers
<span class="hljs-built_in">cd</span> transformers
pip install .`,wrap:!1}}),x=new _({props:{code:"Z2l0JTIwY2hlY2tvdXQlMjB0YWdzJTJGdjMuNS4x",highlighted:"git checkout tags/v3.5.1",wrap:!1}}),N=new _({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:"pip install -r requirements.txt",wrap:!1}}),B=new g({props:{title:"运行脚本",local:"运行脚本",headingTag:"h2"}}),$=new Tl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Xl],pytorch:[bl]},$$scope:{ctx:j}}}),z=new g({props:{title:"分布式训练和混合精度",local:"分布式训练和混合精度",headingTag:"h2"}}),S=new _({props:{code:"dG9yY2hydW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLW5wcm9jX3Blcl9ub2RlJTIwOCUyMHB5dG9yY2glMkZzdW1tYXJpemF0aW9uJTJGcnVuX3N1bW1hcml6YXRpb24ucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLWZwMTYlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1vZGVsX25hbWVfb3JfcGF0aCUyMGdvb2dsZS10NSUyRnQ1LXNtYWxsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb190cmFpbiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fZXZhbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9uYW1lJTIwY25uX2RhaWx5bWFpbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9jb25maWclMjAlMjIzLjAuMCUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tc291cmNlX3ByZWZpeCUyMCUyMnN1bW1hcml6ZSUzQSUyMCUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3V0cHV0X2RpciUyMCUyRnRtcCUyRnRzdC1zdW1tYXJpemF0aW9uJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0Q0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUzRDQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW92ZXJ3cml0ZV9vdXRwdXRfZGlyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wcmVkaWN0X3dpdGhfZ2VuZXJhdGU=",highlighted:`torchrun \\
    --nproc_per_node 8 pytorch/summarization/run_summarization.py \\
    --fp16 \\
    --model_name_or_path google-t5/t5-small \\
    --do_train \\
    --do_eval \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --output_dir /tmp/tst-summarization \\
    --per_device_train_batch_size=4 \\
    --per_device_eval_batch_size=4 \\
    --overwrite_output_dir \\
    --predict_with_generate`,wrap:!1}}),E=new g({props:{title:"在TPU上运行脚本",local:"在tpu上运行脚本",headingTag:"h2"}}),b=new Tl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Wl],pytorch:[Al]},$$scope:{ctx:j}}}),k=new g({props:{title:"基于🤗 Accelerate运行脚本",local:"基于-accelerate运行脚本",headingTag:"h2"}}),P=new _({props:{code:"cGlwJTIwaW5zdGFsbCUyMGdpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmh1Z2dpbmdmYWNlJTJGYWNjZWxlcmF0ZQ==",highlighted:"pip install git+https://github.com/huggingface/accelerate",wrap:!1}}),O=new _({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),tt=new _({props:{code:"YWNjZWxlcmF0ZSUyMHRlc3Q=",highlighted:'accelerate <span class="hljs-built_in">test</span>',wrap:!1}}),lt=new _({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHJ1bl9zdW1tYXJpemF0aW9uX25vX3RyYWluZXIucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1vZGVsX25hbWVfb3JfcGF0aCUyMGdvb2dsZS10NSUyRnQ1LXNtYWxsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X25hbWUlMjBjbm5fZGFpbHltYWlsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X2NvbmZpZyUyMCUyMjMuMC4wJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zb3VyY2VfcHJlZml4JTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwfiUyRnRtcCUyRnRzdC1zdW1tYXJpemF0aW9u",highlighted:`accelerate launch run_summarization_no_trainer.py \\
    --model_name_or_path google-t5/t5-small \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --output_dir ~/tmp/tst-summarization`,wrap:!1}}),at=new g({props:{title:"使用自定义数据集",local:"使用自定义数据集",headingTag:"h2"}}),st=new _({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRyYWluX2ZpbGUlMjBwYXRoX3RvX2Nzdl9vcl9qc29ubGluZXNfZmlsZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdmFsaWRhdGlvbl9maWxlJTIwcGF0aF90b19jc3Zfb3JfanNvbmxpbmVzX2ZpbGUlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRleHRfY29sdW1uJTIwdGV4dF9jb2x1bW5fbmFtZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tc3VtbWFyeV9jb2x1bW4lMjBzdW1tYXJ5X2NvbHVtbl9uYW1lJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zb3VyY2VfcHJlZml4JTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwJTJGdG1wJTJGdHN0LXN1bW1hcml6YXRpb24lMjAlNUMlMEElMjAlMjAlMjAlMjAtLW92ZXJ3cml0ZV9vdXRwdXRfZGlyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0Q0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUzRDQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXByZWRpY3Rfd2l0aF9nZW5lcmF0ZQ==",highlighted:`python examples/pytorch/summarization/run_summarization.py \\
    --model_name_or_path google-t5/t5-small \\
    --do_train \\
    --do_eval \\
    --train_file path_to_csv_or_jsonlines_file \\
    --validation_file path_to_csv_or_jsonlines_file \\
    --text_column text_column_name \\
    --summary_column summary_column_name \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --output_dir /tmp/tst-summarization \\
    --overwrite_output_dir \\
    --per_device_train_batch_size=4 \\
    --per_device_eval_batch_size=4 \\
    --predict_with_generate`,wrap:!1}}),Mt=new g({props:{title:"测试脚本",local:"测试脚本",headingTag:"h2"}}),ot=new _({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWF4X3RyYWluX3NhbXBsZXMlMjA1MCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWF4X2V2YWxfc2FtcGxlcyUyMDUwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tYXhfcHJlZGljdF9zYW1wbGVzJTIwNTAlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX3RyYWluJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb19ldmFsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X25hbWUlMjBjbm5fZGFpbHltYWlsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X2NvbmZpZyUyMCUyMjMuMC4wJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zb3VyY2VfcHJlZml4JTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwJTJGdG1wJTJGdHN0LXN1bW1hcml6YXRpb24lMjAlNUMlMEElMjAlMjAlMjAlMjAtLXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3ZlcndyaXRlX291dHB1dF9kaXIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXByZWRpY3Rfd2l0aF9nZW5lcmF0ZQ==",highlighted:`python examples/pytorch/summarization/run_summarization.py \\
    --model_name_or_path google-t5/t5-small \\
    --max_train_samples 50 \\
    --max_eval_samples 50 \\
    --max_predict_samples 50 \\
    --do_train \\
    --do_eval \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --output_dir /tmp/tst-summarization \\
    --per_device_train_batch_size=4 \\
    --per_device_eval_batch_size=4 \\
    --overwrite_output_dir \\
    --predict_with_generate`,wrap:!1}}),ut=new _({props:{code:"ZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwLWg=",highlighted:"examples/pytorch/summarization/run_summarization.py -h",wrap:!1}}),ct=new g({props:{title:"从checkpoint恢复训练",local:"从checkpoint恢复训练",headingTag:"h2"}}),Tt=new _({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfbmFtZSUyMGNubl9kYWlseW1haWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfY29uZmlnJTIwJTIyMy4wLjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXNvdXJjZV9wcmVmaXglMjAlMjJzdW1tYXJpemUlM0ElMjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW91dHB1dF9kaXIlMjAlMkZ0bXAlMkZ0c3Qtc3VtbWFyaXphdGlvbiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0Q0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwcHJldmlvdXNfb3V0cHV0X2RpciUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHJlZGljdF93aXRoX2dlbmVyYXRl",highlighted:`python examples/pytorch/summarization/run_summarization.py
    --model_name_or_path google-t5/t5-small \\
    --do_train \\
    --do_eval \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --output_dir /tmp/tst-summarization \\
    --per_device_train_batch_size=4 \\
    --per_device_eval_batch_size=4 \\
    --output_dir previous_output_dir \\
    --predict_with_generate`,wrap:!1}}),ht=new _({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfbmFtZSUyMGNubl9kYWlseW1haWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfY29uZmlnJTIwJTIyMy4wLjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXNvdXJjZV9wcmVmaXglMjAlMjJzdW1tYXJpemUlM0ElMjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW91dHB1dF9kaXIlMjAlMkZ0bXAlMkZ0c3Qtc3VtbWFyaXphdGlvbiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0Q0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdmVyd3JpdGVfb3V0cHV0X2RpciUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcmVzdW1lX2Zyb21fY2hlY2twb2ludCUyMHBhdGhfdG9fc3BlY2lmaWNfY2hlY2twb2ludCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHJlZGljdF93aXRoX2dlbmVyYXRl",highlighted:`python examples/pytorch/summarization/run_summarization.py
    --model_name_or_path google-t5/t5-small \\
    --do_train \\
    --do_eval \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --output_dir /tmp/tst-summarization \\
    --per_device_train_batch_size=4 \\
    --per_device_eval_batch_size=4 \\
    --overwrite_output_dir \\
    --resume_from_checkpoint path_to_specific_checkpoint \\
    --predict_with_generate`,wrap:!1}}),dt=new g({props:{title:"分享模型",local:"分享模型",headingTag:"h2"}}),_t=new _({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:"huggingface-cli login",wrap:!1}}),bt=new _({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfbmFtZSUyMGNubl9kYWlseW1haWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfY29uZmlnJTIwJTIyMy4wLjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXNvdXJjZV9wcmVmaXglMjAlMjJzdW1tYXJpemUlM0ElMjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXB1c2hfdG9faHViJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wdXNoX3RvX2h1Yl9tb2RlbF9pZCUyMGZpbmV0dW5lZC10NS1jbm5fZGFpbHltYWlsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwJTJGdG1wJTJGdHN0LXN1bW1hcml6YXRpb24lMjAlNUMlMEElMjAlMjAlMjAlMjAtLXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3ZlcndyaXRlX291dHB1dF9kaXIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXByZWRpY3Rfd2l0aF9nZW5lcmF0ZQ==",highlighted:`python examples/pytorch/summarization/run_summarization.py
    --model_name_or_path google-t5/t5-small \\
    --do_train \\
    --do_eval \\
    --dataset_name cnn_dailymail \\
    --dataset_config <span class="hljs-string">&quot;3.0.0&quot;</span> \\
    --source_prefix <span class="hljs-string">&quot;summarize: &quot;</span> \\
    --push_to_hub \\
    --push_to_hub_model_id finetuned-t5-cnn_dailymail \\
    --output_dir /tmp/tst-summarization \\
    --per_device_train_batch_size=4 \\
    --per_device_eval_batch_size=4 \\
    --overwrite_output_dir \\
    --predict_with_generate`,wrap:!1}}),Ct=new gl({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/run_scripts.md"}}),{c(){n=o("meta"),u=r(),i=o("p"),m=r(),c(p.$$.fragment),M=r(),U=o("p"),U.innerHTML=Re,It=r(),C=o("p"),C.innerHTML=xe,At=r(),X=o("p"),X.textContent=Ve,vt=r(),I=o("p"),I.innerHTML=Ne,Wt=r(),A=o("p"),A.innerHTML=Be,Zt=r(),c(v.$$.fragment),Gt=r(),W=o("p"),W.innerHTML=ze,Lt=r(),c(Z.$$.fragment),Rt=r(),G=o("p"),G.textContent=Fe,xt=r(),L=o("details"),L.innerHTML=Ye,Vt=r(),R=o("p"),R.textContent=Se,Nt=r(),c(x.$$.fragment),Bt=r(),V=o("p"),V.innerHTML=He,zt=r(),c(N.$$.fragment),Ft=r(),c(B.$$.fragment),Yt=r(),c($.$$.fragment),St=r(),c(z.$$.fragment),Ht=r(),F=o("p"),F.innerHTML=Ee,Et=r(),Y=o("ul"),Y.innerHTML=ke,kt=r(),c(S.$$.fragment),Qt=r(),H=o("p"),H.innerHTML=Qe,Dt=r(),c(E.$$.fragment),Pt=r(),c(b.$$.fragment),qt=r(),c(k.$$.fragment),Ot=r(),Q=o("p"),Q.innerHTML=De,Kt=r(),D=o("blockquote"),D.innerHTML=Pe,te=r(),c(P.$$.fragment),ee=r(),q=o("p"),q.innerHTML=qe,le=r(),c(O.$$.fragment),ae=r(),K=o("p"),K.textContent=Oe,ne=r(),c(tt.$$.fragment),ie=r(),et=o("p"),et.textContent=Ke,re=r(),c(lt.$$.fragment),se=r(),c(at.$$.fragment),Me=r(),nt=o("p"),nt.textContent=tl,me=r(),it=o("ul"),it.innerHTML=el,pe=r(),rt=o("p"),rt.textContent=ll,oe=r(),c(st.$$.fragment),fe=r(),c(Mt.$$.fragment),ue=r(),mt=o("p"),mt.textContent=al,ce=r(),pt=o("ul"),pt.innerHTML=nl,we=r(),c(ot.$$.fragment),Je=r(),ft=o("p"),ft.innerHTML=il,Te=r(),c(ut.$$.fragment),ye=r(),c(ct.$$.fragment),he=r(),wt=o("p"),wt.textContent=rl,de=r(),Jt=o("p"),Jt.innerHTML=sl,Ue=r(),c(Tt.$$.fragment),_e=r(),yt=o("p"),yt.innerHTML=Ml,je=r(),c(ht.$$.fragment),ge=r(),c(dt.$$.fragment),$e=r(),Ut=o("p"),Ut.innerHTML=ml,be=r(),c(_t.$$.fragment),Ce=r(),jt=o("p"),jt.innerHTML=pl,Xe=r(),gt=o("p"),gt.innerHTML=ol,Ie=r(),$t=o("p"),$t.textContent=fl,Ae=r(),c(bt.$$.fragment),ve=r(),c(Ct.$$.fragment),We=r(),Xt=o("p"),this.h()},l(t){const e=_l("svelte-u9bgzb",document.head);n=f(e,"META",{name:!0,content:!0}),e.forEach(l),u=s(t),i=f(t,"P",{}),wl(i).forEach(l),m=s(t),w(p.$$.fragment,t),M=s(t),U=f(t,"P",{"data-svelte-h":!0}),d(U)!=="svelte-1sxidum"&&(U.innerHTML=Re),It=s(t),C=f(t,"P",{"data-svelte-h":!0}),d(C)!=="svelte-t9b9sq"&&(C.innerHTML=xe),At=s(t),X=f(t,"P",{"data-svelte-h":!0}),d(X)!=="svelte-y5rq4n"&&(X.textContent=Ve),vt=s(t),I=f(t,"P",{"data-svelte-h":!0}),d(I)!=="svelte-zuh3zf"&&(I.innerHTML=Ne),Wt=s(t),A=f(t,"P",{"data-svelte-h":!0}),d(A)!=="svelte-17m9h91"&&(A.innerHTML=Be),Zt=s(t),w(v.$$.fragment,t),Gt=s(t),W=f(t,"P",{"data-svelte-h":!0}),d(W)!=="svelte-2nj8cj"&&(W.innerHTML=ze),Lt=s(t),w(Z.$$.fragment,t),Rt=s(t),G=f(t,"P",{"data-svelte-h":!0}),d(G)!=="svelte-8nj16n"&&(G.textContent=Fe),xt=s(t),L=f(t,"DETAILS",{"data-svelte-h":!0}),d(L)!=="svelte-1ubwk1n"&&(L.innerHTML=Ye),Vt=s(t),R=f(t,"P",{"data-svelte-h":!0}),d(R)!=="svelte-1ebeyhp"&&(R.textContent=Se),Nt=s(t),w(x.$$.fragment,t),Bt=s(t),V=f(t,"P",{"data-svelte-h":!0}),d(V)!=="svelte-rb945x"&&(V.innerHTML=He),zt=s(t),w(N.$$.fragment,t),Ft=s(t),w(B.$$.fragment,t),Yt=s(t),w($.$$.fragment,t),St=s(t),w(z.$$.fragment,t),Ht=s(t),F=f(t,"P",{"data-svelte-h":!0}),d(F)!=="svelte-1xszoa1"&&(F.innerHTML=Ee),Et=s(t),Y=f(t,"UL",{"data-svelte-h":!0}),d(Y)!=="svelte-zaadqd"&&(Y.innerHTML=ke),kt=s(t),w(S.$$.fragment,t),Qt=s(t),H=f(t,"P",{"data-svelte-h":!0}),d(H)!=="svelte-w6ormk"&&(H.innerHTML=Qe),Dt=s(t),w(E.$$.fragment,t),Pt=s(t),w(b.$$.fragment,t),qt=s(t),w(k.$$.fragment,t),Ot=s(t),Q=f(t,"P",{"data-svelte-h":!0}),d(Q)!=="svelte-1d5gx6n"&&(Q.innerHTML=De),Kt=s(t),D=f(t,"BLOCKQUOTE",{"data-svelte-h":!0}),d(D)!=="svelte-1hi61t"&&(D.innerHTML=Pe),te=s(t),w(P.$$.fragment,t),ee=s(t),q=f(t,"P",{"data-svelte-h":!0}),d(q)!=="svelte-1sqmzpd"&&(q.innerHTML=qe),le=s(t),w(O.$$.fragment,t),ae=s(t),K=f(t,"P",{"data-svelte-h":!0}),d(K)!=="svelte-1sleoq5"&&(K.textContent=Oe),ne=s(t),w(tt.$$.fragment,t),ie=s(t),et=f(t,"P",{"data-svelte-h":!0}),d(et)!=="svelte-jem89t"&&(et.textContent=Ke),re=s(t),w(lt.$$.fragment,t),se=s(t),w(at.$$.fragment,t),Me=s(t),nt=f(t,"P",{"data-svelte-h":!0}),d(nt)!=="svelte-1sbqsjd"&&(nt.textContent=tl),me=s(t),it=f(t,"UL",{"data-svelte-h":!0}),d(it)!=="svelte-1gfb9n1"&&(it.innerHTML=el),pe=s(t),rt=f(t,"P",{"data-svelte-h":!0}),d(rt)!=="svelte-287ma3"&&(rt.textContent=ll),oe=s(t),w(st.$$.fragment,t),fe=s(t),w(Mt.$$.fragment,t),ue=s(t),mt=f(t,"P",{"data-svelte-h":!0}),d(mt)!=="svelte-1h7zdvc"&&(mt.textContent=al),ce=s(t),pt=f(t,"UL",{"data-svelte-h":!0}),d(pt)!=="svelte-14g5f8g"&&(pt.innerHTML=nl),we=s(t),w(ot.$$.fragment,t),Je=s(t),ft=f(t,"P",{"data-svelte-h":!0}),d(ft)!=="svelte-1e4r7qi"&&(ft.innerHTML=il),Te=s(t),w(ut.$$.fragment,t),ye=s(t),w(ct.$$.fragment,t),he=s(t),wt=f(t,"P",{"data-svelte-h":!0}),d(wt)!=="svelte-ixjp8"&&(wt.textContent=rl),de=s(t),Jt=f(t,"P",{"data-svelte-h":!0}),d(Jt)!=="svelte-rn7fgf"&&(Jt.innerHTML=sl),Ue=s(t),w(Tt.$$.fragment,t),_e=s(t),yt=f(t,"P",{"data-svelte-h":!0}),d(yt)!=="svelte-y8jo8h"&&(yt.innerHTML=Ml),je=s(t),w(ht.$$.fragment,t),ge=s(t),w(dt.$$.fragment,t),$e=s(t),Ut=f(t,"P",{"data-svelte-h":!0}),d(Ut)!=="svelte-14o7a7e"&&(Ut.innerHTML=ml),be=s(t),w(_t.$$.fragment,t),Ce=s(t),jt=f(t,"P",{"data-svelte-h":!0}),d(jt)!=="svelte-s1qcjt"&&(jt.innerHTML=pl),Xe=s(t),gt=f(t,"P",{"data-svelte-h":!0}),d(gt)!=="svelte-1dapele"&&(gt.innerHTML=ol),Ie=s(t),$t=f(t,"P",{"data-svelte-h":!0}),d($t)!=="svelte-dckksr"&&($t.textContent=fl),Ae=s(t),w(bt.$$.fragment,t),ve=s(t),w(Ct.$$.fragment,t),We=s(t),Xt=f(t,"P",{}),wl(Xt).forEach(l),this.h()},h(){Jl(n,"name","hf:doc:metadata"),Jl(n,"content",Gl)},m(t,e){jl(document.head,n),a(t,u,e),a(t,i,e),a(t,m,e),J(p,t,e),a(t,M,e),a(t,U,e),a(t,It,e),a(t,C,e),a(t,At,e),a(t,X,e),a(t,vt,e),a(t,I,e),a(t,Wt,e),a(t,A,e),a(t,Zt,e),J(v,t,e),a(t,Gt,e),a(t,W,e),a(t,Lt,e),J(Z,t,e),a(t,Rt,e),a(t,G,e),a(t,xt,e),a(t,L,e),a(t,Vt,e),a(t,R,e),a(t,Nt,e),J(x,t,e),a(t,Bt,e),a(t,V,e),a(t,zt,e),J(N,t,e),a(t,Ft,e),J(B,t,e),a(t,Yt,e),J($,t,e),a(t,St,e),J(z,t,e),a(t,Ht,e),a(t,F,e),a(t,Et,e),a(t,Y,e),a(t,kt,e),J(S,t,e),a(t,Qt,e),a(t,H,e),a(t,Dt,e),J(E,t,e),a(t,Pt,e),J(b,t,e),a(t,qt,e),J(k,t,e),a(t,Ot,e),a(t,Q,e),a(t,Kt,e),a(t,D,e),a(t,te,e),J(P,t,e),a(t,ee,e),a(t,q,e),a(t,le,e),J(O,t,e),a(t,ae,e),a(t,K,e),a(t,ne,e),J(tt,t,e),a(t,ie,e),a(t,et,e),a(t,re,e),J(lt,t,e),a(t,se,e),J(at,t,e),a(t,Me,e),a(t,nt,e),a(t,me,e),a(t,it,e),a(t,pe,e),a(t,rt,e),a(t,oe,e),J(st,t,e),a(t,fe,e),J(Mt,t,e),a(t,ue,e),a(t,mt,e),a(t,ce,e),a(t,pt,e),a(t,we,e),J(ot,t,e),a(t,Je,e),a(t,ft,e),a(t,Te,e),J(ut,t,e),a(t,ye,e),J(ct,t,e),a(t,he,e),a(t,wt,e),a(t,de,e),a(t,Jt,e),a(t,Ue,e),J(Tt,t,e),a(t,_e,e),a(t,yt,e),a(t,je,e),J(ht,t,e),a(t,ge,e),J(dt,t,e),a(t,$e,e),a(t,Ut,e),a(t,be,e),J(_t,t,e),a(t,Ce,e),a(t,jt,e),a(t,Xe,e),a(t,gt,e),a(t,Ie,e),a(t,$t,e),a(t,Ae,e),J(bt,t,e),a(t,ve,e),J(Ct,t,e),a(t,We,e),a(t,Xt,e),Ze=!0},p(t,[e]){const ul={};e&2&&(ul.$$scope={dirty:e,ctx:t}),$.$set(ul);const cl={};e&2&&(cl.$$scope={dirty:e,ctx:t}),b.$set(cl)},i(t){Ze||(T(p.$$.fragment,t),T(v.$$.fragment,t),T(Z.$$.fragment,t),T(x.$$.fragment,t),T(N.$$.fragment,t),T(B.$$.fragment,t),T($.$$.fragment,t),T(z.$$.fragment,t),T(S.$$.fragment,t),T(E.$$.fragment,t),T(b.$$.fragment,t),T(k.$$.fragment,t),T(P.$$.fragment,t),T(O.$$.fragment,t),T(tt.$$.fragment,t),T(lt.$$.fragment,t),T(at.$$.fragment,t),T(st.$$.fragment,t),T(Mt.$$.fragment,t),T(ot.$$.fragment,t),T(ut.$$.fragment,t),T(ct.$$.fragment,t),T(Tt.$$.fragment,t),T(ht.$$.fragment,t),T(dt.$$.fragment,t),T(_t.$$.fragment,t),T(bt.$$.fragment,t),T(Ct.$$.fragment,t),Ze=!0)},o(t){y(p.$$.fragment,t),y(v.$$.fragment,t),y(Z.$$.fragment,t),y(x.$$.fragment,t),y(N.$$.fragment,t),y(B.$$.fragment,t),y($.$$.fragment,t),y(z.$$.fragment,t),y(S.$$.fragment,t),y(E.$$.fragment,t),y(b.$$.fragment,t),y(k.$$.fragment,t),y(P.$$.fragment,t),y(O.$$.fragment,t),y(tt.$$.fragment,t),y(lt.$$.fragment,t),y(at.$$.fragment,t),y(st.$$.fragment,t),y(Mt.$$.fragment,t),y(ot.$$.fragment,t),y(ut.$$.fragment,t),y(ct.$$.fragment,t),y(Tt.$$.fragment,t),y(ht.$$.fragment,t),y(dt.$$.fragment,t),y(_t.$$.fragment,t),y(bt.$$.fragment,t),y(Ct.$$.fragment,t),Ze=!1},d(t){t&&(l(u),l(i),l(m),l(M),l(U),l(It),l(C),l(At),l(X),l(vt),l(I),l(Wt),l(A),l(Zt),l(Gt),l(W),l(Lt),l(Rt),l(G),l(xt),l(L),l(Vt),l(R),l(Nt),l(Bt),l(V),l(zt),l(Ft),l(Yt),l(St),l(Ht),l(F),l(Et),l(Y),l(kt),l(Qt),l(H),l(Dt),l(Pt),l(qt),l(Ot),l(Q),l(Kt),l(D),l(te),l(ee),l(q),l(le),l(ae),l(K),l(ne),l(ie),l(et),l(re),l(se),l(Me),l(nt),l(me),l(it),l(pe),l(rt),l(oe),l(fe),l(ue),l(mt),l(ce),l(pt),l(we),l(Je),l(ft),l(Te),l(ye),l(he),l(wt),l(de),l(Jt),l(Ue),l(_e),l(yt),l(je),l(ge),l($e),l(Ut),l(be),l(Ce),l(jt),l(Xe),l(gt),l(Ie),l($t),l(Ae),l(ve),l(We),l(Xt)),l(n),h(p,t),h(v,t),h(Z,t),h(x,t),h(N,t),h(B,t),h($,t),h(z,t),h(S,t),h(E,t),h(b,t),h(k,t),h(P,t),h(O,t),h(tt,t),h(lt,t),h(at,t),h(st,t),h(Mt,t),h(ot,t),h(ut,t),h(ct,t),h(Tt,t),h(ht,t),h(dt,t),h(_t,t),h(bt,t),h(Ct,t)}}}const Gl='{"title":"使用脚本进行训练","local":"使用脚本进行训练","sections":[{"title":"设置","local":"设置","sections":[],"depth":2},{"title":"运行脚本","local":"运行脚本","sections":[],"depth":2},{"title":"分布式训练和混合精度","local":"分布式训练和混合精度","sections":[],"depth":2},{"title":"在TPU上运行脚本","local":"在tpu上运行脚本","sections":[],"depth":2},{"title":"基于🤗 Accelerate运行脚本","local":"基于-accelerate运行脚本","sections":[],"depth":2},{"title":"使用自定义数据集","local":"使用自定义数据集","sections":[],"depth":2},{"title":"测试脚本","local":"测试脚本","sections":[],"depth":2},{"title":"从checkpoint恢复训练","local":"从checkpoint恢复训练","sections":[],"depth":2},{"title":"分享模型","local":"分享模型","sections":[],"depth":2}],"depth":1}';function Ll(j){return hl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class zl extends dl{constructor(n){super(),Ul(this,n,Ll,Zl,yl,{})}}export{zl as component};
