import{s as st,o as nt,n as Fe}from"../chunks/scheduler.18a86fab.js";import{S as rt,i as ot,g as u,s,r as h,A as pt,h as f,f as t,c as n,j as lt,u as y,x as d,k as at,y as mt,a,v as J,d as _,t as b,w as $}from"../chunks/index.98837b22.js";import{T as ct}from"../chunks/Tip.77304350.js";import{C as A}from"../chunks/CodeBlock.8d0c2e8a.js";import{H as de}from"../chunks/Heading.7e7e0c5b.js";import{H as ut,a as it}from"../chunks/HfOption.6641485e.js";import{E as ft}from"../chunks/index.92f616ba.js";function Mt(G){let r,U="Not all example scripts support the <code>max_predict_samples</code> parameter. Run the command below to check whether a script supports it or not.",m,M,o;return M=new A({props:{code:"ZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwLWg=",highlighted:"examples/pytorch/summarization/run_summarization.py -h",wrap:!1}}),{c(){r=u("p"),r.innerHTML=U,m=s(),h(M.$$.fragment)},l(p){r=f(p,"P",{"data-svelte-h":!0}),d(r)!=="svelte-dama35"&&(r.innerHTML=U),m=n(p),y(M.$$.fragment,p)},m(p,T){a(p,r,T),a(p,m,T),J(M,p,T),o=!0},p:Fe,i(p){o||(_(M.$$.fragment,p),o=!0)},o(p){b(M.$$.fragment,p),o=!1},d(p){p&&(t(r),t(m)),$(M,p)}}}function wt(G){let r,U='The example script downloads and preprocesses a dataset, and then fine-tunes it with <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> with a supported model architecture.',m,M,o="Resuming training from a checkpoint is very useful if training is interrupted because you don’t have to start over again. There are two ways to resume training from a checkpoint.",p,T,W="<li><code>--output dir previous_output_dir</code> resumes training from the latest checkpoint stored in <code>output_dir</code>. Remove the <code>--overwrite_output_dir</code> parameter if you’re using this method.</li> <li><code>--resume_from_checkpoint path_to_specific_checkpoint</code> resumes training from a specific checkpoint folder.</li>",j,g,c='Share your model on the <a href="https://huggingface.co/" rel="nofollow">Hub</a> with the <code>--push_to_hub</code> parameter. It creates a repository and uploads the model to the folder name specified in <code>--output_dir</code>. You could also use the <code>--push_to_hub_model_id</code> parameter to specify the repository name.',I,C,N,x,V='For mixed precision and distributed training, include the following parameters and launch training with <a href="https://pytorch.org/docs/stable/elastic/run.html" rel="nofollow">torchrun</a>.',k,Z,B="<li>Add the <code>fp16</code> or <code>bf16</code> parameters to enable mixed precision training. XPU devices only supports <code>bf16</code>.</li> <li>Add the <code>nproc_per_node</code> parameter to set number of GPUs to train with.</li>",Y,X,S,L,R='PyTorch supports TPUs, hardware designed to accelerate performance, through the <a href="https://github.com/pytorch/xla/blob/master/README.md" rel="nofollow">PyTorch/XLA</a> package. Launch the <code>xla_spawn.py</code> script and use <code>num _cores</code> to set the number of TPU cores to train with.',H,v,E;return C=new A({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMyUyMHJlbW92ZSUyMHRoZSUyMCU2MG1heF90cmFpbl9zYW1wbGVzJTYwJTJDJTIwJTYwbWF4X2V2YWxfc2FtcGxlcyU2MCUyMGFuZCUyMCU2MG1heF9wcmVkaWN0X3NhbXBsZXMlNjAlMjBpZiUyMGV2ZXJ5dGhpbmclMjB3b3JrcyUwQSUyMCUyMCUyMCUyMC0tbWF4X3RyYWluX3NhbXBsZXMlMjA1MCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWF4X2V2YWxfc2FtcGxlcyUyMDUwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tYXhfcHJlZGljdF9zYW1wbGVzJTIwNTAlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX3RyYWluJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb19ldmFsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X25hbWUlMjBjbm5fZGFpbHltYWlsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X2NvbmZpZyUyMCUyMjMuMC4wJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zb3VyY2VfcHJlZml4JTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwJTJGdG1wJTJGdHN0LXN1bW1hcml6YXRpb24lMjAlNUMlMEElMjAlMjAlMjAlMjAtLXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHVzaF90b19odWIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXB1c2hfdG9faHViX21vZGVsX2lkJTIwZmluZXR1bmVkLXQ1LWNubl9kYWlseW1haWwlMjAlNUMlMEElMjAlMjAlMjAlMjAlMjMlMjByZW1vdmUlMjBpZiUyMHVzaW5nJTIwJTYwb3V0cHV0X2RpciUyMHByZXZpb3VzX291dHB1dF9kaXIlNjAlMEElMjAlMjAlMjAlMjAlMjMlMjAtLW92ZXJ3cml0ZV9vdXRwdXRfZGlyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwcHJldmlvdXNfb3V0cHV0X2RpciUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMyUyMC0tcmVzdW1lX2Zyb21fY2hlY2twb2ludCUyMHBhdGhfdG9fc3BlY2lmaWNfY2hlY2twb2ludCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHJlZGljdF93aXRoX2dlbmVyYXRlJTIwJTVD",highlighted:`python examples/pytorch/summarization/run_summarization.py \\
    --model_name_or_path google-t5/t5-small \\
    <span class="hljs-comment"># remove the \`max_train_samples\`, \`max_eval_samples\` and \`max_predict_samples\` if everything works</span>
    --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 \\
    --push_to_hub \\
    --push_to_hub_model_id finetuned-t5-cnn_dailymail \\
    <span class="hljs-comment"># remove if using \`output_dir previous_output_dir\`</span>
    <span class="hljs-comment"># --overwrite_output_dir \\</span>
    --output_dir previous_output_dir \\
    <span class="hljs-comment"># --resume_from_checkpoint path_to_specific_checkpoint \\</span>
    --predict_with_generate \\`,wrap:!1}}),X=new A({props:{code:"dG9yY2hydW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLW5wcm9jX3Blcl9ub2RlJTIwOCUyMHB5dG9yY2glMkZzdW1tYXJpemF0aW9uJTJGcnVuX3N1bW1hcml6YXRpb24ucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLWZwMTYlMjAlNUMlMEElMjAlMjAlMjAlMjAuLi4lMEElMjAlMjAlMjAlMjAuLi4=",highlighted:`torchrun \\
    --nproc_per_node 8 pytorch/summarization/run_summarization.py \\
    --fp16 \\
    ...
    ...`,wrap:!1}}),v=new A({props:{code:"cHl0aG9uJTIweGxhX3NwYXduLnB5JTIwLS1udW1fY29yZXMlMjA4JTIwcHl0b3JjaCUyRnN1bW1hcml6YXRpb24lMkZydW5fc3VtbWFyaXphdGlvbi5weSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwZ29vZ2xlLXQ1JTJGdDUtc21hbGwlMjAlNUMlMEElMjAlMjAlMjAlMjAuLi4lMEElMjAlMjAlMjAlMjAuLi4=",highlighted:`python xla_spawn.py --num_cores 8 pytorch/summarization/run_summarization.py \\
    --model_name_or_path google-t5/t5-small \\
    ...
    ...`,wrap:!1}}),{c(){r=u("p"),r.innerHTML=U,m=s(),M=u("p"),M.textContent=o,p=s(),T=u("ul"),T.innerHTML=W,j=s(),g=u("p"),g.innerHTML=c,I=s(),h(C.$$.fragment),N=s(),x=u("p"),x.innerHTML=V,k=s(),Z=u("ul"),Z.innerHTML=B,Y=s(),h(X.$$.fragment),S=s(),L=u("p"),L.innerHTML=R,H=s(),h(v.$$.fragment)},l(i){r=f(i,"P",{"data-svelte-h":!0}),d(r)!=="svelte-g4tflh"&&(r.innerHTML=U),m=n(i),M=f(i,"P",{"data-svelte-h":!0}),d(M)!=="svelte-1ib51jx"&&(M.textContent=o),p=n(i),T=f(i,"UL",{"data-svelte-h":!0}),d(T)!=="svelte-156tr31"&&(T.innerHTML=W),j=n(i),g=f(i,"P",{"data-svelte-h":!0}),d(g)!=="svelte-3w6fs5"&&(g.innerHTML=c),I=n(i),y(C.$$.fragment,i),N=n(i),x=f(i,"P",{"data-svelte-h":!0}),d(x)!=="svelte-g34bxd"&&(x.innerHTML=V),k=n(i),Z=f(i,"UL",{"data-svelte-h":!0}),d(Z)!=="svelte-vvd6kc"&&(Z.innerHTML=B),Y=n(i),y(X.$$.fragment,i),S=n(i),L=f(i,"P",{"data-svelte-h":!0}),d(L)!=="svelte-1vgd91y"&&(L.innerHTML=R),H=n(i),y(v.$$.fragment,i)},m(i,w){a(i,r,w),a(i,m,w),a(i,M,w),a(i,p,w),a(i,T,w),a(i,j,w),a(i,g,w),a(i,I,w),J(C,i,w),a(i,N,w),a(i,x,w),a(i,k,w),a(i,Z,w),a(i,Y,w),J(X,i,w),a(i,S,w),a(i,L,w),a(i,H,w),J(v,i,w),E=!0},p:Fe,i(i){E||(_(C.$$.fragment,i),_(X.$$.fragment,i),_(v.$$.fragment,i),E=!0)},o(i){b(C.$$.fragment,i),b(X.$$.fragment,i),b(v.$$.fragment,i),E=!1},d(i){i&&(t(r),t(m),t(M),t(p),t(T),t(j),t(g),t(I),t(N),t(x),t(k),t(Z),t(Y),t(S),t(L),t(H)),$(C,i),$(X,i),$(v,i)}}}function dt(G){let r,U,m,M='TensorFlow uses the <a href="https://www.tensorflow.org/guide/distributed_training#mirroredstrategy" rel="nofollow">MirroredStrategy</a> for distributed training and doesn’t require adding any additional parameters. The script uses multiple GPUs by default if they are available.',o,p,T='For TPU training, TensorFlow scripts use the <a href="https://www.tensorflow.org/guide/distributed_training#tpustrategy" rel="nofollow">TPUStrategy</a>. Pass the TPU resource name to the <code>--tpu</code> parameter.',W,j,g;return r=new A({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZ0ZW5zb3JmbG93JTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMyUyMHJlbW92ZSUyMHRoZSUyMCU2MG1heF90cmFpbl9zYW1wbGVzJTYwJTJDJTIwJTYwbWF4X2V2YWxfc2FtcGxlcyU2MCUyMGFuZCUyMCU2MG1heF9wcmVkaWN0X3NhbXBsZXMlNjAlMjBpZiUyMGV2ZXJ5dGhpbmclMjB3b3JrcyUwQSUyMCUyMCUyMCUyMC0tbWF4X3RyYWluX3NhbXBsZXMlMjA1MCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWF4X2V2YWxfc2FtcGxlcyUyMDUwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tYXhfcHJlZGljdF9zYW1wbGVzJTIwNTAlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfbmFtZSUyMGNubl9kYWlseW1haWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfY29uZmlnJTIwJTIyMy4wLjAlMjIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW91dHB1dF9kaXIlMjAlMkZ0bXAlMkZ0c3Qtc3VtbWFyaXphdGlvbiUyMCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwOCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlMjAxNiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbnVtX3RyYWluX2Vwb2NocyUyMDMlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX3RyYWluJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb19ldmFsJTIwJTVD",highlighted:`python examples/tensorflow/summarization/run_summarization.py  \\
    --model_name_or_path google-t5/t5-small \\
    <span class="hljs-comment"># remove the \`max_train_samples\`, \`max_eval_samples\` and \`max_predict_samples\` if everything works</span>
    --max_train_samples 50 \\
    --max_eval_samples 50 \\
    --max_predict_samples 50 \\
    --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}}),j=new A({props:{code:"cHl0aG9uJTIwcnVuX3N1bW1hcml6YXRpb24ucHklMjAlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRwdSUyMG5hbWVfb2ZfdHB1X3Jlc291cmNlJTIwJTVDJTBBJTIwJTIwJTIwJTIwLi4uJTBBJTIwJTIwJTIwJTIwLi4u",highlighted:`python run_summarization.py  \\
    --tpu name_of_tpu_resource \\
    ...
    ...`,wrap:!1}}),{c(){h(r.$$.fragment),U=s(),m=u("p"),m.innerHTML=M,o=s(),p=u("p"),p.innerHTML=T,W=s(),h(j.$$.fragment)},l(c){y(r.$$.fragment,c),U=n(c),m=f(c,"P",{"data-svelte-h":!0}),d(m)!=="svelte-1146bks"&&(m.innerHTML=M),o=n(c),p=f(c,"P",{"data-svelte-h":!0}),d(p)!=="svelte-1hzyazt"&&(p.innerHTML=T),W=n(c),y(j.$$.fragment,c)},m(c,I){J(r,c,I),a(c,U,I),a(c,m,I),a(c,o,I),a(c,p,I),a(c,W,I),J(j,c,I),g=!0},p:Fe,i(c){g||(_(r.$$.fragment,c),_(j.$$.fragment,c),g=!0)},o(c){b(r.$$.fragment,c),b(j.$$.fragment,c),g=!1},d(c){c&&(t(U),t(m),t(o),t(p),t(W)),$(r,c),$(j,c)}}}function Tt(G){let r,U,m,M;return r=new it({props:{id:"script",option:"PyTorch",$$slots:{default:[wt]},$$scope:{ctx:G}}}),m=new it({props:{id:"script",option:"TensorFlow",$$slots:{default:[dt]},$$scope:{ctx:G}}}),{c(){h(r.$$.fragment),U=s(),h(m.$$.fragment)},l(o){y(r.$$.fragment,o),U=n(o),y(m.$$.fragment,o)},m(o,p){J(r,o,p),a(o,U,p),J(m,o,p),M=!0},p(o,p){const T={};p&2&&(T.$$scope={dirty:p,ctx:o}),r.$set(T);const W={};p&2&&(W.$$scope={dirty:p,ctx:o}),m.$set(W)},i(o){M||(_(r.$$.fragment,o),_(m.$$.fragment,o),M=!0)},o(o){b(r.$$.fragment,o),b(m.$$.fragment,o),M=!1},d(o){o&&t(U),$(r,o),$(m,o)}}}function ht(G){let r,U,m,M,o,p,T,W='Transformers provides many example training scripts for deep learning frameworks (PyTorch, TensorFlow, Flax) and tasks in <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">transformers/examples</a>. There are additional scripts in <a href="https://github.com/huggingface/transformers-research-projects/" rel="nofollow">transformers/research projects</a> and <a href="https://github.com/huggingface/transformers/tree/main/examples/legacy" rel="nofollow">transformers/legacy</a>, but these aren’t actively maintained and requires a specific version of Transformers.',j,g,c="Example scripts are only examples and you may need to adapt the script to your use-case. To help you with this, most scripts are very transparent in how data is preprocessed, allowing you to edit it as necessary.",I,C,N='For any feature you’d like to implement in an example script, please discuss it on the <a href="https://discuss.huggingface.co/" rel="nofollow">forum</a> or in an <a href="https://github.com/huggingface/transformers/issues" rel="nofollow">issue</a> before submitting a pull request. While we welcome contributions, it is unlikely a pull request that adds more functionality is added at the cost of readability.',x,V,k='This guide will show you how to run an example summarization training script in <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization" rel="nofollow">PyTorch</a> and <a href="https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization" rel="nofollow">TensorFlow</a>.',Z,B,Y,X,S="Install Transformers from source in a new virtual environment to run the latest version of the example script.",L,R,H,v,E="Run the command below to checkout a script from a specific or older version of Transformers.",i,w,Te,P,ze="After you’ve setup the correct version, navigate to the example folder of your choice and install the example specific requirements.",he,Q,ye,D,Je,q,Ne="Start with a smaller dataset by including the <code>max_train_samples</code>, <code>max_eval_samples</code>, and <code>max_predict_samples</code> parameters to truncate the dataset to a maximum number of samples. This helps ensure training works as expected before committing to the entire dataset which can take hours to complete.",_e,F,be,O,ke='The example below fine-tunes <a href="https://huggingface.co/google-t5/t5-small" rel="nofollow">T5-small</a> on the <a href="https://huggingface.co/datasets/abisee/cnn_dailymail" rel="nofollow">CNN/DailyMail</a> dataset. T5 requires an additional <code>source_prefix</code> parameter to prompt it to summarize.',$e,z,Ue,K,ge,ee,Se='<a href="https://huggingface.co/docs/accelerate" rel="nofollow">Accelerate</a> is designed to simplify distributed training while offering complete visibility into the PyTorch training loop. If you’re planning on training with a script with Accelerate, use the <code>_no_trainer.py</code> version of the script.',je,te,Ee="Install Accelerate from source to ensure you have the latest version.",Ie,le,Ce,ae,Pe='Run the <a href="https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-config" rel="nofollow">accelerate config</a> command to answer a few questions about your training setup. This creates and saves a config file about your system.',Xe,ie,ve,se,Qe='You can use <a href="https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-test" rel="nofollow">accelerate test</a> to ensure your system is properly configured.',Ae,ne,We,re,De='Run <a href="https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch" rel="nofollow">accelerate launch</a> to start training.',xe,oe,Ze,pe,Le,me,qe="The summarization scripts supports custom datasets as long as they are a CSV or JSONL file. When using your own dataset, you need to specify the following additional parameters.",Ge,ce,Oe="<li><code>train_file</code> and <code>validation_file</code> specify the path to your training and validation files.</li> <li><code>text_column</code> is the input text to summarize.</li> <li><code>summary_column</code> is the target text to output.</li>",Ve,ue,Ke="An example command for summarizing a custom dataset is shown below.",Be,fe,Re,Me,Ye,we,He;return o=new de({props:{title:"Training scripts",local:"training-scripts",headingTag:"h1"}}),B=new de({props:{title:"Setup",local:"setup",headingTag:"h2"}}),R=new A({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}}),w=new A({props:{code:"Z2l0JTIwY2hlY2tvdXQlMjB0YWdzJTJGdjMuNS4x",highlighted:"git checkout tags/v3.5.1",wrap:!1}}),Q=new A({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:"pip install -r requirements.txt",wrap:!1}}),D=new de({props:{title:"Run a script",local:"run-a-script",headingTag:"h2"}}),F=new ct({props:{warning:!0,$$slots:{default:[Mt]},$$scope:{ctx:G}}}),z=new ut({props:{id:"script",options:["PyTorch","TensorFlow"],$$slots:{default:[Tt]},$$scope:{ctx:G}}}),K=new de({props:{title:"Accelerate",local:"accelerate",headingTag:"h2"}}),le=new A({props:{code:"cGlwJTIwaW5zdGFsbCUyMGdpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmh1Z2dpbmdmYWNlJTJGYWNjZWxlcmF0ZQ==",highlighted:"pip install git+https://github.com/huggingface/accelerate",wrap:!1}}),ie=new A({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),ne=new A({props:{code:"YWNjZWxlcmF0ZSUyMHRlc3Q=",highlighted:'accelerate <span class="hljs-built_in">test</span>',wrap:!1}}),oe=new A({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHJ1bl9zdW1tYXJpemF0aW9uX25vX3RyYWluZXIucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1vZGVsX25hbWVfb3JfcGF0aCUyMGdvb2dsZS10NSUyRnQ1LXNtYWxsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X25hbWUlMjBjbm5fZGFpbHltYWlsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X2NvbmZpZyUyMCUyMjMuMC4wJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zb3VyY2VfcHJlZml4JTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwfiUyRnRtcCUyRnRzdC1zdW1tYXJpemF0aW9uJTIwJTVD",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}}),pe=new de({props:{title:"Custom dataset",local:"custom-dataset",headingTag:"h2"}}),fe=new A({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZweXRvcmNoJTJGc3VtbWFyaXphdGlvbiUyRnJ1bl9zdW1tYXJpemF0aW9uLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtdDUlMkZ0NS1zbWFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX2V2YWwlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRyYWluX2ZpbGUlMjBwYXRoX3RvX2Nzdl9vcl9qc29ubGluZXNfZmlsZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdmFsaWRhdGlvbl9maWxlJTIwcGF0aF90b19jc3Zfb3JfanNvbmxpbmVzX2ZpbGUlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRleHRfY29sdW1uJTIwdGV4dF9jb2x1bW5fbmFtZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tc3VtbWFyeV9jb2x1bW4lMjBzdW1tYXJ5X2NvbHVtbl9uYW1lJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zb3VyY2VfcHJlZml4JTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwJTJGdG1wJTJGdHN0LXN1bW1hcml6YXRpb24lMjAlNUMlMEElMjAlMjAlMjAlMjAtLW92ZXJ3cml0ZV9vdXRwdXRfZGlyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0Q0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUzRDQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXByZWRpY3Rfd2l0aF9nZW5lcmF0ZSUyMCU1Qw==",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}}),Me=new ft({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/run_scripts.md"}}),{c(){r=u("meta"),U=s(),m=u("p"),M=s(),h(o.$$.fragment),p=s(),T=u("p"),T.innerHTML=W,j=s(),g=u("p"),g.textContent=c,I=s(),C=u("p"),C.innerHTML=N,x=s(),V=u("p"),V.innerHTML=k,Z=s(),h(B.$$.fragment),Y=s(),X=u("p"),X.textContent=S,L=s(),h(R.$$.fragment),H=s(),v=u("p"),v.textContent=E,i=s(),h(w.$$.fragment),Te=s(),P=u("p"),P.textContent=ze,he=s(),h(Q.$$.fragment),ye=s(),h(D.$$.fragment),Je=s(),q=u("p"),q.innerHTML=Ne,_e=s(),h(F.$$.fragment),be=s(),O=u("p"),O.innerHTML=ke,$e=s(),h(z.$$.fragment),Ue=s(),h(K.$$.fragment),ge=s(),ee=u("p"),ee.innerHTML=Se,je=s(),te=u("p"),te.textContent=Ee,Ie=s(),h(le.$$.fragment),Ce=s(),ae=u("p"),ae.innerHTML=Pe,Xe=s(),h(ie.$$.fragment),ve=s(),se=u("p"),se.innerHTML=Qe,Ae=s(),h(ne.$$.fragment),We=s(),re=u("p"),re.innerHTML=De,xe=s(),h(oe.$$.fragment),Ze=s(),h(pe.$$.fragment),Le=s(),me=u("p"),me.textContent=qe,Ge=s(),ce=u("ul"),ce.innerHTML=Oe,Ve=s(),ue=u("p"),ue.textContent=Ke,Be=s(),h(fe.$$.fragment),Re=s(),h(Me.$$.fragment),Ye=s(),we=u("p"),this.h()},l(e){const l=pt("svelte-u9bgzb",document.head);r=f(l,"META",{name:!0,content:!0}),l.forEach(t),U=n(e),m=f(e,"P",{}),lt(m).forEach(t),M=n(e),y(o.$$.fragment,e),p=n(e),T=f(e,"P",{"data-svelte-h":!0}),d(T)!=="svelte-sj6eg3"&&(T.innerHTML=W),j=n(e),g=f(e,"P",{"data-svelte-h":!0}),d(g)!=="svelte-17z6llo"&&(g.textContent=c),I=n(e),C=f(e,"P",{"data-svelte-h":!0}),d(C)!=="svelte-ktsq4f"&&(C.innerHTML=N),x=n(e),V=f(e,"P",{"data-svelte-h":!0}),d(V)!=="svelte-x5jw0l"&&(V.innerHTML=k),Z=n(e),y(B.$$.fragment,e),Y=n(e),X=f(e,"P",{"data-svelte-h":!0}),d(X)!=="svelte-znqcxj"&&(X.textContent=S),L=n(e),y(R.$$.fragment,e),H=n(e),v=f(e,"P",{"data-svelte-h":!0}),d(v)!=="svelte-1heqpxe"&&(v.textContent=E),i=n(e),y(w.$$.fragment,e),Te=n(e),P=f(e,"P",{"data-svelte-h":!0}),d(P)!=="svelte-eoouts"&&(P.textContent=ze),he=n(e),y(Q.$$.fragment,e),ye=n(e),y(D.$$.fragment,e),Je=n(e),q=f(e,"P",{"data-svelte-h":!0}),d(q)!=="svelte-zd5fp"&&(q.innerHTML=Ne),_e=n(e),y(F.$$.fragment,e),be=n(e),O=f(e,"P",{"data-svelte-h":!0}),d(O)!=="svelte-7oln71"&&(O.innerHTML=ke),$e=n(e),y(z.$$.fragment,e),Ue=n(e),y(K.$$.fragment,e),ge=n(e),ee=f(e,"P",{"data-svelte-h":!0}),d(ee)!=="svelte-ovbb1b"&&(ee.innerHTML=Se),je=n(e),te=f(e,"P",{"data-svelte-h":!0}),d(te)!=="svelte-14nzkpr"&&(te.textContent=Ee),Ie=n(e),y(le.$$.fragment,e),Ce=n(e),ae=f(e,"P",{"data-svelte-h":!0}),d(ae)!=="svelte-xfl23x"&&(ae.innerHTML=Pe),Xe=n(e),y(ie.$$.fragment,e),ve=n(e),se=f(e,"P",{"data-svelte-h":!0}),d(se)!=="svelte-e813qa"&&(se.innerHTML=Qe),Ae=n(e),y(ne.$$.fragment,e),We=n(e),re=f(e,"P",{"data-svelte-h":!0}),d(re)!=="svelte-2l6taw"&&(re.innerHTML=De),xe=n(e),y(oe.$$.fragment,e),Ze=n(e),y(pe.$$.fragment,e),Le=n(e),me=f(e,"P",{"data-svelte-h":!0}),d(me)!=="svelte-1ahosjn"&&(me.textContent=qe),Ge=n(e),ce=f(e,"UL",{"data-svelte-h":!0}),d(ce)!=="svelte-1jtimg7"&&(ce.innerHTML=Oe),Ve=n(e),ue=f(e,"P",{"data-svelte-h":!0}),d(ue)!=="svelte-1qbczyv"&&(ue.textContent=Ke),Be=n(e),y(fe.$$.fragment,e),Re=n(e),y(Me.$$.fragment,e),Ye=n(e),we=f(e,"P",{}),lt(we).forEach(t),this.h()},h(){at(r,"name","hf:doc:metadata"),at(r,"content",yt)},m(e,l){mt(document.head,r),a(e,U,l),a(e,m,l),a(e,M,l),J(o,e,l),a(e,p,l),a(e,T,l),a(e,j,l),a(e,g,l),a(e,I,l),a(e,C,l),a(e,x,l),a(e,V,l),a(e,Z,l),J(B,e,l),a(e,Y,l),a(e,X,l),a(e,L,l),J(R,e,l),a(e,H,l),a(e,v,l),a(e,i,l),J(w,e,l),a(e,Te,l),a(e,P,l),a(e,he,l),J(Q,e,l),a(e,ye,l),J(D,e,l),a(e,Je,l),a(e,q,l),a(e,_e,l),J(F,e,l),a(e,be,l),a(e,O,l),a(e,$e,l),J(z,e,l),a(e,Ue,l),J(K,e,l),a(e,ge,l),a(e,ee,l),a(e,je,l),a(e,te,l),a(e,Ie,l),J(le,e,l),a(e,Ce,l),a(e,ae,l),a(e,Xe,l),J(ie,e,l),a(e,ve,l),a(e,se,l),a(e,Ae,l),J(ne,e,l),a(e,We,l),a(e,re,l),a(e,xe,l),J(oe,e,l),a(e,Ze,l),J(pe,e,l),a(e,Le,l),a(e,me,l),a(e,Ge,l),a(e,ce,l),a(e,Ve,l),a(e,ue,l),a(e,Be,l),J(fe,e,l),a(e,Re,l),J(Me,e,l),a(e,Ye,l),a(e,we,l),He=!0},p(e,[l]){const et={};l&2&&(et.$$scope={dirty:l,ctx:e}),F.$set(et);const tt={};l&2&&(tt.$$scope={dirty:l,ctx:e}),z.$set(tt)},i(e){He||(_(o.$$.fragment,e),_(B.$$.fragment,e),_(R.$$.fragment,e),_(w.$$.fragment,e),_(Q.$$.fragment,e),_(D.$$.fragment,e),_(F.$$.fragment,e),_(z.$$.fragment,e),_(K.$$.fragment,e),_(le.$$.fragment,e),_(ie.$$.fragment,e),_(ne.$$.fragment,e),_(oe.$$.fragment,e),_(pe.$$.fragment,e),_(fe.$$.fragment,e),_(Me.$$.fragment,e),He=!0)},o(e){b(o.$$.fragment,e),b(B.$$.fragment,e),b(R.$$.fragment,e),b(w.$$.fragment,e),b(Q.$$.fragment,e),b(D.$$.fragment,e),b(F.$$.fragment,e),b(z.$$.fragment,e),b(K.$$.fragment,e),b(le.$$.fragment,e),b(ie.$$.fragment,e),b(ne.$$.fragment,e),b(oe.$$.fragment,e),b(pe.$$.fragment,e),b(fe.$$.fragment,e),b(Me.$$.fragment,e),He=!1},d(e){e&&(t(U),t(m),t(M),t(p),t(T),t(j),t(g),t(I),t(C),t(x),t(V),t(Z),t(Y),t(X),t(L),t(H),t(v),t(i),t(Te),t(P),t(he),t(ye),t(Je),t(q),t(_e),t(be),t(O),t($e),t(Ue),t(ge),t(ee),t(je),t(te),t(Ie),t(Ce),t(ae),t(Xe),t(ve),t(se),t(Ae),t(We),t(re),t(xe),t(Ze),t(Le),t(me),t(Ge),t(ce),t(Ve),t(ue),t(Be),t(Re),t(Ye),t(we)),t(r),$(o,e),$(B,e),$(R,e),$(w,e),$(Q,e),$(D,e),$(F,e),$(z,e),$(K,e),$(le,e),$(ie,e),$(ne,e),$(oe,e),$(pe,e),$(fe,e),$(Me,e)}}}const yt='{"title":"Training scripts","local":"training-scripts","sections":[{"title":"Setup","local":"setup","sections":[],"depth":2},{"title":"Run a script","local":"run-a-script","sections":[],"depth":2},{"title":"Accelerate","local":"accelerate","sections":[],"depth":2},{"title":"Custom dataset","local":"custom-dataset","sections":[],"depth":2}],"depth":1}';function Jt(G){return nt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ct extends rt{constructor(r){super(),ot(this,r,Jt,ht,st,{})}}export{Ct as component};
