import{S as ZV,i as JV,s as KV,e as n,k as l,w as f,t as r,M as QV,c as s,d as o,m as d,a as i,x as g,h as a,b as m,G as e,g as p,y as _,q as v,o as b,B as y,v as eY,L as ko}from"../../chunks/vendor-hf-doc-builder.js";import{T as $r}from"../../chunks/Tip-hf-doc-builder.js";import{D}from"../../chunks/Docstring-hf-doc-builder.js";import{C as O}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as te}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as xo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function tY(C){let u,x,T,w,k,h,E,z,j,I,G,B,Q,K,Z,X,me,J,M,R,ae,N,we,Te,ne,bt,yt,ue,Ie,Dn,Ee,Sn,On;return{c(){u=n("p"),x=r("The "),T=n("a"),w=r("Trainer"),k=r(` class is optimized for \u{1F917} Transformers models and can have surprising behaviors
when you use it on other models. When using it on your own model, make sure:`),h=l(),E=n("ul"),z=n("li"),j=r("your model always return tuples or subclasses of "),I=n("a"),G=r("ModelOutput"),B=r("."),Q=l(),K=n("li"),Z=r("your model can compute the loss if a "),X=n("code"),me=r("labels"),J=r(` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),M=l(),R=n("li"),ae=r("your model can accept multiple label arguments (use the "),N=n("code"),we=r("label_names"),Te=r(" in your "),ne=n("a"),bt=r("TrainingArguments"),yt=r(" to indicate their name to the "),ue=n("a"),Ie=r("Trainer"),Dn=r(") but none of them should be named "),Ee=n("code"),Sn=r('"label"'),On=r("."),this.h()},l(se){u=s(se,"P",{});var oe=i(u);x=a(oe,"The "),T=s(oe,"A",{href:!0});var ld=i(T);w=a(ld,"Trainer"),ld.forEach(o),k=a(oe,` class is optimized for \u{1F917} Transformers models and can have surprising behaviors
when you use it on other models. When using it on your own model, make sure:`),oe.forEach(o),h=d(se),E=s(se,"UL",{});var $e=i(E);z=s($e,"LI",{});var xr=i(z);j=a(xr,"your model always return tuples or subclasses of "),I=s(xr,"A",{href:!0});var dd=i(I);G=a(dd,"ModelOutput"),dd.forEach(o),B=a(xr,"."),xr.forEach(o),Q=d($e),K=s($e,"LI",{});var Ao=i(K);Z=a(Ao,"your model can compute the loss if a "),X=s(Ao,"CODE",{});var W=i(X);me=a(W,"labels"),W.forEach(o),J=a(Ao,` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),Ao.forEach(o),M=d($e),R=s($e,"LI",{});var re=i(R);ae=a(re,"your model can accept multiple label arguments (use the "),N=s(re,"CODE",{});var kr=i(N);we=a(kr,"label_names"),kr.forEach(o),Te=a(re," in your "),ne=s(re,"A",{href:!0});var cd=i(ne);bt=a(cd,"TrainingArguments"),cd.forEach(o),yt=a(re," to indicate their name to the "),ue=s(re,"A",{href:!0});var pd=i(ue);Ie=a(pd,"Trainer"),pd.forEach(o),Dn=a(re,") but none of them should be named "),Ee=s(re,"CODE",{});var md=i(Ee);Sn=a(md,'"label"'),md.forEach(o),On=a(re,"."),re.forEach(o),$e.forEach(o),this.h()},h(){m(T,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(I,"href","/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput"),m(ne,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.TrainingArguments"),m(ue,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer")},m(se,oe){p(se,u,oe),e(u,x),e(u,T),e(T,w),e(u,k),p(se,h,oe),p(se,E,oe),e(E,z),e(z,j),e(z,I),e(I,G),e(z,B),e(E,Q),e(E,K),e(K,Z),e(K,X),e(X,me),e(K,J),e(E,M),e(E,R),e(R,ae),e(R,N),e(N,we),e(R,Te),e(R,ne),e(ne,bt),e(R,yt),e(R,ue),e(ue,Ie),e(R,Dn),e(R,Ee),e(Ee,Sn),e(R,On)},d(se){se&&o(u),se&&o(h),se&&o(E)}}}function oY(C){let u,x,T,w,k,h,E,z,j,I,G,B,Q,K,Z,X,me;return{c(){u=n("p"),x=r("To use this method, you need to have provided a "),T=n("code"),w=r("model_init"),k=r(" when initializing your "),h=n("a"),E=r("Trainer"),z=r(`: we need to
reinitialize the model at each new run. This is incompatible with the `),j=n("code"),I=r("optimizers"),G=r(` argument, so you need to
subclass `),B=n("a"),Q=r("Trainer"),K=r(" and override the method "),Z=n("a"),X=r("create_optimizer_and_scheduler()"),me=r(` for custom
optimizer/scheduler.`),this.h()},l(J){u=s(J,"P",{});var M=i(u);x=a(M,"To use this method, you need to have provided a "),T=s(M,"CODE",{});var R=i(T);w=a(R,"model_init"),R.forEach(o),k=a(M," when initializing your "),h=s(M,"A",{href:!0});var ae=i(h);E=a(ae,"Trainer"),ae.forEach(o),z=a(M,`: we need to
reinitialize the model at each new run. This is incompatible with the `),j=s(M,"CODE",{});var N=i(j);I=a(N,"optimizers"),N.forEach(o),G=a(M,` argument, so you need to
subclass `),B=s(M,"A",{href:!0});var we=i(B);Q=a(we,"Trainer"),we.forEach(o),K=a(M," and override the method "),Z=s(M,"A",{href:!0});var Te=i(Z);X=a(Te,"create_optimizer_and_scheduler()"),Te.forEach(o),me=a(M,` for custom
optimizer/scheduler.`),M.forEach(o),this.h()},h(){m(h,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(B,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(Z,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.create_optimizer_and_scheduler")},m(J,M){p(J,u,M),e(u,x),e(u,T),e(T,w),e(u,k),e(u,h),e(h,E),e(u,z),e(u,j),e(j,I),e(u,G),e(u,B),e(B,Q),e(u,K),e(u,Z),e(Z,X),e(u,me)},d(J){J&&o(u)}}}function rY(C){let u,x,T,w,k;return w=new O({props:{code:`init_mem_cpu_alloc_delta   =     1301MB
init_mem_cpu_peaked_delta  =      154MB
init_mem_gpu_alloc_delta   =      230MB
init_mem_gpu_peaked_delta  =        0MB
train_mem_cpu_alloc_delta  =     1345MB
train_mem_cpu_peaked_delta =        0MB
train_mem_gpu_alloc_delta  =      693MB
train_mem_gpu_peaked_delta =        7MB`,highlighted:`<span class="hljs-attr">init_mem_cpu_alloc_delta</span>   =     <span class="hljs-number">1301</span>MB
<span class="hljs-attr">init_mem_cpu_peaked_delta</span>  =      <span class="hljs-number">154</span>MB
<span class="hljs-attr">init_mem_gpu_alloc_delta</span>   =      <span class="hljs-number">230</span>MB
<span class="hljs-attr">init_mem_gpu_peaked_delta</span>  =        <span class="hljs-number">0</span>MB
<span class="hljs-attr">train_mem_cpu_alloc_delta</span>  =     <span class="hljs-number">1345</span>MB
<span class="hljs-attr">train_mem_cpu_peaked_delta</span> =        <span class="hljs-number">0</span>MB
<span class="hljs-attr">train_mem_gpu_alloc_delta</span>  =      <span class="hljs-number">693</span>MB
<span class="hljs-attr">train_mem_gpu_peaked_delta</span> =        <span class="hljs-number">7</span>MB`}}),{c(){u=n("p"),x=r("Now when this method is run, you will see a report that will include: :"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Now when this method is run, you will see a report that will include: :"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function aY(C){let u,x;return{c(){u=n("p"),x=r(`If your predictions or labels have different sequence length (for instance because you\u2019re doing dynamic padding
in a token classification task) the predictions will be padded (on the right) to allow for concatenation into
one array. The padding index is -100.`)},l(T){u=s(T,"P",{});var w=i(u);x=a(w,`If your predictions or labels have different sequence length (for instance because you\u2019re doing dynamic padding
in a token classification task) the predictions will be padded (on the right) to allow for concatenation into
one array. The padding index is -100.`),w.forEach(o)},m(T,w){p(T,u,w),e(u,x)},d(T){T&&o(u)}}}function nY(C){let u,x;return{c(){u=n("p"),x=r(`If your predictions or labels have different sequence lengths (for instance because you\u2019re doing dynamic
padding in a token classification task) the predictions will be padded (on the right) to allow for
concatenation into one array. The padding index is -100.`)},l(T){u=s(T,"P",{});var w=i(u);x=a(w,`If your predictions or labels have different sequence lengths (for instance because you\u2019re doing dynamic
padding in a token classification task) the predictions will be padded (on the right) to allow for
concatenation into one array. The padding index is -100.`),w.forEach(o)},m(T,w){p(T,u,w),e(u,x)},d(T){T&&o(u)}}}function sY(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_dataloader(train_batch_size=16, eval_batch_size=64)
args.per_device_train_batch_size`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_dataloader(train_batch_size=<span class="hljs-number">16</span>, eval_batch_size=<span class="hljs-number">64</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.per_device_train_batch_size
<span class="hljs-number">16</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function iY(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_evaluate(strategy="steps", steps=100)
args.eval_steps`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_evaluate(strategy=<span class="hljs-string">&quot;steps&quot;</span>, steps=<span class="hljs-number">100</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.eval_steps
<span class="hljs-number">100</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function lY(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_logging(strategy="steps", steps=100)
args.logging_steps`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_logging(strategy=<span class="hljs-string">&quot;steps&quot;</span>, steps=<span class="hljs-number">100</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.logging_steps
<span class="hljs-number">100</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function dY(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_lr_scheduler(name="cosine", warmup_ratio=0.05)
args.warmup_ratio`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_lr_scheduler(name=<span class="hljs-string">&quot;cosine&quot;</span>, warmup_ratio=<span class="hljs-number">0.05</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.warmup_ratio
<span class="hljs-number">0.05</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function cY(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_optimizer(name="adamw_torch", beta1=0.8)
args.optim`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_optimizer(name=<span class="hljs-string">&quot;adamw_torch&quot;</span>, beta1=<span class="hljs-number">0.8</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.optim
<span class="hljs-string">&#x27;adamw_torch&#x27;</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function pY(C){let u,x,T,w,k,h,E,z,j,I,G,B,Q,K,Z,X,me,J,M,R;return{c(){u=n("p"),x=r("Calling this method will set "),T=n("code"),w=r("self.push_to_hub"),k=r(" to "),h=n("code"),E=r("True"),z=r(", which means the "),j=n("code"),I=r("output_dir"),G=r(` will begin a git
directory synced with the repo (determined by `),B=n("code"),Q=r("model_id"),K=r(`) and the content will be pushed each time a save is
triggered (depending on`),Z=n("code"),X=r("self.save_strategy"),me=r("). Calling "),J=n("a"),M=r("save_model()"),R=r(" will also trigger a push."),this.h()},l(ae){u=s(ae,"P",{});var N=i(u);x=a(N,"Calling this method will set "),T=s(N,"CODE",{});var we=i(T);w=a(we,"self.push_to_hub"),we.forEach(o),k=a(N," to "),h=s(N,"CODE",{});var Te=i(h);E=a(Te,"True"),Te.forEach(o),z=a(N,", which means the "),j=s(N,"CODE",{});var ne=i(j);I=a(ne,"output_dir"),ne.forEach(o),G=a(N,` will begin a git
directory synced with the repo (determined by `),B=s(N,"CODE",{});var bt=i(B);Q=a(bt,"model_id"),bt.forEach(o),K=a(N,`) and the content will be pushed each time a save is
triggered (depending on`),Z=s(N,"CODE",{});var yt=i(Z);X=a(yt,"self.save_strategy"),yt.forEach(o),me=a(N,"). Calling "),J=s(N,"A",{href:!0});var ue=i(J);M=a(ue,"save_model()"),ue.forEach(o),R=a(N," will also trigger a push."),N.forEach(o),this.h()},h(){m(J,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.save_model")},m(ae,N){p(ae,u,N),e(u,x),e(u,T),e(T,w),e(u,k),e(u,h),e(h,E),e(u,z),e(u,j),e(j,I),e(u,G),e(u,B),e(B,Q),e(u,K),e(u,Z),e(Z,X),e(u,me),e(u,J),e(J,M),e(u,R)},d(ae){ae&&o(u)}}}function mY(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_push_to_hub("me/awesome-model")
args.hub_model_id`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_push_to_hub(<span class="hljs-string">&quot;me/awesome-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.hub_model_id
<span class="hljs-string">&#x27;me/awesome-model&#x27;</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function hY(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_save(strategy="steps", steps=100)
args.save_steps`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_save(strategy=<span class="hljs-string">&quot;steps&quot;</span>, steps=<span class="hljs-number">100</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.save_steps
<span class="hljs-number">100</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function uY(C){let u,x,T,w,k,h,E,z;return{c(){u=n("p"),x=r("Calling this method will automatically set "),T=n("code"),w=r("self.do_predict"),k=r(" to "),h=n("code"),E=r("True"),z=r(".")},l(j){u=s(j,"P",{});var I=i(u);x=a(I,"Calling this method will automatically set "),T=s(I,"CODE",{});var G=i(T);w=a(G,"self.do_predict"),G.forEach(o),k=a(I," to "),h=s(I,"CODE",{});var B=i(h);E=a(B,"True"),B.forEach(o),z=a(I,"."),I.forEach(o)},m(j,I){p(j,u,I),e(u,x),e(u,T),e(T,w),e(u,k),e(u,h),e(h,E),e(u,z)},d(j){j&&o(u)}}}function fY(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_testing(batch_size=32)
args.per_device_eval_batch_size`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_testing(batch_size=<span class="hljs-number">32</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.per_device_eval_batch_size
<span class="hljs-number">32</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function gY(C){let u,x,T,w,k,h,E,z;return{c(){u=n("p"),x=r("Calling this method will automatically set "),T=n("code"),w=r("self.do_train"),k=r(" to "),h=n("code"),E=r("True"),z=r(".")},l(j){u=s(j,"P",{});var I=i(u);x=a(I,"Calling this method will automatically set "),T=s(I,"CODE",{});var G=i(T);w=a(G,"self.do_train"),G.forEach(o),k=a(I," to "),h=s(I,"CODE",{});var B=i(h);E=a(B,"True"),B.forEach(o),z=a(I,"."),I.forEach(o)},m(j,I){p(j,u,I),e(u,x),e(u,T),e(T,w),e(u,k),e(u,h),e(h,E),e(u,z)},d(j){j&&o(u)}}}function _Y(C){let u,x,T,w,k;return w=new O({props:{code:`from transformers import TrainingArguments

args = TrainingArguments("working_dir")
args = args.set_training(learning_rate=1e-4, batch_size=32)
args.learning_rate`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_training(learning_rate=<span class="hljs-number">1e-4</span>, batch_size=<span class="hljs-number">32</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.learning_rate
<span class="hljs-number">1e-4</span>`}}),{c(){u=n("p"),x=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);x=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,x),p(h,T,E),_(w,h,E),k=!0},p:ko,i(h){k||(v(w.$$.fragment,h),k=!0)},o(h){b(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function vY(C){let u,x;return{c(){u=n("p"),x=r("This integration is not supported anymore, we recommend you either use DeepSpeed or PyTorch FSDP.")},l(T){u=s(T,"P",{});var w=i(u);x=a(w,"This integration is not supported anymore, we recommend you either use DeepSpeed or PyTorch FSDP."),w.forEach(o)},m(T,w){p(T,u,w),e(u,x)},d(T){T&&o(u)}}}function bY(C){let u,x,T,w,k;return{c(){u=n("p"),x=r(`We strongly recommend to install PyTorch >= 1.13 (nightly version at the time of writing) on your MacOS machine.
It has major fixes related to model correctness and performance improvements for transformer based models.
Please refer to `),T=n("a"),w=r("https://github.com/pytorch/pytorch/issues/82707"),k=r(" for more details."),this.h()},l(h){u=s(h,"P",{});var E=i(u);x=a(E,`We strongly recommend to install PyTorch >= 1.13 (nightly version at the time of writing) on your MacOS machine.
It has major fixes related to model correctness and performance improvements for transformer based models.
Please refer to `),T=s(E,"A",{href:!0,rel:!0});var z=i(T);w=a(z,"https://github.com/pytorch/pytorch/issues/82707"),z.forEach(o),k=a(E," for more details."),E.forEach(o),this.h()},h(){m(T,"href","https://github.com/pytorch/pytorch/issues/82707"),m(T,"rel","nofollow")},m(h,E){p(h,u,E),e(u,x),e(u,T),e(T,w),e(u,k)},d(h){h&&o(u)}}}function yY(C){let u,x,T,w,k,h,E,z,j,I,G,B,Q,K,Z,X,me,J,M,R,ae,N,we,Te,ne,bt,yt,ue,Ie,Dn,Ee,Sn,On,se,oe,ld,$e,xr,dd,Ao,W,re,kr,cd,pd,md,hd,Um,RT,WT,GT,ud,Fm,MT,HT,BT,fd,zm,VT,YT,XT,wt,Nm,ZT,JT,Lm,KT,QT,jm,e4,t4,o4,gd,Rm,r4,a4,n4,_d,Wm,s4,i4,l4,vd,Gm,d4,c4,p4,bd,Mm,m4,h4,u4,yd,Hm,f4,g4,_4,wd,Bm,v4,b4,y4,Td,Vm,w4,T4,S1,Ar,O1,qr,E4,Ed,$4,x4,C1,Cn,I1,Tt,k4,$d,A4,q4,xd,P4,D4,U1,qo,Pr,Ym,In,S4,Xm,O4,F1,$,Un,C4,Zm,I4,U4,Jm,F4,z4,xe,Dr,Km,N4,L4,kd,j4,R4,W4,ie,Qm,G4,M4,eh,H4,B4,th,V4,Y4,oh,X4,Z4,rh,J4,K4,ah,Q4,eE,tE,Ad,nh,oE,rE,aE,Ue,sh,nE,sE,ih,iE,lE,lh,dE,cE,dh,pE,mE,hE,Fe,ch,uE,fE,ph,gE,_E,mh,vE,bE,hh,yE,wE,TE,Sr,Fn,EE,zn,$E,uh,xE,kE,AE,Or,Nn,qE,Ln,PE,fh,DE,SE,OE,Et,jn,CE,gh,IE,UE,_h,FE,zE,Cr,Rn,NE,vh,LE,jE,Ir,Wn,RE,Gn,WE,bh,GE,ME,HE,$t,Mn,BE,yh,VE,YE,Hn,XE,wh,ZE,JE,KE,xt,Bn,QE,Th,e$,t$,it,o$,Eh,r$,a$,$h,n$,s$,xh,i$,l$,d$,Ur,Vn,c$,kh,p$,m$,ze,Yn,h$,Ah,u$,f$,Xn,g$,qh,_$,v$,b$,Ph,y$,w$,kt,Zn,T$,Po,E$,Dh,$$,x$,Sh,k$,A$,q$,Oh,P$,D$,Fr,Jn,S$,Kn,O$,qd,C$,I$,U$,At,Qn,F$,es,z$,Ch,N$,L$,j$,Ih,R$,W$,zr,ts,G$,Uh,M$,H$,qt,os,B$,rs,V$,Fh,Y$,X$,Z$,zh,J$,K$,Ne,as,Q$,ns,e3,Nh,t3,o3,r3,Do,a3,Lh,n3,s3,jh,i3,l3,d3,Rh,c3,p3,Pt,ss,m3,ke,h3,Wh,u3,f3,Gh,g3,_3,Mh,v3,b3,Hh,y3,w3,T3,Nr,E3,Lr,is,$3,ls,x3,Bh,k3,A3,q3,jr,ds,P3,Vh,D3,S3,Rr,cs,O3,ps,C3,Yh,I3,U3,F3,Dt,ms,z3,hs,N3,Xh,L3,j3,R3,Zh,W3,G3,U,us,M3,Jh,H3,B3,Kh,V3,Y3,Qh,X3,Z3,So,J3,eu,K3,Q3,tu,ex,tx,ox,Wr,rx,ou,ru,ax,nx,lt,Ae,sx,au,ix,lx,nu,dx,cx,su,px,mx,iu,hx,ux,fx,Oo,gx,lu,_x,vx,du,bx,yx,wx,Pd,cu,Tx,Ex,$x,St,pu,xx,kx,mu,Ax,qx,hu,Px,Dx,Sx,uu,Ox,Cx,fu,Ix,Ux,fs,Fx,gu,zx,Nx,Lx,dt,jx,_u,Rx,Wx,vu,Gx,Mx,bu,Hx,Bx,Vx,he,Yx,Dd,Xx,Zx,yu,Jx,Kx,wu,Qx,ek,Tu,tk,ok,Eu,rk,ak,nk,V,sk,$u,ik,lk,xu,dk,ck,ku,pk,mk,Au,hk,uk,gs,fk,gk,qu,_k,vk,Pu,bk,yk,Du,wk,Tk,Su,Ek,$k,Ou,xk,kk,Ak,qe,qk,Sd,Pk,Dk,Cu,Sk,Ok,Od,Ck,Ik,Iu,Uk,Fk,zk,Uu,Nk,Lk,Gr,_s,jk,Fu,Rk,Wk,Mr,vs,Gk,bs,Mk,zu,Hk,Bk,Vk,Ot,ys,Yk,ws,Xk,Nu,Zk,Jk,Kk,Ts,Qk,Lu,eA,tA,oA,le,Es,rA,ju,aA,nA,$s,sA,Ru,iA,lA,dA,Hr,cA,xs,pA,Wu,mA,hA,uA,Co,Io,fA,Gu,gA,_A,Mu,vA,bA,yA,Uo,wA,Hu,TA,EA,Bu,$A,xA,kA,Fo,AA,Vu,qA,PA,Yu,DA,SA,OA,Ct,ks,CA,zo,IA,Xu,UA,FA,Zu,zA,NA,LA,Ju,jA,RA,It,As,WA,No,GA,Ku,MA,HA,Qu,BA,VA,YA,ef,XA,ZA,Br,qs,JA,ct,KA,tf,QA,e5,of,t5,o5,rf,r5,a5,n5,Vr,Ps,s5,Ds,i5,af,l5,d5,c5,Le,Ss,p5,Os,m5,nf,h5,u5,f5,sf,g5,_5,Cs,v5,Cd,b5,y5,w5,Ut,Is,T5,Us,E5,lf,$5,x5,k5,df,A5,q5,Ft,Fs,P5,cf,D5,S5,pf,O5,C5,Yr,zs,I5,mf,U5,F5,zt,Ns,z5,hf,N5,L5,uf,j5,z1,Lo,Xr,ff,Ls,R5,gf,W5,N1,pt,js,G5,je,Rs,M5,_f,H5,B5,Ws,V5,vf,Y5,X5,Z5,bf,J5,K5,de,Gs,Q5,yf,e7,t7,Ms,o7,wf,r7,a7,n7,Zr,s7,Hs,i7,Tf,l7,d7,c7,jo,Ro,p7,Ef,m7,h7,$f,u7,f7,g7,Wo,_7,xf,v7,b7,kf,y7,w7,T7,Go,E7,Af,$7,x7,qf,k7,A7,L1,Mo,Jr,Pf,Bs,q7,Df,P7,j1,S,Vs,D7,Ys,S7,Sf,O7,C7,I7,Ho,U7,Id,F7,z7,Xs,N7,L7,j7,fe,Zs,R7,Of,W7,G7,Bo,M7,Cf,H7,B7,If,V7,Y7,X7,Vo,Z7,Uf,J7,K7,Ff,Q7,eq,tq,Js,oq,zf,rq,aq,nq,Kr,Ks,sq,Nf,iq,lq,Nt,Qs,dq,Lf,cq,pq,Yo,mq,jf,hq,uq,Rf,fq,gq,_q,Lt,ei,vq,Wf,bq,yq,Qr,wq,jt,ti,Tq,Gf,Eq,$q,ea,xq,Rt,oi,kq,Mf,Aq,qq,ta,Pq,Wt,ri,Dq,Hf,Sq,Oq,oa,Cq,Gt,ai,Iq,Bf,Uq,Fq,ra,zq,Re,ni,Nq,Vf,Lq,jq,aa,Rq,na,Wq,Mt,si,Gq,Yf,Mq,Hq,sa,Bq,We,ii,Vq,Xf,Yq,Xq,ia,Zq,la,Jq,Ge,li,Kq,Zf,Qq,eP,da,tP,ca,oP,pa,di,rP,ci,aP,Jf,nP,sP,iP,ma,pi,lP,Kf,dP,cP,ha,mi,pP,Qf,mP,R1,Xo,ua,eg,hi,hP,tg,uP,W1,mt,ui,fP,fi,gP,og,_P,vP,bP,Zo,yP,Ud,wP,TP,gi,EP,$P,G1,Jo,fa,rg,_i,xP,ag,kP,M1,ge,AP,Fd,qP,PP,ng,DP,SP,zd,OP,CP,sg,IP,UP,H1,ga,FP,Nd,zP,NP,B1,_a,Ld,ig,LP,jP,RP,jd,lg,WP,GP,V1,Me,MP,dg,HP,BP,cg,VP,YP,Rd,XP,ZP,Y1,va,ba,pg,JP,KP,mg,QP,e6,t6,Wd,hg,o6,r6,X1,Ko,ya,ug,vi,a6,fg,n6,Z1,He,s6,Gd,i6,l6,gg,d6,c6,_g,p6,m6,J1,Ht,h6,vg,u6,f6,Md,g6,_6,K1,wa,Hd,bg,v6,b6,y6,Bd,yg,w6,T6,Q1,Be,E6,Vd,$6,x6,wg,k6,A6,Tg,q6,P6,ey,ce,D6,Yd,S6,O6,Eg,C6,I6,$g,U6,F6,xg,z6,N6,Xd,L6,j6,ty,Zd,R6,oy,bi,ry,Jd,W6,ay,yi,ny,Kd,G6,sy,wi,iy,Qd,M6,ly,ec,H6,dy,Ti,cy,Ta,B6,kg,V6,Y6,py,Qo,Ea,Ag,Ei,X6,qg,Z6,my,_e,J6,tc,K6,Q6,Pg,eD,tD,Dg,oD,rD,Sg,aD,nD,hy,Bt,sD,$i,iD,lD,Og,dD,cD,uy,er,$a,Cg,xi,pD,Ig,mD,fy,oc,hD,gy,xa,uD,ki,Ug,fD,gD,_y,Ai,vy,Vt,_D,qi,Fg,vD,bD,Pi,zg,yD,wD,by,Di,yy,Si,wy,ka,TD,rc,ED,$D,Ty,ac,xD,Ey,nc,kD,$y,sc,Ng,Lg,AD,xy,Aa,qD,jg,PD,DD,ky,ic,SD,Ay,Oi,qy,Yt,OD,Rg,CD,ID,Wg,UD,FD,Py,lc,zD,Dy,Ci,Sy,Xt,ND,Gg,LD,jD,Mg,RD,WD,Oy,Zt,GD,Hg,MD,HD,Ii,Bg,BD,VD,Cy,Ui,Iy,dc,YD,Uy,Fi,Fy,cc,XD,zy,zi,Ny,pc,ZD,Ly,mc,Vg,Yg,JD,jy,qa,KD,Xg,QD,e8,Ry,hc,Ni,t8,Zg,o8,r8,Wy,Li,Gy,ji,Jg,a8,My,Ri,Hy,Jt,n8,Kg,s8,i8,Qg,l8,d8,By,uc,c8,Vy,Wi,Yy,fc,p8,Xy,Pa,m8,e_,h8,u8,Zy,tr,Da,t_,Gi,f8,o_,g8,Jy,Sa,_8,gc,v8,b8,Ky,ve,y8,Mi,w8,T8,Hi,E8,$8,Bi,x8,k8,Vi,A8,q8,Qy,Oa,P8,_c,D8,S8,e2,vc,t2,or,Ca,r_,Yi,O8,a_,C8,o2,bc,I8,r2,Kt,U8,Xi,F8,z8,Zi,N8,L8,a2,yc,j8,n2,Ji,s2,wc,R8,i2,Qt,W8,n_,G8,M8,s_,H8,B8,l2,rr,Ia,i_,Ki,V8,l_,Y8,d2,Tc,X8,c2,Ve,Z8,d_,J8,K8,c_,Q8,e9,p_,t9,o9,p2,eo,r9,m_,a9,n9,h_,s9,i9,m2,Qi,h2,Ua,l9,el,d9,c9,u2,ar,Fa,u_,tl,p9,f_,m9,f2,Ec,h9,g2,ol,_2,to,u9,g_,f9,g9,__,_9,v9,v2,$c,b9,b2,rl,y2,xc,y9,w2,za,w9,v_,T9,E9,T2,ht,b_,$9,x9,y_,k9,A9,w_,q9,P9,E2,kc,D9,$2,al,x2,Ac,S9,k2,Ye,O9,T_,C9,I9,E_,U9,F9,$_,z9,N9,A2,nr,Na,x_,nl,L9,k_,j9,q2,oo,R9,A_,W9,G9,q_,M9,H9,P2,qc,B9,D2,Pc,V9,S2,La,Y9,P_,X9,Z9,O2,sl,C2,ee,J9,D_,K9,Q9,S_,eS,tS,O_,oS,rS,C_,aS,nS,I_,sS,iS,U_,lS,dS,I2,Dc,cS,U2,sr,ja,F_,il,pS,z_,mS,F2,Ra,z2,Xe,hS,ll,uS,fS,Sc,gS,_S,dl,vS,bS,N2,Ze,N_,yS,wS,L_,TS,ES,j_,$S,xS,R_,kS,L2,Oc,AS,j2,cl,W_,qS,PS,R2,Cc,DS,W2,pl,G2,ro,SS,G_,OS,CS,M_,IS,US,M2,ml,H2,ao,FS,H_,zS,NS,hl,LS,jS,B2,Wa,RS,Ic,WS,GS,V2,Uc,MS,Y2,ul,B_,HS,BS,X2,fl,Z2,Fc,VS,J2,gl,K2,_l,V_,YS,XS,Q2,vl,ew,zc,ZS,tw,bl,ow,Nc,JS,rw,Ga,KS,yl,QS,eO,aw,wl,Y_,tO,oO,nw,no,rO,X_,aO,nO,Z_,sO,iO,sw,Ma,lO,J_,dO,cO,iw,Tl,lw,Lc,pO,dw,Je,K_,mO,hO,Q_,uO,fO,El,gO,ev,_O,vO,bO,$l,yO,tv,wO,TO,cw,xl,ut,EO,ov,$O,xO,rv,kO,AO,av,qO,PO,pw,Ha,DO,nv,SO,OO,mw,kl,hw,ir,sv,CO,IO,iv,UO,FO,uw,so,zO,lv,NO,LO,dv,jO,RO,fw,jc,WO,gw,be,cv,GO,MO,pv,HO,BO,Al,VO,mv,YO,XO,ZO,lr,JO,hv,KO,QO,uv,eC,tC,oC,fv,rC,_w,Rc,aC,vw,Ba,dr,nC,gv,sC,iC,_v,lC,dC,cC,Pe,pC,vv,mC,hC,bv,uC,fC,yv,gC,_C,wv,vC,bC,bw,cr,Va,Tv,ql,yC,Ev,wC,yw,Ya,TC,Pl,EC,$C,ww,Dl,$v,xC,kC,Tw,Sl,xv,AC,qC,Ew,pe,kv,Ol,PC,Av,DC,SC,OC,Cl,Wc,qv,CC,IC,UC,pr,Il,FC,Pv,zC,NC,LC,Ul,jC,Dv,RC,WC,GC,Fl,MC,Sv,HC,BC,VC,Ov,mr,YC,Cv,XC,ZC,Iv,JC,KC,QC,Uv,ft,eI,Fv,tI,oI,zv,rI,aI,Nv,nI,sI,iI,Lv,hr,lI,jv,dI,cI,Rv,pI,mI,hI,zl,gt,uI,Wv,fI,gI,Gv,_I,vI,Mv,bI,yI,wI,_t,Gc,TI,Nl,De,EI,Hv,$I,xI,Bv,kI,AI,Vv,qI,PI,Yv,DI,SI,OI,Ll,CI,Xv,II,UI,FI,vt,Zv,zI,NI,Jv,LI,jI,Kv,RI,WI,Qv,GI,MI,Xa,eb,HI,BI,tb,VI,YI,XI,Za,ob,ZI,JI,rb,KI,QI,$w,Mc,ab,eU,xw,Hc,Ke,tU,nb,oU,rU,sb,aU,nU,sU,iU,jl,lU,kw,ur,Ja,ib,Rl,dU,lb,cU,Aw,io,pU,Wl,mU,hU,Gl,uU,fU,qw,Ml,db,gU,_U,Pw,Hl,cb,vU,bU,Dw,lo,yU,pb,wU,TU,mb,EU,$U,Sw,Qe,Ka,hb,xU,kU,ub,AU,qU,PU,Qa,fb,DU,SU,Bl,OU,CU,IU,et,gb,UU,FU,_b,zU,NU,vb,LU,jU,bb,RU,WU,GU,Bc,MU,Vl,Se,HU,yb,BU,VU,wb,YU,XU,Tb,ZU,JU,Eb,KU,QU,eF,Yl,tF,$b,oF,rF,Ow,fr,en,xb,Xl,aF,kb,nF,Cw,tt,sF,Ab,iF,lF,Zl,dF,cF,Jl,pF,mF,Iw,tn,Uw,Vc,qb,hF,Fw,co,Pb,uF,fF,Db,gF,_F,Sb,vF,zw,gr,Ob,bF,yF,Kl,wF,TF,Nw,_r,Cb,EF,$F,Ib,xF,kF,Lw,Ql,jw,Yc,Ub,AF,Rw,on,ed,qF,Fb,PF,DF,SF,Oe,OF,zb,CF,IF,Nb,UF,FF,Lb,zF,NF,jb,LF,jF,Ww,po,RF,Rb,WF,GF,td,MF,HF,Gw,Xc,BF,Mw,q,VF,Zc,YF,Wb,XF,Jc,ZF,Gb,JF,Kc,KF,Mb,QF,Qc,ez,Hb,tz,ep,oz,Bb,rz,tp,az,Vb,nz,op,sz,Yb,iz,rp,lz,Xb,dz,ap,cz,Zb,pz,np,mz,Jb,hz,sp,uz,Kb,fz,ip,gz,Qb,_z,lp,vz,e1,bz,dp,yz,t1,wz,cp,Tz,o1,Ez,pp,$z,r1,xz,mp,kz,a1,Az,hp,qz,n1,Pz,up,Dz,s1,Sz,fp,Oz,i1,Cz,gp,Iz,l1,Uz,_p,Fz,d1,zz,vp,Nz,c1,Lz,Hw;return h=new te({}),Ar=new $r({props:{warning:!0,$$slots:{default:[tY]},$$scope:{ctx:C}}}),Cn=new O({props:{code:`from torch import nn
from transformers import Trainer


class CustomTrainer(Trainer):
    def compute_loss(self, model, inputs, return_outputs=False):
        labels = inputs.get("labels")
        # forward pass
        outputs = model(**inputs)
        logits = outputs.get("logits")
        # compute custom loss (suppose one has 3 labels with different weights)
        loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([1.0, 2.0, 3.0]))
        loss = loss_fct(logits.view(-1, self.model.config.num_labels), labels.view(-1))
        return (loss, outputs) if return_outputs else loss`,highlighted:`<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Trainer


<span class="hljs-keyword">class</span> <span class="hljs-title class_">CustomTrainer</span>(<span class="hljs-title class_ inherited__">Trainer</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_loss</span>(<span class="hljs-params">self, model, inputs, return_outputs=<span class="hljs-literal">False</span></span>):
        labels = inputs.get(<span class="hljs-string">&quot;labels&quot;</span>)
        <span class="hljs-comment"># forward pass</span>
        outputs = model(**inputs)
        logits = outputs.get(<span class="hljs-string">&quot;logits&quot;</span>)
        <span class="hljs-comment"># compute custom loss (suppose one has 3 labels with different weights)</span>
        loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([<span class="hljs-number">1.0</span>, <span class="hljs-number">2.0</span>, <span class="hljs-number">3.0</span>]))
        loss = loss_fct(logits.view(-<span class="hljs-number">1</span>, self.model.config.num_labels), labels.view(-<span class="hljs-number">1</span>))
        <span class="hljs-keyword">return</span> (loss, outputs) <span class="hljs-keyword">if</span> return_outputs <span class="hljs-keyword">else</span> loss`}}),In=new te({}),Un=new D({props:{name:"class transformers.Trainer",anchor:"transformers.Trainer",parameters:[{name:"model",val:": typing.Union[transformers.modeling_utils.PreTrainedModel, torch.nn.modules.module.Module] = None"},{name:"args",val:": TrainingArguments = None"},{name:"data_collator",val:": typing.Optional[DataCollator] = None"},{name:"train_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"eval_dataset",val:": typing.Union[torch.utils.data.dataset.Dataset, typing.Dict[str, torch.utils.data.dataset.Dataset], NoneType] = None"},{name:"tokenizer",val:": typing.Optional[transformers.tokenization_utils_base.PreTrainedTokenizerBase] = None"},{name:"model_init",val:": typing.Union[typing.Callable[[], transformers.modeling_utils.PreTrainedModel], NoneType] = None"},{name:"compute_metrics",val:": typing.Union[typing.Callable[[transformers.trainer_utils.EvalPrediction], typing.Dict], NoneType] = None"},{name:"callbacks",val:": typing.Optional[typing.List[transformers.trainer_callback.TrainerCallback]] = None"},{name:"optimizers",val:": typing.Tuple[torch.optim.optimizer.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None)"},{name:"preprocess_logits_for_metrics",val:": typing.Union[typing.Callable[[torch.Tensor, torch.Tensor], torch.Tensor], NoneType] = None"}],parametersDescription:[{anchor:"transformers.Trainer.model",description:`<strong>model</strong> (<a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a> or <code>torch.nn.Module</code>, <em>optional</em>) &#x2014;
The model to train, evaluate or use for predictions. If not provided, a <code>model_init</code> must be passed.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p><a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a> is optimized to work with the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a> provided by the library. You can still use
your own models defined as <code>torch.nn.Module</code> as long as they work the same way as the &#x1F917; Transformers
models.</p>

					</div>`,name:"model"},{anchor:"transformers.Trainer.args",description:`<strong>args</strong> (<a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>, <em>optional</em>) &#x2014;
The arguments to tweak for training. Will default to a basic instance of <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> with the
<code>output_dir</code> set to a directory named <em>tmp_trainer</em> in the current directory if not provided.`,name:"args"},{anchor:"transformers.Trainer.data_collator",description:`<strong>data_collator</strong> (<code>DataCollator</code>, <em>optional</em>) &#x2014;
The function to use to form a batch from a list of elements of <code>train_dataset</code> or <code>eval_dataset</code>. Will
default to <a href="/docs/transformers/v4.27.1/en/main_classes/data_collator#transformers.default_data_collator">default_data_collator()</a> if no <code>tokenizer</code> is provided, an instance of
<a href="/docs/transformers/v4.27.1/en/main_classes/data_collator#transformers.DataCollatorWithPadding">DataCollatorWithPadding</a> otherwise.`,name:"data_collator"},{anchor:"transformers.Trainer.train_dataset",description:`<strong>train_dataset</strong> (<code>torch.utils.data.Dataset</code> or <code>torch.utils.data.IterableDataset</code>, <em>optional</em>) &#x2014;
The dataset to use for training. If it is a <code>Dataset</code>, columns not accepted by the
<code>model.forward()</code> method are automatically removed.</p>
<p>Note that if it&#x2019;s a <code>torch.utils.data.IterableDataset</code> with some randomization and you are training in a
distributed fashion, your iterable dataset should either use a internal attribute <code>generator</code> that is a
<code>torch.Generator</code> for the randomization that must be identical on all processes (and the Trainer will
manually set the seed of this <code>generator</code> at each epoch) or have a <code>set_epoch()</code> method that internally
sets the seed of the RNGs used.`,name:"train_dataset"},{anchor:"transformers.Trainer.eval_dataset",description:`<strong>eval_dataset</strong> (Union[<code>torch.utils.data.Dataset</code>, Dict[str, <code>torch.utils.data.Dataset</code>]), <em>optional</em>) &#x2014;
The dataset to use for evaluation. If it is a <code>Dataset</code>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. If it is a dictionary, it will evaluate on each
dataset prepending the dictionary key to the metric name.`,name:"eval_dataset"},{anchor:"transformers.Trainer.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase">PreTrainedTokenizerBase</a>, <em>optional</em>) &#x2014;
The tokenizer used to preprocess the data. If provided, will be used to automatically pad the inputs to the
maximum length when batching inputs, and it will be saved along the model to make it easier to rerun an
interrupted training or reuse the fine-tuned model.`,name:"tokenizer"},{anchor:"transformers.Trainer.model_init",description:`<strong>model_init</strong> (<code>Callable[[], PreTrainedModel]</code>, <em>optional</em>) &#x2014;
A function that instantiates the model to be used. If provided, each call to <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.train">train()</a> will start
from a new instance of the model as given by this function.</p>
<p>The function may have zero argument, or a single one containing the optuna/Ray Tune/SigOpt trial object, to
be able to choose different architectures according to hyper parameters (such as layer count, sizes of
inner layers, dropout probabilities etc).`,name:"model_init"},{anchor:"transformers.Trainer.compute_metrics",description:`<strong>compute_metrics</strong> (<code>Callable[[EvalPrediction], Dict]</code>, <em>optional</em>) &#x2014;
The function that will be used to compute metrics at evaluation. Must take a <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.EvalPrediction">EvalPrediction</a> and return
a dictionary string to metric values.`,name:"compute_metrics"},{anchor:"transformers.Trainer.callbacks",description:`<strong>callbacks</strong> (List of <a href="/docs/transformers/v4.27.1/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a>, <em>optional</em>) &#x2014;
A list of callbacks to customize the training loop. Will add those to the list of default callbacks
detailed in <a href="callback">here</a>.</p>
<p>If you want to remove one of the default callbacks used, use the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.remove_callback">Trainer.remove_callback()</a> method.`,name:"callbacks"},{anchor:"transformers.Trainer.optimizers",description:`<strong>optimizers</strong> (<code>Tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR]</code>, <em>optional</em>) &#x2014; A tuple
containing the optimizer and the scheduler to use. Will default to an instance of <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> on your model
and a scheduler given by <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.get_linear_schedule_with_warmup">get_linear_schedule_with_warmup()</a> controlled by <code>args</code>.`,name:"optimizers"},{anchor:"transformers.Trainer.preprocess_logits_for_metrics",description:`<strong>preprocess_logits_for_metrics</strong> (<code>Callable[[torch.Tensor, torch.Tensor], torch.Tensor]</code>, <em>optional</em>) &#x2014;
A function that preprocess the logits right before caching them at each evaluation step. Must take two
tensors, the logits and the labels, and return the logits once processed as desired. The modifications made
by this function will be reflected in the predictions received by <code>compute_metrics</code>.</p>
<p>Note that the labels (second parameter) will be <code>None</code> if the dataset does not have them.`,name:"preprocess_logits_for_metrics"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L222"}}),Fn=new D({props:{name:"add_callback",anchor:"transformers.Trainer.add_callback",parameters:[{name:"callback",val:""}],parametersDescription:[{anchor:"transformers.Trainer.add_callback.callback",description:`<strong>callback</strong> (<code>type</code> or <code>~transformer.TrainerCallback</code>) &#x2014;
A <code>~transformer.TrainerCallback</code> class or an instance of a <code>~transformer.TrainerCallback</code>. In the
first case, will instantiate a member of that class.`,name:"callback"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L677"}}),Nn=new D({props:{name:"autocast_smart_context_manager",anchor:"transformers.Trainer.autocast_smart_context_manager",parameters:[{name:"cache_enabled",val:": typing.Optional[bool] = True"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2600"}}),jn=new D({props:{name:"compute_loss",anchor:"transformers.Trainer.compute_loss",parameters:[{name:"model",val:""},{name:"inputs",val:""},{name:"return_outputs",val:" = False"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2667"}}),Rn=new D({props:{name:"compute_loss_context_manager",anchor:"transformers.Trainer.compute_loss_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2594"}}),Wn=new D({props:{name:"create_model_card",anchor:"transformers.Trainer.create_model_card",parameters:[{name:"language",val:": typing.Optional[str] = None"},{name:"license",val:": typing.Optional[str] = None"},{name:"tags",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"model_name",val:": typing.Optional[str] = None"},{name:"finetuned_from",val:": typing.Optional[str] = None"},{name:"tasks",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset_tags",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset_args",val:": typing.Union[str, typing.List[str], NoneType] = None"}],parametersDescription:[{anchor:"transformers.Trainer.create_model_card.language",description:`<strong>language</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language of the model (if applicable)`,name:"language"},{anchor:"transformers.Trainer.create_model_card.license",description:`<strong>license</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The license of the model. Will default to the license of the pretrained model used, if the original
model given to the <code>Trainer</code> comes from a repo on the Hub.`,name:"license"},{anchor:"transformers.Trainer.create_model_card.tags",description:`<strong>tags</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
Some tags to be included in the metadata of the model card.`,name:"tags"},{anchor:"transformers.Trainer.create_model_card.model_name",description:`<strong>model_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the model.`,name:"model_name"},{anchor:"transformers.Trainer.create_model_card.finetuned_from",description:`<strong>finetuned_from</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo
of the original model given to the <code>Trainer</code> (if it comes from the Hub).`,name:"finetuned_from"},{anchor:"transformers.Trainer.create_model_card.tasks",description:`<strong>tasks</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several task identifiers, to be included in the metadata of the model card.`,name:"tasks"},{anchor:"transformers.Trainer.create_model_card.dataset_tags",description:`<strong>dataset_tags</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset tags, to be included in the metadata of the model card.`,name:"dataset_tags"},{anchor:"transformers.Trainer.create_model_card.dataset",description:`<strong>dataset</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset identifiers, to be included in the metadata of the model card.`,name:"dataset"},{anchor:"transformers.Trainer.create_model_card.dataset_args",description:`<strong>dataset_args</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset arguments, to be included in the metadata of the model card.`,name:"dataset_args"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L3461"}}),Mn=new D({props:{name:"create_optimizer",anchor:"transformers.Trainer.create_optimizer",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L1037"}}),Bn=new D({props:{name:"create_optimizer_and_scheduler",anchor:"transformers.Trainer.create_optimizer_and_scheduler",parameters:[{name:"num_training_steps",val:": int"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L1021"}}),Vn=new D({props:{name:"create_scheduler",anchor:"transformers.Trainer.create_scheduler",parameters:[{name:"num_training_steps",val:": int"},{name:"optimizer",val:": Optimizer = None"}],parametersDescription:[{anchor:"transformers.Trainer.create_scheduler.num_training_steps",description:"<strong>num_training_steps</strong> (int) &#x2014; The number of training steps to do.",name:"num_training_steps"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L1184"}}),Yn=new D({props:{name:"evaluate",anchor:"transformers.Trainer.evaluate",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'eval'"}],parametersDescription:[{anchor:"transformers.Trainer.evaluate.eval_dataset",description:`<strong>eval_dataset</strong> (<code>Dataset</code>, <em>optional</em>) &#x2014;
Pass a dataset if you wish to override <code>self.eval_dataset</code>. If it is a <code>Dataset</code>, columns
not accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Trainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>Lst[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Trainer.evaluate.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is &#x201C;eval&#x201D; (default)`,name:"metric_key_prefix"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2895",returnDescription:`
<p>A dictionary containing the evaluation loss and the potential metrics computed from the predictions. The
dictionary also contains the epoch number which comes from the training state.</p>
`}}),Zn=new D({props:{name:"evaluation_loop",anchor:"transformers.Trainer.evaluation_loop",parameters:[{name:"dataloader",val:": DataLoader"},{name:"description",val:": str"},{name:"prediction_loss_only",val:": typing.Optional[bool] = None"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'eval'"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L3028"}}),Jn=new D({props:{name:"floating_point_ops",anchor:"transformers.Trainer.floating_point_ops",parameters:[{name:"inputs",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"}],parametersDescription:[{anchor:"transformers.Trainer.floating_point_ops.inputs",description:`<strong>inputs</strong> (<code>Dict[str, Union[torch.Tensor, Any]]</code>) &#x2014;
The inputs and targets of the model.`,name:"inputs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L3396",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Qn=new D({props:{name:"get_eval_dataloader",anchor:"transformers.Trainer.get_eval_dataloader",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"}],parametersDescription:[{anchor:"transformers.Trainer.get_eval_dataloader.eval_dataset",description:`<strong>eval_dataset</strong> (<code>torch.utils.data.Dataset</code>, <em>optional</em>) &#x2014;
If provided, will override <code>self.eval_dataset</code>. If it is a <code>Dataset</code>, columns not accepted
by the <code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"eval_dataset"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L923"}}),ts=new D({props:{name:"get_optimizer_cls_and_kwargs",anchor:"transformers.Trainer.get_optimizer_cls_and_kwargs",parameters:[{name:"args",val:": TrainingArguments"}],parametersDescription:[{anchor:"transformers.Trainer.get_optimizer_cls_and_kwargs.args",description:`<strong>args</strong> (<code>transformers.training_args.TrainingArguments</code>) &#x2014;
The training arguments for the training session.`,name:"args"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L1093"}}),os=new D({props:{name:"get_test_dataloader",anchor:"transformers.Trainer.get_test_dataloader",parameters:[{name:"test_dataset",val:": Dataset"}],parametersDescription:[{anchor:"transformers.Trainer.get_test_dataloader.test_dataset",description:`<strong>test_dataset</strong> (<code>torch.utils.data.Dataset</code>, <em>optional</em>) &#x2014;
The test dataset to use. If it is a <code>Dataset</code>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"test_dataset"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L973"}}),as=new D({props:{name:"get_train_dataloader",anchor:"transformers.Trainer.get_train_dataloader",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L844"}}),ss=new D({props:{name:"hyperparameter_search",anchor:"transformers.Trainer.hyperparameter_search",parameters:[{name:"hp_space",val:": typing.Union[typing.Callable[[ForwardRef('optuna.Trial')], typing.Dict[str, float]], NoneType] = None"},{name:"compute_objective",val:": typing.Union[typing.Callable[[typing.Dict[str, float]], float], NoneType] = None"},{name:"n_trials",val:": int = 20"},{name:"direction",val:": str = 'minimize'"},{name:"backend",val:": typing.Union[ForwardRef('str'), transformers.trainer_utils.HPSearchBackend, NoneType] = None"},{name:"hp_name",val:": typing.Union[typing.Callable[[ForwardRef('optuna.Trial')], str], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Trainer.hyperparameter_search.hp_space",description:`<strong>hp_space</strong> (<code>Callable[[&quot;optuna.Trial&quot;], Dict[str, float]]</code>, <em>optional</em>) &#x2014;
A function that defines the hyperparameter search space. Will default to
<code>default_hp_space_optuna()</code> or <code>default_hp_space_ray()</code> or
<code>default_hp_space_sigopt()</code> depending on your backend.`,name:"hp_space"},{anchor:"transformers.Trainer.hyperparameter_search.compute_objective",description:`<strong>compute_objective</strong> (<code>Callable[[Dict[str, float]], float]</code>, <em>optional</em>) &#x2014;
A function computing the objective to minimize or maximize from the metrics returned by the <code>evaluate</code>
method. Will default to <code>default_compute_objective()</code>.`,name:"compute_objective"},{anchor:"transformers.Trainer.hyperparameter_search.n_trials",description:`<strong>n_trials</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of trial runs to test.`,name:"n_trials"},{anchor:"transformers.Trainer.hyperparameter_search.direction",description:`<strong>direction</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;minimize&quot;</code>) &#x2014;
Whether to optimize greater or lower objects. Can be <code>&quot;minimize&quot;</code> or <code>&quot;maximize&quot;</code>, you should pick
<code>&quot;minimize&quot;</code> when optimizing the validation loss, <code>&quot;maximize&quot;</code> when optimizing one or several metrics.`,name:"direction"},{anchor:"transformers.Trainer.hyperparameter_search.backend",description:`<strong>backend</strong> (<code>str</code> or <code>~training_utils.HPSearchBackend</code>, <em>optional</em>) &#x2014;
The backend to use for hyperparameter search. Will default to optuna or Ray Tune or SigOpt, depending
on which one is installed. If all are installed, will default to optuna.`,name:"backend"},{anchor:"transformers.Trainer.hyperparameter_search.hp_name",description:`<strong>hp_name</strong> (<code>Callable[[&quot;optuna.Trial&quot;], str]]</code>, <em>optional</em>) &#x2014;
A function that defines the trial/run name. Will default to None.`,name:"hp_name"},{anchor:"transformers.Trainer.hyperparameter_search.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments passed along to <code>optuna.create_study</code> or <code>ray.tune.run</code>. For more
information see:</p>
<ul>
<li>the documentation of
<a href="https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.create_study.html" rel="nofollow">optuna.create_study</a></li>
<li>the documentation of <a href="https://docs.ray.io/en/latest/tune/api_docs/execution.html#tune-run" rel="nofollow">tune.run</a></li>
<li>the documentation of <a href="https://app.sigopt.com/docs/endpoints/experiments/create" rel="nofollow">sigopt</a></li>
</ul>`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2447",returnDescription:`
<p>All the information about the best run. Experiment summary can be found in
<code>run_summary</code> attribute for Ray backend.</p>
`,returnType:`
<p><code>trainer_utils.BestRun</code></p>
`}}),Nr=new $r({props:{warning:!0,$$slots:{default:[oY]},$$scope:{ctx:C}}}),is=new D({props:{name:"init_git_repo",anchor:"transformers.Trainer.init_git_repo",parameters:[{name:"at_init",val:": bool = False"}],parametersDescription:[{anchor:"transformers.Trainer.init_git_repo.at_init",description:`<strong>at_init</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether this function is called before any training or not. If <code>self.args.overwrite_output_dir</code> is
<code>True</code> and <code>at_init</code> is <code>True</code>, the path to the repo (which is <code>self.args.output_dir</code>) might be wiped
out.`,name:"at_init"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L3414"}}),ds=new D({props:{name:"is_local_process_zero",anchor:"transformers.Trainer.is_local_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2699"}}),cs=new D({props:{name:"is_world_process_zero",anchor:"transformers.Trainer.is_world_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2706"}}),ms=new D({props:{name:"log",anchor:"transformers.Trainer.log",parameters:[{name:"logs",val:": typing.Dict[str, float]"}],parametersDescription:[{anchor:"transformers.Trainer.log.logs",description:`<strong>logs</strong> (<code>Dict[str, float]</code>) &#x2014;
The values to log.`,name:"logs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2543"}}),us=new D({props:{name:"log_metrics",anchor:"transformers.Trainer.log_metrics",parameters:[{name:"split",val:""},{name:"metrics",val:""}],parametersDescription:[{anchor:"transformers.Trainer.log_metrics.split",description:`<strong>split</strong> (<code>str</code>) &#x2014;
Mode/split name: one of <code>train</code>, <code>eval</code>, <code>test</code>`,name:"split"},{anchor:"transformers.Trainer.log_metrics.metrics",description:`<strong>metrics</strong> (<code>Dict[str, float]</code>) &#x2014;
The metrics returned from train/evaluate/predictmetrics: metrics dict`,name:"metrics"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer_pt_utils.py#L894"}}),Wr=new xo({props:{anchor:"transformers.Trainer.log_metrics.example",$$slots:{default:[rY]},$$scope:{ctx:C}}}),_s=new D({props:{name:"metrics_format",anchor:"transformers.Trainer.metrics_format",parameters:[{name:"metrics",val:": typing.Dict[str, float]"}],parametersDescription:[{anchor:"transformers.Trainer.metrics_format.metrics",description:`<strong>metrics</strong> (<code>Dict[str, float]</code>) &#x2014;
The metrics returned from train/evaluate/predict`,name:"metrics"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer_pt_utils.py#L868",returnDescription:`
<p>The reformatted metrics</p>
`,returnType:`
<p>metrics (<code>Dict[str, float]</code>)</p>
`}}),vs=new D({props:{name:"num_examples",anchor:"transformers.Trainer.num_examples",parameters:[{name:"dataloader",val:": DataLoader"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L1201"}}),ys=new D({props:{name:"pop_callback",anchor:"transformers.Trainer.pop_callback",parameters:[{name:"callback",val:""}],parametersDescription:[{anchor:"transformers.Trainer.pop_callback.callback",description:`<strong>callback</strong> (<code>type</code> or <code>~transformer.TrainerCallback</code>) &#x2014;
A <code>~transformer.TrainerCallback</code> class or an instance of a <code>~transformer.TrainerCallback</code>. In the
first case, will pop the first member of that class found in the list of callbacks.`,name:"callback"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L688",returnDescription:`
<p>The callback removed, if found.</p>
`,returnType:`
<p><code>~transformer.TrainerCallback</code></p>
`}}),Es=new D({props:{name:"predict",anchor:"transformers.Trainer.predict",parameters:[{name:"test_dataset",val:": Dataset"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'test'"}],parametersDescription:[{anchor:"transformers.Trainer.predict.test_dataset",description:`<strong>test_dataset</strong> (<code>Dataset</code>) &#x2014;
Dataset to run the predictions on. If it is an <code>datasets.Dataset</code>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. Has to implement the method <code>__len__</code>`,name:"test_dataset"},{anchor:"transformers.Trainer.predict.ignore_keys",description:`<strong>ignore_keys</strong> (<code>Lst[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Trainer.predict.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;test&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;test_bleu&#x201D; if the prefix is &#x201C;test&#x201D; (default)`,name:"metric_key_prefix"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2966"}}),Hr=new $r({props:{$$slots:{default:[aY]},$$scope:{ctx:C}}}),ks=new D({props:{name:"prediction_loop",anchor:"transformers.Trainer.prediction_loop",parameters:[{name:"dataloader",val:": DataLoader"},{name:"description",val:": str"},{name:"prediction_loss_only",val:": typing.Optional[bool] = None"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'eval'"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L3619"}}),As=new D({props:{name:"prediction_step",anchor:"transformers.Trainer.prediction_step",parameters:[{name:"model",val:": Module"},{name:"inputs",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"},{name:"prediction_loss_only",val:": bool"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"}],parametersDescription:[{anchor:"transformers.Trainer.prediction_step.model",description:`<strong>model</strong> (<code>nn.Module</code>) &#x2014;
The model to evaluate.`,name:"model"},{anchor:"transformers.Trainer.prediction_step.inputs",description:`<strong>inputs</strong> (<code>Dict[str, Union[torch.Tensor, Any]]</code>) &#x2014;
The inputs and targets of the model.</p>
<p>The dictionary will be unpacked before being fed to the model. Most models expect the targets under the
argument <code>labels</code>. Check your model&#x2019;s documentation for all accepted arguments.`,name:"inputs"},{anchor:"transformers.Trainer.prediction_step.prediction_loss_only",description:`<strong>prediction_loss_only</strong> (<code>bool</code>) &#x2014;
Whether or not to return the loss only.`,name:"prediction_loss_only"},{anchor:"transformers.Trainer.prediction_step.ignore_keys",description:`<strong>ignore_keys</strong> (<code>Lst[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L3291",returnDescription:`
<p>A tuple with the loss,
logits and labels (each being optional).</p>
`,returnType:`
<p>Tuple[Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor]]</p>
`}}),qs=new D({props:{name:"push_to_hub",anchor:"transformers.Trainer.push_to_hub",parameters:[{name:"commit_message",val:": typing.Optional[str] = 'End of training'"},{name:"blocking",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Trainer.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;End of training&quot;</code>) &#x2014;
Message to commit while pushing.`,name:"commit_message"},{anchor:"transformers.Trainer.push_to_hub.blocking",description:`<strong>blocking</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the function should return only when the <code>git push</code> has finished.
kwargs &#x2014;
Additional keyword arguments passed along to <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.create_model_card">create_model_card()</a>.`,name:"blocking"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L3559",returnDescription:`
<p>The url of the commit of your model in the given repository if <code>blocking=False</code>, a tuple with the url of
the commit and an object to track the progress of the commit if <code>blocking=True</code></p>
`}}),Ps=new D({props:{name:"remove_callback",anchor:"transformers.Trainer.remove_callback",parameters:[{name:"callback",val:""}],parametersDescription:[{anchor:"transformers.Trainer.remove_callback.callback",description:`<strong>callback</strong> (<code>type</code> or <code>~transformer.TrainerCallback</code>) &#x2014;
A <code>~transformer.TrainerCallback</code> class or an instance of a <code>~transformer.TrainerCallback</code>. In the
first case, will remove the first member of that class found in the list of callbacks.`,name:"callback"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L704"}}),Ss=new D({props:{name:"save_metrics",anchor:"transformers.Trainer.save_metrics",parameters:[{name:"split",val:""},{name:"metrics",val:""},{name:"combined",val:" = True"}],parametersDescription:[{anchor:"transformers.Trainer.save_metrics.split",description:`<strong>split</strong> (<code>str</code>) &#x2014;
Mode/split name: one of <code>train</code>, <code>eval</code>, <code>test</code>, <code>all</code>`,name:"split"},{anchor:"transformers.Trainer.save_metrics.metrics",description:`<strong>metrics</strong> (<code>Dict[str, float]</code>) &#x2014;
The metrics returned from train/evaluate/predict`,name:"metrics"},{anchor:"transformers.Trainer.save_metrics.combined",description:`<strong>combined</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Creates combined metrics by updating <code>all_results.json</code> with metrics of this call`,name:"combined"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer_pt_utils.py#L984"}}),Is=new D({props:{name:"save_model",anchor:"transformers.Trainer.save_model",parameters:[{name:"output_dir",val:": typing.Optional[str] = None"},{name:"_internal_call",val:": bool = False"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2718"}}),Fs=new D({props:{name:"save_state",anchor:"transformers.Trainer.save_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer_pt_utils.py#L1022"}}),zs=new D({props:{name:"train",anchor:"transformers.Trainer.train",parameters:[{name:"resume_from_checkpoint",val:": typing.Union[str, bool, NoneType] = None"},{name:"trial",val:": typing.Union[ForwardRef('optuna.Trial'), typing.Dict[str, typing.Any]] = None"},{name:"ignore_keys_for_eval",val:": typing.Optional[typing.List[str]] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Trainer.train.resume_from_checkpoint",description:`<strong>resume_from_checkpoint</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
If a <code>str</code>, local path to a saved checkpoint as saved by a previous instance of <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>. If a
<code>bool</code> and equals <code>True</code>, load the last checkpoint in <em>args.output_dir</em> as saved by a previous instance
of <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>. If present, training will resume from the model/optimizer/scheduler states loaded here.`,name:"resume_from_checkpoint"},{anchor:"transformers.Trainer.train.trial",description:`<strong>trial</strong> (<code>optuna.Trial</code> or <code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
The trial run or the hyperparameter dictionary for hyperparameter search.`,name:"trial"},{anchor:"transformers.Trainer.train.ignore_keys_for_eval",description:`<strong>ignore_keys_for_eval</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions for evaluation during the training.
kwargs &#x2014;
Additional keyword arguments used to hide deprecated arguments`,name:"ignore_keys_for_eval"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L1554"}}),Ns=new D({props:{name:"training_step",anchor:"transformers.Trainer.training_step",parameters:[{name:"model",val:": Module"},{name:"inputs",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"}],parametersDescription:[{anchor:"transformers.Trainer.training_step.model",description:`<strong>model</strong> (<code>nn.Module</code>) &#x2014;
The model to train.`,name:"model"},{anchor:"transformers.Trainer.training_step.inputs",description:`<strong>inputs</strong> (<code>Dict[str, Union[torch.Tensor, Any]]</code>) &#x2014;
The inputs and targets of the model.</p>
<p>The dictionary will be unpacked before being fed to the model. Most models expect the targets under the
argument <code>labels</code>. Check your model&#x2019;s documentation for all accepted arguments.`,name:"inputs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer.py#L2619",returnDescription:`
<p>The tensor with training loss on this batch.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Ls=new te({}),js=new D({props:{name:"class transformers.Seq2SeqTrainer",anchor:"transformers.Seq2SeqTrainer",parameters:[{name:"model",val:": typing.Union[transformers.modeling_utils.PreTrainedModel, torch.nn.modules.module.Module] = None"},{name:"args",val:": TrainingArguments = None"},{name:"data_collator",val:": typing.Optional[DataCollator] = None"},{name:"train_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"eval_dataset",val:": typing.Union[torch.utils.data.dataset.Dataset, typing.Dict[str, torch.utils.data.dataset.Dataset], NoneType] = None"},{name:"tokenizer",val:": typing.Optional[transformers.tokenization_utils_base.PreTrainedTokenizerBase] = None"},{name:"model_init",val:": typing.Union[typing.Callable[[], transformers.modeling_utils.PreTrainedModel], NoneType] = None"},{name:"compute_metrics",val:": typing.Union[typing.Callable[[transformers.trainer_utils.EvalPrediction], typing.Dict], NoneType] = None"},{name:"callbacks",val:": typing.Optional[typing.List[transformers.trainer_callback.TrainerCallback]] = None"},{name:"optimizers",val:": typing.Tuple[torch.optim.optimizer.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None)"},{name:"preprocess_logits_for_metrics",val:": typing.Union[typing.Callable[[torch.Tensor, torch.Tensor], torch.Tensor], NoneType] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer_seq2seq.py#L30"}}),Rs=new D({props:{name:"evaluate",anchor:"transformers.Seq2SeqTrainer.evaluate",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'eval'"},{name:"**gen_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainer.evaluate.eval_dataset",description:`<strong>eval_dataset</strong> (<code>Dataset</code>, <em>optional</em>) &#x2014;
Pass a dataset if you wish to override <code>self.eval_dataset</code>. If it is an <code>Dataset</code>, columns
not accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Seq2SeqTrainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.evaluate.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.evaluate.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.evaluate.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.
gen_kwargs &#x2014;
Additional <code>generate</code> specific kwargs.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer_seq2seq.py#L31",returnDescription:`
<p>A dictionary containing the evaluation loss and the potential metrics computed from the predictions. The
dictionary also contains the epoch number which comes from the training state.</p>
`}}),Gs=new D({props:{name:"predict",anchor:"transformers.Seq2SeqTrainer.predict",parameters:[{name:"test_dataset",val:": Dataset"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'test'"},{name:"**gen_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainer.predict.test_dataset",description:`<strong>test_dataset</strong> (<code>Dataset</code>) &#x2014;
Dataset to run the predictions on. If it is a <code>Dataset</code>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. Has to implement the method <code>__len__</code>`,name:"test_dataset"},{anchor:"transformers.Seq2SeqTrainer.predict.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.predict.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.predict.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.predict.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.
gen_kwargs &#x2014;
Additional <code>generate</code> specific kwargs.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/trainer_seq2seq.py#L80"}}),Zr=new $r({props:{$$slots:{default:[nY]},$$scope:{ctx:C}}}),Bs=new te({}),Vs=new D({props:{name:"class transformers.TrainingArguments",anchor:"transformers.TrainingArguments",parameters:[{name:"output_dir",val:": str"},{name:"overwrite_output_dir",val:": bool = False"},{name:"do_train",val:": bool = False"},{name:"do_eval",val:": bool = False"},{name:"do_predict",val:": bool = False"},{name:"evaluation_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'no'"},{name:"prediction_loss_only",val:": bool = False"},{name:"per_device_train_batch_size",val:": int = 8"},{name:"per_device_eval_batch_size",val:": int = 8"},{name:"per_gpu_train_batch_size",val:": typing.Optional[int] = None"},{name:"per_gpu_eval_batch_size",val:": typing.Optional[int] = None"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"eval_accumulation_steps",val:": typing.Optional[int] = None"},{name:"eval_delay",val:": typing.Optional[float] = 0"},{name:"learning_rate",val:": float = 5e-05"},{name:"weight_decay",val:": float = 0.0"},{name:"adam_beta1",val:": float = 0.9"},{name:"adam_beta2",val:": float = 0.999"},{name:"adam_epsilon",val:": float = 1e-08"},{name:"max_grad_norm",val:": float = 1.0"},{name:"num_train_epochs",val:": float = 3.0"},{name:"max_steps",val:": int = -1"},{name:"lr_scheduler_type",val:": typing.Union[transformers.trainer_utils.SchedulerType, str] = 'linear'"},{name:"warmup_ratio",val:": float = 0.0"},{name:"warmup_steps",val:": int = 0"},{name:"log_level",val:": typing.Optional[str] = 'passive'"},{name:"log_level_replica",val:": typing.Optional[str] = 'warning'"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_dir",val:": typing.Optional[str] = None"},{name:"logging_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"logging_first_step",val:": bool = False"},{name:"logging_steps",val:": int = 500"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"save_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"save_steps",val:": int = 500"},{name:"save_total_limit",val:": typing.Optional[int] = None"},{name:"save_on_each_node",val:": bool = False"},{name:"no_cuda",val:": bool = False"},{name:"use_mps_device",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": typing.Optional[int] = None"},{name:"jit_mode_eval",val:": bool = False"},{name:"use_ipex",val:": bool = False"},{name:"bf16",val:": bool = False"},{name:"fp16",val:": bool = False"},{name:"fp16_opt_level",val:": str = 'O1'"},{name:"half_precision_backend",val:": str = 'auto'"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": typing.Optional[bool] = None"},{name:"local_rank",val:": int = -1"},{name:"xpu_backend",val:": typing.Optional[str] = None"},{name:"tpu_num_cores",val:": typing.Optional[int] = None"},{name:"tpu_metrics_debug",val:": bool = False"},{name:"debug",val:": str = ''"},{name:"dataloader_drop_last",val:": bool = False"},{name:"eval_steps",val:": typing.Optional[int] = None"},{name:"dataloader_num_workers",val:": int = 0"},{name:"past_index",val:": int = -1"},{name:"run_name",val:": typing.Optional[str] = None"},{name:"disable_tqdm",val:": typing.Optional[bool] = None"},{name:"remove_unused_columns",val:": typing.Optional[bool] = True"},{name:"label_names",val:": typing.Optional[typing.List[str]] = None"},{name:"load_best_model_at_end",val:": typing.Optional[bool] = False"},{name:"metric_for_best_model",val:": typing.Optional[str] = None"},{name:"greater_is_better",val:": typing.Optional[bool] = None"},{name:"ignore_data_skip",val:": bool = False"},{name:"sharded_ddp",val:": str = ''"},{name:"fsdp",val:": str = ''"},{name:"fsdp_min_num_params",val:": int = 0"},{name:"fsdp_config",val:": typing.Optional[str] = None"},{name:"fsdp_transformer_layer_cls_to_wrap",val:": typing.Optional[str] = None"},{name:"deepspeed",val:": typing.Optional[str] = None"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"optim",val:": typing.Union[transformers.training_args.OptimizerNames, str] = 'adamw_hf'"},{name:"optim_args",val:": typing.Optional[str] = None"},{name:"adafactor",val:": bool = False"},{name:"group_by_length",val:": bool = False"},{name:"length_column_name",val:": typing.Optional[str] = 'length'"},{name:"report_to",val:": typing.Optional[typing.List[str]] = None"},{name:"ddp_find_unused_parameters",val:": typing.Optional[bool] = None"},{name:"ddp_bucket_cap_mb",val:": typing.Optional[int] = None"},{name:"dataloader_pin_memory",val:": bool = True"},{name:"skip_memory_metrics",val:": bool = True"},{name:"use_legacy_prediction_loop",val:": bool = False"},{name:"push_to_hub",val:": bool = False"},{name:"resume_from_checkpoint",val:": typing.Optional[str] = None"},{name:"hub_model_id",val:": typing.Optional[str] = None"},{name:"hub_strategy",val:": typing.Union[transformers.trainer_utils.HubStrategy, str] = 'every_save'"},{name:"hub_token",val:": typing.Optional[str] = None"},{name:"hub_private_repo",val:": bool = False"},{name:"gradient_checkpointing",val:": bool = False"},{name:"include_inputs_for_metrics",val:": bool = False"},{name:"fp16_backend",val:": str = 'auto'"},{name:"push_to_hub_model_id",val:": typing.Optional[str] = None"},{name:"push_to_hub_organization",val:": typing.Optional[str] = None"},{name:"push_to_hub_token",val:": typing.Optional[str] = None"},{name:"mp_parameters",val:": str = ''"},{name:"auto_find_batch_size",val:": bool = False"},{name:"full_determinism",val:": bool = False"},{name:"torchdynamo",val:": typing.Optional[str] = None"},{name:"ray_scope",val:": typing.Optional[str] = 'last'"},{name:"ddp_timeout",val:": typing.Optional[int] = 1800"},{name:"torch_compile",val:": bool = False"},{name:"torch_compile_backend",val:": typing.Optional[str] = None"},{name:"torch_compile_mode",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"transformers.TrainingArguments.output_dir",description:`<strong>output_dir</strong> (<code>str</code>) &#x2014;
The output directory where the model predictions and checkpoints will be written.`,name:"output_dir"},{anchor:"transformers.TrainingArguments.overwrite_output_dir",description:`<strong>overwrite_output_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, overwrite the content of the output directory. Use this to continue training if <code>output_dir</code>
points to a checkpoint directory.`,name:"overwrite_output_dir"},{anchor:"transformers.TrainingArguments.do_train",description:`<strong>do_train</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run training or not. This argument is not directly used by <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used
by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_train"},{anchor:"transformers.TrainingArguments.do_eval",description:`<strong>do_eval</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to run evaluation on the validation set or not. Will be set to <code>True</code> if <code>evaluation_strategy</code> is
different from <code>&quot;no&quot;</code>. This argument is not directly used by <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your
training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_eval"},{anchor:"transformers.TrainingArguments.do_predict",description:`<strong>do_predict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run predictions on the test set or not. This argument is not directly used by <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s
intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_predict"},{anchor:"transformers.TrainingArguments.evaluation_strategy",description:`<strong>evaluation_strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;no&quot;</code>) &#x2014;
The evaluation strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No evaluation is done during training.</li>
<li><code>&quot;steps&quot;</code>: Evaluation is done (and logged) every <code>eval_steps</code>.</li>
<li><code>&quot;epoch&quot;</code>: Evaluation is done at the end of each epoch.</li>
</ul>`,name:"evaluation_strategy"},{anchor:"transformers.TrainingArguments.prediction_loss_only",description:`<strong>prediction_loss_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When performing evaluation and generating predictions, only returns the loss.`,name:"prediction_loss_only"},{anchor:"transformers.TrainingArguments.per_device_train_batch_size",description:`<strong>per_device_train_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for training.`,name:"per_device_train_batch_size"},{anchor:"transformers.TrainingArguments.per_device_eval_batch_size",description:`<strong>per_device_eval_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for evaluation.`,name:"per_device_eval_batch_size"},{anchor:"transformers.TrainingArguments.gradient_accumulation_steps",description:`<strong>gradient_accumulation_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of updates steps to accumulate the gradients for, before performing a backward/update pass.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>When using gradient accumulation, one step is counted as one step with backward pass. Therefore, logging,
evaluation, save will be conducted every <code>gradient_accumulation_steps * xxx_step</code> training examples.</p>

					</div>`,name:"gradient_accumulation_steps"},{anchor:"transformers.TrainingArguments.eval_accumulation_steps",description:`<strong>eval_accumulation_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If
left unset, the whole predictions are accumulated on GPU/TPU before being moved to the CPU (faster but
requires more memory).`,name:"eval_accumulation_steps"},{anchor:"transformers.TrainingArguments.eval_delay",description:`<strong>eval_delay</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Number of epochs or steps to wait for before the first evaluation can be performed, depending on the
evaluation_strategy.`,name:"eval_delay"},{anchor:"transformers.TrainingArguments.learning_rate",description:`<strong>learning_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 5e-5) &#x2014;
The initial learning rate for <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"learning_rate"},{anchor:"transformers.TrainingArguments.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights in <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a>
optimizer.`,name:"weight_decay"},{anchor:"transformers.TrainingArguments.adam_beta1",description:`<strong>adam_beta1</strong> (<code>float</code>, <em>optional</em>, defaults to 0.9) &#x2014;
The beta1 hyperparameter for the <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_beta1"},{anchor:"transformers.TrainingArguments.adam_beta2",description:`<strong>adam_beta2</strong> (<code>float</code>, <em>optional</em>, defaults to 0.999) &#x2014;
The beta2 hyperparameter for the <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_beta2"},{anchor:"transformers.TrainingArguments.adam_epsilon",description:`<strong>adam_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-8) &#x2014;
The epsilon hyperparameter for the <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_epsilon"},{anchor:"transformers.TrainingArguments.max_grad_norm",description:`<strong>max_grad_norm</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Maximum gradient norm (for gradient clipping).`,name:"max_grad_norm"},{anchor:"transformers.TrainingArguments.num_train_epochs(float,",description:`<strong>num_train_epochs(<code>float</code>,</strong> <em>optional</em>, defaults to 3.0) &#x2014;
Total number of training epochs to perform (if not an integer, will perform the decimal part percents of
the last epoch before stopping training).`,name:"num_train_epochs(float,"},{anchor:"transformers.TrainingArguments.max_steps",description:`<strong>max_steps</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
If set to a positive number, the total number of training steps to perform. Overrides <code>num_train_epochs</code>.
In case of using a finite iterable dataset the training may stop before reaching the set number of steps
when all data is exhausted`,name:"max_steps"},{anchor:"transformers.TrainingArguments.lr_scheduler_type",description:`<strong>lr_scheduler_type</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.SchedulerType">SchedulerType</a>, <em>optional</em>, defaults to <code>&quot;linear&quot;</code>) &#x2014;
The scheduler type to use. See the documentation of <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.SchedulerType">SchedulerType</a> for all possible values.`,name:"lr_scheduler_type"},{anchor:"transformers.TrainingArguments.warmup_ratio",description:`<strong>warmup_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Ratio of total training steps used for a linear warmup from 0 to <code>learning_rate</code>.`,name:"warmup_ratio"},{anchor:"transformers.TrainingArguments.warmup_steps",description:`<strong>warmup_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of steps used for a linear warmup from 0 to <code>learning_rate</code>. Overrides any effect of <code>warmup_ratio</code>.`,name:"warmup_steps"},{anchor:"transformers.TrainingArguments.log_level",description:`<strong>log_level</strong> (<code>str</code>, <em>optional</em>, defaults to <code>passive</code>) &#x2014;
Logger log level to use on the main process. Possible choices are the log levels as strings: &#x2018;debug&#x2019;,
&#x2018;info&#x2019;, &#x2018;warning&#x2019;, &#x2018;error&#x2019; and &#x2018;critical&#x2019;, plus a &#x2018;passive&#x2019; level which doesn&#x2019;t set anything and keeps the
current log level for the Transformers library (which will be <code>&quot;warning&quot;</code> by default).`,name:"log_level"},{anchor:"transformers.TrainingArguments.log_level_replica",description:`<strong>log_level_replica</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;warning&quot;</code>) &#x2014;
Logger log level to use on replicas. Same choices as <code>log_level</code>&#x201D;`,name:"log_level_replica"},{anchor:"transformers.TrainingArguments.log_on_each_node",description:`<strong>log_on_each_node</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
In multinode distributed training, whether to log using <code>log_level</code> once per node, or only on the main
node.`,name:"log_on_each_node"},{anchor:"transformers.TrainingArguments.logging_dir",description:`<strong>logging_dir</strong> (<code>str</code>, <em>optional</em>) &#x2014;
<a href="https://www.tensorflow.org/tensorboard" rel="nofollow">TensorBoard</a> log directory. Will default to
*output_dir/runs/<strong>CURRENT_DATETIME_HOSTNAME*</strong>.`,name:"logging_dir"},{anchor:"transformers.TrainingArguments.logging_strategy",description:`<strong>logging_strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The logging strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No logging is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Logging is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Logging is done every <code>logging_steps</code>.</li>
</ul>`,name:"logging_strategy"},{anchor:"transformers.TrainingArguments.logging_first_step",description:`<strong>logging_first_step</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to log and evaluate the first <code>global_step</code> or not.`,name:"logging_first_step"},{anchor:"transformers.TrainingArguments.logging_steps",description:`<strong>logging_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of update steps between two logs if <code>logging_strategy=&quot;steps&quot;</code>.`,name:"logging_steps"},{anchor:"transformers.TrainingArguments.logging_nan_inf_filter",description:`<strong>logging_nan_inf_filter</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to filter <code>nan</code> and <code>inf</code> losses for logging. If set to <code>True</code> the loss of every step that is <code>nan</code>
or <code>inf</code> is filtered and the average loss of the current logging window is taken instead.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p><code>logging_nan_inf_filter</code> only influences the logging of loss values, it does not change the behavior the
gradient is computed or applied to the model.</p>

					</div>`,name:"logging_nan_inf_filter"},{anchor:"transformers.TrainingArguments.save_strategy",description:`<strong>save_strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The checkpoint save strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No save is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Save is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Save is done every <code>save_steps</code>.</li>
</ul>`,name:"save_strategy"},{anchor:"transformers.TrainingArguments.save_steps",description:`<strong>save_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of updates steps before two checkpoint saves if <code>save_strategy=&quot;steps&quot;</code>.`,name:"save_steps"},{anchor:"transformers.TrainingArguments.save_total_limit",description:`<strong>save_total_limit</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in
<code>output_dir</code>.`,name:"save_total_limit"},{anchor:"transformers.TrainingArguments.save_on_each_node",description:`<strong>save_on_each_node</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When doing multi-node distributed training, whether to save models and checkpoints on each node, or only on
the main one.</p>
<p>This should not be activated when the different nodes use the same storage as the files will be saved with
the same names for each node.`,name:"save_on_each_node"},{anchor:"transformers.TrainingArguments.no_cuda",description:`<strong>no_cuda</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to not use CUDA even when it is available or not.`,name:"no_cuda"},{anchor:"transformers.TrainingArguments.seed",description:`<strong>seed</strong> (<code>int</code>, <em>optional</em>, defaults to 42) &#x2014;
Random seed that will be set at the beginning of training. To ensure reproducibility across runs, use the
<code>~Trainer.model_init</code> function to instantiate the model if it has some randomly initialized parameters.`,name:"seed"},{anchor:"transformers.TrainingArguments.data_seed",description:`<strong>data_seed</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Random seed to be used with data samplers. If not set, random generators for data sampling will use the
same seed as <code>seed</code>. This can be used to ensure reproducibility of data sampling, independent of the model
seed.`,name:"data_seed"},{anchor:"transformers.TrainingArguments.jit_mode_eval",description:`<strong>jit_mode_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use PyTorch jit trace for inference.`,name:"jit_mode_eval"},{anchor:"transformers.TrainingArguments.use_ipex",description:`<strong>use_ipex</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Intel extension for PyTorch when it is available. <a href="https://github.com/intel/intel-extension-for-pytorch" rel="nofollow">IPEX
installation</a>.`,name:"use_ipex"},{anchor:"transformers.TrainingArguments.bf16",description:`<strong>bf16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use bf16 16-bit (mixed) precision training instead of 32-bit training. Requires Ampere or higher
NVIDIA architecture or using CPU (no_cuda). This is an experimental API and it may change.`,name:"bf16"},{anchor:"transformers.TrainingArguments.fp16",description:`<strong>fp16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use fp16 16-bit (mixed) precision training instead of 32-bit training.`,name:"fp16"},{anchor:"transformers.TrainingArguments.fp16_opt_level",description:`<strong>fp16_opt_level</strong> (<code>str</code>, <em>optional</em>, defaults to &#x2018;O1&#x2019;) &#x2014;
For <code>fp16</code> training, Apex AMP optimization level selected in [&#x2018;O0&#x2019;, &#x2018;O1&#x2019;, &#x2018;O2&#x2019;, and &#x2018;O3&#x2019;]. See details on
the <a href="https://nvidia.github.io/apex/amp" rel="nofollow">Apex documentation</a>.`,name:"fp16_opt_level"},{anchor:"transformers.TrainingArguments.fp16_backend",description:`<strong>fp16_backend</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
This argument is deprecated. Use <code>half_precision_backend</code> instead.`,name:"fp16_backend"},{anchor:"transformers.TrainingArguments.half_precision_backend",description:`<strong>half_precision_backend</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
The backend to use for mixed precision training. Must be one of <code>&quot;auto&quot;, &quot;cuda_amp&quot;, &quot;apex&quot;, &quot;cpu_amp&quot;</code>.
<code>&quot;auto&quot;</code> will use CPU/CUDA AMP or APEX depending on the PyTorch version detected, while the other choices
will force the requested backend.`,name:"half_precision_backend"},{anchor:"transformers.TrainingArguments.bf16_full_eval",description:`<strong>bf16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full bfloat16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values. This is an experimental API and it may change.`,name:"bf16_full_eval"},{anchor:"transformers.TrainingArguments.fp16_full_eval",description:`<strong>fp16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full float16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values.`,name:"fp16_full_eval"},{anchor:"transformers.TrainingArguments.tf32",description:`<strong>tf32</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to enable the TF32 mode, available in Ampere and newer GPU architectures. The default value depends
on PyTorch&#x2019;s version default of <code>torch.backends.cuda.matmul.allow_tf32</code>. For more details please refer to
the <a href="https://huggingface.co/docs/transformers/performance#tf32" rel="nofollow">TF32</a> documentation. This is an
experimental API and it may change.`,name:"tf32"},{anchor:"transformers.TrainingArguments.local_rank",description:`<strong>local_rank</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Rank of the process during distributed training.`,name:"local_rank"},{anchor:"transformers.TrainingArguments.xpu_backend",description:`<strong>xpu_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use for xpu distributed training. Must be one of <code>&quot;mpi&quot;</code> or <code>&quot;ccl&quot;</code> or <code>&quot;gloo&quot;</code>.`,name:"xpu_backend"},{anchor:"transformers.TrainingArguments.tpu_num_cores",description:`<strong>tpu_num_cores</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When training on TPU, the number of TPU cores (automatically passed by launcher script).`,name:"tpu_num_cores"},{anchor:"transformers.TrainingArguments.dataloader_drop_last",description:`<strong>dataloader_drop_last</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch size)
or not.`,name:"dataloader_drop_last"},{anchor:"transformers.TrainingArguments.eval_steps",description:`<strong>eval_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of update steps between two evaluations if <code>evaluation_strategy=&quot;steps&quot;</code>. Will default to the same
value as <code>logging_steps</code> if not set.`,name:"eval_steps"},{anchor:"transformers.TrainingArguments.dataloader_num_workers",description:`<strong>dataloader_num_workers</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in the
main process.`,name:"dataloader_num_workers"},{anchor:"transformers.TrainingArguments.past_index",description:`<strong>past_index</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Some models like <a href="../model_doc/transformerxl">TransformerXL</a> or <a href="../model_doc/xlnet">XLNet</a> can make use of
the past hidden states for their predictions. If this argument is set to a positive int, the <code>Trainer</code> will
use the corresponding output (usually index 2) as the past state and feed it to the model at the next
training step under the keyword argument <code>mems</code>.`,name:"past_index"},{anchor:"transformers.TrainingArguments.run_name",description:`<strong>run_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
A descriptor for the run. Typically used for <a href="https://www.wandb.com/" rel="nofollow">wandb</a> and
<a href="https://www.mlflow.org/" rel="nofollow">mlflow</a> logging.`,name:"run_name"},{anchor:"transformers.TrainingArguments.disable_tqdm",description:`<strong>disable_tqdm</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to disable the tqdm progress bars and table of metrics produced by
<code>~notebook.NotebookTrainingTracker</code> in Jupyter Notebooks. Will default to <code>True</code> if the logging level is
set to warn or lower (default), <code>False</code> otherwise.`,name:"disable_tqdm"},{anchor:"transformers.TrainingArguments.remove_unused_columns",description:`<strong>remove_unused_columns</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to automatically remove the columns unused by the model forward method.</p>
<p>(Note that this behavior is not implemented for <code>TFTrainer</code> yet.)`,name:"remove_unused_columns"},{anchor:"transformers.TrainingArguments.label_names",description:`<strong>label_names</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
The list of keys in your dictionary of inputs that correspond to the labels.</p>
<p>Will eventually default to the list of argument names accepted by the model that contain the word &#x201C;label&#x201D;,
except if the model used is one of the <code>XxxForQuestionAnswering</code> in which case it will also include the
<code>[&quot;start_positions&quot;, &quot;end_positions&quot;]</code> keys.`,name:"label_names"},{anchor:"transformers.TrainingArguments.load_best_model_at_end",description:`<strong>load_best_model_at_end</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to load the best model found during training at the end of training.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When set to <code>True</code>, the parameters <code>save_strategy</code> needs to be the same as <code>evaluation_strategy</code>, and in
the case it is &#x201C;steps&#x201D;, <code>save_steps</code> must be a round multiple of <code>eval_steps</code>.</p>

					</div>`,name:"load_best_model_at_end"},{anchor:"transformers.TrainingArguments.metric_for_best_model",description:`<strong>metric_for_best_model</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> to specify the metric to use to compare two different
models. Must be the name of a metric returned by the evaluation with or without the prefix <code>&quot;eval_&quot;</code>. Will
default to <code>&quot;loss&quot;</code> if unspecified and <code>load_best_model_at_end=True</code> (to use the evaluation loss).</p>
<p>If you set this value, <code>greater_is_better</code> will default to <code>True</code>. Don&#x2019;t forget to set it to <code>False</code> if
your metric is better when lower.`,name:"metric_for_best_model"},{anchor:"transformers.TrainingArguments.greater_is_better",description:`<strong>greater_is_better</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> and <code>metric_for_best_model</code> to specify if better models
should have a greater metric or not. Will default to:</p>
<ul>
<li><code>True</code> if <code>metric_for_best_model</code> is set to a value that isn&#x2019;t <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
<li><code>False</code> if <code>metric_for_best_model</code> is not set, or set to <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
</ul>`,name:"greater_is_better"},{anchor:"transformers.TrainingArguments.ignore_data_skip",description:`<strong>ignore_data_skip</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When resuming training, whether or not to skip the epochs and batches to get the data loading at the same
stage as in the previous training. If set to <code>True</code>, the training will begin faster (as that skipping step
can take a long time) but will not yield the same results as the interrupted training would have.`,name:"ignore_data_skip"},{anchor:"transformers.TrainingArguments.sharded_ddp",description:`<strong>sharded_ddp</strong> (<code>bool</code>, <code>str</code> or list of <code>ShardedDDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Sharded DDP training from <a href="https://github.com/facebookresearch/fairscale" rel="nofollow">FairScale</a> (in distributed
training only). This is an experimental feature.</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;simple&quot;</code>: to use first instance of sharded DDP released by fairscale (<code>ShardedDDP</code>) similar to ZeRO-2.</li>
<li><code>&quot;zero_dp_2&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-2 mode (with <code>reshard_after_forward=False</code>).</li>
<li><code>&quot;zero_dp_3&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-3 mode (with <code>reshard_after_forward=True</code>).</li>
<li><code>&quot;offload&quot;</code>: to add ZeRO-offload (only compatible with <code>&quot;zero_dp_2&quot;</code> and <code>&quot;zero_dp_3&quot;</code>).</li>
</ul>
<p>If a string is passed, it will be split on space. If a bool is passed, it will be converted to an empty
list for <code>False</code> and <code>[&quot;simple&quot;]</code> for <code>True</code>.`,name:"sharded_ddp"},{anchor:"transformers.TrainingArguments.fsdp",description:`<strong>fsdp</strong> (<code>bool</code>, <code>str</code> or list of <code>FSDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use PyTorch Distributed Parallel Training (in distributed training only).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;full_shard&quot;</code>: Shard parameters, gradients and optimizer states.</li>
<li><code>&quot;shard_grad_op&quot;</code>: Shard optimizer states and gradients.</li>
<li><code>&quot;offload&quot;</code>: Offload parameters and gradients to CPUs (only compatible with <code>&quot;full_shard&quot;</code> and
<code>&quot;shard_grad_op&quot;</code>).</li>
<li><code>&quot;auto_wrap&quot;</code>: Automatically recursively wrap layers with FSDP using <code>default_auto_wrap_policy</code>.</li>
</ul>`,name:"fsdp"},{anchor:"transformers.TrainingArguments.fsdp_config",description:`<strong>fsdp_config</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
Config to be used with fsdp (Pytorch Distributed Parallel Training). The value is either a location of
deepspeed json config file (e.g., <code>ds_config.json</code>) or an already loaded json file as <code>dict</code>.</p>
<p>A List of config and its options:</p>
<ul>
<li>
<p>fsdp_min_num_params (<code>int</code>, <em>optional</em>, defaults to <code>0</code>):
FSDP&#x2019;s minimum number of parameters for Default Auto Wrapping. (useful only when <code>fsdp</code> field is
passed).</p>
</li>
<li>
<p>fsdp_transformer_layer_cls_to_wrap (<code>List[str]</code>, <em>optional</em>):
List of transformer layer class names (case-sensitive) to wrap, e.g, <code>BertLayer</code>, <code>GPTJBlock</code>,
<code>T5Block</code> &#x2026; (useful only when <code>fsdp</code> flag is passed).</p>
</li>
<li>
<p>fsdp_backward_prefetch (<code>str</code>, <em>optional</em>)
FSDP&#x2019;s backward prefetch mode. Controls when to prefetch next set of parameters (useful only when
<code>fsdp</code> field is passed).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;backward_pre&quot;</code> : Prefetches the next set of parameters before the current set of parameter&#x2019;s
gradient
computation.</li>
<li><code>&quot;backward_pos&quot;</code> : This prefetches the next set of parameters after the current set of
parameter&#x2019;s
gradient computation.</li>
</ul>
</li>
<li>
<p>fsdp_forward_prefetch (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
FSDP&#x2019;s forward prefetch mode (useful only when <code>fsdp</code> field is passed).
If <code>&quot;True&quot;</code>, then FSDP explicitly prefetches the next upcoming all-gather while executing in the
forward pass.</p>
</li>
<li>
<p>limit_all_gathers (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
FSDP&#x2019;s limit_all_gathers (useful only when <code>fsdp</code> field is passed).
If <code>&quot;True&quot;</code>, FSDP explicitly synchronizes the CPU thread to prevent too many in-flight
all-gathers.</p>
</li>
<li>
<p>xla (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether to use PyTorch/XLA Fully Sharded Data Parallel Training. This is an experimental feature
and its API may evolve in the future.</p>
</li>
<li>
<p>xla_fsdp_settings (<code>dict</code>, <em>optional</em>)
The value is a dictionary which stores the XLA FSDP wrapping parameters.</p>
<p>For a complete list of options, please see <a href="https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py" rel="nofollow">here</a>.</p>
</li>
<li>
<p>xla_fsdp_grad_ckpt (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Will use gradient checkpointing over each nested XLA FSDP wrapped layer. This setting can only be
used when the xla flag is set to true, and an auto wrapping policy is specified through
fsdp_min_num_params or fsdp_transformer_layer_cls_to_wrap.</p>
</li>
</ul>`,name:"fsdp_config"},{anchor:"transformers.TrainingArguments.deepspeed",description:`<strong>deepspeed</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
Use <a href="https://github.com/microsoft/deepspeed" rel="nofollow">Deepspeed</a>. This is an experimental feature and its API may
evolve in the future. The value is either the location of DeepSpeed json config file (e.g.,
<code>ds_config.json</code>) or an already loaded json file as a <code>dict</code>&#x201D;`,name:"deepspeed"},{anchor:"transformers.TrainingArguments.label_smoothing_factor",description:`<strong>label_smoothing_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The label smoothing factor to use. Zero means no label smoothing, otherwise the underlying onehot-encoded
labels are changed from 0s and 1s to <code>label_smoothing_factor/num_labels</code> and <code>1 - label_smoothing_factor + label_smoothing_factor/num_labels</code> respectively.`,name:"label_smoothing_factor"},{anchor:"transformers.TrainingArguments.debug",description:`<strong>debug</strong> (<code>str</code> or list of <code>DebugOption</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
Enable one or more debug features. This is an experimental feature.</p>
<p>Possible options are:</p>
<ul>
<li><code>&quot;underflow_overflow&quot;</code>: detects overflow in model&#x2019;s input/outputs and reports the last frames that led to
the event</li>
<li><code>&quot;tpu_metrics_debug&quot;</code>: print debug metrics on TPU</li>
</ul>
<p>The options should be separated by whitespaces.`,name:"debug"},{anchor:"transformers.TrainingArguments.optim",description:`<strong>optim</strong> (<code>str</code> or <code>training_args.OptimizerNames</code>, <em>optional</em>, defaults to <code>&quot;adamw_hf&quot;</code>) &#x2014;
The optimizer to use: adamw_hf, adamw_torch, adamw_torch_fused, adamw_apex_fused, adamw_anyprecision or
adafactor.`,name:"optim"},{anchor:"transformers.TrainingArguments.optim_args",description:`<strong>optim_args</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional arguments that are supplied to AnyPrecisionAdamW.`,name:"optim_args"},{anchor:"transformers.TrainingArguments.group_by_length",description:`<strong>group_by_length</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to group together samples of roughly the same length in the training dataset (to minimize
padding applied and be more efficient). Only useful if applying dynamic padding.`,name:"group_by_length"},{anchor:"transformers.TrainingArguments.length_column_name",description:`<strong>length_column_name</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;length&quot;</code>) &#x2014;
Column name for precomputed lengths. If the column exists, grouping by length will use these values rather
than computing them on train startup. Ignored unless <code>group_by_length</code> is <code>True</code> and the dataset is an
instance of <code>Dataset</code>.`,name:"length_column_name"},{anchor:"transformers.TrainingArguments.report_to",description:`<strong>report_to</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>, defaults to <code>&quot;all&quot;</code>) &#x2014;
The list of integrations to report the results and logs to. Supported platforms are <code>&quot;azure_ml&quot;</code>,
<code>&quot;comet_ml&quot;</code>, <code>&quot;mlflow&quot;</code>, <code>&quot;neptune&quot;</code>, <code>&quot;tensorboard&quot;</code>,<code>&quot;clearml&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report to
all integrations installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.TrainingArguments.ddp_find_unused_parameters",description:`<strong>ddp_find_unused_parameters</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>find_unused_parameters</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_find_unused_parameters"},{anchor:"transformers.TrainingArguments.ddp_bucket_cap_mb",description:`<strong>ddp_bucket_cap_mb</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>bucket_cap_mb</code> passed to <code>DistributedDataParallel</code>.`,name:"ddp_bucket_cap_mb"},{anchor:"transformers.TrainingArguments.dataloader_pin_memory",description:`<strong>dataloader_pin_memory</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether you want to pin memory in data loaders or not. Will default to <code>True</code>.`,name:"dataloader_pin_memory"},{anchor:"transformers.TrainingArguments.skip_memory_metrics",description:`<strong>skip_memory_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to skip adding of memory profiler reports to metrics. This is skipped by default because it slows
down the training and evaluation speed.`,name:"skip_memory_metrics"},{anchor:"transformers.TrainingArguments.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push the model to the Hub every time the model is saved. If this is activated,
<code>output_dir</code> will begin a git directory synced with the repo (determined by <code>hub_model_id</code>) and the content
will be pushed each time a save is triggered (depending on your <code>save_strategy</code>). Calling
<a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> will also trigger a push.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>If <code>output_dir</code> exists, it needs to be a local clone of the repository to which the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a> will be
pushed.</p>

					</div>`,name:"push_to_hub"},{anchor:"transformers.TrainingArguments.resume_from_checkpoint",description:`<strong>resume_from_checkpoint</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The path to a folder with a valid checkpoint for your model. This argument is not directly used by
<a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"resume_from_checkpoint"},{anchor:"transformers.TrainingArguments.hub_model_id",description:`<strong>hub_model_id</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the repository to keep in sync with the local <em>output_dir</em>. It can be a simple model ID in
which case the model will be pushed in your namespace. Otherwise it should be the whole repository name,
for instance <code>&quot;user_name/model&quot;</code>, which allows you to push to an organization you are a member of with
<code>&quot;organization_name/model&quot;</code>. Will default to <code>user_name/output_dir_name</code> with <em>output_dir_name</em> being the
name of <code>output_dir</code>.</p>
<p>Will default to the name of <code>output_dir</code>.`,name:"hub_model_id"},{anchor:"transformers.TrainingArguments.hub_strategy",description:`<strong>hub_strategy</strong> (<code>str</code> or <code>HubStrategy</code>, <em>optional</em>, defaults to <code>&quot;every_save&quot;</code>) &#x2014;
Defines the scope of what is pushed to the Hub and when. Possible values are:</p>
<ul>
<li><code>&quot;end&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> method is called.</li>
<li><code>&quot;every_save&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and
a draft of a model card each time there is a model save. The pushes are asynchronous to not block
training, and in case the save are very frequent, a new push is only attempted if the previous one is
finished. A last push is made with the final model at the end of training.</li>
<li><code>&quot;checkpoint&quot;</code>: like <code>&quot;every_save&quot;</code> but the latest checkpoint is also pushed in a subfolder named
last-checkpoint, allowing you to resume training easily with
<code>trainer.train(resume_from_checkpoint=&quot;last-checkpoint&quot;)</code>.</li>
<li><code>&quot;all_checkpoints&quot;</code>: like <code>&quot;checkpoint&quot;</code> but all checkpoints are pushed like they appear in the output
folder (so you will get one checkpoint folder per folder in your final repository)</li>
</ul>`,name:"hub_strategy"},{anchor:"transformers.TrainingArguments.hub_token",description:`<strong>hub_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with
<code>huggingface-cli login</code>.`,name:"hub_token"},{anchor:"transformers.TrainingArguments.hub_private_repo",description:`<strong>hub_private_repo</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, the Hub repo will be set to private.`,name:"hub_private_repo"},{anchor:"transformers.TrainingArguments.gradient_checkpointing",description:`<strong>gradient_checkpointing</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, use gradient checkpointing to save memory at the expense of slower backward pass.`,name:"gradient_checkpointing"},{anchor:"transformers.TrainingArguments.include_inputs_for_metrics",description:`<strong>include_inputs_for_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the inputs will be passed to the <code>compute_metrics</code> function. This is intended for metrics
that need inputs, predictions and references for scoring calculation in Metric class.`,name:"include_inputs_for_metrics"},{anchor:"transformers.TrainingArguments.auto_find_batch_size",description:`<strong>auto_find_batch_size</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding
CUDA Out-of-Memory errors. Requires accelerate to be installed (<code>pip install accelerate</code>)`,name:"auto_find_batch_size"},{anchor:"transformers.TrainingArguments.full_determinism",description:`<strong>full_determinism</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.set_seed">set_seed()</a> to ensure reproducible results in
distributed training`,name:"full_determinism"},{anchor:"transformers.TrainingArguments.torchdynamo",description:`<strong>torchdynamo</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If set, the backend compiler for TorchDynamo. Possible choices are <code>&quot;eager&quot;</code>, <code>&quot;aot_eager&quot;</code>, <code>&quot;inductor&quot;</code>,
<code>&quot;nvfuser&quot;</code>, <code>&quot;aot_nvfuser&quot;</code>, <code>&quot;aot_cudagraphs&quot;</code>, <code>&quot;ofi&quot;</code>, <code>&quot;fx2trt&quot;</code>, <code>&quot;onnxrt&quot;</code> and <code>&quot;ipex&quot;</code>.`,name:"torchdynamo"},{anchor:"transformers.TrainingArguments.ray_scope",description:`<strong>ray_scope</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;last&quot;</code>) &#x2014;
The scope to use when doing hyperparameter search with Ray. By default, <code>&quot;last&quot;</code> will be used. Ray will
then use the last checkpoint of all trials, compare those, and select the best one. However, other options
are also available. See the <a href="https://docs.ray.io/en/latest/tune/api_docs/analysis.html#ray.tune.ExperimentAnalysis.get_best_trial" rel="nofollow">Ray documentation</a> for
more options.`,name:"ray_scope"},{anchor:"transformers.TrainingArguments.ddp_timeout",description:`<strong>ddp_timeout</strong> (<code>int</code>, <em>optional</em>, defaults to 1800) &#x2014;
The timeout for <code>torch.distributed.init_process_group</code> calls, used to avoid GPU socket timeouts when
performing slow operations in distributed runnings. Please refer the [PyTorch documentation]
(<a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group" rel="nofollow">https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group</a>) for more
information.`,name:"ddp_timeout"},{anchor:"transformers.TrainingArguments.use_mps_device",description:`<strong>use_mps_device</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use Apple Silicon chip based <code>mps</code> device.`,name:"use_mps_device"},{anchor:"transformers.TrainingArguments.torch_compile",description:`<strong>torch_compile</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to compile the model using PyTorch 2.0
<a href="https://pytorch.org/get-started/pytorch-2.0/" rel="nofollow"><code>torch.compile</code></a> (requires a nighlty install of PyTorch).</p>
<p>This will use the best defaults for the <a href="https://pytorch.org/docs/2.0/generated/torch.compile.html?highlight=torch+compile#torch.compile" rel="nofollow"><code>torch.compile</code>
API</a>. You
can customize the defaults with the argument <code>torch_compile_backend</code> and <code>torch_compile_mode</code> but we don&#x2019;t
guarantee any of them will work as the support is progressively rolled in in PyTorch.</p>
<p>This flag and the whole compile API is experimental and subject to change in future releases.`,name:"torch_compile"},{anchor:"transformers.TrainingArguments.torch_compile_backend",description:`<strong>torch_compile_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Refer to the PyTorch doc for possible values and note that they may change across PyTorch versions.</p>
<p>This flag is experimental and subject to change in future releases.`,name:"torch_compile_backend"},{anchor:"transformers.TrainingArguments.torch_compile_mode",description:`<strong>torch_compile_mode</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The mode to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Refer to the PyTorch doc for possible values and note that they may change across PyTorch versions.</p>
<p>This flag is experimental and subject to change in future releases.`,name:"torch_compile_mode"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L135"}}),Zs=new D({props:{name:"get_process_log_level",anchor:"transformers.TrainingArguments.get_process_log_level",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L1775"}}),Ks=new D({props:{name:"get_warmup_steps",anchor:"transformers.TrainingArguments.get_warmup_steps",parameters:[{name:"num_training_steps",val:": int"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L1868"}}),Qs=new D({props:{name:"main_process_first",anchor:"transformers.TrainingArguments.main_process_first",parameters:[{name:"local",val:" = True"},{name:"desc",val:" = 'work'"}],parametersDescription:[{anchor:"transformers.TrainingArguments.main_process_first.local",description:`<strong>local</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
if <code>True</code> first means process of rank 0 of each node if <code>False</code> first means process of rank 0 of node
rank 0 In multi-node environment with a shared filesystem you most likely will want to use
<code>local=False</code> so that only the main process of the first node will do the processing. If however, the
filesystem is not shared, then the main process of each node will need to do the processing, which is
the default behavior.`,name:"local"},{anchor:"transformers.TrainingArguments.main_process_first.desc",description:`<strong>desc</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;work&quot;</code>) &#x2014;
a work description to be used in debug logs`,name:"desc"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L1813"}}),ei=new D({props:{name:"set_dataloader",anchor:"transformers.TrainingArguments.set_dataloader",parameters:[{name:"train_batch_size",val:": int = 8"},{name:"eval_batch_size",val:": int = 8"},{name:"drop_last",val:": bool = False"},{name:"num_workers",val:": int = 0"},{name:"pin_memory",val:": bool = True"},{name:"auto_find_batch_size",val:": bool = False"},{name:"ignore_data_skip",val:": bool = False"},{name:"sampler_seed",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_dataloader.drop_last",description:`<strong>drop_last</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch
size) or not.`,name:"drop_last"},{anchor:"transformers.TrainingArguments.set_dataloader.num_workers",description:`<strong>num_workers</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in
the main process.`,name:"num_workers"},{anchor:"transformers.TrainingArguments.set_dataloader.pin_memory",description:`<strong>pin_memory</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether you want to pin memory in data loaders or not. Will default to <code>True</code>.`,name:"pin_memory"},{anchor:"transformers.TrainingArguments.set_dataloader.auto_find_batch_size",description:`<strong>auto_find_batch_size</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to find a batch size that will fit into memory automatically through exponential decay,
avoiding CUDA Out-of-Memory errors. Requires accelerate to be installed (<code>pip install accelerate</code>)`,name:"auto_find_batch_size"},{anchor:"transformers.TrainingArguments.set_dataloader.ignore_data_skip",description:`<strong>ignore_data_skip</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When resuming training, whether or not to skip the epochs and batches to get the data loading at the
same stage as in the previous training. If set to <code>True</code>, the training will begin faster (as that
skipping step can take a long time) but will not yield the same results as the interrupted training
would have.`,name:"ignore_data_skip"},{anchor:"transformers.TrainingArguments.set_dataloader.sampler_seed",description:`<strong>sampler_seed</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Random seed to be used with data samplers. If not set, random generators for data sampling will use the
same seed as <code>self.seed</code>. This can be used to ensure reproducibility of data sampling, independent of
the model seed.`,name:"sampler_seed"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L2374"}}),Qr=new xo({props:{anchor:"transformers.TrainingArguments.set_dataloader.example",$$slots:{default:[sY]},$$scope:{ctx:C}}}),ti=new D({props:{name:"set_evaluate",anchor:"transformers.TrainingArguments.set_evaluate",parameters:[{name:"strategy",val:": typing.Union[str, transformers.trainer_utils.IntervalStrategy] = 'no'"},{name:"steps",val:": int = 500"},{name:"batch_size",val:": int = 8"},{name:"accumulation_steps",val:": typing.Optional[int] = None"},{name:"delay",val:": typing.Optional[float] = None"},{name:"loss_only",val:": bool = False"},{name:"jit_mode",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_evaluate.strategy",description:`<strong>strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;no&quot;</code>) &#x2014;
The evaluation strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No evaluation is done during training.</li>
<li><code>&quot;steps&quot;</code>: Evaluation is done (and logged) every <code>steps</code>.</li>
<li><code>&quot;epoch&quot;</code>: Evaluation is done at the end of each epoch.</li>
</ul>
<p>Setting a <code>strategy</code> different from <code>&quot;no&quot;</code> will set <code>self.do_eval</code> to <code>True</code>.`,name:"strategy"},{anchor:"transformers.TrainingArguments.set_evaluate.steps",description:`<strong>steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of update steps between two evaluations if <code>strategy=&quot;steps&quot;</code>.`,name:"steps"},{anchor:"transformers.TrainingArguments.set_evaluate.batch_size",description:`<strong>batch_size</strong> (<code>int</code> <em>optional</em>, defaults to 8) &#x2014;
The batch size per device (GPU/TPU core/CPU&#x2026;) used for evaluation.`,name:"batch_size"},{anchor:"transformers.TrainingArguments.set_evaluate.accumulation_steps",description:`<strong>accumulation_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU.
If left unset, the whole predictions are accumulated on GPU/TPU before being moved to the CPU (faster
but requires more memory).`,name:"accumulation_steps"},{anchor:"transformers.TrainingArguments.set_evaluate.delay",description:`<strong>delay</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Number of epochs or steps to wait for before the first evaluation can be performed, depending on the
evaluation_strategy.`,name:"delay"},{anchor:"transformers.TrainingArguments.set_evaluate.loss_only",description:`<strong>loss_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Ignores all outputs except the loss.`,name:"loss_only"},{anchor:"transformers.TrainingArguments.set_evaluate.jit_mode",description:`<strong>jit_mode</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use PyTorch jit trace for inference.`,name:"jit_mode"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L1989"}}),ea=new xo({props:{anchor:"transformers.TrainingArguments.set_evaluate.example",$$slots:{default:[iY]},$$scope:{ctx:C}}}),oi=new D({props:{name:"set_logging",anchor:"transformers.TrainingArguments.set_logging",parameters:[{name:"strategy",val:": typing.Union[str, transformers.trainer_utils.IntervalStrategy] = 'steps'"},{name:"steps",val:": int = 500"},{name:"report_to",val:": typing.Union[str, typing.List[str]] = 'none'"},{name:"level",val:": str = 'passive'"},{name:"first_step",val:": bool = False"},{name:"nan_inf_filter",val:": bool = False"},{name:"on_each_node",val:": bool = False"},{name:"replica_level",val:": str = 'passive'"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_logging.strategy",description:`<strong>strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The logging strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No save is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Save is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Save is done every <code>save_steps</code>.</li>
</ul>`,name:"strategy"},{anchor:"transformers.TrainingArguments.set_logging.steps",description:`<strong>steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of update steps between two logs if <code>strategy=&quot;steps&quot;</code>.`,name:"steps"},{anchor:"transformers.TrainingArguments.set_logging.level",description:`<strong>level</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;passive&quot;</code>) &#x2014;
Logger log level to use on the main process. Possible choices are the log levels as strings: <code>&quot;debug&quot;</code>,
<code>&quot;info&quot;</code>, <code>&quot;warning&quot;</code>, <code>&quot;error&quot;</code> and <code>&quot;critical&quot;</code>, plus a <code>&quot;passive&quot;</code> level which doesn&#x2019;t set anything
and lets the application set the level.`,name:"level"},{anchor:"transformers.TrainingArguments.set_logging.report_to",description:`<strong>report_to</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>, defaults to <code>&quot;none&quot;</code>) &#x2014;
The list of integrations to report the results and logs to. Supported platforms are <code>&quot;azure_ml&quot;</code>,
<code>&quot;comet_ml&quot;</code>, <code>&quot;mlflow&quot;</code>, <code>&quot;neptune&quot;</code>, <code>&quot;tensorboard&quot;</code>,<code>&quot;clearml&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report
to all integrations installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.TrainingArguments.set_logging.first_step",description:`<strong>first_step</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to log and evaluate the first <code>global_step</code> or not.`,name:"first_step"},{anchor:"transformers.TrainingArguments.set_logging.nan_inf_filter",description:`<strong>nan_inf_filter</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to filter <code>nan</code> and <code>inf</code> losses for logging. If set to <code>True</code> the loss of every step that is
<code>nan</code> or <code>inf</code> is filtered and the average loss of the current logging window is taken instead.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p><code>nan_inf_filter</code> only influences the logging of loss values, it does not change the behavior the
gradient is computed or applied to the model.</p>

					</div>`,name:"nan_inf_filter"},{anchor:"transformers.TrainingArguments.set_logging.on_each_node",description:`<strong>on_each_node</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
In multinode distributed training, whether to log using <code>log_level</code> once per node, or only on the main
node.`,name:"on_each_node"},{anchor:"transformers.TrainingArguments.set_logging.replica_level",description:`<strong>replica_level</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;passive&quot;</code>) &#x2014;
Logger log level to use on replicas. Same choices as <code>log_level</code>`,name:"replica_level"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L2139"}}),ta=new xo({props:{anchor:"transformers.TrainingArguments.set_logging.example",$$slots:{default:[lY]},$$scope:{ctx:C}}}),ri=new D({props:{name:"set_lr_scheduler",anchor:"transformers.TrainingArguments.set_lr_scheduler",parameters:[{name:"name",val:": typing.Union[str, transformers.trainer_utils.SchedulerType] = 'linear'"},{name:"num_epochs",val:": float = 3.0"},{name:"max_steps",val:": int = -1"},{name:"warmup_ratio",val:": float = 0"},{name:"warmup_steps",val:": int = 0"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_lr_scheduler.name",description:`<strong>name</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.SchedulerType">SchedulerType</a>, <em>optional</em>, defaults to <code>&quot;linear&quot;</code>) &#x2014;
The scheduler type to use. See the documentation of <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.SchedulerType">SchedulerType</a> for all possible values.`,name:"name"},{anchor:"transformers.TrainingArguments.set_lr_scheduler.num_epochs(float,",description:`<strong>num_epochs(<code>float</code>,</strong> <em>optional</em>, defaults to 3.0) &#x2014;
Total number of training epochs to perform (if not an integer, will perform the decimal part percents
of the last epoch before stopping training).`,name:"num_epochs(float,"},{anchor:"transformers.TrainingArguments.set_lr_scheduler.max_steps",description:`<strong>max_steps</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
If set to a positive number, the total number of training steps to perform. Overrides
<code>num_train_epochs</code>. In case of using a finite iterable dataset the training may stop before reaching
the set number of steps when all data is exhausted.`,name:"max_steps"},{anchor:"transformers.TrainingArguments.set_lr_scheduler.warmup_ratio",description:`<strong>warmup_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Ratio of total training steps used for a linear warmup from 0 to <code>learning_rate</code>.`,name:"warmup_ratio"},{anchor:"transformers.TrainingArguments.set_lr_scheduler.warmup_steps",description:`<strong>warmup_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of steps used for a linear warmup from 0 to <code>learning_rate</code>. Overrides any effect of
<code>warmup_ratio</code>.`,name:"warmup_steps"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L2329"}}),oa=new xo({props:{anchor:"transformers.TrainingArguments.set_lr_scheduler.example",$$slots:{default:[dY]},$$scope:{ctx:C}}}),ai=new D({props:{name:"set_optimizer",anchor:"transformers.TrainingArguments.set_optimizer",parameters:[{name:"name",val:": typing.Union[str, transformers.training_args.OptimizerNames] = 'adamw_hf'"},{name:"learning_rate",val:": float = 5e-05"},{name:"weight_decay",val:": float = 0"},{name:"beta1",val:": float = 0.9"},{name:"beta2",val:": float = 0.999"},{name:"epsilon",val:": float = 1e-08"},{name:"args",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_optimizer.name",description:`<strong>name</strong> (<code>str</code> or <code>training_args.OptimizerNames</code>, <em>optional</em>, defaults to <code>&quot;adamw_hf&quot;</code>) &#x2014;
The optimizer to use: <code>&quot;adamw_hf&quot;</code>, <code>&quot;adamw_torch&quot;</code>, <code>&quot;adamw_torch_fused&quot;</code>, <code>&quot;adamw_apex_fused&quot;</code>,
<code>&quot;adamw_anyprecision&quot;</code> or <code>&quot;adafactor&quot;</code>.`,name:"name"},{anchor:"transformers.TrainingArguments.set_optimizer.learning_rate",description:`<strong>learning_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 5e-5) &#x2014;
The initial learning rate.`,name:"learning_rate"},{anchor:"transformers.TrainingArguments.set_optimizer.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights.`,name:"weight_decay"},{anchor:"transformers.TrainingArguments.set_optimizer.beta1",description:`<strong>beta1</strong> (<code>float</code>, <em>optional</em>, defaults to 0.9) &#x2014;
The beta1 hyperparameter for the adam optimizer or its variants.`,name:"beta1"},{anchor:"transformers.TrainingArguments.set_optimizer.beta2",description:`<strong>beta2</strong> (<code>float</code>, <em>optional</em>, defaults to 0.999) &#x2014;
The beta2 hyperparameter for the adam optimizer or its variants.`,name:"beta2"},{anchor:"transformers.TrainingArguments.set_optimizer.epsilon",description:`<strong>epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-8) &#x2014;
The epsilon hyperparameter for the adam optimizer or its variants.`,name:"epsilon"},{anchor:"transformers.TrainingArguments.set_optimizer.args",description:`<strong>args</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional arguments that are supplied to AnyPrecisionAdamW (only useful when
<code>optim=&quot;adamw_anyprecision&quot;</code>).`,name:"args"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L2278"}}),ra=new xo({props:{anchor:"transformers.TrainingArguments.set_optimizer.example",$$slots:{default:[cY]},$$scope:{ctx:C}}}),ni=new D({props:{name:"set_push_to_hub",anchor:"transformers.TrainingArguments.set_push_to_hub",parameters:[{name:"model_id",val:": str"},{name:"strategy",val:": typing.Union[str, transformers.trainer_utils.HubStrategy] = 'every_save'"},{name:"token",val:": typing.Optional[str] = None"},{name:"private_repo",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_push_to_hub.model_id",description:`<strong>model_id</strong> (<code>str</code>) &#x2014;
The name of the repository to keep in sync with the local <em>output_dir</em>. It can be a simple model ID in
which case the model will be pushed in your namespace. Otherwise it should be the whole repository
name, for instance <code>&quot;user_name/model&quot;</code>, which allows you to push to an organization you are a member of
with <code>&quot;organization_name/model&quot;</code>.`,name:"model_id"},{anchor:"transformers.TrainingArguments.set_push_to_hub.strategy",description:`<strong>strategy</strong> (<code>str</code> or <code>HubStrategy</code>, <em>optional</em>, defaults to <code>&quot;every_save&quot;</code>) &#x2014;
Defines the scope of what is pushed to the Hub and when. Possible values are:</p>
<ul>
<li><code>&quot;end&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> method is called.</li>
<li><code>&quot;every_save&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>)
and
a draft of a model card each time there is a model save. The pushes are asynchronous to not block
training, and in case the save are very frequent, a new push is only attempted if the previous one is
finished. A last push is made with the final model at the end of training.</li>
<li><code>&quot;checkpoint&quot;</code>: like <code>&quot;every_save&quot;</code> but the latest checkpoint is also pushed in a subfolder named
last-checkpoint, allowing you to resume training easily with
<code>trainer.train(resume_from_checkpoint=&quot;last-checkpoint&quot;)</code>.</li>
<li><code>&quot;all_checkpoints&quot;</code>: like <code>&quot;checkpoint&quot;</code> but all checkpoints are pushed like they appear in the
output
folder (so you will get one checkpoint folder per folder in your final repository)</li>
</ul>`,name:"strategy"},{anchor:"transformers.TrainingArguments.set_push_to_hub.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained
with <code>huggingface-cli login</code>.`,name:"token"},{anchor:"transformers.TrainingArguments.set_push_to_hub.private_repo",description:`<strong>private_repo</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, the Hub repo will be set to private.`,name:"private_repo"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L2213"}}),aa=new $r({props:{$$slots:{default:[pY]},$$scope:{ctx:C}}}),na=new xo({props:{anchor:"transformers.TrainingArguments.set_push_to_hub.example",$$slots:{default:[mY]},$$scope:{ctx:C}}}),si=new D({props:{name:"set_save",anchor:"transformers.TrainingArguments.set_save",parameters:[{name:"strategy",val:": typing.Union[str, transformers.trainer_utils.IntervalStrategy] = 'steps'"},{name:"steps",val:": int = 500"},{name:"total_limit",val:": typing.Optional[int] = None"},{name:"on_each_node",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_save.strategy",description:`<strong>strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The checkpoint save strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No save is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Save is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Save is done every <code>save_steps</code>.</li>
</ul>`,name:"strategy"},{anchor:"transformers.TrainingArguments.set_save.steps",description:`<strong>steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of updates steps before two checkpoint saves if <code>strategy=&quot;steps&quot;</code>.`,name:"steps"},{anchor:"transformers.TrainingArguments.set_save.total_limit",description:`<strong>total_limit</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in
<code>output_dir</code>.`,name:"total_limit"},{anchor:"transformers.TrainingArguments.set_save.on_each_node",description:`<strong>on_each_node</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When doing multi-node distributed training, whether to save models and checkpoints on each node, or
only on the main one.</p>
<p>This should not be activated when the different nodes use the same storage as the files will be saved
with the same names for each node.`,name:"on_each_node"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L2090"}}),sa=new xo({props:{anchor:"transformers.TrainingArguments.set_save.example",$$slots:{default:[hY]},$$scope:{ctx:C}}}),ii=new D({props:{name:"set_testing",anchor:"transformers.TrainingArguments.set_testing",parameters:[{name:"batch_size",val:": int = 8"},{name:"loss_only",val:": bool = False"},{name:"jit_mode",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_testing.batch_size",description:`<strong>batch_size</strong> (<code>int</code> <em>optional</em>, defaults to 8) &#x2014;
The batch size per device (GPU/TPU core/CPU&#x2026;) used for testing.`,name:"batch_size"},{anchor:"transformers.TrainingArguments.set_testing.loss_only",description:`<strong>loss_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Ignores all outputs except the loss.`,name:"loss_only"},{anchor:"transformers.TrainingArguments.set_testing.jit_mode",description:`<strong>jit_mode</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use PyTorch jit trace for inference.`,name:"jit_mode"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L2050"}}),ia=new $r({props:{$$slots:{default:[uY]},$$scope:{ctx:C}}}),la=new xo({props:{anchor:"transformers.TrainingArguments.set_testing.example",$$slots:{default:[fY]},$$scope:{ctx:C}}}),li=new D({props:{name:"set_training",anchor:"transformers.TrainingArguments.set_training",parameters:[{name:"learning_rate",val:": float = 5e-05"},{name:"batch_size",val:": int = 8"},{name:"weight_decay",val:": float = 0"},{name:"num_epochs",val:": float = 3"},{name:"max_steps",val:": int = -1"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"seed",val:": int = 42"},{name:"gradient_checkpointing",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_training.learning_rate",description:`<strong>learning_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 5e-5) &#x2014;
The initial learning rate for the optimizer.`,name:"learning_rate"},{anchor:"transformers.TrainingArguments.set_training.batch_size",description:`<strong>batch_size</strong> (<code>int</code> <em>optional</em>, defaults to 8) &#x2014;
The batch size per device (GPU/TPU core/CPU&#x2026;) used for training.`,name:"batch_size"},{anchor:"transformers.TrainingArguments.set_training.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights in the
optimizer.`,name:"weight_decay"},{anchor:"transformers.TrainingArguments.set_training.num_train_epochs(float,",description:`<strong>num_train_epochs(<code>float</code>,</strong> <em>optional</em>, defaults to 3.0) &#x2014;
Total number of training epochs to perform (if not an integer, will perform the decimal part percents
of the last epoch before stopping training).`,name:"num_train_epochs(float,"},{anchor:"transformers.TrainingArguments.set_training.max_steps",description:`<strong>max_steps</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
If set to a positive number, the total number of training steps to perform. Overrides
<code>num_train_epochs</code>. In case of using a finite iterable dataset the training may stop before reaching
the set number of steps when all data is exhausted.`,name:"max_steps"},{anchor:"transformers.TrainingArguments.set_training.gradient_accumulation_steps",description:`<strong>gradient_accumulation_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of updates steps to accumulate the gradients for, before performing a backward/update pass.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>When using gradient accumulation, one step is counted as one step with backward pass. Therefore,
logging, evaluation, save will be conducted every <code>gradient_accumulation_steps * xxx_step</code> training
examples.</p>

					</div>`,name:"gradient_accumulation_steps"},{anchor:"transformers.TrainingArguments.set_training.seed",description:`<strong>seed</strong> (<code>int</code>, <em>optional</em>, defaults to 42) &#x2014;
Random seed that will be set at the beginning of training. To ensure reproducibility across runs, use
the <code>~Trainer.model_init</code> function to instantiate the model if it has some randomly initialized
parameters.`,name:"seed"},{anchor:"transformers.TrainingArguments.set_training.gradient_checkpointing",description:`<strong>gradient_checkpointing</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, use gradient checkpointing to save memory at the expense of slower backward pass.`,name:"gradient_checkpointing"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L1914"}}),da=new $r({props:{$$slots:{default:[gY]},$$scope:{ctx:C}}}),ca=new xo({props:{anchor:"transformers.TrainingArguments.set_training.example",$$slots:{default:[_Y]},$$scope:{ctx:C}}}),di=new D({props:{name:"to_dict",anchor:"transformers.TrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L1877"}}),pi=new D({props:{name:"to_json_string",anchor:"transformers.TrainingArguments.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L1894"}}),mi=new D({props:{name:"to_sanitized_dict",anchor:"transformers.TrainingArguments.to_sanitized_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args.py#L1900"}}),hi=new te({}),ui=new D({props:{name:"class transformers.Seq2SeqTrainingArguments",anchor:"transformers.Seq2SeqTrainingArguments",parameters:[{name:"output_dir",val:": str"},{name:"overwrite_output_dir",val:": bool = False"},{name:"do_train",val:": bool = False"},{name:"do_eval",val:": bool = False"},{name:"do_predict",val:": bool = False"},{name:"evaluation_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'no'"},{name:"prediction_loss_only",val:": bool = False"},{name:"per_device_train_batch_size",val:": int = 8"},{name:"per_device_eval_batch_size",val:": int = 8"},{name:"per_gpu_train_batch_size",val:": typing.Optional[int] = None"},{name:"per_gpu_eval_batch_size",val:": typing.Optional[int] = None"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"eval_accumulation_steps",val:": typing.Optional[int] = None"},{name:"eval_delay",val:": typing.Optional[float] = 0"},{name:"learning_rate",val:": float = 5e-05"},{name:"weight_decay",val:": float = 0.0"},{name:"adam_beta1",val:": float = 0.9"},{name:"adam_beta2",val:": float = 0.999"},{name:"adam_epsilon",val:": float = 1e-08"},{name:"max_grad_norm",val:": float = 1.0"},{name:"num_train_epochs",val:": float = 3.0"},{name:"max_steps",val:": int = -1"},{name:"lr_scheduler_type",val:": typing.Union[transformers.trainer_utils.SchedulerType, str] = 'linear'"},{name:"warmup_ratio",val:": float = 0.0"},{name:"warmup_steps",val:": int = 0"},{name:"log_level",val:": typing.Optional[str] = 'passive'"},{name:"log_level_replica",val:": typing.Optional[str] = 'warning'"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_dir",val:": typing.Optional[str] = None"},{name:"logging_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"logging_first_step",val:": bool = False"},{name:"logging_steps",val:": int = 500"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"save_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"save_steps",val:": int = 500"},{name:"save_total_limit",val:": typing.Optional[int] = None"},{name:"save_on_each_node",val:": bool = False"},{name:"no_cuda",val:": bool = False"},{name:"use_mps_device",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": typing.Optional[int] = None"},{name:"jit_mode_eval",val:": bool = False"},{name:"use_ipex",val:": bool = False"},{name:"bf16",val:": bool = False"},{name:"fp16",val:": bool = False"},{name:"fp16_opt_level",val:": str = 'O1'"},{name:"half_precision_backend",val:": str = 'auto'"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": typing.Optional[bool] = None"},{name:"local_rank",val:": int = -1"},{name:"xpu_backend",val:": typing.Optional[str] = None"},{name:"tpu_num_cores",val:": typing.Optional[int] = None"},{name:"tpu_metrics_debug",val:": bool = False"},{name:"debug",val:": str = ''"},{name:"dataloader_drop_last",val:": bool = False"},{name:"eval_steps",val:": typing.Optional[int] = None"},{name:"dataloader_num_workers",val:": int = 0"},{name:"past_index",val:": int = -1"},{name:"run_name",val:": typing.Optional[str] = None"},{name:"disable_tqdm",val:": typing.Optional[bool] = None"},{name:"remove_unused_columns",val:": typing.Optional[bool] = True"},{name:"label_names",val:": typing.Optional[typing.List[str]] = None"},{name:"load_best_model_at_end",val:": typing.Optional[bool] = False"},{name:"metric_for_best_model",val:": typing.Optional[str] = None"},{name:"greater_is_better",val:": typing.Optional[bool] = None"},{name:"ignore_data_skip",val:": bool = False"},{name:"sharded_ddp",val:": str = ''"},{name:"fsdp",val:": str = ''"},{name:"fsdp_min_num_params",val:": int = 0"},{name:"fsdp_config",val:": typing.Optional[str] = None"},{name:"fsdp_transformer_layer_cls_to_wrap",val:": typing.Optional[str] = None"},{name:"deepspeed",val:": typing.Optional[str] = None"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"optim",val:": typing.Union[transformers.training_args.OptimizerNames, str] = 'adamw_hf'"},{name:"optim_args",val:": typing.Optional[str] = None"},{name:"adafactor",val:": bool = False"},{name:"group_by_length",val:": bool = False"},{name:"length_column_name",val:": typing.Optional[str] = 'length'"},{name:"report_to",val:": typing.Optional[typing.List[str]] = None"},{name:"ddp_find_unused_parameters",val:": typing.Optional[bool] = None"},{name:"ddp_bucket_cap_mb",val:": typing.Optional[int] = None"},{name:"dataloader_pin_memory",val:": bool = True"},{name:"skip_memory_metrics",val:": bool = True"},{name:"use_legacy_prediction_loop",val:": bool = False"},{name:"push_to_hub",val:": bool = False"},{name:"resume_from_checkpoint",val:": typing.Optional[str] = None"},{name:"hub_model_id",val:": typing.Optional[str] = None"},{name:"hub_strategy",val:": typing.Union[transformers.trainer_utils.HubStrategy, str] = 'every_save'"},{name:"hub_token",val:": typing.Optional[str] = None"},{name:"hub_private_repo",val:": bool = False"},{name:"gradient_checkpointing",val:": bool = False"},{name:"include_inputs_for_metrics",val:": bool = False"},{name:"fp16_backend",val:": str = 'auto'"},{name:"push_to_hub_model_id",val:": typing.Optional[str] = None"},{name:"push_to_hub_organization",val:": typing.Optional[str] = None"},{name:"push_to_hub_token",val:": typing.Optional[str] = None"},{name:"mp_parameters",val:": str = ''"},{name:"auto_find_batch_size",val:": bool = False"},{name:"full_determinism",val:": bool = False"},{name:"torchdynamo",val:": typing.Optional[str] = None"},{name:"ray_scope",val:": typing.Optional[str] = 'last'"},{name:"ddp_timeout",val:": typing.Optional[int] = 1800"},{name:"torch_compile",val:": bool = False"},{name:"torch_compile_backend",val:": typing.Optional[str] = None"},{name:"torch_compile_mode",val:": typing.Optional[str] = None"},{name:"sortish_sampler",val:": bool = False"},{name:"predict_with_generate",val:": bool = False"},{name:"generation_max_length",val:": typing.Optional[int] = None"},{name:"generation_num_beams",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainingArguments.output_dir",description:`<strong>output_dir</strong> (<code>str</code>) &#x2014;
The output directory where the model predictions and checkpoints will be written.`,name:"output_dir"},{anchor:"transformers.Seq2SeqTrainingArguments.overwrite_output_dir",description:`<strong>overwrite_output_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, overwrite the content of the output directory. Use this to continue training if <code>output_dir</code>
points to a checkpoint directory.`,name:"overwrite_output_dir"},{anchor:"transformers.Seq2SeqTrainingArguments.do_train",description:`<strong>do_train</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run training or not. This argument is not directly used by <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used
by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_train"},{anchor:"transformers.Seq2SeqTrainingArguments.do_eval",description:`<strong>do_eval</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to run evaluation on the validation set or not. Will be set to <code>True</code> if <code>evaluation_strategy</code> is
different from <code>&quot;no&quot;</code>. This argument is not directly used by <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your
training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.do_predict",description:`<strong>do_predict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run predictions on the test set or not. This argument is not directly used by <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s
intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_predict"},{anchor:"transformers.Seq2SeqTrainingArguments.evaluation_strategy",description:`<strong>evaluation_strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;no&quot;</code>) &#x2014;
The evaluation strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No evaluation is done during training.</li>
<li><code>&quot;steps&quot;</code>: Evaluation is done (and logged) every <code>eval_steps</code>.</li>
<li><code>&quot;epoch&quot;</code>: Evaluation is done at the end of each epoch.</li>
</ul>`,name:"evaluation_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.prediction_loss_only",description:`<strong>prediction_loss_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When performing evaluation and generating predictions, only returns the loss.`,name:"prediction_loss_only"},{anchor:"transformers.Seq2SeqTrainingArguments.per_device_train_batch_size",description:`<strong>per_device_train_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for training.`,name:"per_device_train_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.per_device_eval_batch_size",description:`<strong>per_device_eval_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for evaluation.`,name:"per_device_eval_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.gradient_accumulation_steps",description:`<strong>gradient_accumulation_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of updates steps to accumulate the gradients for, before performing a backward/update pass.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>When using gradient accumulation, one step is counted as one step with backward pass. Therefore, logging,
evaluation, save will be conducted every <code>gradient_accumulation_steps * xxx_step</code> training examples.</p>

					</div>`,name:"gradient_accumulation_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.eval_accumulation_steps",description:`<strong>eval_accumulation_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If
left unset, the whole predictions are accumulated on GPU/TPU before being moved to the CPU (faster but
requires more memory).`,name:"eval_accumulation_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.eval_delay",description:`<strong>eval_delay</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Number of epochs or steps to wait for before the first evaluation can be performed, depending on the
evaluation_strategy.`,name:"eval_delay"},{anchor:"transformers.Seq2SeqTrainingArguments.learning_rate",description:`<strong>learning_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 5e-5) &#x2014;
The initial learning rate for <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"learning_rate"},{anchor:"transformers.Seq2SeqTrainingArguments.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights in <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a>
optimizer.`,name:"weight_decay"},{anchor:"transformers.Seq2SeqTrainingArguments.adam_beta1",description:`<strong>adam_beta1</strong> (<code>float</code>, <em>optional</em>, defaults to 0.9) &#x2014;
The beta1 hyperparameter for the <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_beta1"},{anchor:"transformers.Seq2SeqTrainingArguments.adam_beta2",description:`<strong>adam_beta2</strong> (<code>float</code>, <em>optional</em>, defaults to 0.999) &#x2014;
The beta2 hyperparameter for the <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_beta2"},{anchor:"transformers.Seq2SeqTrainingArguments.adam_epsilon",description:`<strong>adam_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-8) &#x2014;
The epsilon hyperparameter for the <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_epsilon"},{anchor:"transformers.Seq2SeqTrainingArguments.max_grad_norm",description:`<strong>max_grad_norm</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Maximum gradient norm (for gradient clipping).`,name:"max_grad_norm"},{anchor:"transformers.Seq2SeqTrainingArguments.num_train_epochs(float,",description:`<strong>num_train_epochs(<code>float</code>,</strong> <em>optional</em>, defaults to 3.0) &#x2014;
Total number of training epochs to perform (if not an integer, will perform the decimal part percents of
the last epoch before stopping training).`,name:"num_train_epochs(float,"},{anchor:"transformers.Seq2SeqTrainingArguments.max_steps",description:`<strong>max_steps</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
If set to a positive number, the total number of training steps to perform. Overrides <code>num_train_epochs</code>.
In case of using a finite iterable dataset the training may stop before reaching the set number of steps
when all data is exhausted`,name:"max_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.lr_scheduler_type",description:`<strong>lr_scheduler_type</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.SchedulerType">SchedulerType</a>, <em>optional</em>, defaults to <code>&quot;linear&quot;</code>) &#x2014;
The scheduler type to use. See the documentation of <a href="/docs/transformers/v4.27.1/en/main_classes/optimizer_schedules#transformers.SchedulerType">SchedulerType</a> for all possible values.`,name:"lr_scheduler_type"},{anchor:"transformers.Seq2SeqTrainingArguments.warmup_ratio",description:`<strong>warmup_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Ratio of total training steps used for a linear warmup from 0 to <code>learning_rate</code>.`,name:"warmup_ratio"},{anchor:"transformers.Seq2SeqTrainingArguments.warmup_steps",description:`<strong>warmup_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of steps used for a linear warmup from 0 to <code>learning_rate</code>. Overrides any effect of <code>warmup_ratio</code>.`,name:"warmup_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.log_level",description:`<strong>log_level</strong> (<code>str</code>, <em>optional</em>, defaults to <code>passive</code>) &#x2014;
Logger log level to use on the main process. Possible choices are the log levels as strings: &#x2018;debug&#x2019;,
&#x2018;info&#x2019;, &#x2018;warning&#x2019;, &#x2018;error&#x2019; and &#x2018;critical&#x2019;, plus a &#x2018;passive&#x2019; level which doesn&#x2019;t set anything and keeps the
current log level for the Transformers library (which will be <code>&quot;warning&quot;</code> by default).`,name:"log_level"},{anchor:"transformers.Seq2SeqTrainingArguments.log_level_replica",description:`<strong>log_level_replica</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;warning&quot;</code>) &#x2014;
Logger log level to use on replicas. Same choices as <code>log_level</code>&#x201D;`,name:"log_level_replica"},{anchor:"transformers.Seq2SeqTrainingArguments.log_on_each_node",description:`<strong>log_on_each_node</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
In multinode distributed training, whether to log using <code>log_level</code> once per node, or only on the main
node.`,name:"log_on_each_node"},{anchor:"transformers.Seq2SeqTrainingArguments.logging_dir",description:`<strong>logging_dir</strong> (<code>str</code>, <em>optional</em>) &#x2014;
<a href="https://www.tensorflow.org/tensorboard" rel="nofollow">TensorBoard</a> log directory. Will default to
*output_dir/runs/<strong>CURRENT_DATETIME_HOSTNAME*</strong>.`,name:"logging_dir"},{anchor:"transformers.Seq2SeqTrainingArguments.logging_strategy",description:`<strong>logging_strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The logging strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No logging is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Logging is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Logging is done every <code>logging_steps</code>.</li>
</ul>`,name:"logging_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.logging_first_step",description:`<strong>logging_first_step</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to log and evaluate the first <code>global_step</code> or not.`,name:"logging_first_step"},{anchor:"transformers.Seq2SeqTrainingArguments.logging_steps",description:`<strong>logging_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of update steps between two logs if <code>logging_strategy=&quot;steps&quot;</code>.`,name:"logging_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.logging_nan_inf_filter",description:`<strong>logging_nan_inf_filter</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to filter <code>nan</code> and <code>inf</code> losses for logging. If set to <code>True</code> the loss of every step that is <code>nan</code>
or <code>inf</code> is filtered and the average loss of the current logging window is taken instead.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p><code>logging_nan_inf_filter</code> only influences the logging of loss values, it does not change the behavior the
gradient is computed or applied to the model.</p>

					</div>`,name:"logging_nan_inf_filter"},{anchor:"transformers.Seq2SeqTrainingArguments.save_strategy",description:`<strong>save_strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The checkpoint save strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No save is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Save is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Save is done every <code>save_steps</code>.</li>
</ul>`,name:"save_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.save_steps",description:`<strong>save_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of updates steps before two checkpoint saves if <code>save_strategy=&quot;steps&quot;</code>.`,name:"save_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.save_total_limit",description:`<strong>save_total_limit</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in
<code>output_dir</code>.`,name:"save_total_limit"},{anchor:"transformers.Seq2SeqTrainingArguments.save_on_each_node",description:`<strong>save_on_each_node</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When doing multi-node distributed training, whether to save models and checkpoints on each node, or only on
the main one.</p>
<p>This should not be activated when the different nodes use the same storage as the files will be saved with
the same names for each node.`,name:"save_on_each_node"},{anchor:"transformers.Seq2SeqTrainingArguments.no_cuda",description:`<strong>no_cuda</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to not use CUDA even when it is available or not.`,name:"no_cuda"},{anchor:"transformers.Seq2SeqTrainingArguments.seed",description:`<strong>seed</strong> (<code>int</code>, <em>optional</em>, defaults to 42) &#x2014;
Random seed that will be set at the beginning of training. To ensure reproducibility across runs, use the
<code>~Trainer.model_init</code> function to instantiate the model if it has some randomly initialized parameters.`,name:"seed"},{anchor:"transformers.Seq2SeqTrainingArguments.data_seed",description:`<strong>data_seed</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Random seed to be used with data samplers. If not set, random generators for data sampling will use the
same seed as <code>seed</code>. This can be used to ensure reproducibility of data sampling, independent of the model
seed.`,name:"data_seed"},{anchor:"transformers.Seq2SeqTrainingArguments.jit_mode_eval",description:`<strong>jit_mode_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use PyTorch jit trace for inference.`,name:"jit_mode_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.use_ipex",description:`<strong>use_ipex</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Intel extension for PyTorch when it is available. <a href="https://github.com/intel/intel-extension-for-pytorch" rel="nofollow">IPEX
installation</a>.`,name:"use_ipex"},{anchor:"transformers.Seq2SeqTrainingArguments.bf16",description:`<strong>bf16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use bf16 16-bit (mixed) precision training instead of 32-bit training. Requires Ampere or higher
NVIDIA architecture or using CPU (no_cuda). This is an experimental API and it may change.`,name:"bf16"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16",description:`<strong>fp16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use fp16 16-bit (mixed) precision training instead of 32-bit training.`,name:"fp16"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16_opt_level",description:`<strong>fp16_opt_level</strong> (<code>str</code>, <em>optional</em>, defaults to &#x2018;O1&#x2019;) &#x2014;
For <code>fp16</code> training, Apex AMP optimization level selected in [&#x2018;O0&#x2019;, &#x2018;O1&#x2019;, &#x2018;O2&#x2019;, and &#x2018;O3&#x2019;]. See details on
the <a href="https://nvidia.github.io/apex/amp" rel="nofollow">Apex documentation</a>.`,name:"fp16_opt_level"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16_backend",description:`<strong>fp16_backend</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
This argument is deprecated. Use <code>half_precision_backend</code> instead.`,name:"fp16_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.half_precision_backend",description:`<strong>half_precision_backend</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
The backend to use for mixed precision training. Must be one of <code>&quot;auto&quot;, &quot;cuda_amp&quot;, &quot;apex&quot;, &quot;cpu_amp&quot;</code>.
<code>&quot;auto&quot;</code> will use CPU/CUDA AMP or APEX depending on the PyTorch version detected, while the other choices
will force the requested backend.`,name:"half_precision_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.bf16_full_eval",description:`<strong>bf16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full bfloat16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values. This is an experimental API and it may change.`,name:"bf16_full_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16_full_eval",description:`<strong>fp16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full float16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values.`,name:"fp16_full_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.tf32",description:`<strong>tf32</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to enable the TF32 mode, available in Ampere and newer GPU architectures. The default value depends
on PyTorch&#x2019;s version default of <code>torch.backends.cuda.matmul.allow_tf32</code>. For more details please refer to
the <a href="https://huggingface.co/docs/transformers/performance#tf32" rel="nofollow">TF32</a> documentation. This is an
experimental API and it may change.`,name:"tf32"},{anchor:"transformers.Seq2SeqTrainingArguments.local_rank",description:`<strong>local_rank</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Rank of the process during distributed training.`,name:"local_rank"},{anchor:"transformers.Seq2SeqTrainingArguments.xpu_backend",description:`<strong>xpu_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use for xpu distributed training. Must be one of <code>&quot;mpi&quot;</code> or <code>&quot;ccl&quot;</code> or <code>&quot;gloo&quot;</code>.`,name:"xpu_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.tpu_num_cores",description:`<strong>tpu_num_cores</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When training on TPU, the number of TPU cores (automatically passed by launcher script).`,name:"tpu_num_cores"},{anchor:"transformers.Seq2SeqTrainingArguments.dataloader_drop_last",description:`<strong>dataloader_drop_last</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch size)
or not.`,name:"dataloader_drop_last"},{anchor:"transformers.Seq2SeqTrainingArguments.eval_steps",description:`<strong>eval_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of update steps between two evaluations if <code>evaluation_strategy=&quot;steps&quot;</code>. Will default to the same
value as <code>logging_steps</code> if not set.`,name:"eval_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.dataloader_num_workers",description:`<strong>dataloader_num_workers</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in the
main process.`,name:"dataloader_num_workers"},{anchor:"transformers.Seq2SeqTrainingArguments.past_index",description:`<strong>past_index</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Some models like <a href="../model_doc/transformerxl">TransformerXL</a> or <a href="../model_doc/xlnet">XLNet</a> can make use of
the past hidden states for their predictions. If this argument is set to a positive int, the <code>Trainer</code> will
use the corresponding output (usually index 2) as the past state and feed it to the model at the next
training step under the keyword argument <code>mems</code>.`,name:"past_index"},{anchor:"transformers.Seq2SeqTrainingArguments.run_name",description:`<strong>run_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
A descriptor for the run. Typically used for <a href="https://www.wandb.com/" rel="nofollow">wandb</a> and
<a href="https://www.mlflow.org/" rel="nofollow">mlflow</a> logging.`,name:"run_name"},{anchor:"transformers.Seq2SeqTrainingArguments.disable_tqdm",description:`<strong>disable_tqdm</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to disable the tqdm progress bars and table of metrics produced by
<code>~notebook.NotebookTrainingTracker</code> in Jupyter Notebooks. Will default to <code>True</code> if the logging level is
set to warn or lower (default), <code>False</code> otherwise.`,name:"disable_tqdm"},{anchor:"transformers.Seq2SeqTrainingArguments.remove_unused_columns",description:`<strong>remove_unused_columns</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to automatically remove the columns unused by the model forward method.</p>
<p>(Note that this behavior is not implemented for <code>TFTrainer</code> yet.)`,name:"remove_unused_columns"},{anchor:"transformers.Seq2SeqTrainingArguments.label_names",description:`<strong>label_names</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
The list of keys in your dictionary of inputs that correspond to the labels.</p>
<p>Will eventually default to the list of argument names accepted by the model that contain the word &#x201C;label&#x201D;,
except if the model used is one of the <code>XxxForQuestionAnswering</code> in which case it will also include the
<code>[&quot;start_positions&quot;, &quot;end_positions&quot;]</code> keys.`,name:"label_names"},{anchor:"transformers.Seq2SeqTrainingArguments.load_best_model_at_end",description:`<strong>load_best_model_at_end</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to load the best model found during training at the end of training.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When set to <code>True</code>, the parameters <code>save_strategy</code> needs to be the same as <code>evaluation_strategy</code>, and in
the case it is &#x201C;steps&#x201D;, <code>save_steps</code> must be a round multiple of <code>eval_steps</code>.</p>

					</div>`,name:"load_best_model_at_end"},{anchor:"transformers.Seq2SeqTrainingArguments.metric_for_best_model",description:`<strong>metric_for_best_model</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> to specify the metric to use to compare two different
models. Must be the name of a metric returned by the evaluation with or without the prefix <code>&quot;eval_&quot;</code>. Will
default to <code>&quot;loss&quot;</code> if unspecified and <code>load_best_model_at_end=True</code> (to use the evaluation loss).</p>
<p>If you set this value, <code>greater_is_better</code> will default to <code>True</code>. Don&#x2019;t forget to set it to <code>False</code> if
your metric is better when lower.`,name:"metric_for_best_model"},{anchor:"transformers.Seq2SeqTrainingArguments.greater_is_better",description:`<strong>greater_is_better</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> and <code>metric_for_best_model</code> to specify if better models
should have a greater metric or not. Will default to:</p>
<ul>
<li><code>True</code> if <code>metric_for_best_model</code> is set to a value that isn&#x2019;t <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
<li><code>False</code> if <code>metric_for_best_model</code> is not set, or set to <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
</ul>`,name:"greater_is_better"},{anchor:"transformers.Seq2SeqTrainingArguments.ignore_data_skip",description:`<strong>ignore_data_skip</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When resuming training, whether or not to skip the epochs and batches to get the data loading at the same
stage as in the previous training. If set to <code>True</code>, the training will begin faster (as that skipping step
can take a long time) but will not yield the same results as the interrupted training would have.`,name:"ignore_data_skip"},{anchor:"transformers.Seq2SeqTrainingArguments.sharded_ddp",description:`<strong>sharded_ddp</strong> (<code>bool</code>, <code>str</code> or list of <code>ShardedDDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Sharded DDP training from <a href="https://github.com/facebookresearch/fairscale" rel="nofollow">FairScale</a> (in distributed
training only). This is an experimental feature.</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;simple&quot;</code>: to use first instance of sharded DDP released by fairscale (<code>ShardedDDP</code>) similar to ZeRO-2.</li>
<li><code>&quot;zero_dp_2&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-2 mode (with <code>reshard_after_forward=False</code>).</li>
<li><code>&quot;zero_dp_3&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-3 mode (with <code>reshard_after_forward=True</code>).</li>
<li><code>&quot;offload&quot;</code>: to add ZeRO-offload (only compatible with <code>&quot;zero_dp_2&quot;</code> and <code>&quot;zero_dp_3&quot;</code>).</li>
</ul>
<p>If a string is passed, it will be split on space. If a bool is passed, it will be converted to an empty
list for <code>False</code> and <code>[&quot;simple&quot;]</code> for <code>True</code>.`,name:"sharded_ddp"},{anchor:"transformers.Seq2SeqTrainingArguments.fsdp",description:`<strong>fsdp</strong> (<code>bool</code>, <code>str</code> or list of <code>FSDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use PyTorch Distributed Parallel Training (in distributed training only).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;full_shard&quot;</code>: Shard parameters, gradients and optimizer states.</li>
<li><code>&quot;shard_grad_op&quot;</code>: Shard optimizer states and gradients.</li>
<li><code>&quot;offload&quot;</code>: Offload parameters and gradients to CPUs (only compatible with <code>&quot;full_shard&quot;</code> and
<code>&quot;shard_grad_op&quot;</code>).</li>
<li><code>&quot;auto_wrap&quot;</code>: Automatically recursively wrap layers with FSDP using <code>default_auto_wrap_policy</code>.</li>
</ul>`,name:"fsdp"},{anchor:"transformers.Seq2SeqTrainingArguments.fsdp_config",description:`<strong>fsdp_config</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
Config to be used with fsdp (Pytorch Distributed Parallel Training). The value is either a location of
deepspeed json config file (e.g., <code>ds_config.json</code>) or an already loaded json file as <code>dict</code>.</p>
<p>A List of config and its options:</p>
<ul>
<li>
<p>fsdp_min_num_params (<code>int</code>, <em>optional</em>, defaults to <code>0</code>):
FSDP&#x2019;s minimum number of parameters for Default Auto Wrapping. (useful only when <code>fsdp</code> field is
passed).</p>
</li>
<li>
<p>fsdp_transformer_layer_cls_to_wrap (<code>List[str]</code>, <em>optional</em>):
List of transformer layer class names (case-sensitive) to wrap, e.g, <code>BertLayer</code>, <code>GPTJBlock</code>,
<code>T5Block</code> &#x2026; (useful only when <code>fsdp</code> flag is passed).</p>
</li>
<li>
<p>fsdp_backward_prefetch (<code>str</code>, <em>optional</em>)
FSDP&#x2019;s backward prefetch mode. Controls when to prefetch next set of parameters (useful only when
<code>fsdp</code> field is passed).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;backward_pre&quot;</code> : Prefetches the next set of parameters before the current set of parameter&#x2019;s
gradient
computation.</li>
<li><code>&quot;backward_pos&quot;</code> : This prefetches the next set of parameters after the current set of
parameter&#x2019;s
gradient computation.</li>
</ul>
</li>
<li>
<p>fsdp_forward_prefetch (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
FSDP&#x2019;s forward prefetch mode (useful only when <code>fsdp</code> field is passed).
If <code>&quot;True&quot;</code>, then FSDP explicitly prefetches the next upcoming all-gather while executing in the
forward pass.</p>
</li>
<li>
<p>limit_all_gathers (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
FSDP&#x2019;s limit_all_gathers (useful only when <code>fsdp</code> field is passed).
If <code>&quot;True&quot;</code>, FSDP explicitly synchronizes the CPU thread to prevent too many in-flight
all-gathers.</p>
</li>
<li>
<p>xla (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether to use PyTorch/XLA Fully Sharded Data Parallel Training. This is an experimental feature
and its API may evolve in the future.</p>
</li>
<li>
<p>xla_fsdp_settings (<code>dict</code>, <em>optional</em>)
The value is a dictionary which stores the XLA FSDP wrapping parameters.</p>
<p>For a complete list of options, please see <a href="https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py" rel="nofollow">here</a>.</p>
</li>
<li>
<p>xla_fsdp_grad_ckpt (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Will use gradient checkpointing over each nested XLA FSDP wrapped layer. This setting can only be
used when the xla flag is set to true, and an auto wrapping policy is specified through
fsdp_min_num_params or fsdp_transformer_layer_cls_to_wrap.</p>
</li>
</ul>`,name:"fsdp_config"},{anchor:"transformers.Seq2SeqTrainingArguments.deepspeed",description:`<strong>deepspeed</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
Use <a href="https://github.com/microsoft/deepspeed" rel="nofollow">Deepspeed</a>. This is an experimental feature and its API may
evolve in the future. The value is either the location of DeepSpeed json config file (e.g.,
<code>ds_config.json</code>) or an already loaded json file as a <code>dict</code>&#x201D;`,name:"deepspeed"},{anchor:"transformers.Seq2SeqTrainingArguments.label_smoothing_factor",description:`<strong>label_smoothing_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The label smoothing factor to use. Zero means no label smoothing, otherwise the underlying onehot-encoded
labels are changed from 0s and 1s to <code>label_smoothing_factor/num_labels</code> and <code>1 - label_smoothing_factor + label_smoothing_factor/num_labels</code> respectively.`,name:"label_smoothing_factor"},{anchor:"transformers.Seq2SeqTrainingArguments.debug",description:`<strong>debug</strong> (<code>str</code> or list of <code>DebugOption</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
Enable one or more debug features. This is an experimental feature.</p>
<p>Possible options are:</p>
<ul>
<li><code>&quot;underflow_overflow&quot;</code>: detects overflow in model&#x2019;s input/outputs and reports the last frames that led to
the event</li>
<li><code>&quot;tpu_metrics_debug&quot;</code>: print debug metrics on TPU</li>
</ul>
<p>The options should be separated by whitespaces.`,name:"debug"},{anchor:"transformers.Seq2SeqTrainingArguments.optim",description:`<strong>optim</strong> (<code>str</code> or <code>training_args.OptimizerNames</code>, <em>optional</em>, defaults to <code>&quot;adamw_hf&quot;</code>) &#x2014;
The optimizer to use: adamw_hf, adamw_torch, adamw_torch_fused, adamw_apex_fused, adamw_anyprecision or
adafactor.`,name:"optim"},{anchor:"transformers.Seq2SeqTrainingArguments.optim_args",description:`<strong>optim_args</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional arguments that are supplied to AnyPrecisionAdamW.`,name:"optim_args"},{anchor:"transformers.Seq2SeqTrainingArguments.group_by_length",description:`<strong>group_by_length</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to group together samples of roughly the same length in the training dataset (to minimize
padding applied and be more efficient). Only useful if applying dynamic padding.`,name:"group_by_length"},{anchor:"transformers.Seq2SeqTrainingArguments.length_column_name",description:`<strong>length_column_name</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;length&quot;</code>) &#x2014;
Column name for precomputed lengths. If the column exists, grouping by length will use these values rather
than computing them on train startup. Ignored unless <code>group_by_length</code> is <code>True</code> and the dataset is an
instance of <code>Dataset</code>.`,name:"length_column_name"},{anchor:"transformers.Seq2SeqTrainingArguments.report_to",description:`<strong>report_to</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>, defaults to <code>&quot;all&quot;</code>) &#x2014;
The list of integrations to report the results and logs to. Supported platforms are <code>&quot;azure_ml&quot;</code>,
<code>&quot;comet_ml&quot;</code>, <code>&quot;mlflow&quot;</code>, <code>&quot;neptune&quot;</code>, <code>&quot;tensorboard&quot;</code>,<code>&quot;clearml&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report to
all integrations installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_find_unused_parameters",description:`<strong>ddp_find_unused_parameters</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>find_unused_parameters</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_find_unused_parameters"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_bucket_cap_mb",description:`<strong>ddp_bucket_cap_mb</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>bucket_cap_mb</code> passed to <code>DistributedDataParallel</code>.`,name:"ddp_bucket_cap_mb"},{anchor:"transformers.Seq2SeqTrainingArguments.dataloader_pin_memory",description:`<strong>dataloader_pin_memory</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether you want to pin memory in data loaders or not. Will default to <code>True</code>.`,name:"dataloader_pin_memory"},{anchor:"transformers.Seq2SeqTrainingArguments.skip_memory_metrics",description:`<strong>skip_memory_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to skip adding of memory profiler reports to metrics. This is skipped by default because it slows
down the training and evaluation speed.`,name:"skip_memory_metrics"},{anchor:"transformers.Seq2SeqTrainingArguments.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push the model to the Hub every time the model is saved. If this is activated,
<code>output_dir</code> will begin a git directory synced with the repo (determined by <code>hub_model_id</code>) and the content
will be pushed each time a save is triggered (depending on your <code>save_strategy</code>). Calling
<a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> will also trigger a push.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>If <code>output_dir</code> exists, it needs to be a local clone of the repository to which the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a> will be
pushed.</p>

					</div>`,name:"push_to_hub"},{anchor:"transformers.Seq2SeqTrainingArguments.resume_from_checkpoint",description:`<strong>resume_from_checkpoint</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The path to a folder with a valid checkpoint for your model. This argument is not directly used by
<a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"resume_from_checkpoint"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_model_id",description:`<strong>hub_model_id</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the repository to keep in sync with the local <em>output_dir</em>. It can be a simple model ID in
which case the model will be pushed in your namespace. Otherwise it should be the whole repository name,
for instance <code>&quot;user_name/model&quot;</code>, which allows you to push to an organization you are a member of with
<code>&quot;organization_name/model&quot;</code>. Will default to <code>user_name/output_dir_name</code> with <em>output_dir_name</em> being the
name of <code>output_dir</code>.</p>
<p>Will default to the name of <code>output_dir</code>.`,name:"hub_model_id"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_strategy",description:`<strong>hub_strategy</strong> (<code>str</code> or <code>HubStrategy</code>, <em>optional</em>, defaults to <code>&quot;every_save&quot;</code>) &#x2014;
Defines the scope of what is pushed to the Hub and when. Possible values are:</p>
<ul>
<li><code>&quot;end&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> method is called.</li>
<li><code>&quot;every_save&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and
a draft of a model card each time there is a model save. The pushes are asynchronous to not block
training, and in case the save are very frequent, a new push is only attempted if the previous one is
finished. A last push is made with the final model at the end of training.</li>
<li><code>&quot;checkpoint&quot;</code>: like <code>&quot;every_save&quot;</code> but the latest checkpoint is also pushed in a subfolder named
last-checkpoint, allowing you to resume training easily with
<code>trainer.train(resume_from_checkpoint=&quot;last-checkpoint&quot;)</code>.</li>
<li><code>&quot;all_checkpoints&quot;</code>: like <code>&quot;checkpoint&quot;</code> but all checkpoints are pushed like they appear in the output
folder (so you will get one checkpoint folder per folder in your final repository)</li>
</ul>`,name:"hub_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_token",description:`<strong>hub_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with
<code>huggingface-cli login</code>.`,name:"hub_token"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_private_repo",description:`<strong>hub_private_repo</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, the Hub repo will be set to private.`,name:"hub_private_repo"},{anchor:"transformers.Seq2SeqTrainingArguments.gradient_checkpointing",description:`<strong>gradient_checkpointing</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, use gradient checkpointing to save memory at the expense of slower backward pass.`,name:"gradient_checkpointing"},{anchor:"transformers.Seq2SeqTrainingArguments.include_inputs_for_metrics",description:`<strong>include_inputs_for_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the inputs will be passed to the <code>compute_metrics</code> function. This is intended for metrics
that need inputs, predictions and references for scoring calculation in Metric class.`,name:"include_inputs_for_metrics"},{anchor:"transformers.Seq2SeqTrainingArguments.auto_find_batch_size",description:`<strong>auto_find_batch_size</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding
CUDA Out-of-Memory errors. Requires accelerate to be installed (<code>pip install accelerate</code>)`,name:"auto_find_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.full_determinism",description:`<strong>full_determinism</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.set_seed">set_seed()</a> to ensure reproducible results in
distributed training`,name:"full_determinism"},{anchor:"transformers.Seq2SeqTrainingArguments.torchdynamo",description:`<strong>torchdynamo</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If set, the backend compiler for TorchDynamo. Possible choices are <code>&quot;eager&quot;</code>, <code>&quot;aot_eager&quot;</code>, <code>&quot;inductor&quot;</code>,
<code>&quot;nvfuser&quot;</code>, <code>&quot;aot_nvfuser&quot;</code>, <code>&quot;aot_cudagraphs&quot;</code>, <code>&quot;ofi&quot;</code>, <code>&quot;fx2trt&quot;</code>, <code>&quot;onnxrt&quot;</code> and <code>&quot;ipex&quot;</code>.`,name:"torchdynamo"},{anchor:"transformers.Seq2SeqTrainingArguments.ray_scope",description:`<strong>ray_scope</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;last&quot;</code>) &#x2014;
The scope to use when doing hyperparameter search with Ray. By default, <code>&quot;last&quot;</code> will be used. Ray will
then use the last checkpoint of all trials, compare those, and select the best one. However, other options
are also available. See the <a href="https://docs.ray.io/en/latest/tune/api_docs/analysis.html#ray.tune.ExperimentAnalysis.get_best_trial" rel="nofollow">Ray documentation</a> for
more options.`,name:"ray_scope"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_timeout",description:`<strong>ddp_timeout</strong> (<code>int</code>, <em>optional</em>, defaults to 1800) &#x2014;
The timeout for <code>torch.distributed.init_process_group</code> calls, used to avoid GPU socket timeouts when
performing slow operations in distributed runnings. Please refer the [PyTorch documentation]
(<a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group" rel="nofollow">https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group</a>) for more
information.`,name:"ddp_timeout"},{anchor:"transformers.Seq2SeqTrainingArguments.use_mps_device",description:`<strong>use_mps_device</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use Apple Silicon chip based <code>mps</code> device.`,name:"use_mps_device"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile",description:`<strong>torch_compile</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to compile the model using PyTorch 2.0
<a href="https://pytorch.org/get-started/pytorch-2.0/" rel="nofollow"><code>torch.compile</code></a> (requires a nighlty install of PyTorch).</p>
<p>This will use the best defaults for the <a href="https://pytorch.org/docs/2.0/generated/torch.compile.html?highlight=torch+compile#torch.compile" rel="nofollow"><code>torch.compile</code>
API</a>. You
can customize the defaults with the argument <code>torch_compile_backend</code> and <code>torch_compile_mode</code> but we don&#x2019;t
guarantee any of them will work as the support is progressively rolled in in PyTorch.</p>
<p>This flag and the whole compile API is experimental and subject to change in future releases.`,name:"torch_compile"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile_backend",description:`<strong>torch_compile_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Refer to the PyTorch doc for possible values and note that they may change across PyTorch versions.</p>
<p>This flag is experimental and subject to change in future releases.`,name:"torch_compile_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile_mode",description:`<strong>torch_compile_mode</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The mode to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Refer to the PyTorch doc for possible values and note that they may change across PyTorch versions.</p>
<p>This flag is experimental and subject to change in future releases.`,name:"torch_compile_mode"},{anchor:"transformers.Seq2SeqTrainingArguments.sortish_sampler",description:`<strong>sortish_sampler</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a <em>sortish sampler</em> or not. Only possible if the underlying datasets are <em>Seq2SeqDataset</em>
for now but will become generally available in the near future.</p>
<p>It sorts the inputs according to lengths in order to minimize the padding size, with a bit of randomness
for the training set.`,name:"sortish_sampler"},{anchor:"transformers.Seq2SeqTrainingArguments.predict_with_generate",description:`<strong>predict_with_generate</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use generate to calculate generative metrics (ROUGE, BLEU).`,name:"predict_with_generate"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_max_length",description:`<strong>generation_max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The <code>max_length</code> to use on each evaluation loop when <code>predict_with_generate=True</code>. Will default to the
<code>max_length</code> value of the model configuration.`,name:"generation_max_length"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_num_beams",description:`<strong>generation_num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The <code>num_beams</code> to use on each evaluation loop when <code>predict_with_generate=True</code>. Will default to the
<code>num_beams</code> value of the model configuration.`,name:"generation_num_beams"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/training_args_seq2seq.py#L28"}}),_i=new te({}),vi=new te({}),bi=new O({props:{code:`[...]
logger = logging.getLogger(__name__)

# Setup logging
logging.basicConfig(
    format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
    datefmt="%m/%d/%Y %H:%M:%S",
    handlers=[logging.StreamHandler(sys.stdout)],
)

# set the main code and the modules it uses to the same log-level according to the node
log_level = training_args.get_process_log_level()
logger.setLevel(log_level)
datasets.utils.logging.set_verbosity(log_level)
transformers.utils.logging.set_verbosity(log_level)

trainer = Trainer(...)`,highlighted:`[...]
logger = logging.getLogger(__name__)

<span class="hljs-comment"># Setup logging</span>
logging.basicConfig(
    <span class="hljs-built_in">format</span>=<span class="hljs-string">&quot;%(asctime)s - %(levelname)s - %(name)s - %(message)s&quot;</span>,
    datefmt=<span class="hljs-string">&quot;%m/%d/%Y %H:%M:%S&quot;</span>,
    handlers=[logging.StreamHandler(sys.stdout)],
)

<span class="hljs-comment"># set the main code and the modules it uses to the same log-level according to the node</span>
log_level = training_args.get_process_log_level()
logger.setLevel(log_level)
datasets.utils.logging.set_verbosity(log_level)
transformers.utils.logging.set_verbosity(log_level)

trainer = Trainer(...)`}}),yi=new O({props:{code:"my_app.py ... --log_level warning --log_level_replica error",highlighted:"my_app.py ... --log_level warning --log_level_replica error"}}),wi=new O({props:{code:"my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0",highlighted:"my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0"}}),Ti=new O({props:{code:"my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0",highlighted:"my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0"}}),Ei=new te({}),xi=new te({}),Ai=new O({props:{code:"python -m torch.distributed.launch --nproc_per_node=2  trainer-program.py ...",highlighted:"python -m torch.distributed.launch --nproc_per_node=2  trainer-program.py ..."}}),Di=new O({props:{code:"accelerate launch --num_processes 2 trainer-program.py ...",highlighted:"accelerate launch --num_processes 2 trainer-program.py ..."}}),Si=new O({props:{code:"deepspeed --num_gpus 2 trainer-program.py ...",highlighted:"deepspeed --num_gpus 2 trainer-program.py ..."}}),Oi=new O({props:{code:"CUDA_VISIBLE_DEVICES=0,2 python -m torch.distributed.launch trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES=0,2 python -m torch.distributed.launch trainer-program.py ..."}}),Ci=new O({props:{code:"CUDA_VISIBLE_DEVICES=2,0 python -m torch.distributed.launch trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python -m torch.distributed.launch trainer-program.py ..."}}),Ui=new O({props:{code:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ..."}}),Fi=new O({props:{code:"CUDA_VISIBLE_DEVICES= python trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES= python trainer-program.py ..."}}),zi=new O({props:{code:`export CUDA_VISIBLE_DEVICES=0,2
python -m torch.distributed.launch trainer-program.py ...`,highlighted:`<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=0,2
python -m torch.distributed.launch trainer-program.py ...`}}),Li=new O({props:{code:"export CUDA_DEVICE_ORDER=PCI_BUS_ID",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=PCI_BUS_ID'}}),Ri=new O({props:{code:"export CUDA_DEVICE_ORDER=FASTEST_FIRST",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=FASTEST_FIRST'}}),Wi=new O({props:{code:"export CUDA_VISIBLE_DEVICES=1,0",highlighted:'<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=1,0'}}),Gi=new te({}),Yi=new te({}),Ji=new O({props:{code:`pip install fairscale
pip install deepspeed`,highlighted:`pip install fairscale
pip install deepspeed`}}),Ki=new te({}),Qi=new O({props:{code:"which nvcc",highlighted:'<span class="hljs-built_in">which</span> nvcc'}}),tl=new te({}),ol=new O({props:{code:`/usr/local/cuda-10.2
/usr/local/cuda-11.0`,highlighted:`/usr/local/cuda-10.2
/usr/local/cuda-11.0`}}),rl=new O({props:{code:`echo $PATH
echo $LD_LIBRARY_PATH`,highlighted:`<span class="hljs-built_in">echo</span> <span class="hljs-variable">$PATH</span>
<span class="hljs-built_in">echo</span> <span class="hljs-variable">$LD_LIBRARY_PATH</span>`}}),al=new O({props:{code:`export PATH=/usr/local/cuda-10.2/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH`,highlighted:`<span class="hljs-built_in">export</span> PATH=/usr/local/cuda-10.2/bin:<span class="hljs-variable">$PATH</span>
<span class="hljs-built_in">export</span> LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:<span class="hljs-variable">$LD_LIBRARY_PATH</span>`}}),nl=new te({}),sl=new O({props:{code:`sudo ln -s /usr/bin/gcc-7  /usr/local/cuda-10.2/bin/gcc
sudo ln -s /usr/bin/g++-7  /usr/local/cuda-10.2/bin/g++`,highlighted:`sudo <span class="hljs-built_in">ln</span> -s /usr/bin/gcc-7  /usr/local/cuda-10.2/bin/gcc
sudo <span class="hljs-built_in">ln</span> -s /usr/bin/g++-7  /usr/local/cuda-10.2/bin/g++`}}),il=new te({}),Ra=new $r({props:{warning:!0,$$slots:{default:[vY]},$$scope:{ctx:C}}}),pl=new O({props:{code:"pip install fairscale",highlighted:"pip install fairscale"}}),ml=new O({props:{code:"pip install transformers[fairscale]",highlighted:"pip install transformers[fairscale]"}}),fl=new O({props:{code:"pip install fairscale --no-build-isolation .",highlighted:"pip install fairscale --no-build-isolation ."}}),gl=new O({props:{code:`git clone https://github.com/facebookresearch/fairscale/
cd fairscale
rm -r dist build
python setup.py bdist_wheel
pip uninstall -y fairscale
pip install dist/fairscale-*.whl`,highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/facebookresearch/fairscale/
<span class="hljs-built_in">cd</span> fairscale
<span class="hljs-built_in">rm</span> -r dist build
python setup.py bdist_wheel
pip uninstall -y fairscale
pip install dist/fairscale-*.whl`}}),vl=new O({props:{code:`pip uninstall -y fairscale; pip install fairscale --pre \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly \\
--no-cache --no-build-isolation`,highlighted:`pip uninstall -y fairscale; pip install fairscale --pre \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly \\
--no-cache --no-build-isolation`}}),bl=new O({props:{code:`pip install -v --disable-pip-version-check . \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly --pre`,highlighted:`pip install -v --disable-pip-version-check . \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly --pre`}}),Tl=new O({props:{code:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config "ro-en" \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp simple`,highlighted:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config <span class="hljs-string">&quot;ro-en&quot;</span> \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp simple`}}),kl=new O({props:{code:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config "ro-en" \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp zero_dp_2`,highlighted:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config <span class="hljs-string">&quot;ro-en&quot;</span> \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp zero_dp_2`}}),ql=new te({}),Rl=new te({}),Xl=new te({}),tn=new $r({props:{warning:!1,$$slots:{default:[bY]},$$scope:{ctx:C}}}),Ql=new O({props:{code:`export TASK_NAME=mrpc

python examples/pytorch/text-classification/run_glue.py \\
  --model_name_or_path bert-base-cased \\
  --task_name $TASK_NAME \\
  --do_train \\
  --do_eval \\
  --max_seq_length 128 \\
  --per_device_train_batch_size 32 \\
  --learning_rate 2e-5 \\
  --num_train_epochs 3 \\
  --output_dir /tmp/$TASK_NAME/ \\
  --use_mps_device \\
  --overwrite_output_dir`,highlighted:`<span class="hljs-built_in">export</span> TASK_NAME=mrpc

python examples/pytorch/text-classification/run_glue.py \\
  --model_name_or_path bert-base-cased \\
  --task_name <span class="hljs-variable">$TASK_NAME</span> \\
  --do_train \\
  --do_eval \\
  --max_seq_length 128 \\
  --per_device_train_batch_size 32 \\
  --learning_rate 2e-5 \\
  --num_train_epochs 3 \\
  --output_dir /tmp/<span class="hljs-variable">$TASK_NAME</span>/ \\
  --use_mps_device \\
  --overwrite_output_dir`}}),{c(){u=n("meta"),x=l(),T=n("h1"),w=n("a"),k=n("span"),f(h.$$.fragment),E=l(),z=n("span"),j=r("Trainer"),I=l(),G=n("p"),B=r("The "),Q=n("a"),K=r("Trainer"),Z=r(" class provides an API for feature-complete training in PyTorch for most standard use cases. It\u2019s used in most of the "),X=n("a"),me=r("example scripts"),J=r("."),M=l(),R=n("p"),ae=r("Before instantiating your "),N=n("a"),we=r("Trainer"),Te=r(", create a "),ne=n("a"),bt=r("TrainingArguments"),yt=r(" to access all the points of customization during training."),ue=l(),Ie=n("p"),Dn=r("The API supports distributed training on multiple GPUs/TPUs, mixed precision through "),Ee=n("a"),Sn=r("NVIDIA Apex"),On=r(" and Native AMP for PyTorch."),se=l(),oe=n("p"),ld=r("The "),$e=n("a"),xr=r("Trainer"),dd=r(" contains the basic training loop which supports the above features. To inject custom behavior you can subclass them and override the following methods:"),Ao=l(),W=n("ul"),re=n("li"),kr=n("strong"),cd=r("get_train_dataloader"),pd=r(" \u2014 Creates the training DataLoader."),md=l(),hd=n("li"),Um=n("strong"),RT=r("get_eval_dataloader"),WT=r(" \u2014 Creates the evaluation DataLoader."),GT=l(),ud=n("li"),Fm=n("strong"),MT=r("get_test_dataloader"),HT=r(" \u2014 Creates the test DataLoader."),BT=l(),fd=n("li"),zm=n("strong"),VT=r("log"),YT=r(" \u2014 Logs information on the various objects watching training."),XT=l(),wt=n("li"),Nm=n("strong"),ZT=r("create_optimizer_and_scheduler"),JT=r(` \u2014 Sets up the optimizer and learning rate scheduler if they were not passed at
init. Note, that you can also subclass or override the `),Lm=n("code"),KT=r("create_optimizer"),QT=r(" and "),jm=n("code"),e4=r("create_scheduler"),t4=r(` methods
separately.`),o4=l(),gd=n("li"),Rm=n("strong"),r4=r("create_optimizer"),a4=r(" \u2014 Sets up the optimizer if it wasn\u2019t passed at init."),n4=l(),_d=n("li"),Wm=n("strong"),s4=r("create_scheduler"),i4=r(" \u2014 Sets up the learning rate scheduler if it wasn\u2019t passed at init."),l4=l(),vd=n("li"),Gm=n("strong"),d4=r("compute_loss"),c4=r(" - Computes the loss on a batch of training inputs."),p4=l(),bd=n("li"),Mm=n("strong"),m4=r("training_step"),h4=r(" \u2014 Performs a training step."),u4=l(),yd=n("li"),Hm=n("strong"),f4=r("prediction_step"),g4=r(" \u2014 Performs an evaluation/test step."),_4=l(),wd=n("li"),Bm=n("strong"),v4=r("evaluate"),b4=r(" \u2014 Runs an evaluation loop and returns metrics."),y4=l(),Td=n("li"),Vm=n("strong"),w4=r("predict"),T4=r(" \u2014 Returns predictions (with metrics if labels are available) on a test set."),S1=l(),f(Ar.$$.fragment),O1=l(),qr=n("p"),E4=r("Here is an example of how to customize "),Ed=n("a"),$4=r("Trainer"),x4=r(" to use a weighted loss (useful when you have an unbalanced training set):"),C1=l(),f(Cn.$$.fragment),I1=l(),Tt=n("p"),k4=r("Another way to customize the training loop behavior for the PyTorch "),$d=n("a"),A4=r("Trainer"),q4=r(" is to use "),xd=n("a"),P4=r("callbacks"),D4=r(" that can inspect the training loop state (for progress reporting, logging on TensorBoard or other ML platforms\u2026) and take decisions (like early stopping)."),U1=l(),qo=n("h2"),Pr=n("a"),Ym=n("span"),f(In.$$.fragment),S4=l(),Xm=n("span"),O4=r("Trainer"),F1=l(),$=n("div"),f(Un.$$.fragment),C4=l(),Zm=n("p"),I4=r("Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for \u{1F917} Transformers."),U4=l(),Jm=n("p"),F4=r("Important attributes:"),z4=l(),xe=n("ul"),Dr=n("li"),Km=n("strong"),N4=r("model"),L4=r(" \u2014 Always points to the core model. If using a transformers model, it will be a "),kd=n("a"),j4=r("PreTrainedModel"),R4=r(`
subclass.`),W4=l(),ie=n("li"),Qm=n("strong"),G4=r("model_wrapped"),M4=r(` \u2014 Always points to the most external model in case one or more other modules wrap the
original model. This is the model that should be used for the forward pass. For example, under `),eh=n("code"),H4=r("DeepSpeed"),B4=r(`,
the inner model is wrapped in `),th=n("code"),V4=r("DeepSpeed"),Y4=r(" and then again in "),oh=n("code"),X4=r("torch.nn.DistributedDataParallel"),Z4=r(`. If the inner
model hasn\u2019t been wrapped, then `),rh=n("code"),J4=r("self.model_wrapped"),K4=r(" is the same as "),ah=n("code"),Q4=r("self.model"),eE=r("."),tE=l(),Ad=n("li"),nh=n("strong"),oE=r("is_model_parallel"),rE=r(` \u2014 Whether or not a model has been switched to a model parallel mode (different from
data parallelism, this means some of the model layers are split on different GPUs).`),aE=l(),Ue=n("li"),sh=n("strong"),nE=r("place_model_on_device"),sE=r(` \u2014 Whether or not to automatically place the model on the device - it will be set
to `),ih=n("code"),iE=r("False"),lE=r(` if model parallel or deepspeed is used, or if the default
`),lh=n("code"),dE=r("TrainingArguments.place_model_on_device"),cE=r(" is overridden to return "),dh=n("code"),pE=r("False"),mE=r(" ."),hE=l(),Fe=n("li"),ch=n("strong"),uE=r("is_in_train"),fE=r(" \u2014 Whether or not a model is currently running "),ph=n("code"),gE=r("train"),_E=r(" (e.g. when "),mh=n("code"),vE=r("evaluate"),bE=r(` is called while
in `),hh=n("code"),yE=r("train"),wE=r(")"),TE=l(),Sr=n("div"),f(Fn.$$.fragment),EE=l(),zn=n("p"),$E=r("Add a callback to the current list of "),uh=n("code"),xE=r("~transformer.TrainerCallback"),kE=r("."),AE=l(),Or=n("div"),f(Nn.$$.fragment),qE=l(),Ln=n("p"),PE=r("A helper wrapper that creates an appropriate context manager for "),fh=n("code"),DE=r("autocast"),SE=r(` while feeding it the desired
arguments, depending on the situation.`),OE=l(),Et=n("div"),f(jn.$$.fragment),CE=l(),gh=n("p"),IE=r("How the loss is computed by Trainer. By default, all models return the loss in the first element."),UE=l(),_h=n("p"),FE=r("Subclass and override for custom behavior."),zE=l(),Cr=n("div"),f(Rn.$$.fragment),NE=l(),vh=n("p"),LE=r("A helper wrapper to group together context managers."),jE=l(),Ir=n("div"),f(Wn.$$.fragment),RE=l(),Gn=n("p"),WE=r("Creates a draft of a model card using the information available to the "),bh=n("code"),GE=r("Trainer"),ME=r("."),HE=l(),$t=n("div"),f(Mn.$$.fragment),BE=l(),yh=n("p"),VE=r("Setup the optimizer."),YE=l(),Hn=n("p"),XE=r(`We provide a reasonable default that works well. If you want to use something else, you can pass a tuple in the
Trainer\u2019s init through `),wh=n("code"),ZE=r("optimizers"),JE=r(", or subclass and override this method in a subclass."),KE=l(),xt=n("div"),f(Bn.$$.fragment),QE=l(),Th=n("p"),e$=r("Setup the optimizer and the learning rate scheduler."),t$=l(),it=n("p"),o$=r(`We provide a reasonable default that works well. If you want to use something else, you can pass a tuple in the
Trainer\u2019s init through `),Eh=n("code"),r$=r("optimizers"),a$=r(", or subclass and override this method (or "),$h=n("code"),n$=r("create_optimizer"),s$=r(` and/or
`),xh=n("code"),i$=r("create_scheduler"),l$=r(") in a subclass."),d$=l(),Ur=n("div"),f(Vn.$$.fragment),c$=l(),kh=n("p"),p$=r(`Setup the scheduler. The optimizer of the trainer must have been set up either before this method is called or
passed as an argument.`),m$=l(),ze=n("div"),f(Yn.$$.fragment),h$=l(),Ah=n("p"),u$=r("Run evaluation and returns metrics."),f$=l(),Xn=n("p"),g$=r(`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),qh=n("code"),_$=r("compute_metrics"),v$=r(" argument)."),b$=l(),Ph=n("p"),y$=r("You can also subclass and override this method to inject custom behavior."),w$=l(),kt=n("div"),f(Zn.$$.fragment),T$=l(),Po=n("p"),E$=r("Prediction/evaluation loop, shared by "),Dh=n("code"),$$=r("Trainer.evaluate()"),x$=r(" and "),Sh=n("code"),k$=r("Trainer.predict()"),A$=r("."),q$=l(),Oh=n("p"),P$=r("Works both with or without labels."),D$=l(),Fr=n("div"),f(Jn.$$.fragment),S$=l(),Kn=n("p"),O$=r("For models that inherit from "),qd=n("a"),C$=r("PreTrainedModel"),I$=r(`, uses that method to compute the number of floating point
operations for every backward + forward pass. If using another model, either implement such a method in the
model or subclass and override this method.`),U$=l(),At=n("div"),f(Qn.$$.fragment),F$=l(),es=n("p"),z$=r("Returns the evaluation "),Ch=n("code"),N$=r("~torch.utils.data.DataLoader"),L$=r("."),j$=l(),Ih=n("p"),R$=r("Subclass and override this method if you want to inject some custom behavior."),W$=l(),zr=n("div"),f(ts.$$.fragment),G$=l(),Uh=n("p"),M$=r("Returns the optimizer class and optimizer parameters based on the training arguments."),H$=l(),qt=n("div"),f(os.$$.fragment),B$=l(),rs=n("p"),V$=r("Returns the test "),Fh=n("code"),Y$=r("~torch.utils.data.DataLoader"),X$=r("."),Z$=l(),zh=n("p"),J$=r("Subclass and override this method if you want to inject some custom behavior."),K$=l(),Ne=n("div"),f(as.$$.fragment),Q$=l(),ns=n("p"),e3=r("Returns the training "),Nh=n("code"),t3=r("~torch.utils.data.DataLoader"),o3=r("."),r3=l(),Do=n("p"),a3=r("Will use no sampler if "),Lh=n("code"),n3=r("train_dataset"),s3=r(" does not implement "),jh=n("code"),i3=r("__len__"),l3=r(`, a random sampler (adapted to distributed
training if necessary) otherwise.`),d3=l(),Rh=n("p"),c3=r("Subclass and override this method if you want to inject some custom behavior."),p3=l(),Pt=n("div"),f(ss.$$.fragment),m3=l(),ke=n("p"),h3=r("Launch an hyperparameter search using "),Wh=n("code"),u3=r("optuna"),f3=r(" or "),Gh=n("code"),g3=r("Ray Tune"),_3=r(" or "),Mh=n("code"),v3=r("SigOpt"),b3=r(`. The optimized quantity is determined
by `),Hh=n("code"),y3=r("compute_objective"),w3=r(`, which defaults to a function returning the evaluation loss when no metric is provided,
the sum of all metrics otherwise.`),T3=l(),f(Nr.$$.fragment),E3=l(),Lr=n("div"),f(is.$$.fragment),$3=l(),ls=n("p"),x3=r("Initializes a git repo in "),Bh=n("code"),k3=r("self.args.hub_model_id"),A3=r("."),q3=l(),jr=n("div"),f(ds.$$.fragment),P3=l(),Vh=n("p"),D3=r(`Whether or not this process is the local (e.g., on one machine if training in a distributed fashion on several
machines) main process.`),S3=l(),Rr=n("div"),f(cs.$$.fragment),O3=l(),ps=n("p"),C3=r(`Whether or not this process is the global main process (when training in a distributed fashion on several
machines, this is only going to be `),Yh=n("code"),I3=r("True"),U3=r(" for one process)."),F3=l(),Dt=n("div"),f(ms.$$.fragment),z3=l(),hs=n("p"),N3=r("Log "),Xh=n("code"),L3=r("logs"),j3=r(" on the various objects watching training."),R3=l(),Zh=n("p"),W3=r("Subclass and override this method to inject custom behavior."),G3=l(),U=n("div"),f(us.$$.fragment),M3=l(),Jh=n("p"),H3=r("Log metrics in a specially formatted way"),B3=l(),Kh=n("p"),V3=r("Under distributed environment this is done only for a process with rank 0."),Y3=l(),Qh=n("p"),X3=r("Notes on memory reports:"),Z3=l(),So=n("p"),J3=r("In order to get memory usage report you need to install "),eu=n("code"),K3=r("psutil"),Q3=r(". You can do that with "),tu=n("code"),ex=r("pip install psutil"),tx=r("."),ox=l(),f(Wr.$$.fragment),rx=l(),ou=n("p"),ru=n("strong"),ax=r("Understanding the reports:"),nx=l(),lt=n("ul"),Ae=n("li"),sx=r("the first segment, e.g., "),au=n("code"),ix=r("train__"),lx=r(", tells you which stage the metrics are for. Reports starting with "),nu=n("code"),dx=r("init_"),cx=r(`
will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the
`),su=n("code"),px=r("__init__"),mx=r(" will be reported along with the "),iu=n("code"),hx=r("eval_"),ux=r(" metrics."),fx=l(),Oo=n("li"),gx=r("the third segment, is either "),lu=n("code"),_x=r("cpu"),vx=r(" or "),du=n("code"),bx=r("gpu"),yx=r(`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),wx=l(),Pd=n("li"),cu=n("code"),Tx=r("*_alloc_delta"),Ex=r(` - is the difference in the used/allocated memory counter between the end and the start of the
stage - it can be negative if a function released more memory than it allocated.`),$x=l(),St=n("li"),pu=n("code"),xx=r("*_peaked_delta"),kx=r(` - is any extra memory that was consumed and then freed - relative to the current allocated
memory counter - it is never negative. When you look at the metrics of any stage you add up `),mu=n("code"),Ax=r("alloc_delta"),qx=r(` +
`),hu=n("code"),Px=r("peaked_delta"),Dx=r(" and you know how much memory was needed to complete that stage."),Sx=l(),uu=n("p"),Ox=r(`The reporting happens only for process of rank 0 and gpu 0 (if there is a gpu). Typically this is enough since the
main process does the bulk of work, but it could be not quite so if model parallel is used and then other GPUs may
use a different amount of gpu memory. This is also not the same under DataParallel where gpu0 may require much more
memory than the rest since it stores the gradient and optimizer states for all participating GPUS. Perhaps in the
future these reports will evolve to measure those too.`),Cx=l(),fu=n("p"),Ix=r(`The CPU RAM metric measures RSS (Resident Set Size) includes both the memory which is unique to the process and the
memory shared with other processes. It is important to note that it does not include swapped out memory, so the
reports could be imprecise.`),Ux=l(),fs=n("p"),Fx=r(`The CPU peak memory is measured using a sampling thread. Due to python\u2019s GIL it may miss some of the peak memory if
that thread didn\u2019t get a chance to run when the highest memory was used. Therefore this report can be less than
reality. Using `),gu=n("code"),zx=r("tracemalloc"),Nx=r(` would have reported the exact peak memory, but it doesn\u2019t report memory allocations
outside of python. So if some C++ CUDA extension allocated its own memory it won\u2019t be reported. And therefore it
was dropped in favor of the memory sampling approach, which reads the current process memory usage.`),Lx=l(),dt=n("p"),jx=r("The GPU allocated and peak memory reporting is done with "),_u=n("code"),Rx=r("torch.cuda.memory_allocated()"),Wx=r(` and
`),vu=n("code"),Gx=r("torch.cuda.max_memory_allocated()"),Mx=r(`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),bu=n("code"),Hx=r("torch.cuda"),Bx=r(` memory management system doesn\u2019t track any memory allocated outside of pytorch. For example, the very
first cuda call typically loads CUDA kernels, which may take from 0.5 to 2GB of GPU memory.`),Vx=l(),he=n("p"),Yx=r("Note that this tracker doesn\u2019t account for memory allocations outside of "),Dd=n("a"),Xx=r("Trainer"),Zx=r("\u2019s "),yu=n("code"),Jx=r("__init__"),Kx=r(", "),wu=n("code"),Qx=r("train"),ek=r(`,
`),Tu=n("code"),tk=r("evaluate"),ok=r(" and "),Eu=n("code"),rk=r("predict"),ak=r(" calls."),nk=l(),V=n("p"),sk=r("Because "),$u=n("code"),ik=r("evaluation"),lk=r(" calls may happen during "),xu=n("code"),dk=r("train"),ck=r(`, we can\u2019t handle nested invocations because
`),ku=n("code"),pk=r("torch.cuda.max_memory_allocated"),mk=r(" is a single counter, so if it gets reset by a nested eval call, "),Au=n("code"),hk=r("train"),uk=r(`\u2019s tracker
will report incorrect info. If this `),gs=n("a"),fk=r("pytorch issue"),gk=r(` gets resolved
it will be possible to change this class to be re-entrant. Until then we will only track the outer level of
`),qu=n("code"),_k=r("train"),vk=r(", "),Pu=n("code"),bk=r("evaluate"),yk=r(" and "),Du=n("code"),wk=r("predict"),Tk=r(" methods. Which means that if "),Su=n("code"),Ek=r("eval"),$k=r(" is called during "),Ou=n("code"),xk=r("train"),kk=r(`, it\u2019s the latter
that will account for its memory usage and that of the former.`),Ak=l(),qe=n("p"),qk=r("This also means that if any other tool that is used along the "),Sd=n("a"),Pk=r("Trainer"),Dk=r(` calls
`),Cu=n("code"),Sk=r("torch.cuda.reset_peak_memory_stats"),Ok=r(", the gpu peak memory stats could be invalid. And the "),Od=n("a"),Ck=r("Trainer"),Ik=r(` will disrupt
the normal behavior of any such tools that rely on calling `),Iu=n("code"),Uk=r("torch.cuda.reset_peak_memory_stats"),Fk=r(" themselves."),zk=l(),Uu=n("p"),Nk=r("For best performance you may want to consider turning the memory profiling off for production runs."),Lk=l(),Gr=n("div"),f(_s.$$.fragment),jk=l(),Fu=n("p"),Rk=r("Reformat Trainer metrics values to a human-readable format"),Wk=l(),Mr=n("div"),f(vs.$$.fragment),Gk=l(),bs=n("p"),Mk=r("Helper to get number of samples in a "),zu=n("code"),Hk=r("~torch.utils.data.DataLoader"),Bk=r(` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),Vk=l(),Ot=n("div"),f(ys.$$.fragment),Yk=l(),ws=n("p"),Xk=r("Remove a callback from the current list of "),Nu=n("code"),Zk=r("~transformer.TrainerCallback"),Jk=r(" and returns it."),Kk=l(),Ts=n("p"),Qk=r("If the callback is not found, returns "),Lu=n("code"),eA=r("None"),tA=r(" (and no error is raised)."),oA=l(),le=n("div"),f(Es.$$.fragment),rA=l(),ju=n("p"),aA=r("Run prediction and returns predictions and potential metrics."),nA=l(),$s=n("p"),sA=r(`Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method
will also return metrics, like in `),Ru=n("code"),iA=r("evaluate()"),lA=r("."),dA=l(),f(Hr.$$.fragment),cA=l(),xs=n("p"),pA=r("Returns: "),Wu=n("em"),mA=r("NamedTuple"),hA=r(" A namedtuple with the following keys:"),uA=l(),Co=n("ul"),Io=n("li"),fA=r("predictions ("),Gu=n("code"),gA=r("np.ndarray"),_A=r("): The predictions on "),Mu=n("code"),vA=r("test_dataset"),bA=r("."),yA=l(),Uo=n("li"),wA=r("label_ids ("),Hu=n("code"),TA=r("np.ndarray"),EA=r(", "),Bu=n("em"),$A=r("optional"),xA=r("): The labels (if the dataset contained some)."),kA=l(),Fo=n("li"),AA=r("metrics ("),Vu=n("code"),qA=r("Dict[str, float]"),PA=r(", "),Yu=n("em"),DA=r("optional"),SA=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),OA=l(),Ct=n("div"),f(ks.$$.fragment),CA=l(),zo=n("p"),IA=r("Prediction/evaluation loop, shared by "),Xu=n("code"),UA=r("Trainer.evaluate()"),FA=r(" and "),Zu=n("code"),zA=r("Trainer.predict()"),NA=r("."),LA=l(),Ju=n("p"),jA=r("Works both with or without labels."),RA=l(),It=n("div"),f(As.$$.fragment),WA=l(),No=n("p"),GA=r("Perform an evaluation step on "),Ku=n("code"),MA=r("model"),HA=r(" using "),Qu=n("code"),BA=r("inputs"),VA=r("."),YA=l(),ef=n("p"),XA=r("Subclass and override to inject custom behavior."),ZA=l(),Br=n("div"),f(qs.$$.fragment),JA=l(),ct=n("p"),KA=r("Upload "),tf=n("em"),QA=r("self.model"),e5=r(" and "),of=n("em"),t5=r("self.tokenizer"),o5=r(" to the \u{1F917} model hub on the repo "),rf=n("em"),r5=r("self.args.hub_model_id"),a5=r("."),n5=l(),Vr=n("div"),f(Ps.$$.fragment),s5=l(),Ds=n("p"),i5=r("Remove a callback from the current list of "),af=n("code"),l5=r("~transformer.TrainerCallback"),d5=r("."),c5=l(),Le=n("div"),f(Ss.$$.fragment),p5=l(),Os=n("p"),m5=r("Save metrics into a json file for that split, e.g. "),nf=n("code"),h5=r("train_results.json"),u5=r("."),f5=l(),sf=n("p"),g5=r("Under distributed environment this is done only for a process with rank 0."),_5=l(),Cs=n("p"),v5=r("To understand the metrics please read the docstring of "),Cd=n("a"),b5=r("log_metrics()"),y5=r(`. The only difference is that raw
unformatted numbers are saved in the current method.`),w5=l(),Ut=n("div"),f(Is.$$.fragment),T5=l(),Us=n("p"),E5=r("Will save the model, so you can reload it using "),lf=n("code"),$5=r("from_pretrained()"),x5=r("."),k5=l(),df=n("p"),A5=r("Will only save from the main process."),q5=l(),Ft=n("div"),f(Fs.$$.fragment),P5=l(),cf=n("p"),D5=r("Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),S5=l(),pf=n("p"),O5=r("Under distributed environment this is done only for a process with rank 0."),C5=l(),Yr=n("div"),f(zs.$$.fragment),I5=l(),mf=n("p"),U5=r("Main training entry point."),F5=l(),zt=n("div"),f(Ns.$$.fragment),z5=l(),hf=n("p"),N5=r("Perform a training step on a batch of inputs."),L5=l(),uf=n("p"),j5=r("Subclass and override to inject custom behavior."),z1=l(),Lo=n("h2"),Xr=n("a"),ff=n("span"),f(Ls.$$.fragment),R5=l(),gf=n("span"),W5=r("Seq2SeqTrainer"),N1=l(),pt=n("div"),f(js.$$.fragment),G5=l(),je=n("div"),f(Rs.$$.fragment),M5=l(),_f=n("p"),H5=r("Run evaluation and returns metrics."),B5=l(),Ws=n("p"),V5=r(`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),vf=n("code"),Y5=r("compute_metrics"),X5=r(" argument)."),Z5=l(),bf=n("p"),J5=r("You can also subclass and override this method to inject custom behavior."),K5=l(),de=n("div"),f(Gs.$$.fragment),Q5=l(),yf=n("p"),e7=r("Run prediction and returns predictions and potential metrics."),t7=l(),Ms=n("p"),o7=r(`Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method
will also return metrics, like in `),wf=n("code"),r7=r("evaluate()"),a7=r("."),n7=l(),f(Zr.$$.fragment),s7=l(),Hs=n("p"),i7=r("Returns: "),Tf=n("em"),l7=r("NamedTuple"),d7=r(" A namedtuple with the following keys:"),c7=l(),jo=n("ul"),Ro=n("li"),p7=r("predictions ("),Ef=n("code"),m7=r("np.ndarray"),h7=r("): The predictions on "),$f=n("code"),u7=r("test_dataset"),f7=r("."),g7=l(),Wo=n("li"),_7=r("label_ids ("),xf=n("code"),v7=r("np.ndarray"),b7=r(", "),kf=n("em"),y7=r("optional"),w7=r("): The labels (if the dataset contained some)."),T7=l(),Go=n("li"),E7=r("metrics ("),Af=n("code"),$7=r("Dict[str, float]"),x7=r(", "),qf=n("em"),k7=r("optional"),A7=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),L1=l(),Mo=n("h2"),Jr=n("a"),Pf=n("span"),f(Bs.$$.fragment),q7=l(),Df=n("span"),P7=r("TrainingArguments"),j1=l(),S=n("div"),f(Vs.$$.fragment),D7=l(),Ys=n("p"),S7=r("TrainingArguments is the subset of the arguments we use in our example scripts "),Sf=n("strong"),O7=r(`which relate to the training loop
itself`),C7=r("."),I7=l(),Ho=n("p"),U7=r("Using "),Id=n("a"),F7=r("HfArgumentParser"),z7=r(` we can turn this class into
`),Xs=n("a"),N7=r("argparse"),L7=r(` arguments that can be specified on the
command line.`),j7=l(),fe=n("div"),f(Zs.$$.fragment),R7=l(),Of=n("p"),W7=r(`Returns the log level to be used depending on whether this process is the main process of node 0, main process
of node non-0, or a non-main process.`),G7=l(),Bo=n("p"),M7=r("For the main process the log level defaults to the logging level set ("),Cf=n("code"),H7=r("logging.WARNING"),B7=r(` if you didn\u2019t do
anything) unless overridden by `),If=n("code"),V7=r("log_level"),Y7=r(" argument."),X7=l(),Vo=n("p"),Z7=r("For the replica processes the log level defaults to "),Uf=n("code"),J7=r("logging.WARNING"),K7=r(" unless overridden by "),Ff=n("code"),Q7=r("log_level_replica"),eq=r(`
argument.`),tq=l(),Js=n("p"),oq=r("The choice between the main and replica process settings is made according to the return value of "),zf=n("code"),rq=r("should_log"),aq=r("."),nq=l(),Kr=n("div"),f(Ks.$$.fragment),sq=l(),Nf=n("p"),iq=r("Get number of steps used for a linear warmup."),lq=l(),Nt=n("div"),f(Qs.$$.fragment),dq=l(),Lf=n("p"),cq=r(`A context manager for torch distributed environment where on needs to do something on the main process, while
blocking replicas, and when it\u2019s finished releasing the replicas.`),pq=l(),Yo=n("p"),mq=r("One such use is for "),jf=n("code"),hq=r("datasets"),uq=r("\u2019s "),Rf=n("code"),fq=r("map"),gq=r(` feature which to be efficient should be run once on the main process,
which upon completion saves a cached version of results and which then automatically gets loaded by the
replicas.`),_q=l(),Lt=n("div"),f(ei.$$.fragment),vq=l(),Wf=n("p"),bq=r("A method that regroups all arguments linked to the dataloaders creation."),yq=l(),f(Qr.$$.fragment),wq=l(),jt=n("div"),f(ti.$$.fragment),Tq=l(),Gf=n("p"),Eq=r("A method that regroups all arguments linked to the evaluation."),$q=l(),f(ea.$$.fragment),xq=l(),Rt=n("div"),f(oi.$$.fragment),kq=l(),Mf=n("p"),Aq=r("A method that regroups all arguments linked to the evaluation."),qq=l(),f(ta.$$.fragment),Pq=l(),Wt=n("div"),f(ri.$$.fragment),Dq=l(),Hf=n("p"),Sq=r("A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters."),Oq=l(),f(oa.$$.fragment),Cq=l(),Gt=n("div"),f(ai.$$.fragment),Iq=l(),Bf=n("p"),Uq=r("A method that regroups all arguments linked to the optimizer and its hyperparameters."),Fq=l(),f(ra.$$.fragment),zq=l(),Re=n("div"),f(ni.$$.fragment),Nq=l(),Vf=n("p"),Lq=r("A method that regroups all arguments linked to synchronizing checkpoints with the Hub."),jq=l(),f(aa.$$.fragment),Rq=l(),f(na.$$.fragment),Wq=l(),Mt=n("div"),f(si.$$.fragment),Gq=l(),Yf=n("p"),Mq=r("A method that regroups all arguments linked to the evaluation."),Hq=l(),f(sa.$$.fragment),Bq=l(),We=n("div"),f(ii.$$.fragment),Vq=l(),Xf=n("p"),Yq=r("A method that regroups all basic arguments linked to testing on a held-out dataset."),Xq=l(),f(ia.$$.fragment),Zq=l(),f(la.$$.fragment),Jq=l(),Ge=n("div"),f(li.$$.fragment),Kq=l(),Zf=n("p"),Qq=r("A method that regroups all basic arguments linked to the training."),eP=l(),f(da.$$.fragment),tP=l(),f(ca.$$.fragment),oP=l(),pa=n("div"),f(di.$$.fragment),rP=l(),ci=n("p"),aP=r("Serializes this instance while replace "),Jf=n("code"),nP=r("Enum"),sP=r(` by their values (for JSON serialization support). It obfuscates
the token values by removing their value.`),iP=l(),ma=n("div"),f(pi.$$.fragment),lP=l(),Kf=n("p"),dP=r("Serializes this instance to a JSON string."),cP=l(),ha=n("div"),f(mi.$$.fragment),pP=l(),Qf=n("p"),mP=r("Sanitized serialization to use with TensorBoard\u2019s hparams"),R1=l(),Xo=n("h2"),ua=n("a"),eg=n("span"),f(hi.$$.fragment),hP=l(),tg=n("span"),uP=r("Seq2SeqTrainingArguments"),W1=l(),mt=n("div"),f(ui.$$.fragment),fP=l(),fi=n("p"),gP=r("TrainingArguments is the subset of the arguments we use in our example scripts "),og=n("strong"),_P=r(`which relate to the training loop
itself`),vP=r("."),bP=l(),Zo=n("p"),yP=r("Using "),Ud=n("a"),wP=r("HfArgumentParser"),TP=r(` we can turn this class into
`),gi=n("a"),EP=r("argparse"),$P=r(` arguments that can be specified on the
command line.`),G1=l(),Jo=n("h2"),fa=n("a"),rg=n("span"),f(_i.$$.fragment),xP=l(),ag=n("span"),kP=r("Checkpoints"),M1=l(),ge=n("p"),AP=r("By default, "),Fd=n("a"),qP=r("Trainer"),PP=r(" will save all checkpoints in the "),ng=n("code"),DP=r("output_dir"),SP=r(` you set in the
`),zd=n("a"),OP=r("TrainingArguments"),CP=r(" you are using. Those will go in subfolder named "),sg=n("code"),IP=r("checkpoint-xxx"),UP=r(` with xxx
being the step at which the training was at.`),H1=l(),ga=n("p"),FP=r("Resuming training from a checkpoint can be done when calling "),Nd=n("a"),zP=r("Trainer.train()"),NP=r(" with either:"),B1=l(),_a=n("ul"),Ld=n("li"),ig=n("code"),LP=r("resume_from_checkpoint=True"),jP=r(" which will resume training from the latest checkpoint"),RP=l(),jd=n("li"),lg=n("code"),WP=r("resume_from_checkpoint=checkpoint_dir"),GP=r(` which will resume training from the specific checkpoint in the directory
passed.`),V1=l(),Me=n("p"),MP=r("In addition, you can easily save your checkpoints on the Model Hub when using "),dg=n("code"),HP=r("push_to_hub=True"),BP=r(`. By default, all
the models saved in intermediate checkpoints are saved in different commits, but not the optimizer state. You can adapt
the `),cg=n("code"),VP=r("hub-strategy"),YP=r(" value of your "),Rd=n("a"),XP=r("TrainingArguments"),ZP=r(" to either:"),Y1=l(),va=n("ul"),ba=n("li"),pg=n("code"),JP=r('"checkpoint"'),KP=r(`: the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to
resume training easily with `),mg=n("code"),QP=r('trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")'),e6=r("."),t6=l(),Wd=n("li"),hg=n("code"),o6=r('"all_checkpoints"'),r6=r(`: all checkpoints are pushed like they appear in the output folder (so you will get one
checkpoint folder per folder in your final repository)`),X1=l(),Ko=n("h2"),ya=n("a"),ug=n("span"),f(vi.$$.fragment),a6=l(),fg=n("span"),n6=r("Logging"),Z1=l(),He=n("p"),s6=r("By default "),Gd=n("a"),i6=r("Trainer"),l6=r(" will use "),gg=n("code"),d6=r("logging.INFO"),c6=r(" for the main process and "),_g=n("code"),p6=r("logging.WARNING"),m6=r(" for the replicas if any."),J1=l(),Ht=n("p"),h6=r("These defaults can be overridden to use any of the 5 "),vg=n("code"),u6=r("logging"),f6=r(" levels with "),Md=n("a"),g6=r("TrainingArguments"),_6=r(`\u2019s
arguments:`),K1=l(),wa=n("ul"),Hd=n("li"),bg=n("code"),v6=r("log_level"),b6=r(" - for the main process"),y6=l(),Bd=n("li"),yg=n("code"),w6=r("log_level_replica"),T6=r(" - for the replicas"),Q1=l(),Be=n("p"),E6=r("Further, if "),Vd=n("a"),$6=r("TrainingArguments"),x6=r("\u2019s "),wg=n("code"),k6=r("log_on_each_node"),A6=r(" is set to "),Tg=n("code"),q6=r("False"),P6=r(` only the main node will
use the log level settings for its main process, all other nodes will use the log level settings for replicas.`),ey=l(),ce=n("p"),D6=r("Note that "),Yd=n("a"),S6=r("Trainer"),O6=r(" is going to set "),Eg=n("code"),C6=r("transformers"),I6=r(`\u2019s log level separately for each node in its
`),$g=n("code"),U6=r("Trainer.__init__()"),F6=r(`. So you may want to set this sooner (see the next example) if you tap into other
`),xg=n("code"),z6=r("transformers"),N6=r(" functionality before creating the "),Xd=n("a"),L6=r("Trainer"),j6=r(" object."),ty=l(),Zd=n("p"),R6=r("Here is an example of how this can be used in an application:"),oy=l(),f(bi.$$.fragment),ry=l(),Jd=n("p"),W6=r(`And then if you only want to see warnings on the main node and all other nodes to not print any most likely duplicated
warnings you could run it as:`),ay=l(),f(yi.$$.fragment),ny=l(),Kd=n("p"),G6=r(`In the multi-node environment if you also don\u2019t want the logs to repeat for each node\u2019s main process, you will want to
change the above to:`),sy=l(),f(wi.$$.fragment),iy=l(),Qd=n("p"),M6=r(`and then only the main process of the first node will log at the \u201Cwarning\u201D level, and all other processes on the main
node and all processes on other nodes will log at the \u201Cerror\u201D level.`),ly=l(),ec=n("p"),H6=r("If you need your application to be as quiet as possible you could do:"),dy=l(),f(Ti.$$.fragment),cy=l(),Ta=n("p"),B6=r("(add "),kg=n("code"),V6=r("--log_on_each_node 0"),Y6=r(" if on multi-node environment)"),py=l(),Qo=n("h2"),Ea=n("a"),Ag=n("span"),f(Ei.$$.fragment),X6=l(),qg=n("span"),Z6=r("Randomness"),my=l(),_e=n("p"),J6=r("When resuming from a checkpoint generated by "),tc=n("a"),K6=r("Trainer"),Q6=r(` all efforts are made to restore the
`),Pg=n("em"),eD=r("python"),tD=r(", "),Dg=n("em"),oD=r("numpy"),rD=r(" and "),Sg=n("em"),aD=r("pytorch"),nD=r(` RNG states to the same states as they were at the moment of saving that checkpoint,
which should make the \u201Cstop and resume\u201D style of training as close as possible to non-stop training.`),hy=l(),Bt=n("p"),sD=r(`However, due to various default non-deterministic pytorch settings this might not fully work. If you want full
determinism please refer to `),$i=n("a"),iD=r("Controlling sources of randomness"),lD=r(`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),Og=n("code"),dD=r("torch.backends.cudnn.deterministic"),cD=r(`) may slow things down, therefore this
can\u2019t be done by default, but you can enable those yourself if needed.`),uy=l(),er=n("h2"),$a=n("a"),Cg=n("span"),f(xi.$$.fragment),pD=l(),Ig=n("span"),mD=r("Specific GPUs Selection"),fy=l(),oc=n("p"),hD=r("Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),gy=l(),xa=n("p"),uD=r("When using "),ki=n("a"),Ug=n("code"),fD=r("DistributedDataParallel"),gD=r(" to use only a subset of your GPUs, you simply specify the number of GPUs to use. For example, if you have 4 GPUs, but you wish to use the first 2 you can do:"),_y=l(),f(Ai.$$.fragment),vy=l(),Vt=n("p"),_D=r("if you have either "),qi=n("a"),Fg=n("code"),vD=r("accelerate"),bD=r(" or "),Pi=n("a"),zg=n("code"),yD=r("deepspeed"),wD=r(" installed you can also accomplish the same by using one of:"),by=l(),f(Di.$$.fragment),yy=l(),f(Si.$$.fragment),wy=l(),ka=n("p"),TD=r("You don\u2019t need to use the Accelerate or "),rc=n("a"),ED=r("the Deepspeed integration"),$D=r(" features to use these launchers."),Ty=l(),ac=n("p"),xD=r("Until now you were able to tell the program how many GPUs to use. Now let\u2019s discuss how to select specific GPUs and control their order."),Ey=l(),nc=n("p"),kD=r("The following environment variables help you control which GPUs to use and their order."),$y=l(),sc=n("p"),Ng=n("strong"),Lg=n("code"),AD=r("CUDA_VISIBLE_DEVICES"),xy=l(),Aa=n("p"),qD=r("If you have multiple GPUs and you\u2019d like to use only 1 or a few of those GPUs, set the environment variable "),jg=n("code"),PD=r("CUDA_VISIBLE_DEVICES"),DD=r(" to a list of the GPUs to be used."),ky=l(),ic=n("p"),SD=r("For example, let\u2019s say you have 4 GPUs: 0, 1, 2 and 3. To run only on the physical GPUs 0 and 2, you can do:"),Ay=l(),f(Oi.$$.fragment),qy=l(),Yt=n("p"),OD=r("So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),Rg=n("code"),CD=r("cuda:0"),ID=r(" and "),Wg=n("code"),UD=r("cuda:1"),FD=r(" correspondingly."),Py=l(),lc=n("p"),zD=r("You can even change their order:"),Dy=l(),f(Ci.$$.fragment),Sy=l(),Xt=n("p"),ND=r("Here your physical GPUs 0 and 2 are mapped to "),Gg=n("code"),LD=r("cuda:1"),jD=r(" and "),Mg=n("code"),RD=r("cuda:0"),WD=r(" correspondingly."),Oy=l(),Zt=n("p"),GD=r("The above examples were all for "),Hg=n("code"),MD=r("DistributedDataParallel"),HD=r(" use pattern, but the same method works for "),Ii=n("a"),Bg=n("code"),BD=r("DataParallel"),VD=r(" as well:"),Cy=l(),f(Ui.$$.fragment),Iy=l(),dc=n("p"),YD=r("To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),Uy=l(),f(Fi.$$.fragment),Fy=l(),cc=n("p"),XD=r("As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),zy=l(),f(zi.$$.fragment),Ny=l(),pc=n("p"),ZD=r("but this approach can be confusing since you may forget you set up the environment variable earlier and not understand why the wrong GPUs are used. Therefore, it\u2019s a common practice to set the environment variable just for a specific run on the same command line as it\u2019s shown in most examples of this section."),Ly=l(),mc=n("p"),Vg=n("strong"),Yg=n("code"),JD=r("CUDA_DEVICE_ORDER"),jy=l(),qa=n("p"),KD=r("There is an additional environment variable "),Xg=n("code"),QD=r("CUDA_DEVICE_ORDER"),e8=r(" that controls how the physical devices are ordered. The two choices are:"),Ry=l(),hc=n("ol"),Ni=n("li"),t8=r("ordered by PCIe bus IDs (matches "),Zg=n("code"),o8=r("nvidia-smi"),r8=r("\u2019s order) - this is the default."),Wy=l(),f(Li.$$.fragment),Gy=l(),ji=n("ol"),Jg=n("li"),a8=r("ordered by GPU compute capabilities"),My=l(),f(Ri.$$.fragment),Hy=l(),Jt=n("p"),n8=r("Most of the time you don\u2019t need to care about this environment variable, but it\u2019s very helpful if you have a lopsided setup where you have an old and a new GPUs physically inserted in such a way so that the slow older card appears to be first. One way to fix that is to swap the cards. But if you can\u2019t swap the cards (e.g., if the cooling of the devices gets impacted) then setting "),Kg=n("code"),s8=r("CUDA_DEVICE_ORDER=FASTEST_FIRST"),i8=r(" will always put the newer faster card first. It\u2019ll be somewhat confusing though since "),Qg=n("code"),l8=r("nvidia-smi"),d8=r(" will still report them in the PCIe order."),By=l(),uc=n("p"),c8=r("The other solution to swapping the order is to use:"),Vy=l(),f(Wi.$$.fragment),Yy=l(),fc=n("p"),p8=r("In this example we are working with just 2 GPUs, but of course the same would apply to as many GPUs as your computer has."),Xy=l(),Pa=n("p"),m8=r("Also if you do set this environment variable it\u2019s the best to set it in your "),e_=n("code"),h8=r("~/.bashrc"),u8=r(" file or some other startup config file and forget about it."),Zy=l(),tr=n("h2"),Da=n("a"),t_=n("span"),f(Gi.$$.fragment),f8=l(),o_=n("span"),g8=r("Trainer Integrations"),Jy=l(),Sa=n("p"),_8=r("The "),gc=n("a"),v8=r("Trainer"),b8=r(` has been extended to support libraries that may dramatically improve your training
time and fit much bigger models.`),Ky=l(),ve=n("p"),y8=r("Currently it supports third party solutions, "),Mi=n("a"),w8=r("DeepSpeed"),T8=r(", "),Hi=n("a"),E8=r("PyTorch FSDP"),$8=r(" and "),Bi=n("a"),x8=r("FairScale"),k8=r(", which implement parts of the paper "),Vi=n("a"),A8=r(`ZeRO: Memory Optimizations
Toward Training Trillion Parameter Models, by Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, Yuxiong He`),q8=r("."),Qy=l(),Oa=n("p"),P8=r("This provided support is new and experimental as of this writing. While the support for DeepSpeed and PyTorch FSDP is active and we welcome issues around it, we don\u2019t support the FairScale integration anymore since it has been integrated in PyTorch main (see the "),_c=n("a"),D8=r("PyTorch FSDP integration"),S8=r(")"),e2=l(),vc=n("a"),t2=l(),or=n("h3"),Ca=n("a"),r_=n("span"),f(Yi.$$.fragment),O8=l(),a_=n("span"),C8=r("CUDA Extension Installation Notes"),o2=l(),bc=n("p"),I8=r("As of this writing, both FairScale and Deepspeed require compilation of CUDA C++ code, before they can be used."),r2=l(),Kt=n("p"),U8=r("While all installation issues should be dealt with through the corresponding GitHub Issues of "),Xi=n("a"),F8=r("FairScale"),z8=r(" and "),Zi=n("a"),N8=r("Deepspeed"),L8=r(`, there are a few common issues that one may encounter while building
any PyTorch extension that needs to build CUDA extensions.`),a2=l(),yc=n("p"),j8=r("Therefore, if you encounter a CUDA-related build issue while doing one of the following or both:"),n2=l(),f(Ji.$$.fragment),s2=l(),wc=n("p"),R8=r("please, read the following notes first."),i2=l(),Qt=n("p"),W8=r("In these notes we give examples for what to do when "),n_=n("code"),G8=r("pytorch"),M8=r(" has been built with CUDA "),s_=n("code"),H8=r("10.2"),B8=r(`. If your situation is
different remember to adjust the version number to the one you are after.`),l2=l(),rr=n("h4"),Ia=n("a"),i_=n("span"),f(Ki.$$.fragment),V8=l(),l_=n("span"),Y8=r("Possible problem #1"),d2=l(),Tc=n("p"),X8=r(`While, Pytorch comes with its own CUDA toolkit, to build these two projects you must have an identical version of CUDA
installed system-wide.`),c2=l(),Ve=n("p"),Z8=r("For example, if you installed "),d_=n("code"),J8=r("pytorch"),K8=r(" with "),c_=n("code"),Q8=r("cudatoolkit==10.2"),e9=r(` in the Python environment, you also need to have
CUDA `),p_=n("code"),t9=r("10.2"),o9=r(" installed system-wide."),p2=l(),eo=n("p"),r9=r("The exact location may vary from system to system, but "),m_=n("code"),a9=r("/usr/local/cuda-10.2"),n9=r(` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),h_=n("code"),s9=r("PATH"),i9=r(` environment variable, one can find the
installation location by doing:`),m2=l(),f(Qi.$$.fragment),h2=l(),Ua=n("p"),l9=r(`If you don\u2019t have CUDA installed system-wide, install it first. You will find the instructions by using your favorite
search engine. For example, if you\u2019re on Ubuntu you may want to search for: `),el=n("a"),d9=r("ubuntu cuda 10.2 install"),c9=r("."),u2=l(),ar=n("h4"),Fa=n("a"),u_=n("span"),f(tl.$$.fragment),p9=l(),f_=n("span"),m9=r("Possible problem #2"),f2=l(),Ec=n("p"),h9=r(`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),g2=l(),f(ol.$$.fragment),_2=l(),to=n("p"),u9=r("Now, in this situation you need to make sure that your "),g_=n("code"),f9=r("PATH"),g9=r(" and "),__=n("code"),_9=r("LD_LIBRARY_PATH"),v9=r(` environment variables contain
the correct paths to the desired CUDA version. Typically, package installers will set these to contain whatever the
last version was installed. If you encounter the problem, where the package build fails because it can\u2019t find the right
CUDA version despite you having it installed system-wide, it means that you need to adjust the 2 aforementioned
environment variables.`),v2=l(),$c=n("p"),b9=r("First, you may look at their contents:"),b2=l(),f(rl.$$.fragment),y2=l(),xc=n("p"),y9=r("so you get an idea of what is inside."),w2=l(),za=n("p"),w9=r("It\u2019s possible that "),v_=n("code"),T9=r("LD_LIBRARY_PATH"),E9=r(" is empty."),T2=l(),ht=n("p"),b_=n("code"),$9=r("PATH"),x9=r(" lists the locations of where executables can be found and "),y_=n("code"),k9=r("LD_LIBRARY_PATH"),A9=r(` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),w_=n("code"),q9=r(":"),P9=r(` is used to separate multiple
entries.`),E2=l(),kc=n("p"),D9=r(`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),$2=l(),f(al.$$.fragment),x2=l(),Ac=n("p"),S9=r("Note that we aren\u2019t overwriting the existing values, but prepending instead."),k2=l(),Ye=n("p"),O9=r(`Of course, adjust the version number, the full path if need be. Check that the directories you assign actually do
exist. `),T_=n("code"),C9=r("lib64"),I9=r(" sub-directory is where the various CUDA "),E_=n("code"),U9=r(".so"),F9=r(" objects, like "),$_=n("code"),z9=r("libcudart.so"),N9=r(` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),A2=l(),nr=n("h4"),Na=n("a"),x_=n("span"),f(nl.$$.fragment),L9=l(),k_=n("span"),j9=r("Possible problem #3"),q2=l(),oo=n("p"),R9=r("Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),A_=n("code"),W9=r("gcc-9"),G9=r(` but it wants
`),q_=n("code"),M9=r("gcc-7"),H9=r("."),P2=l(),qc=n("p"),B9=r("There are various ways to go about it."),D2=l(),Pc=n("p"),V9=r("If you can install the latest CUDA toolkit it typically should support the newer compiler."),S2=l(),La=n("p"),Y9=r(`Alternatively, you could install the lower version of the compiler in addition to the one you already have, or you may
already have it but it\u2019s not the default one, so the build system can\u2019t see it. If you have `),P_=n("code"),X9=r("gcc-7"),Z9=r(` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),O2=l(),f(sl.$$.fragment),C2=l(),ee=n("p"),J9=r("Here, we are making a symlink to "),D_=n("code"),K9=r("gcc-7"),Q9=r(" from "),S_=n("code"),eS=r("/usr/local/cuda-10.2/bin/gcc"),tS=r(` and since
`),O_=n("code"),oS=r("/usr/local/cuda-10.2/bin/"),rS=r(" should be in the "),C_=n("code"),aS=r("PATH"),nS=r(` environment variable (see the previous problem\u2019s solution), it
should find `),I_=n("code"),sS=r("gcc-7"),iS=r(" (and "),U_=n("code"),lS=r("g++7"),dS=r(") and then the build will succeed."),I2=l(),Dc=n("p"),cS=r("As always make sure to edit the paths in the example to match your situation."),U2=l(),sr=n("h3"),ja=n("a"),F_=n("span"),f(il.$$.fragment),pS=l(),z_=n("span"),mS=r("FairScale"),F2=l(),f(Ra.$$.fragment),z2=l(),Xe=n("p"),hS=r("By integrating "),ll=n("a"),uS=r("FairScale"),fS=r(" the "),Sc=n("a"),gS=r("Trainer"),_S=r(`
provides support for the following features from `),dl=n("a"),vS=r("the ZeRO paper"),bS=r(":"),N2=l(),Ze=n("ol"),N_=n("li"),yS=r("Optimizer State Sharding"),wS=l(),L_=n("li"),TS=r("Gradient Sharding"),ES=l(),j_=n("li"),$S=r("Model Parameters Sharding (new and very experimental)"),xS=l(),R_=n("li"),kS=r("CPU offload (new and very experimental)"),L2=l(),Oc=n("p"),AS=r("You will need at least two GPUs to use this feature."),j2=l(),cl=n("p"),W_=n("strong"),qS=r("Installation"),PS=r(":"),R2=l(),Cc=n("p"),DS=r("Install the library via pypi:"),W2=l(),f(pl.$$.fragment),G2=l(),ro=n("p"),SS=r("or via "),G_=n("code"),OS=r("transformers"),CS=r("\u2019 "),M_=n("code"),IS=r("extras"),US=r(":"),M2=l(),f(ml.$$.fragment),H2=l(),ao=n("p"),FS=r("(available starting from "),H_=n("code"),zS=r("transformers==4.6.0"),NS=r(") or find more details on "),hl=n("a"),LS=r("the FairScale\u2019s GitHub page"),jS=r("."),B2=l(),Wa=n("p"),RS=r("If you\u2019re still struggling with the build, first make sure to read "),Ic=n("a"),WS=r("CUDA Extension Installation Notes"),GS=r("."),V2=l(),Uc=n("p"),MS=r("If it\u2019s still not resolved the build issue, here are a few more ideas."),Y2=l(),ul=n("p"),B_=n("code"),HS=r("fairscale"),BS=r(` seems to have an issue with the recently introduced by pip build isolation feature. If you have a problem
with it, you may want to try one of:`),X2=l(),f(fl.$$.fragment),Z2=l(),Fc=n("p"),VS=r("or:"),J2=l(),f(gl.$$.fragment),K2=l(),_l=n("p"),V_=n("code"),YS=r("fairscale"),XS=r(" also has issues with building against pytorch-nightly, so if you use it you may have to try one of:"),Q2=l(),f(vl.$$.fragment),ew=l(),zc=n("p"),ZS=r("or:"),tw=l(),f(bl.$$.fragment),ow=l(),Nc=n("p"),JS=r("Of course, adjust the urls to match the cuda version you use."),rw=l(),Ga=n("p"),KS=r(`If after trying everything suggested you still encounter build issues, please, proceed with the GitHub Issue of
`),yl=n("a"),QS=r("FairScale"),eO=r("."),aw=l(),wl=n("p"),Y_=n("strong"),tO=r("Usage"),oO=r(":"),nw=l(),no=n("p"),rO=r("To use the first version of Sharded data-parallelism, add "),X_=n("code"),aO=r("--sharded_ddp simple"),nO=r(` to the command line arguments, and
make sure you have added the distributed launcher `),Z_=n("code"),sO=r("-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),iO=r(" if you haven\u2019t been using it already."),sw=l(),Ma=n("p"),lO=r("For example here is how you could use it for "),J_=n("code"),dO=r("run_translation.py"),cO=r(" with 2 GPUs:"),iw=l(),f(Tl.$$.fragment),lw=l(),Lc=n("p"),pO=r("Notes:"),dw=l(),Je=n("ul"),K_=n("li"),mO=r("This feature requires distributed training (so multiple GPUs)."),hO=l(),Q_=n("li"),uO=r("It is not implemented for TPUs."),fO=l(),El=n("li"),gO=r("It works with "),ev=n("code"),_O=r("--fp16"),vO=r(" too, to make things even faster."),bO=l(),$l=n("li"),yO=r("One of the main benefits of enabling "),tv=n("code"),wO=r("--sharded_ddp simple"),TO=r(` is that it uses a lot less GPU memory, so you should be
able to use significantly larger batch sizes using the same hardware (e.g. 3x and even bigger) which should lead to
significantly shorter training time.`),cw=l(),xl=n("ol"),ut=n("li"),EO=r("To use the second version of Sharded data-parallelism, add "),ov=n("code"),$O=r("--sharded_ddp zero_dp_2"),xO=r(" or "),rv=n("code"),kO=r("--sharded_ddp zero_dp_3"),AO=r(" to the command line arguments, and make sure you have added the distributed launcher "),av=n("code"),qO=r("-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),PO=r(" if you haven\u2019t been using it already."),pw=l(),Ha=n("p"),DO=r("For example here is how you could use it for "),nv=n("code"),SO=r("run_translation.py"),OO=r(" with 2 GPUs:"),mw=l(),f(kl.$$.fragment),hw=l(),ir=n("p"),sv=n("code"),CO=r("zero_dp_2"),IO=r(" is an optimized version of the simple wrapper, while "),iv=n("code"),UO=r("zero_dp_3"),FO=r(` fully shards model weights,
gradients and optimizer states.`),uw=l(),so=n("p"),zO=r("Both are compatible with adding "),lv=n("code"),NO=r("cpu_offload"),LO=r(" to enable ZeRO-offload (activate it like this: "),dv=n("code"),jO=r('--sharded_ddp "zero_dp_2 cpu_offload"'),RO=r(")."),fw=l(),jc=n("p"),WO=r("Notes:"),gw=l(),be=n("ul"),cv=n("li"),GO=r("This feature requires distributed training (so multiple GPUs)."),MO=l(),pv=n("li"),HO=r("It is not implemented for TPUs."),BO=l(),Al=n("li"),VO=r("It works with "),mv=n("code"),YO=r("--fp16"),XO=r(" too, to make things even faster."),ZO=l(),lr=n("li"),JO=r("The "),hv=n("code"),KO=r("cpu_offload"),QO=r(" additional option requires "),uv=n("code"),eC=r("--fp16"),tC=r("."),oC=l(),fv=n("li"),rC=r(`This is an area of active development, so make sure you have a source install of fairscale to use this feature as
some bugs you encounter may have been fixed there already.`),_w=l(),Rc=n("p"),aC=r("Known caveats:"),vw=l(),Ba=n("ul"),dr=n("li"),nC=r("This feature is incompatible with "),gv=n("code"),sC=r("--predict_with_generate"),iC=r(" in the "),_v=n("em"),lC=r("run_translation.py"),dC=r(" script."),cC=l(),Pe=n("li"),pC=r("Using "),vv=n("code"),mC=r("--sharded_ddp zero_dp_3"),hC=r(` requires wrapping each layer of the model in the special container
`),bv=n("code"),uC=r("FullyShardedDataParallelism"),fC=r(" of fairscale. It should be used with the option "),yv=n("code"),gC=r("auto_wrap"),_C=r(` if you are not
doing this yourself: `),wv=n("code"),vC=r('--sharded_ddp "zero_dp_3 auto_wrap"'),bC=r("."),bw=l(),cr=n("h3"),Va=n("a"),Tv=n("span"),f(ql.$$.fragment),yC=l(),Ev=n("span"),wC=r("PyTorch Fully Sharded Data parallel"),yw=l(),Ya=n("p"),TC=r(`To accelerate training huge models on larger batch sizes, we can use a fully sharded data parallel model.
This type of data parallel paradigm enables fitting more data and larger models by sharding the optimizer states, gradients and parameters.
To read more about it and the benefits, check out the `),Pl=n("a"),EC=r("Fully Sharded Data Parallel blog"),$C=r(`.
We have integrated the latest PyTorch\u2019s Fully Sharded Data Parallel (FSDP) training feature.
All you need to do is enable it through the config.`),ww=l(),Dl=n("p"),$v=n("strong"),xC=r("Required PyTorch version for FSDP support"),kC=r(`: PyTorch Nightly (or 1.12.0 if you read this after it has been released)
as the model saving with FSDP activated is only available with recent fixes.`),Tw=l(),Sl=n("p"),xv=n("strong"),AC=r("Usage"),qC=r(":"),Ew=l(),pe=n("ul"),kv=n("li"),Ol=n("p"),PC=r(`Make sure you have added the distributed launcher
`),Av=n("code"),DC=r("-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),SC=r(" if you haven\u2019t been using it already."),OC=l(),Cl=n("li"),Wc=n("p"),qv=n("strong"),CC=r("Sharding Strategy"),IC=r(":"),UC=l(),pr=n("ul"),Il=n("li"),FC=r(`FULL_SHARD : Shards optimizer states + gradients + model parameters across data parallel workers/GPUs.
For this, add `),Pv=n("code"),zC=r("--fsdp full_shard"),NC=r(" to the command line arguments."),LC=l(),Ul=n("li"),jC=r(`SHARD_GRAD_OP : Shards optimizer states + gradients across data parallel workers/GPUs.
For this, add `),Dv=n("code"),RC=r("--fsdp shard_grad_op"),WC=r(" to the command line arguments."),GC=l(),Fl=n("li"),MC=r("NO_SHARD : No sharding. For this, add "),Sv=n("code"),HC=r("--fsdp no_shard"),BC=r(" to the command line arguments."),VC=l(),Ov=n("li"),mr=n("p"),YC=r(`To offload the parameters and gradients to the CPU,
add `),Cv=n("code"),XC=r('--fsdp "full_shard offload"'),ZC=r(" or "),Iv=n("code"),JC=r('--fsdp "shard_grad_op offload"'),KC=r(" to the command line arguments."),QC=l(),Uv=n("li"),ft=n("p"),eI=r("To automatically recursively wrap layers with FSDP using "),Fv=n("code"),tI=r("default_auto_wrap_policy"),oI=r(`,
add `),zv=n("code"),rI=r('--fsdp "full_shard auto_wrap"'),aI=r(" or "),Nv=n("code"),nI=r('--fsdp "shard_grad_op auto_wrap"'),sI=r(" to the command line arguments."),iI=l(),Lv=n("li"),hr=n("p"),lI=r(`To enable both CPU offloading and auto wrapping,
add `),jv=n("code"),dI=r('--fsdp "full_shard offload auto_wrap"'),cI=r(" or "),Rv=n("code"),pI=r('--fsdp "shard_grad_op offload auto_wrap"'),mI=r(" to the command line arguments."),hI=l(),zl=n("li"),gt=n("p"),uI=r("Remaining FSDP config is passed via "),Wv=n("code"),fI=r("--fsdp_config <path_to_fsdp_config.json>"),gI=r(`. It is either a location of
FSDP json config file (e.g., `),Gv=n("code"),_I=r("fsdp_config.json"),vI=r(") or an already loaded json file as "),Mv=n("code"),bI=r("dict"),yI=r("."),wI=l(),_t=n("ul"),Gc=n("li"),TI=r("If auto wrapping is enabled, you can either use transformer based auto wrap policy or size based auto wrap policy."),Nl=n("ul"),De=n("li"),EI=r("For transformer based auto wrap policy, please specify "),Hv=n("code"),$I=r("fsdp_transformer_layer_cls_to_wrap"),xI=r(` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),Bv=n("code"),kI=r("BertLayer"),AI=r(", "),Vv=n("code"),qI=r("GPTJBlock"),PI=r(", "),Yv=n("code"),DI=r("T5Block"),SI=r(` \u2026
This is important because submodules that share weights (e.g., embedding layer) should not end up in different FSDP wrapped units.
Using this policy, wrapping happens for each block containing Multi-Head Attention followed by couple of MLP layers.
Remaining layers including the shared embeddings are conveniently wrapped in same outermost FSDP unit.
Therefore, use this for transformer based models.`),OI=l(),Ll=n("li"),CI=r("For size based auto wrap policy, please add "),Xv=n("code"),II=r("fsdp_min_num_params"),UI=r(` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),FI=l(),vt=n("li"),Zv=n("code"),zI=r("fsdp_backward_prefetch"),NI=r(` can be specified in the config file. It controls when to prefetch next set of parameters.
`),Jv=n("code"),LI=r("backward_pre"),jI=r(" and "),Kv=n("code"),RI=r("backward_pos"),WI=r(` are available options.
For more information refer `),Qv=n("code"),GI=r("torch.distributed.fsdp.fully_sharded_data_parallel.BackwardPrefetch"),MI=l(),Xa=n("li"),eb=n("code"),HI=r("fsdp_forward_prefetch"),BI=r(` can be specified in the config file. It controls when to prefetch next set of parameters.
If `),tb=n("code"),VI=r('"True"'),YI=r(", FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass."),XI=l(),Za=n("li"),ob=n("code"),ZI=r("limit_all_gathers"),JI=r(` can be specified in the config file.
If `),rb=n("code"),KI=r('"True"'),QI=r(", FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers."),$w=l(),Mc=n("p"),ab=n("strong"),eU=r("Few caveats to be aware of"),xw=l(),Hc=n("ul"),Ke=n("li"),tU=r("it is incompatible with "),nb=n("code"),oU=r("generate"),rU=r(", thus is incompatible with "),sb=n("code"),aU=r("--predict_with_generate"),nU=r(`
in all seq2seq/clm scripts (translation/summarization/clm etc.).`),sU=n("br"),iU=r(`
Please refer issue `),jl=n("a"),lU=r("#21667"),kw=l(),ur=n("h3"),Ja=n("a"),ib=n("span"),f(Rl.$$.fragment),dU=l(),lb=n("span"),cU=r("PyTorch/XLA Fully Sharded Data parallel"),Aw=l(),io=n("p"),pU=r(`For all the TPU users, great news! PyTorch/XLA now supports FSDP.
All the latest Fully Sharded Data Parallel (FSDP) training are supported.
For more information refer to the `),Wl=n("a"),mU=r("Scaling PyTorch models on Cloud TPUs with FSDP"),hU=r(" and "),Gl=n("a"),uU=r("PyTorch/XLA implementation of FSDP"),fU=r(`
All you need to do is enable it through the config.`),qw=l(),Ml=n("p"),db=n("strong"),gU=r("Required PyTorch/XLA version for FSDP support"),_U=r(": >=2.0"),Pw=l(),Hl=n("p"),cb=n("strong"),vU=r("Usage"),bU=r(":"),Dw=l(),lo=n("p"),yU=r("Pass "),pb=n("code"),wU=r('--fsdp "full shard"'),TU=r(" along with following changes to be made in "),mb=n("code"),EU=r("--fsdp_config <path_to_fsdp_config.json>"),$U=r(":"),Sw=l(),Qe=n("ul"),Ka=n("li"),hb=n("code"),xU=r("xla"),kU=r(" should be set to "),ub=n("code"),AU=r("True"),qU=r(" to enable PyTorch/XLA FSDP."),PU=l(),Qa=n("li"),fb=n("code"),DU=r("xla_fsdp_settings"),SU=r(` The value is a dictionary which stores the XLA FSDP wrapping parameters.
For a complete list of options, please see `),Bl=n("a"),OU=r("here"),CU=r("."),IU=l(),et=n("li"),gb=n("code"),UU=r("xla_fsdp_grad_ckpt"),FU=r(". When "),_b=n("code"),zU=r("True"),NU=r(`, uses gradient checkpointing over each nested XLA FSDP wrapped layer.
This setting can only be used when the xla flag is set to true, and an auto wrapping policy is specified through
`),vb=n("code"),LU=r("fsdp_min_num_params"),jU=r(" or "),bb=n("code"),RU=r("fsdp_transformer_layer_cls_to_wrap"),WU=r("."),GU=l(),Bc=n("li"),MU=r("You can either use transformer based auto wrap policy or size based auto wrap policy."),Vl=n("ul"),Se=n("li"),HU=r("For transformer based auto wrap policy, please specify "),yb=n("code"),BU=r("fsdp_transformer_layer_cls_to_wrap"),VU=r(` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),wb=n("code"),YU=r("BertLayer"),XU=r(", "),Tb=n("code"),ZU=r("GPTJBlock"),JU=r(", "),Eb=n("code"),KU=r("T5Block"),QU=r(` \u2026
This is important because submodules that share weights (e.g., embedding layer) should not end up in different FSDP wrapped units.
Using this policy, wrapping happens for each block containing Multi-Head Attention followed by couple of MLP layers.
Remaining layers including the shared embeddings are conveniently wrapped in same outermost FSDP unit.
Therefore, use this for transformer based models.`),eF=l(),Yl=n("li"),tF=r("For size based auto wrap policy, please add "),$b=n("code"),oF=r("fsdp_min_num_params"),rF=r(` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),Ow=l(),fr=n("h3"),en=n("a"),xb=n("span"),f(Xl.$$.fragment),aF=l(),kb=n("span"),nF=r("Using Trainer for accelerated PyTorch Training on Mac"),Cw=l(),tt=n("p"),sF=r(`With PyTorch v1.12 release, developers and researchers can take advantage of Apple silicon GPUs for significantly faster model training.
This unlocks the ability to perform machine learning workflows like prototyping and fine-tuning locally, right on Mac.
Apple\u2019s Metal Performance Shaders (MPS) as a backend for PyTorch enables this and can be used via the new `),Ab=n("code"),iF=r('"mps"'),lF=r(` device.
This will map computational graphs and primitives on the MPS Graph framework and tuned kernels provided by MPS.
For more information please refer official documents `),Zl=n("a"),dF=r("Introducing Accelerated PyTorch Training on Mac"),cF=r(`
and `),Jl=n("a"),pF=r("MPS BACKEND"),mF=r("."),Iw=l(),f(tn.$$.fragment),Uw=l(),Vc=n("p"),qb=n("strong"),hF=r("Benefits of Training and Inference using Apple Silicon Chips"),Fw=l(),co=n("ol"),Pb=n("li"),uF=r("Enables users to train larger networks or batch sizes locally"),fF=l(),Db=n("li"),gF=r(`Reduces data retrieval latency and provides the GPU with direct access to the full memory store due to unified memory architecture.
Therefore, improving end-to-end performance.`),_F=l(),Sb=n("li"),vF=r("Reduces costs associated with cloud-based development or the need for additional local GPUs."),zw=l(),gr=n("p"),Ob=n("strong"),bF=r("Pre-requisites"),yF=r(`: To install torch with mps support,
please follow this nice medium article `),Kl=n("a"),wF=r("GPU-Acceleration Comes to PyTorch on M1 Macs"),TF=r("."),Nw=l(),_r=n("p"),Cb=n("strong"),EF=r("Usage"),$F=r(`:
User has to just pass `),Ib=n("code"),xF=r("--use_mps_device"),kF=r(` argument.
For example, you can run the official Glue text classififcation task (from the root folder) using Apple Silicon GPU with below command:`),Lw=l(),f(Ql.$$.fragment),jw=l(),Yc=n("p"),Ub=n("strong"),AF=r("A few caveats to be aware of"),Rw=l(),on=n("ol"),ed=n("li"),qF=r(`Some PyTorch operations have not been implemented in mps and will throw an error.
One way to get around that is to set the environment variable `),Fb=n("code"),PF=r("PYTORCH_ENABLE_MPS_FALLBACK=1"),DF=r(`,
which will fallback to CPU for these operations. It still throws a UserWarning however.`),SF=l(),Oe=n("li"),OF=r("Distributed setups "),zb=n("code"),CF=r("gloo"),IF=r(" and "),Nb=n("code"),UF=r("nccl"),FF=r(" are not working with "),Lb=n("code"),zF=r("mps"),NF=r(` device.
This means that currently only single GPU of `),jb=n("code"),LF=r("mps"),jF=r(" device type can be used."),Ww=l(),po=n("p"),RF=r("Finally, please, remember that, \u{1F917} "),Rb=n("code"),WF=r("Trainer"),GF=r(` only integrates MPS backend, therefore if you
have any problems or questions with regards to MPS backend usage, please,
file an issue with `),td=n("a"),MF=r("PyTorch GitHub"),HF=r("."),Gw=l(),Xc=n("p"),BF=r("Sections that were moved:"),Mw=l(),q=n("p"),VF=r("[ "),Zc=n("a"),YF=r("DeepSpeed"),Wb=n("a"),XF=r(`
| `),Jc=n("a"),ZF=r("Installation"),Gb=n("a"),JF=r(`
| `),Kc=n("a"),KF=r("Deployment with multiple GPUs"),Mb=n("a"),QF=r(`
| `),Qc=n("a"),ez=r("Deployment with one GPU"),Hb=n("a"),tz=r(`
| `),ep=n("a"),oz=r("Deployment in Notebooks"),Bb=n("a"),rz=r(`
| `),tp=n("a"),az=r("Configuration"),Vb=n("a"),nz=r(`
| `),op=n("a"),sz=r("Passing Configuration"),Yb=n("a"),iz=r(`
| `),rp=n("a"),lz=r("Shared Configuration"),Xb=n("a"),dz=r(`
| `),ap=n("a"),cz=r("ZeRO"),Zb=n("a"),pz=r(`
| `),np=n("a"),mz=r("ZeRO-2 Config"),Jb=n("a"),hz=r(`
| `),sp=n("a"),uz=r("ZeRO-3 Config"),Kb=n("a"),fz=r(`
| `),ip=n("a"),gz=r("NVMe Support"),Qb=n("a"),_z=r(`
| `),lp=n("a"),vz=r("ZeRO-2 vs ZeRO-3 Performance"),e1=n("a"),bz=r(`
| `),dp=n("a"),yz=r("ZeRO-2 Example"),t1=n("a"),wz=r(`
| `),cp=n("a"),Tz=r("ZeRO-3 Example"),o1=n("a"),Ez=r(`
| `),pp=n("a"),$z=r("Optimizer"),r1=n("a"),xz=r(`
| `),mp=n("a"),kz=r("Scheduler"),a1=n("a"),Az=r(`
| `),hp=n("a"),qz=r("fp32 Precision"),n1=n("a"),Pz=r(`
| `),up=n("a"),Dz=r("Automatic Mixed Precision"),s1=n("a"),Sz=r(`
| `),fp=n("a"),Oz=r("Batch Size"),i1=n("a"),Cz=r(`
| `),gp=n("a"),Iz=r("Gradient Accumulation"),l1=n("a"),Uz=r(`
| `),_p=n("a"),Fz=r("Gradient Clipping"),d1=n("a"),zz=r(`
| `),vp=n("a"),Nz=r("Getting The Model Weights Out"),c1=n("a"),Lz=r(`
]`),this.h()},l(t){const c=QV('[data-svelte="svelte-1phssyn"]',document.head);u=s(c,"META",{name:!0,content:!0}),c.forEach(o),x=d(t),T=s(t,"H1",{class:!0});var od=i(T);w=s(od,"A",{id:!0,class:!0,href:!0});var p1=i(w);k=s(p1,"SPAN",{});var m1=i(k);g(h.$$.fragment,m1),m1.forEach(o),p1.forEach(o),E=d(od),z=s(od,"SPAN",{});var h1=i(z);j=a(h1,"Trainer"),h1.forEach(o),od.forEach(o),I=d(t),G=s(t,"P",{});var vr=i(G);B=a(vr,"The "),Q=s(vr,"A",{href:!0});var u1=i(Q);K=a(u1,"Trainer"),u1.forEach(o),Z=a(vr," class provides an API for feature-complete training in PyTorch for most standard use cases. It\u2019s used in most of the "),X=s(vr,"A",{href:!0,rel:!0});var f1=i(X);me=a(f1,"example scripts"),f1.forEach(o),J=a(vr,"."),vr.forEach(o),M=d(t),R=s(t,"P",{});var br=i(R);ae=a(br,"Before instantiating your "),N=s(br,"A",{href:!0});var g1=i(N);we=a(g1,"Trainer"),g1.forEach(o),Te=a(br,", create a "),ne=s(br,"A",{href:!0});var _1=i(ne);bt=a(_1,"TrainingArguments"),_1.forEach(o),yt=a(br," to access all the points of customization during training."),br.forEach(o),ue=d(t),Ie=s(t,"P",{});var rd=i(Ie);Dn=a(rd,"The API supports distributed training on multiple GPUs/TPUs, mixed precision through "),Ee=s(rd,"A",{href:!0,rel:!0});var v1=i(Ee);Sn=a(v1,"NVIDIA Apex"),v1.forEach(o),On=a(rd," and Native AMP for PyTorch."),rd.forEach(o),se=d(t),oe=s(t,"P",{});var ad=i(oe);ld=a(ad,"The "),$e=s(ad,"A",{href:!0});var b1=i($e);xr=a(b1,"Trainer"),b1.forEach(o),dd=a(ad," contains the basic training loop which supports the above features. To inject custom behavior you can subclass them and override the following methods:"),ad.forEach(o),Ao=d(t),W=s(t,"UL",{});var H=i(W);re=s(H,"LI",{});var bp=i(re);kr=s(bp,"STRONG",{});var y1=i(kr);cd=a(y1,"get_train_dataloader"),y1.forEach(o),pd=a(bp," \u2014 Creates the training DataLoader."),bp.forEach(o),md=d(H),hd=s(H,"LI",{});var yp=i(hd);Um=s(yp,"STRONG",{});var w1=i(Um);RT=a(w1,"get_eval_dataloader"),w1.forEach(o),WT=a(yp," \u2014 Creates the evaluation DataLoader."),yp.forEach(o),GT=d(H),ud=s(H,"LI",{});var jz=i(ud);Fm=s(jz,"STRONG",{});var hN=i(Fm);MT=a(hN,"get_test_dataloader"),hN.forEach(o),HT=a(jz," \u2014 Creates the test DataLoader."),jz.forEach(o),BT=d(H),fd=s(H,"LI",{});var Rz=i(fd);zm=s(Rz,"STRONG",{});var uN=i(zm);VT=a(uN,"log"),uN.forEach(o),YT=a(Rz," \u2014 Logs information on the various objects watching training."),Rz.forEach(o),XT=d(H),wt=s(H,"LI",{});var nd=i(wt);Nm=s(nd,"STRONG",{});var fN=i(Nm);ZT=a(fN,"create_optimizer_and_scheduler"),fN.forEach(o),JT=a(nd,` \u2014 Sets up the optimizer and learning rate scheduler if they were not passed at
init. Note, that you can also subclass or override the `),Lm=s(nd,"CODE",{});var gN=i(Lm);KT=a(gN,"create_optimizer"),gN.forEach(o),QT=a(nd," and "),jm=s(nd,"CODE",{});var _N=i(jm);e4=a(_N,"create_scheduler"),_N.forEach(o),t4=a(nd,` methods
separately.`),nd.forEach(o),o4=d(H),gd=s(H,"LI",{});var Wz=i(gd);Rm=s(Wz,"STRONG",{});var vN=i(Rm);r4=a(vN,"create_optimizer"),vN.forEach(o),a4=a(Wz," \u2014 Sets up the optimizer if it wasn\u2019t passed at init."),Wz.forEach(o),n4=d(H),_d=s(H,"LI",{});var Gz=i(_d);Wm=s(Gz,"STRONG",{});var bN=i(Wm);s4=a(bN,"create_scheduler"),bN.forEach(o),i4=a(Gz," \u2014 Sets up the learning rate scheduler if it wasn\u2019t passed at init."),Gz.forEach(o),l4=d(H),vd=s(H,"LI",{});var Mz=i(vd);Gm=s(Mz,"STRONG",{});var yN=i(Gm);d4=a(yN,"compute_loss"),yN.forEach(o),c4=a(Mz," - Computes the loss on a batch of training inputs."),Mz.forEach(o),p4=d(H),bd=s(H,"LI",{});var Hz=i(bd);Mm=s(Hz,"STRONG",{});var wN=i(Mm);m4=a(wN,"training_step"),wN.forEach(o),h4=a(Hz," \u2014 Performs a training step."),Hz.forEach(o),u4=d(H),yd=s(H,"LI",{});var Bz=i(yd);Hm=s(Bz,"STRONG",{});var TN=i(Hm);f4=a(TN,"prediction_step"),TN.forEach(o),g4=a(Bz," \u2014 Performs an evaluation/test step."),Bz.forEach(o),_4=d(H),wd=s(H,"LI",{});var Vz=i(wd);Bm=s(Vz,"STRONG",{});var EN=i(Bm);v4=a(EN,"evaluate"),EN.forEach(o),b4=a(Vz," \u2014 Runs an evaluation loop and returns metrics."),Vz.forEach(o),y4=d(H),Td=s(H,"LI",{});var Yz=i(Td);Vm=s(Yz,"STRONG",{});var $N=i(Vm);w4=a($N,"predict"),$N.forEach(o),T4=a(Yz," \u2014 Returns predictions (with metrics if labels are available) on a test set."),Yz.forEach(o),H.forEach(o),S1=d(t),g(Ar.$$.fragment,t),O1=d(t),qr=s(t,"P",{});var Bw=i(qr);E4=a(Bw,"Here is an example of how to customize "),Ed=s(Bw,"A",{href:!0});var xN=i(Ed);$4=a(xN,"Trainer"),xN.forEach(o),x4=a(Bw," to use a weighted loss (useful when you have an unbalanced training set):"),Bw.forEach(o),C1=d(t),g(Cn.$$.fragment,t),I1=d(t),Tt=s(t,"P",{});var wp=i(Tt);k4=a(wp,"Another way to customize the training loop behavior for the PyTorch "),$d=s(wp,"A",{href:!0});var kN=i($d);A4=a(kN,"Trainer"),kN.forEach(o),q4=a(wp," is to use "),xd=s(wp,"A",{href:!0});var AN=i(xd);P4=a(AN,"callbacks"),AN.forEach(o),D4=a(wp," that can inspect the training loop state (for progress reporting, logging on TensorBoard or other ML platforms\u2026) and take decisions (like early stopping)."),wp.forEach(o),U1=d(t),qo=s(t,"H2",{class:!0});var Vw=i(qo);Pr=s(Vw,"A",{id:!0,class:!0,href:!0});var qN=i(Pr);Ym=s(qN,"SPAN",{});var PN=i(Ym);g(In.$$.fragment,PN),PN.forEach(o),qN.forEach(o),S4=d(Vw),Xm=s(Vw,"SPAN",{});var DN=i(Xm);O4=a(DN,"Trainer"),DN.forEach(o),Vw.forEach(o),F1=d(t),$=s(t,"DIV",{class:!0});var A=i($);g(Un.$$.fragment,A),C4=d(A),Zm=s(A,"P",{});var SN=i(Zm);I4=a(SN,"Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for \u{1F917} Transformers."),SN.forEach(o),U4=d(A),Jm=s(A,"P",{});var ON=i(Jm);F4=a(ON,"Important attributes:"),ON.forEach(o),z4=d(A),xe=s(A,"UL",{});var mo=i(xe);Dr=s(mo,"LI",{});var T1=i(Dr);Km=s(T1,"STRONG",{});var CN=i(Km);N4=a(CN,"model"),CN.forEach(o),L4=a(T1," \u2014 Always points to the core model. If using a transformers model, it will be a "),kd=s(T1,"A",{href:!0});var IN=i(kd);j4=a(IN,"PreTrainedModel"),IN.forEach(o),R4=a(T1,`
subclass.`),T1.forEach(o),W4=d(mo),ie=s(mo,"LI",{});var Ce=i(ie);Qm=s(Ce,"STRONG",{});var UN=i(Qm);G4=a(UN,"model_wrapped"),UN.forEach(o),M4=a(Ce,` \u2014 Always points to the most external model in case one or more other modules wrap the
original model. This is the model that should be used for the forward pass. For example, under `),eh=s(Ce,"CODE",{});var FN=i(eh);H4=a(FN,"DeepSpeed"),FN.forEach(o),B4=a(Ce,`,
the inner model is wrapped in `),th=s(Ce,"CODE",{});var zN=i(th);V4=a(zN,"DeepSpeed"),zN.forEach(o),Y4=a(Ce," and then again in "),oh=s(Ce,"CODE",{});var NN=i(oh);X4=a(NN,"torch.nn.DistributedDataParallel"),NN.forEach(o),Z4=a(Ce,`. If the inner
model hasn\u2019t been wrapped, then `),rh=s(Ce,"CODE",{});var LN=i(rh);J4=a(LN,"self.model_wrapped"),LN.forEach(o),K4=a(Ce," is the same as "),ah=s(Ce,"CODE",{});var jN=i(ah);Q4=a(jN,"self.model"),jN.forEach(o),eE=a(Ce,"."),Ce.forEach(o),tE=d(mo),Ad=s(mo,"LI",{});var Xz=i(Ad);nh=s(Xz,"STRONG",{});var RN=i(nh);oE=a(RN,"is_model_parallel"),RN.forEach(o),rE=a(Xz,` \u2014 Whether or not a model has been switched to a model parallel mode (different from
data parallelism, this means some of the model layers are split on different GPUs).`),Xz.forEach(o),aE=d(mo),Ue=s(mo,"LI",{});var yr=i(Ue);sh=s(yr,"STRONG",{});var WN=i(sh);nE=a(WN,"place_model_on_device"),WN.forEach(o),sE=a(yr,` \u2014 Whether or not to automatically place the model on the device - it will be set
to `),ih=s(yr,"CODE",{});var GN=i(ih);iE=a(GN,"False"),GN.forEach(o),lE=a(yr,` if model parallel or deepspeed is used, or if the default
`),lh=s(yr,"CODE",{});var MN=i(lh);dE=a(MN,"TrainingArguments.place_model_on_device"),MN.forEach(o),cE=a(yr," is overridden to return "),dh=s(yr,"CODE",{});var HN=i(dh);pE=a(HN,"False"),HN.forEach(o),mE=a(yr," ."),yr.forEach(o),hE=d(mo),Fe=s(mo,"LI",{});var wr=i(Fe);ch=s(wr,"STRONG",{});var BN=i(ch);uE=a(BN,"is_in_train"),BN.forEach(o),fE=a(wr," \u2014 Whether or not a model is currently running "),ph=s(wr,"CODE",{});var VN=i(ph);gE=a(VN,"train"),VN.forEach(o),_E=a(wr," (e.g. when "),mh=s(wr,"CODE",{});var YN=i(mh);vE=a(YN,"evaluate"),YN.forEach(o),bE=a(wr,` is called while
in `),hh=s(wr,"CODE",{});var XN=i(hh);yE=a(XN,"train"),XN.forEach(o),wE=a(wr,")"),wr.forEach(o),mo.forEach(o),TE=d(A),Sr=s(A,"DIV",{class:!0});var Yw=i(Sr);g(Fn.$$.fragment,Yw),EE=d(Yw),zn=s(Yw,"P",{});var Xw=i(zn);$E=a(Xw,"Add a callback to the current list of "),uh=s(Xw,"CODE",{});var ZN=i(uh);xE=a(ZN,"~transformer.TrainerCallback"),ZN.forEach(o),kE=a(Xw,"."),Xw.forEach(o),Yw.forEach(o),AE=d(A),Or=s(A,"DIV",{class:!0});var Zw=i(Or);g(Nn.$$.fragment,Zw),qE=d(Zw),Ln=s(Zw,"P",{});var Jw=i(Ln);PE=a(Jw,"A helper wrapper that creates an appropriate context manager for "),fh=s(Jw,"CODE",{});var JN=i(fh);DE=a(JN,"autocast"),JN.forEach(o),SE=a(Jw,` while feeding it the desired
arguments, depending on the situation.`),Jw.forEach(o),Zw.forEach(o),OE=d(A),Et=s(A,"DIV",{class:!0});var Tp=i(Et);g(jn.$$.fragment,Tp),CE=d(Tp),gh=s(Tp,"P",{});var KN=i(gh);IE=a(KN,"How the loss is computed by Trainer. By default, all models return the loss in the first element."),KN.forEach(o),UE=d(Tp),_h=s(Tp,"P",{});var QN=i(_h);FE=a(QN,"Subclass and override for custom behavior."),QN.forEach(o),Tp.forEach(o),zE=d(A),Cr=s(A,"DIV",{class:!0});var Kw=i(Cr);g(Rn.$$.fragment,Kw),NE=d(Kw),vh=s(Kw,"P",{});var eL=i(vh);LE=a(eL,"A helper wrapper to group together context managers."),eL.forEach(o),Kw.forEach(o),jE=d(A),Ir=s(A,"DIV",{class:!0});var Qw=i(Ir);g(Wn.$$.fragment,Qw),RE=d(Qw),Gn=s(Qw,"P",{});var e0=i(Gn);WE=a(e0,"Creates a draft of a model card using the information available to the "),bh=s(e0,"CODE",{});var tL=i(bh);GE=a(tL,"Trainer"),tL.forEach(o),ME=a(e0,"."),e0.forEach(o),Qw.forEach(o),HE=d(A),$t=s(A,"DIV",{class:!0});var Ep=i($t);g(Mn.$$.fragment,Ep),BE=d(Ep),yh=s(Ep,"P",{});var oL=i(yh);VE=a(oL,"Setup the optimizer."),oL.forEach(o),YE=d(Ep),Hn=s(Ep,"P",{});var t0=i(Hn);XE=a(t0,`We provide a reasonable default that works well. If you want to use something else, you can pass a tuple in the
Trainer\u2019s init through `),wh=s(t0,"CODE",{});var rL=i(wh);ZE=a(rL,"optimizers"),rL.forEach(o),JE=a(t0,", or subclass and override this method in a subclass."),t0.forEach(o),Ep.forEach(o),KE=d(A),xt=s(A,"DIV",{class:!0});var $p=i(xt);g(Bn.$$.fragment,$p),QE=d($p),Th=s($p,"P",{});var aL=i(Th);e$=a(aL,"Setup the optimizer and the learning rate scheduler."),aL.forEach(o),t$=d($p),it=s($p,"P",{});var rn=i(it);o$=a(rn,`We provide a reasonable default that works well. If you want to use something else, you can pass a tuple in the
Trainer\u2019s init through `),Eh=s(rn,"CODE",{});var nL=i(Eh);r$=a(nL,"optimizers"),nL.forEach(o),a$=a(rn,", or subclass and override this method (or "),$h=s(rn,"CODE",{});var sL=i($h);n$=a(sL,"create_optimizer"),sL.forEach(o),s$=a(rn,` and/or
`),xh=s(rn,"CODE",{});var iL=i(xh);i$=a(iL,"create_scheduler"),iL.forEach(o),l$=a(rn,") in a subclass."),rn.forEach(o),$p.forEach(o),d$=d(A),Ur=s(A,"DIV",{class:!0});var o0=i(Ur);g(Vn.$$.fragment,o0),c$=d(o0),kh=s(o0,"P",{});var lL=i(kh);p$=a(lL,`Setup the scheduler. The optimizer of the trainer must have been set up either before this method is called or
passed as an argument.`),lL.forEach(o),o0.forEach(o),m$=d(A),ze=s(A,"DIV",{class:!0});var an=i(ze);g(Yn.$$.fragment,an),h$=d(an),Ah=s(an,"P",{});var dL=i(Ah);u$=a(dL,"Run evaluation and returns metrics."),dL.forEach(o),f$=d(an),Xn=s(an,"P",{});var r0=i(Xn);g$=a(r0,`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),qh=s(r0,"CODE",{});var cL=i(qh);_$=a(cL,"compute_metrics"),cL.forEach(o),v$=a(r0," argument)."),r0.forEach(o),b$=d(an),Ph=s(an,"P",{});var pL=i(Ph);y$=a(pL,"You can also subclass and override this method to inject custom behavior."),pL.forEach(o),an.forEach(o),w$=d(A),kt=s(A,"DIV",{class:!0});var xp=i(kt);g(Zn.$$.fragment,xp),T$=d(xp),Po=s(xp,"P",{});var kp=i(Po);E$=a(kp,"Prediction/evaluation loop, shared by "),Dh=s(kp,"CODE",{});var mL=i(Dh);$$=a(mL,"Trainer.evaluate()"),mL.forEach(o),x$=a(kp," and "),Sh=s(kp,"CODE",{});var hL=i(Sh);k$=a(hL,"Trainer.predict()"),hL.forEach(o),A$=a(kp,"."),kp.forEach(o),q$=d(xp),Oh=s(xp,"P",{});var uL=i(Oh);P$=a(uL,"Works both with or without labels."),uL.forEach(o),xp.forEach(o),D$=d(A),Fr=s(A,"DIV",{class:!0});var a0=i(Fr);g(Jn.$$.fragment,a0),S$=d(a0),Kn=s(a0,"P",{});var n0=i(Kn);O$=a(n0,"For models that inherit from "),qd=s(n0,"A",{href:!0});var fL=i(qd);C$=a(fL,"PreTrainedModel"),fL.forEach(o),I$=a(n0,`, uses that method to compute the number of floating point
operations for every backward + forward pass. If using another model, either implement such a method in the
model or subclass and override this method.`),n0.forEach(o),a0.forEach(o),U$=d(A),At=s(A,"DIV",{class:!0});var Ap=i(At);g(Qn.$$.fragment,Ap),F$=d(Ap),es=s(Ap,"P",{});var s0=i(es);z$=a(s0,"Returns the evaluation "),Ch=s(s0,"CODE",{});var gL=i(Ch);N$=a(gL,"~torch.utils.data.DataLoader"),gL.forEach(o),L$=a(s0,"."),s0.forEach(o),j$=d(Ap),Ih=s(Ap,"P",{});var _L=i(Ih);R$=a(_L,"Subclass and override this method if you want to inject some custom behavior."),_L.forEach(o),Ap.forEach(o),W$=d(A),zr=s(A,"DIV",{class:!0});var i0=i(zr);g(ts.$$.fragment,i0),G$=d(i0),Uh=s(i0,"P",{});var vL=i(Uh);M$=a(vL,"Returns the optimizer class and optimizer parameters based on the training arguments."),vL.forEach(o),i0.forEach(o),H$=d(A),qt=s(A,"DIV",{class:!0});var qp=i(qt);g(os.$$.fragment,qp),B$=d(qp),rs=s(qp,"P",{});var l0=i(rs);V$=a(l0,"Returns the test "),Fh=s(l0,"CODE",{});var bL=i(Fh);Y$=a(bL,"~torch.utils.data.DataLoader"),bL.forEach(o),X$=a(l0,"."),l0.forEach(o),Z$=d(qp),zh=s(qp,"P",{});var yL=i(zh);J$=a(yL,"Subclass and override this method if you want to inject some custom behavior."),yL.forEach(o),qp.forEach(o),K$=d(A),Ne=s(A,"DIV",{class:!0});var nn=i(Ne);g(as.$$.fragment,nn),Q$=d(nn),ns=s(nn,"P",{});var d0=i(ns);e3=a(d0,"Returns the training "),Nh=s(d0,"CODE",{});var wL=i(Nh);t3=a(wL,"~torch.utils.data.DataLoader"),wL.forEach(o),o3=a(d0,"."),d0.forEach(o),r3=d(nn),Do=s(nn,"P",{});var Pp=i(Do);a3=a(Pp,"Will use no sampler if "),Lh=s(Pp,"CODE",{});var TL=i(Lh);n3=a(TL,"train_dataset"),TL.forEach(o),s3=a(Pp," does not implement "),jh=s(Pp,"CODE",{});var EL=i(jh);i3=a(EL,"__len__"),EL.forEach(o),l3=a(Pp,`, a random sampler (adapted to distributed
training if necessary) otherwise.`),Pp.forEach(o),d3=d(nn),Rh=s(nn,"P",{});var $L=i(Rh);c3=a($L,"Subclass and override this method if you want to inject some custom behavior."),$L.forEach(o),nn.forEach(o),p3=d(A),Pt=s(A,"DIV",{class:!0});var Dp=i(Pt);g(ss.$$.fragment,Dp),m3=d(Dp),ke=s(Dp,"P",{});var ho=i(ke);h3=a(ho,"Launch an hyperparameter search using "),Wh=s(ho,"CODE",{});var xL=i(Wh);u3=a(xL,"optuna"),xL.forEach(o),f3=a(ho," or "),Gh=s(ho,"CODE",{});var kL=i(Gh);g3=a(kL,"Ray Tune"),kL.forEach(o),_3=a(ho," or "),Mh=s(ho,"CODE",{});var AL=i(Mh);v3=a(AL,"SigOpt"),AL.forEach(o),b3=a(ho,`. The optimized quantity is determined
by `),Hh=s(ho,"CODE",{});var qL=i(Hh);y3=a(qL,"compute_objective"),qL.forEach(o),w3=a(ho,`, which defaults to a function returning the evaluation loss when no metric is provided,
the sum of all metrics otherwise.`),ho.forEach(o),T3=d(Dp),g(Nr.$$.fragment,Dp),Dp.forEach(o),E3=d(A),Lr=s(A,"DIV",{class:!0});var c0=i(Lr);g(is.$$.fragment,c0),$3=d(c0),ls=s(c0,"P",{});var p0=i(ls);x3=a(p0,"Initializes a git repo in "),Bh=s(p0,"CODE",{});var PL=i(Bh);k3=a(PL,"self.args.hub_model_id"),PL.forEach(o),A3=a(p0,"."),p0.forEach(o),c0.forEach(o),q3=d(A),jr=s(A,"DIV",{class:!0});var m0=i(jr);g(ds.$$.fragment,m0),P3=d(m0),Vh=s(m0,"P",{});var DL=i(Vh);D3=a(DL,`Whether or not this process is the local (e.g., on one machine if training in a distributed fashion on several
machines) main process.`),DL.forEach(o),m0.forEach(o),S3=d(A),Rr=s(A,"DIV",{class:!0});var h0=i(Rr);g(cs.$$.fragment,h0),O3=d(h0),ps=s(h0,"P",{});var u0=i(ps);C3=a(u0,`Whether or not this process is the global main process (when training in a distributed fashion on several
machines, this is only going to be `),Yh=s(u0,"CODE",{});var SL=i(Yh);I3=a(SL,"True"),SL.forEach(o),U3=a(u0," for one process)."),u0.forEach(o),h0.forEach(o),F3=d(A),Dt=s(A,"DIV",{class:!0});var Sp=i(Dt);g(ms.$$.fragment,Sp),z3=d(Sp),hs=s(Sp,"P",{});var f0=i(hs);N3=a(f0,"Log "),Xh=s(f0,"CODE",{});var OL=i(Xh);L3=a(OL,"logs"),OL.forEach(o),j3=a(f0," on the various objects watching training."),f0.forEach(o),R3=d(Sp),Zh=s(Sp,"P",{});var CL=i(Zh);W3=a(CL,"Subclass and override this method to inject custom behavior."),CL.forEach(o),Sp.forEach(o),G3=d(A),U=s(A,"DIV",{class:!0});var L=i(U);g(us.$$.fragment,L),M3=d(L),Jh=s(L,"P",{});var IL=i(Jh);H3=a(IL,"Log metrics in a specially formatted way"),IL.forEach(o),B3=d(L),Kh=s(L,"P",{});var UL=i(Kh);V3=a(UL,"Under distributed environment this is done only for a process with rank 0."),UL.forEach(o),Y3=d(L),Qh=s(L,"P",{});var FL=i(Qh);X3=a(FL,"Notes on memory reports:"),FL.forEach(o),Z3=d(L),So=s(L,"P",{});var Op=i(So);J3=a(Op,"In order to get memory usage report you need to install "),eu=s(Op,"CODE",{});var zL=i(eu);K3=a(zL,"psutil"),zL.forEach(o),Q3=a(Op,". You can do that with "),tu=s(Op,"CODE",{});var NL=i(tu);ex=a(NL,"pip install psutil"),NL.forEach(o),tx=a(Op,"."),Op.forEach(o),ox=d(L),g(Wr.$$.fragment,L),rx=d(L),ou=s(L,"P",{});var LL=i(ou);ru=s(LL,"STRONG",{});var jL=i(ru);ax=a(jL,"Understanding the reports:"),jL.forEach(o),LL.forEach(o),nx=d(L),lt=s(L,"UL",{});var sn=i(lt);Ae=s(sn,"LI",{});var uo=i(Ae);sx=a(uo,"the first segment, e.g., "),au=s(uo,"CODE",{});var RL=i(au);ix=a(RL,"train__"),RL.forEach(o),lx=a(uo,", tells you which stage the metrics are for. Reports starting with "),nu=s(uo,"CODE",{});var WL=i(nu);dx=a(WL,"init_"),WL.forEach(o),cx=a(uo,`
will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the
`),su=s(uo,"CODE",{});var GL=i(su);px=a(GL,"__init__"),GL.forEach(o),mx=a(uo," will be reported along with the "),iu=s(uo,"CODE",{});var ML=i(iu);hx=a(ML,"eval_"),ML.forEach(o),ux=a(uo," metrics."),uo.forEach(o),fx=d(sn),Oo=s(sn,"LI",{});var Cp=i(Oo);gx=a(Cp,"the third segment, is either "),lu=s(Cp,"CODE",{});var HL=i(lu);_x=a(HL,"cpu"),HL.forEach(o),vx=a(Cp," or "),du=s(Cp,"CODE",{});var BL=i(du);bx=a(BL,"gpu"),BL.forEach(o),yx=a(Cp,`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),Cp.forEach(o),wx=d(sn),Pd=s(sn,"LI",{});var Zz=i(Pd);cu=s(Zz,"CODE",{});var VL=i(cu);Tx=a(VL,"*_alloc_delta"),VL.forEach(o),Ex=a(Zz,` - is the difference in the used/allocated memory counter between the end and the start of the
stage - it can be negative if a function released more memory than it allocated.`),Zz.forEach(o),$x=d(sn),St=s(sn,"LI",{});var sd=i(St);pu=s(sd,"CODE",{});var YL=i(pu);xx=a(YL,"*_peaked_delta"),YL.forEach(o),kx=a(sd,` - is any extra memory that was consumed and then freed - relative to the current allocated
memory counter - it is never negative. When you look at the metrics of any stage you add up `),mu=s(sd,"CODE",{});var XL=i(mu);Ax=a(XL,"alloc_delta"),XL.forEach(o),qx=a(sd,` +
`),hu=s(sd,"CODE",{});var ZL=i(hu);Px=a(ZL,"peaked_delta"),ZL.forEach(o),Dx=a(sd," and you know how much memory was needed to complete that stage."),sd.forEach(o),sn.forEach(o),Sx=d(L),uu=s(L,"P",{});var JL=i(uu);Ox=a(JL,`The reporting happens only for process of rank 0 and gpu 0 (if there is a gpu). Typically this is enough since the
main process does the bulk of work, but it could be not quite so if model parallel is used and then other GPUs may
use a different amount of gpu memory. This is also not the same under DataParallel where gpu0 may require much more
memory than the rest since it stores the gradient and optimizer states for all participating GPUS. Perhaps in the
future these reports will evolve to measure those too.`),JL.forEach(o),Cx=d(L),fu=s(L,"P",{});var KL=i(fu);Ix=a(KL,`The CPU RAM metric measures RSS (Resident Set Size) includes both the memory which is unique to the process and the
memory shared with other processes. It is important to note that it does not include swapped out memory, so the
reports could be imprecise.`),KL.forEach(o),Ux=d(L),fs=s(L,"P",{});var g0=i(fs);Fx=a(g0,`The CPU peak memory is measured using a sampling thread. Due to python\u2019s GIL it may miss some of the peak memory if
that thread didn\u2019t get a chance to run when the highest memory was used. Therefore this report can be less than
reality. Using `),gu=s(g0,"CODE",{});var QL=i(gu);zx=a(QL,"tracemalloc"),QL.forEach(o),Nx=a(g0,` would have reported the exact peak memory, but it doesn\u2019t report memory allocations
outside of python. So if some C++ CUDA extension allocated its own memory it won\u2019t be reported. And therefore it
was dropped in favor of the memory sampling approach, which reads the current process memory usage.`),g0.forEach(o),Lx=d(L),dt=s(L,"P",{});var ln=i(dt);jx=a(ln,"The GPU allocated and peak memory reporting is done with "),_u=s(ln,"CODE",{});var ej=i(_u);Rx=a(ej,"torch.cuda.memory_allocated()"),ej.forEach(o),Wx=a(ln,` and
`),vu=s(ln,"CODE",{});var tj=i(vu);Gx=a(tj,"torch.cuda.max_memory_allocated()"),tj.forEach(o),Mx=a(ln,`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),bu=s(ln,"CODE",{});var oj=i(bu);Hx=a(oj,"torch.cuda"),oj.forEach(o),Bx=a(ln,` memory management system doesn\u2019t track any memory allocated outside of pytorch. For example, the very
first cuda call typically loads CUDA kernels, which may take from 0.5 to 2GB of GPU memory.`),ln.forEach(o),Vx=d(L),he=s(L,"P",{});var ot=i(he);Yx=a(ot,"Note that this tracker doesn\u2019t account for memory allocations outside of "),Dd=s(ot,"A",{href:!0});var rj=i(Dd);Xx=a(rj,"Trainer"),rj.forEach(o),Zx=a(ot,"\u2019s "),yu=s(ot,"CODE",{});var aj=i(yu);Jx=a(aj,"__init__"),aj.forEach(o),Kx=a(ot,", "),wu=s(ot,"CODE",{});var nj=i(wu);Qx=a(nj,"train"),nj.forEach(o),ek=a(ot,`,
`),Tu=s(ot,"CODE",{});var sj=i(Tu);tk=a(sj,"evaluate"),sj.forEach(o),ok=a(ot," and "),Eu=s(ot,"CODE",{});var ij=i(Eu);rk=a(ij,"predict"),ij.forEach(o),ak=a(ot," calls."),ot.forEach(o),nk=d(L),V=s(L,"P",{});var Y=i(V);sk=a(Y,"Because "),$u=s(Y,"CODE",{});var lj=i($u);ik=a(lj,"evaluation"),lj.forEach(o),lk=a(Y," calls may happen during "),xu=s(Y,"CODE",{});var dj=i(xu);dk=a(dj,"train"),dj.forEach(o),ck=a(Y,`, we can\u2019t handle nested invocations because
`),ku=s(Y,"CODE",{});var cj=i(ku);pk=a(cj,"torch.cuda.max_memory_allocated"),cj.forEach(o),mk=a(Y," is a single counter, so if it gets reset by a nested eval call, "),Au=s(Y,"CODE",{});var pj=i(Au);hk=a(pj,"train"),pj.forEach(o),uk=a(Y,`\u2019s tracker
will report incorrect info. If this `),gs=s(Y,"A",{href:!0,rel:!0});var mj=i(gs);fk=a(mj,"pytorch issue"),mj.forEach(o),gk=a(Y,` gets resolved
it will be possible to change this class to be re-entrant. Until then we will only track the outer level of
`),qu=s(Y,"CODE",{});var hj=i(qu);_k=a(hj,"train"),hj.forEach(o),vk=a(Y,", "),Pu=s(Y,"CODE",{});var uj=i(Pu);bk=a(uj,"evaluate"),uj.forEach(o),yk=a(Y," and "),Du=s(Y,"CODE",{});var fj=i(Du);wk=a(fj,"predict"),fj.forEach(o),Tk=a(Y," methods. Which means that if "),Su=s(Y,"CODE",{});var gj=i(Su);Ek=a(gj,"eval"),gj.forEach(o),$k=a(Y," is called during "),Ou=s(Y,"CODE",{});var _j=i(Ou);xk=a(_j,"train"),_j.forEach(o),kk=a(Y,`, it\u2019s the latter
that will account for its memory usage and that of the former.`),Y.forEach(o),Ak=d(L),qe=s(L,"P",{});var fo=i(qe);qk=a(fo,"This also means that if any other tool that is used along the "),Sd=s(fo,"A",{href:!0});var vj=i(Sd);Pk=a(vj,"Trainer"),vj.forEach(o),Dk=a(fo,` calls
`),Cu=s(fo,"CODE",{});var bj=i(Cu);Sk=a(bj,"torch.cuda.reset_peak_memory_stats"),bj.forEach(o),Ok=a(fo,", the gpu peak memory stats could be invalid. And the "),Od=s(fo,"A",{href:!0});var yj=i(Od);Ck=a(yj,"Trainer"),yj.forEach(o),Ik=a(fo,` will disrupt
the normal behavior of any such tools that rely on calling `),Iu=s(fo,"CODE",{});var wj=i(Iu);Uk=a(wj,"torch.cuda.reset_peak_memory_stats"),wj.forEach(o),Fk=a(fo," themselves."),fo.forEach(o),zk=d(L),Uu=s(L,"P",{});var Tj=i(Uu);Nk=a(Tj,"For best performance you may want to consider turning the memory profiling off for production runs."),Tj.forEach(o),L.forEach(o),Lk=d(A),Gr=s(A,"DIV",{class:!0});var _0=i(Gr);g(_s.$$.fragment,_0),jk=d(_0),Fu=s(_0,"P",{});var Ej=i(Fu);Rk=a(Ej,"Reformat Trainer metrics values to a human-readable format"),Ej.forEach(o),_0.forEach(o),Wk=d(A),Mr=s(A,"DIV",{class:!0});var v0=i(Mr);g(vs.$$.fragment,v0),Gk=d(v0),bs=s(v0,"P",{});var b0=i(bs);Mk=a(b0,"Helper to get number of samples in a "),zu=s(b0,"CODE",{});var $j=i(zu);Hk=a($j,"~torch.utils.data.DataLoader"),$j.forEach(o),Bk=a(b0,` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),b0.forEach(o),v0.forEach(o),Vk=d(A),Ot=s(A,"DIV",{class:!0});var Ip=i(Ot);g(ys.$$.fragment,Ip),Yk=d(Ip),ws=s(Ip,"P",{});var y0=i(ws);Xk=a(y0,"Remove a callback from the current list of "),Nu=s(y0,"CODE",{});var xj=i(Nu);Zk=a(xj,"~transformer.TrainerCallback"),xj.forEach(o),Jk=a(y0," and returns it."),y0.forEach(o),Kk=d(Ip),Ts=s(Ip,"P",{});var w0=i(Ts);Qk=a(w0,"If the callback is not found, returns "),Lu=s(w0,"CODE",{});var kj=i(Lu);eA=a(kj,"None"),kj.forEach(o),tA=a(w0," (and no error is raised)."),w0.forEach(o),Ip.forEach(o),oA=d(A),le=s(A,"DIV",{class:!0});var rt=i(le);g(Es.$$.fragment,rt),rA=d(rt),ju=s(rt,"P",{});var Aj=i(ju);aA=a(Aj,"Run prediction and returns predictions and potential metrics."),Aj.forEach(o),nA=d(rt),$s=s(rt,"P",{});var T0=i($s);sA=a(T0,`Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method
will also return metrics, like in `),Ru=s(T0,"CODE",{});var qj=i(Ru);iA=a(qj,"evaluate()"),qj.forEach(o),lA=a(T0,"."),T0.forEach(o),dA=d(rt),g(Hr.$$.fragment,rt),cA=d(rt),xs=s(rt,"P",{});var E0=i(xs);pA=a(E0,"Returns: "),Wu=s(E0,"EM",{});var Pj=i(Wu);mA=a(Pj,"NamedTuple"),Pj.forEach(o),hA=a(E0," A namedtuple with the following keys:"),E0.forEach(o),uA=d(rt),Co=s(rt,"UL",{});var Up=i(Co);Io=s(Up,"LI",{});var Fp=i(Io);fA=a(Fp,"predictions ("),Gu=s(Fp,"CODE",{});var Dj=i(Gu);gA=a(Dj,"np.ndarray"),Dj.forEach(o),_A=a(Fp,"): The predictions on "),Mu=s(Fp,"CODE",{});var Sj=i(Mu);vA=a(Sj,"test_dataset"),Sj.forEach(o),bA=a(Fp,"."),Fp.forEach(o),yA=d(Up),Uo=s(Up,"LI",{});var zp=i(Uo);wA=a(zp,"label_ids ("),Hu=s(zp,"CODE",{});var Oj=i(Hu);TA=a(Oj,"np.ndarray"),Oj.forEach(o),EA=a(zp,", "),Bu=s(zp,"EM",{});var Cj=i(Bu);$A=a(Cj,"optional"),Cj.forEach(o),xA=a(zp,"): The labels (if the dataset contained some)."),zp.forEach(o),kA=d(Up),Fo=s(Up,"LI",{});var Np=i(Fo);AA=a(Np,"metrics ("),Vu=s(Np,"CODE",{});var Ij=i(Vu);qA=a(Ij,"Dict[str, float]"),Ij.forEach(o),PA=a(Np,", "),Yu=s(Np,"EM",{});var Uj=i(Yu);DA=a(Uj,"optional"),Uj.forEach(o),SA=a(Np,`): The potential dictionary of metrics (if the dataset contained
labels).`),Np.forEach(o),Up.forEach(o),rt.forEach(o),OA=d(A),Ct=s(A,"DIV",{class:!0});var Lp=i(Ct);g(ks.$$.fragment,Lp),CA=d(Lp),zo=s(Lp,"P",{});var jp=i(zo);IA=a(jp,"Prediction/evaluation loop, shared by "),Xu=s(jp,"CODE",{});var Fj=i(Xu);UA=a(Fj,"Trainer.evaluate()"),Fj.forEach(o),FA=a(jp," and "),Zu=s(jp,"CODE",{});var zj=i(Zu);zA=a(zj,"Trainer.predict()"),zj.forEach(o),NA=a(jp,"."),jp.forEach(o),LA=d(Lp),Ju=s(Lp,"P",{});var Nj=i(Ju);jA=a(Nj,"Works both with or without labels."),Nj.forEach(o),Lp.forEach(o),RA=d(A),It=s(A,"DIV",{class:!0});var Rp=i(It);g(As.$$.fragment,Rp),WA=d(Rp),No=s(Rp,"P",{});var Wp=i(No);GA=a(Wp,"Perform an evaluation step on "),Ku=s(Wp,"CODE",{});var Lj=i(Ku);MA=a(Lj,"model"),Lj.forEach(o),HA=a(Wp," using "),Qu=s(Wp,"CODE",{});var jj=i(Qu);BA=a(jj,"inputs"),jj.forEach(o),VA=a(Wp,"."),Wp.forEach(o),YA=d(Rp),ef=s(Rp,"P",{});var Rj=i(ef);XA=a(Rj,"Subclass and override to inject custom behavior."),Rj.forEach(o),Rp.forEach(o),ZA=d(A),Br=s(A,"DIV",{class:!0});var $0=i(Br);g(qs.$$.fragment,$0),JA=d($0),ct=s($0,"P",{});var dn=i(ct);KA=a(dn,"Upload "),tf=s(dn,"EM",{});var Wj=i(tf);QA=a(Wj,"self.model"),Wj.forEach(o),e5=a(dn," and "),of=s(dn,"EM",{});var Gj=i(of);t5=a(Gj,"self.tokenizer"),Gj.forEach(o),o5=a(dn," to the \u{1F917} model hub on the repo "),rf=s(dn,"EM",{});var Mj=i(rf);r5=a(Mj,"self.args.hub_model_id"),Mj.forEach(o),a5=a(dn,"."),dn.forEach(o),$0.forEach(o),n5=d(A),Vr=s(A,"DIV",{class:!0});var x0=i(Vr);g(Ps.$$.fragment,x0),s5=d(x0),Ds=s(x0,"P",{});var k0=i(Ds);i5=a(k0,"Remove a callback from the current list of "),af=s(k0,"CODE",{});var Hj=i(af);l5=a(Hj,"~transformer.TrainerCallback"),Hj.forEach(o),d5=a(k0,"."),k0.forEach(o),x0.forEach(o),c5=d(A),Le=s(A,"DIV",{class:!0});var cn=i(Le);g(Ss.$$.fragment,cn),p5=d(cn),Os=s(cn,"P",{});var A0=i(Os);m5=a(A0,"Save metrics into a json file for that split, e.g. "),nf=s(A0,"CODE",{});var Bj=i(nf);h5=a(Bj,"train_results.json"),Bj.forEach(o),u5=a(A0,"."),A0.forEach(o),f5=d(cn),sf=s(cn,"P",{});var Vj=i(sf);g5=a(Vj,"Under distributed environment this is done only for a process with rank 0."),Vj.forEach(o),_5=d(cn),Cs=s(cn,"P",{});var q0=i(Cs);v5=a(q0,"To understand the metrics please read the docstring of "),Cd=s(q0,"A",{href:!0});var Yj=i(Cd);b5=a(Yj,"log_metrics()"),Yj.forEach(o),y5=a(q0,`. The only difference is that raw
unformatted numbers are saved in the current method.`),q0.forEach(o),cn.forEach(o),w5=d(A),Ut=s(A,"DIV",{class:!0});var Gp=i(Ut);g(Is.$$.fragment,Gp),T5=d(Gp),Us=s(Gp,"P",{});var P0=i(Us);E5=a(P0,"Will save the model, so you can reload it using "),lf=s(P0,"CODE",{});var Xj=i(lf);$5=a(Xj,"from_pretrained()"),Xj.forEach(o),x5=a(P0,"."),P0.forEach(o),k5=d(Gp),df=s(Gp,"P",{});var Zj=i(df);A5=a(Zj,"Will only save from the main process."),Zj.forEach(o),Gp.forEach(o),q5=d(A),Ft=s(A,"DIV",{class:!0});var Mp=i(Ft);g(Fs.$$.fragment,Mp),P5=d(Mp),cf=s(Mp,"P",{});var Jj=i(cf);D5=a(Jj,"Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),Jj.forEach(o),S5=d(Mp),pf=s(Mp,"P",{});var Kj=i(pf);O5=a(Kj,"Under distributed environment this is done only for a process with rank 0."),Kj.forEach(o),Mp.forEach(o),C5=d(A),Yr=s(A,"DIV",{class:!0});var D0=i(Yr);g(zs.$$.fragment,D0),I5=d(D0),mf=s(D0,"P",{});var Qj=i(mf);U5=a(Qj,"Main training entry point."),Qj.forEach(o),D0.forEach(o),F5=d(A),zt=s(A,"DIV",{class:!0});var Hp=i(zt);g(Ns.$$.fragment,Hp),z5=d(Hp),hf=s(Hp,"P",{});var eR=i(hf);N5=a(eR,"Perform a training step on a batch of inputs."),eR.forEach(o),L5=d(Hp),uf=s(Hp,"P",{});var tR=i(uf);j5=a(tR,"Subclass and override to inject custom behavior."),tR.forEach(o),Hp.forEach(o),A.forEach(o),z1=d(t),Lo=s(t,"H2",{class:!0});var S0=i(Lo);Xr=s(S0,"A",{id:!0,class:!0,href:!0});var oR=i(Xr);ff=s(oR,"SPAN",{});var rR=i(ff);g(Ls.$$.fragment,rR),rR.forEach(o),oR.forEach(o),R5=d(S0),gf=s(S0,"SPAN",{});var aR=i(gf);W5=a(aR,"Seq2SeqTrainer"),aR.forEach(o),S0.forEach(o),N1=d(t),pt=s(t,"DIV",{class:!0});var Bp=i(pt);g(js.$$.fragment,Bp),G5=d(Bp),je=s(Bp,"DIV",{class:!0});var pn=i(je);g(Rs.$$.fragment,pn),M5=d(pn),_f=s(pn,"P",{});var nR=i(_f);H5=a(nR,"Run evaluation and returns metrics."),nR.forEach(o),B5=d(pn),Ws=s(pn,"P",{});var O0=i(Ws);V5=a(O0,`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),vf=s(O0,"CODE",{});var sR=i(vf);Y5=a(sR,"compute_metrics"),sR.forEach(o),X5=a(O0," argument)."),O0.forEach(o),Z5=d(pn),bf=s(pn,"P",{});var iR=i(bf);J5=a(iR,"You can also subclass and override this method to inject custom behavior."),iR.forEach(o),pn.forEach(o),K5=d(Bp),de=s(Bp,"DIV",{class:!0});var at=i(de);g(Gs.$$.fragment,at),Q5=d(at),yf=s(at,"P",{});var lR=i(yf);e7=a(lR,"Run prediction and returns predictions and potential metrics."),lR.forEach(o),t7=d(at),Ms=s(at,"P",{});var C0=i(Ms);o7=a(C0,`Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method
will also return metrics, like in `),wf=s(C0,"CODE",{});var dR=i(wf);r7=a(dR,"evaluate()"),dR.forEach(o),a7=a(C0,"."),C0.forEach(o),n7=d(at),g(Zr.$$.fragment,at),s7=d(at),Hs=s(at,"P",{});var I0=i(Hs);i7=a(I0,"Returns: "),Tf=s(I0,"EM",{});var cR=i(Tf);l7=a(cR,"NamedTuple"),cR.forEach(o),d7=a(I0," A namedtuple with the following keys:"),I0.forEach(o),c7=d(at),jo=s(at,"UL",{});var Vp=i(jo);Ro=s(Vp,"LI",{});var Yp=i(Ro);p7=a(Yp,"predictions ("),Ef=s(Yp,"CODE",{});var pR=i(Ef);m7=a(pR,"np.ndarray"),pR.forEach(o),h7=a(Yp,"): The predictions on "),$f=s(Yp,"CODE",{});var mR=i($f);u7=a(mR,"test_dataset"),mR.forEach(o),f7=a(Yp,"."),Yp.forEach(o),g7=d(Vp),Wo=s(Vp,"LI",{});var Xp=i(Wo);_7=a(Xp,"label_ids ("),xf=s(Xp,"CODE",{});var hR=i(xf);v7=a(hR,"np.ndarray"),hR.forEach(o),b7=a(Xp,", "),kf=s(Xp,"EM",{});var uR=i(kf);y7=a(uR,"optional"),uR.forEach(o),w7=a(Xp,"): The labels (if the dataset contained some)."),Xp.forEach(o),T7=d(Vp),Go=s(Vp,"LI",{});var Zp=i(Go);E7=a(Zp,"metrics ("),Af=s(Zp,"CODE",{});var fR=i(Af);$7=a(fR,"Dict[str, float]"),fR.forEach(o),x7=a(Zp,", "),qf=s(Zp,"EM",{});var gR=i(qf);k7=a(gR,"optional"),gR.forEach(o),A7=a(Zp,`): The potential dictionary of metrics (if the dataset contained
labels).`),Zp.forEach(o),Vp.forEach(o),at.forEach(o),Bp.forEach(o),L1=d(t),Mo=s(t,"H2",{class:!0});var U0=i(Mo);Jr=s(U0,"A",{id:!0,class:!0,href:!0});var _R=i(Jr);Pf=s(_R,"SPAN",{});var vR=i(Pf);g(Bs.$$.fragment,vR),vR.forEach(o),_R.forEach(o),q7=d(U0),Df=s(U0,"SPAN",{});var bR=i(Df);P7=a(bR,"TrainingArguments"),bR.forEach(o),U0.forEach(o),j1=d(t),S=s(t,"DIV",{class:!0});var F=i(S);g(Vs.$$.fragment,F),D7=d(F),Ys=s(F,"P",{});var F0=i(Ys);S7=a(F0,"TrainingArguments is the subset of the arguments we use in our example scripts "),Sf=s(F0,"STRONG",{});var yR=i(Sf);O7=a(yR,`which relate to the training loop
itself`),yR.forEach(o),C7=a(F0,"."),F0.forEach(o),I7=d(F),Ho=s(F,"P",{});var Jp=i(Ho);U7=a(Jp,"Using "),Id=s(Jp,"A",{href:!0});var wR=i(Id);F7=a(wR,"HfArgumentParser"),wR.forEach(o),z7=a(Jp,` we can turn this class into
`),Xs=s(Jp,"A",{href:!0,rel:!0});var TR=i(Xs);N7=a(TR,"argparse"),TR.forEach(o),L7=a(Jp,` arguments that can be specified on the
command line.`),Jp.forEach(o),j7=d(F),fe=s(F,"DIV",{class:!0});var go=i(fe);g(Zs.$$.fragment,go),R7=d(go),Of=s(go,"P",{});var ER=i(Of);W7=a(ER,`Returns the log level to be used depending on whether this process is the main process of node 0, main process
of node non-0, or a non-main process.`),ER.forEach(o),G7=d(go),Bo=s(go,"P",{});var Kp=i(Bo);M7=a(Kp,"For the main process the log level defaults to the logging level set ("),Cf=s(Kp,"CODE",{});var $R=i(Cf);H7=a($R,"logging.WARNING"),$R.forEach(o),B7=a(Kp,` if you didn\u2019t do
anything) unless overridden by `),If=s(Kp,"CODE",{});var xR=i(If);V7=a(xR,"log_level"),xR.forEach(o),Y7=a(Kp," argument."),Kp.forEach(o),X7=d(go),Vo=s(go,"P",{});var Qp=i(Vo);Z7=a(Qp,"For the replica processes the log level defaults to "),Uf=s(Qp,"CODE",{});var kR=i(Uf);J7=a(kR,"logging.WARNING"),kR.forEach(o),K7=a(Qp," unless overridden by "),Ff=s(Qp,"CODE",{});var AR=i(Ff);Q7=a(AR,"log_level_replica"),AR.forEach(o),eq=a(Qp,`
argument.`),Qp.forEach(o),tq=d(go),Js=s(go,"P",{});var z0=i(Js);oq=a(z0,"The choice between the main and replica process settings is made according to the return value of "),zf=s(z0,"CODE",{});var qR=i(zf);rq=a(qR,"should_log"),qR.forEach(o),aq=a(z0,"."),z0.forEach(o),go.forEach(o),nq=d(F),Kr=s(F,"DIV",{class:!0});var N0=i(Kr);g(Ks.$$.fragment,N0),sq=d(N0),Nf=s(N0,"P",{});var PR=i(Nf);iq=a(PR,"Get number of steps used for a linear warmup."),PR.forEach(o),N0.forEach(o),lq=d(F),Nt=s(F,"DIV",{class:!0});var em=i(Nt);g(Qs.$$.fragment,em),dq=d(em),Lf=s(em,"P",{});var DR=i(Lf);cq=a(DR,`A context manager for torch distributed environment where on needs to do something on the main process, while
blocking replicas, and when it\u2019s finished releasing the replicas.`),DR.forEach(o),pq=d(em),Yo=s(em,"P",{});var tm=i(Yo);mq=a(tm,"One such use is for "),jf=s(tm,"CODE",{});var SR=i(jf);hq=a(SR,"datasets"),SR.forEach(o),uq=a(tm,"\u2019s "),Rf=s(tm,"CODE",{});var OR=i(Rf);fq=a(OR,"map"),OR.forEach(o),gq=a(tm,` feature which to be efficient should be run once on the main process,
which upon completion saves a cached version of results and which then automatically gets loaded by the
replicas.`),tm.forEach(o),em.forEach(o),_q=d(F),Lt=s(F,"DIV",{class:!0});var om=i(Lt);g(ei.$$.fragment,om),vq=d(om),Wf=s(om,"P",{});var CR=i(Wf);bq=a(CR,"A method that regroups all arguments linked to the dataloaders creation."),CR.forEach(o),yq=d(om),g(Qr.$$.fragment,om),om.forEach(o),wq=d(F),jt=s(F,"DIV",{class:!0});var rm=i(jt);g(ti.$$.fragment,rm),Tq=d(rm),Gf=s(rm,"P",{});var IR=i(Gf);Eq=a(IR,"A method that regroups all arguments linked to the evaluation."),IR.forEach(o),$q=d(rm),g(ea.$$.fragment,rm),rm.forEach(o),xq=d(F),Rt=s(F,"DIV",{class:!0});var am=i(Rt);g(oi.$$.fragment,am),kq=d(am),Mf=s(am,"P",{});var UR=i(Mf);Aq=a(UR,"A method that regroups all arguments linked to the evaluation."),UR.forEach(o),qq=d(am),g(ta.$$.fragment,am),am.forEach(o),Pq=d(F),Wt=s(F,"DIV",{class:!0});var nm=i(Wt);g(ri.$$.fragment,nm),Dq=d(nm),Hf=s(nm,"P",{});var FR=i(Hf);Sq=a(FR,"A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters."),FR.forEach(o),Oq=d(nm),g(oa.$$.fragment,nm),nm.forEach(o),Cq=d(F),Gt=s(F,"DIV",{class:!0});var sm=i(Gt);g(ai.$$.fragment,sm),Iq=d(sm),Bf=s(sm,"P",{});var zR=i(Bf);Uq=a(zR,"A method that regroups all arguments linked to the optimizer and its hyperparameters."),zR.forEach(o),Fq=d(sm),g(ra.$$.fragment,sm),sm.forEach(o),zq=d(F),Re=s(F,"DIV",{class:!0});var mn=i(Re);g(ni.$$.fragment,mn),Nq=d(mn),Vf=s(mn,"P",{});var NR=i(Vf);Lq=a(NR,"A method that regroups all arguments linked to synchronizing checkpoints with the Hub."),NR.forEach(o),jq=d(mn),g(aa.$$.fragment,mn),Rq=d(mn),g(na.$$.fragment,mn),mn.forEach(o),Wq=d(F),Mt=s(F,"DIV",{class:!0});var im=i(Mt);g(si.$$.fragment,im),Gq=d(im),Yf=s(im,"P",{});var LR=i(Yf);Mq=a(LR,"A method that regroups all arguments linked to the evaluation."),LR.forEach(o),Hq=d(im),g(sa.$$.fragment,im),im.forEach(o),Bq=d(F),We=s(F,"DIV",{class:!0});var hn=i(We);g(ii.$$.fragment,hn),Vq=d(hn),Xf=s(hn,"P",{});var jR=i(Xf);Yq=a(jR,"A method that regroups all basic arguments linked to testing on a held-out dataset."),jR.forEach(o),Xq=d(hn),g(ia.$$.fragment,hn),Zq=d(hn),g(la.$$.fragment,hn),hn.forEach(o),Jq=d(F),Ge=s(F,"DIV",{class:!0});var un=i(Ge);g(li.$$.fragment,un),Kq=d(un),Zf=s(un,"P",{});var RR=i(Zf);Qq=a(RR,"A method that regroups all basic arguments linked to the training."),RR.forEach(o),eP=d(un),g(da.$$.fragment,un),tP=d(un),g(ca.$$.fragment,un),un.forEach(o),oP=d(F),pa=s(F,"DIV",{class:!0});var L0=i(pa);g(di.$$.fragment,L0),rP=d(L0),ci=s(L0,"P",{});var j0=i(ci);aP=a(j0,"Serializes this instance while replace "),Jf=s(j0,"CODE",{});var WR=i(Jf);nP=a(WR,"Enum"),WR.forEach(o),sP=a(j0,` by their values (for JSON serialization support). It obfuscates
the token values by removing their value.`),j0.forEach(o),L0.forEach(o),iP=d(F),ma=s(F,"DIV",{class:!0});var R0=i(ma);g(pi.$$.fragment,R0),lP=d(R0),Kf=s(R0,"P",{});var GR=i(Kf);dP=a(GR,"Serializes this instance to a JSON string."),GR.forEach(o),R0.forEach(o),cP=d(F),ha=s(F,"DIV",{class:!0});var W0=i(ha);g(mi.$$.fragment,W0),pP=d(W0),Qf=s(W0,"P",{});var MR=i(Qf);mP=a(MR,"Sanitized serialization to use with TensorBoard\u2019s hparams"),MR.forEach(o),W0.forEach(o),F.forEach(o),R1=d(t),Xo=s(t,"H2",{class:!0});var G0=i(Xo);ua=s(G0,"A",{id:!0,class:!0,href:!0});var HR=i(ua);eg=s(HR,"SPAN",{});var BR=i(eg);g(hi.$$.fragment,BR),BR.forEach(o),HR.forEach(o),hP=d(G0),tg=s(G0,"SPAN",{});var VR=i(tg);uP=a(VR,"Seq2SeqTrainingArguments"),VR.forEach(o),G0.forEach(o),W1=d(t),mt=s(t,"DIV",{class:!0});var lm=i(mt);g(ui.$$.fragment,lm),fP=d(lm),fi=s(lm,"P",{});var M0=i(fi);gP=a(M0,"TrainingArguments is the subset of the arguments we use in our example scripts "),og=s(M0,"STRONG",{});var YR=i(og);_P=a(YR,`which relate to the training loop
itself`),YR.forEach(o),vP=a(M0,"."),M0.forEach(o),bP=d(lm),Zo=s(lm,"P",{});var dm=i(Zo);yP=a(dm,"Using "),Ud=s(dm,"A",{href:!0});var XR=i(Ud);wP=a(XR,"HfArgumentParser"),XR.forEach(o),TP=a(dm,` we can turn this class into
`),gi=s(dm,"A",{href:!0,rel:!0});var ZR=i(gi);EP=a(ZR,"argparse"),ZR.forEach(o),$P=a(dm,` arguments that can be specified on the
command line.`),dm.forEach(o),lm.forEach(o),G1=d(t),Jo=s(t,"H2",{class:!0});var H0=i(Jo);fa=s(H0,"A",{id:!0,class:!0,href:!0});var JR=i(fa);rg=s(JR,"SPAN",{});var KR=i(rg);g(_i.$$.fragment,KR),KR.forEach(o),JR.forEach(o),xP=d(H0),ag=s(H0,"SPAN",{});var QR=i(ag);kP=a(QR,"Checkpoints"),QR.forEach(o),H0.forEach(o),M1=d(t),ge=s(t,"P",{});var _o=i(ge);AP=a(_o,"By default, "),Fd=s(_o,"A",{href:!0});var eW=i(Fd);qP=a(eW,"Trainer"),eW.forEach(o),PP=a(_o," will save all checkpoints in the "),ng=s(_o,"CODE",{});var tW=i(ng);DP=a(tW,"output_dir"),tW.forEach(o),SP=a(_o,` you set in the
`),zd=s(_o,"A",{href:!0});var oW=i(zd);OP=a(oW,"TrainingArguments"),oW.forEach(o),CP=a(_o," you are using. Those will go in subfolder named "),sg=s(_o,"CODE",{});var rW=i(sg);IP=a(rW,"checkpoint-xxx"),rW.forEach(o),UP=a(_o,` with xxx
being the step at which the training was at.`),_o.forEach(o),H1=d(t),ga=s(t,"P",{});var B0=i(ga);FP=a(B0,"Resuming training from a checkpoint can be done when calling "),Nd=s(B0,"A",{href:!0});var aW=i(Nd);zP=a(aW,"Trainer.train()"),aW.forEach(o),NP=a(B0," with either:"),B0.forEach(o),B1=d(t),_a=s(t,"UL",{});var V0=i(_a);Ld=s(V0,"LI",{});var Jz=i(Ld);ig=s(Jz,"CODE",{});var nW=i(ig);LP=a(nW,"resume_from_checkpoint=True"),nW.forEach(o),jP=a(Jz," which will resume training from the latest checkpoint"),Jz.forEach(o),RP=d(V0),jd=s(V0,"LI",{});var Kz=i(jd);lg=s(Kz,"CODE",{});var sW=i(lg);WP=a(sW,"resume_from_checkpoint=checkpoint_dir"),sW.forEach(o),GP=a(Kz,` which will resume training from the specific checkpoint in the directory
passed.`),Kz.forEach(o),V0.forEach(o),V1=d(t),Me=s(t,"P",{});var fn=i(Me);MP=a(fn,"In addition, you can easily save your checkpoints on the Model Hub when using "),dg=s(fn,"CODE",{});var iW=i(dg);HP=a(iW,"push_to_hub=True"),iW.forEach(o),BP=a(fn,`. By default, all
the models saved in intermediate checkpoints are saved in different commits, but not the optimizer state. You can adapt
the `),cg=s(fn,"CODE",{});var lW=i(cg);VP=a(lW,"hub-strategy"),lW.forEach(o),YP=a(fn," value of your "),Rd=s(fn,"A",{href:!0});var dW=i(Rd);XP=a(dW,"TrainingArguments"),dW.forEach(o),ZP=a(fn," to either:"),fn.forEach(o),Y1=d(t),va=s(t,"UL",{});var Y0=i(va);ba=s(Y0,"LI",{});var E1=i(ba);pg=s(E1,"CODE",{});var cW=i(pg);JP=a(cW,'"checkpoint"'),cW.forEach(o),KP=a(E1,`: the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to
resume training easily with `),mg=s(E1,"CODE",{});var pW=i(mg);QP=a(pW,'trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")'),pW.forEach(o),e6=a(E1,"."),E1.forEach(o),t6=d(Y0),Wd=s(Y0,"LI",{});var Qz=i(Wd);hg=s(Qz,"CODE",{});var mW=i(hg);o6=a(mW,'"all_checkpoints"'),mW.forEach(o),r6=a(Qz,`: all checkpoints are pushed like they appear in the output folder (so you will get one
checkpoint folder per folder in your final repository)`),Qz.forEach(o),Y0.forEach(o),X1=d(t),Ko=s(t,"H2",{class:!0});var X0=i(Ko);ya=s(X0,"A",{id:!0,class:!0,href:!0});var hW=i(ya);ug=s(hW,"SPAN",{});var uW=i(ug);g(vi.$$.fragment,uW),uW.forEach(o),hW.forEach(o),a6=d(X0),fg=s(X0,"SPAN",{});var fW=i(fg);n6=a(fW,"Logging"),fW.forEach(o),X0.forEach(o),Z1=d(t),He=s(t,"P",{});var gn=i(He);s6=a(gn,"By default "),Gd=s(gn,"A",{href:!0});var gW=i(Gd);i6=a(gW,"Trainer"),gW.forEach(o),l6=a(gn," will use "),gg=s(gn,"CODE",{});var _W=i(gg);d6=a(_W,"logging.INFO"),_W.forEach(o),c6=a(gn," for the main process and "),_g=s(gn,"CODE",{});var vW=i(_g);p6=a(vW,"logging.WARNING"),vW.forEach(o),m6=a(gn," for the replicas if any."),gn.forEach(o),J1=d(t),Ht=s(t,"P",{});var cm=i(Ht);h6=a(cm,"These defaults can be overridden to use any of the 5 "),vg=s(cm,"CODE",{});var bW=i(vg);u6=a(bW,"logging"),bW.forEach(o),f6=a(cm," levels with "),Md=s(cm,"A",{href:!0});var yW=i(Md);g6=a(yW,"TrainingArguments"),yW.forEach(o),_6=a(cm,`\u2019s
arguments:`),cm.forEach(o),K1=d(t),wa=s(t,"UL",{});var Z0=i(wa);Hd=s(Z0,"LI",{});var eN=i(Hd);bg=s(eN,"CODE",{});var wW=i(bg);v6=a(wW,"log_level"),wW.forEach(o),b6=a(eN," - for the main process"),eN.forEach(o),y6=d(Z0),Bd=s(Z0,"LI",{});var tN=i(Bd);yg=s(tN,"CODE",{});var TW=i(yg);w6=a(TW,"log_level_replica"),TW.forEach(o),T6=a(tN," - for the replicas"),tN.forEach(o),Z0.forEach(o),Q1=d(t),Be=s(t,"P",{});var _n=i(Be);E6=a(_n,"Further, if "),Vd=s(_n,"A",{href:!0});var EW=i(Vd);$6=a(EW,"TrainingArguments"),EW.forEach(o),x6=a(_n,"\u2019s "),wg=s(_n,"CODE",{});var $W=i(wg);k6=a($W,"log_on_each_node"),$W.forEach(o),A6=a(_n," is set to "),Tg=s(_n,"CODE",{});var xW=i(Tg);q6=a(xW,"False"),xW.forEach(o),P6=a(_n,` only the main node will
use the log level settings for its main process, all other nodes will use the log level settings for replicas.`),_n.forEach(o),ey=d(t),ce=s(t,"P",{});var nt=i(ce);D6=a(nt,"Note that "),Yd=s(nt,"A",{href:!0});var kW=i(Yd);S6=a(kW,"Trainer"),kW.forEach(o),O6=a(nt," is going to set "),Eg=s(nt,"CODE",{});var AW=i(Eg);C6=a(AW,"transformers"),AW.forEach(o),I6=a(nt,`\u2019s log level separately for each node in its
`),$g=s(nt,"CODE",{});var qW=i($g);U6=a(qW,"Trainer.__init__()"),qW.forEach(o),F6=a(nt,`. So you may want to set this sooner (see the next example) if you tap into other
`),xg=s(nt,"CODE",{});var PW=i(xg);z6=a(PW,"transformers"),PW.forEach(o),N6=a(nt," functionality before creating the "),Xd=s(nt,"A",{href:!0});var DW=i(Xd);L6=a(DW,"Trainer"),DW.forEach(o),j6=a(nt," object."),nt.forEach(o),ty=d(t),Zd=s(t,"P",{});var SW=i(Zd);R6=a(SW,"Here is an example of how this can be used in an application:"),SW.forEach(o),oy=d(t),g(bi.$$.fragment,t),ry=d(t),Jd=s(t,"P",{});var OW=i(Jd);W6=a(OW,`And then if you only want to see warnings on the main node and all other nodes to not print any most likely duplicated
warnings you could run it as:`),OW.forEach(o),ay=d(t),g(yi.$$.fragment,t),ny=d(t),Kd=s(t,"P",{});var CW=i(Kd);G6=a(CW,`In the multi-node environment if you also don\u2019t want the logs to repeat for each node\u2019s main process, you will want to
change the above to:`),CW.forEach(o),sy=d(t),g(wi.$$.fragment,t),iy=d(t),Qd=s(t,"P",{});var IW=i(Qd);M6=a(IW,`and then only the main process of the first node will log at the \u201Cwarning\u201D level, and all other processes on the main
node and all processes on other nodes will log at the \u201Cerror\u201D level.`),IW.forEach(o),ly=d(t),ec=s(t,"P",{});var UW=i(ec);H6=a(UW,"If you need your application to be as quiet as possible you could do:"),UW.forEach(o),dy=d(t),g(Ti.$$.fragment,t),cy=d(t),Ta=s(t,"P",{});var J0=i(Ta);B6=a(J0,"(add "),kg=s(J0,"CODE",{});var FW=i(kg);V6=a(FW,"--log_on_each_node 0"),FW.forEach(o),Y6=a(J0," if on multi-node environment)"),J0.forEach(o),py=d(t),Qo=s(t,"H2",{class:!0});var K0=i(Qo);Ea=s(K0,"A",{id:!0,class:!0,href:!0});var zW=i(Ea);Ag=s(zW,"SPAN",{});var NW=i(Ag);g(Ei.$$.fragment,NW),NW.forEach(o),zW.forEach(o),X6=d(K0),qg=s(K0,"SPAN",{});var LW=i(qg);Z6=a(LW,"Randomness"),LW.forEach(o),K0.forEach(o),my=d(t),_e=s(t,"P",{});var vo=i(_e);J6=a(vo,"When resuming from a checkpoint generated by "),tc=s(vo,"A",{href:!0});var jW=i(tc);K6=a(jW,"Trainer"),jW.forEach(o),Q6=a(vo,` all efforts are made to restore the
`),Pg=s(vo,"EM",{});var RW=i(Pg);eD=a(RW,"python"),RW.forEach(o),tD=a(vo,", "),Dg=s(vo,"EM",{});var WW=i(Dg);oD=a(WW,"numpy"),WW.forEach(o),rD=a(vo," and "),Sg=s(vo,"EM",{});var GW=i(Sg);aD=a(GW,"pytorch"),GW.forEach(o),nD=a(vo,` RNG states to the same states as they were at the moment of saving that checkpoint,
which should make the \u201Cstop and resume\u201D style of training as close as possible to non-stop training.`),vo.forEach(o),hy=d(t),Bt=s(t,"P",{});var pm=i(Bt);sD=a(pm,`However, due to various default non-deterministic pytorch settings this might not fully work. If you want full
determinism please refer to `),$i=s(pm,"A",{href:!0,rel:!0});var MW=i($i);iD=a(MW,"Controlling sources of randomness"),MW.forEach(o),lD=a(pm,`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),Og=s(pm,"CODE",{});var HW=i(Og);dD=a(HW,"torch.backends.cudnn.deterministic"),HW.forEach(o),cD=a(pm,`) may slow things down, therefore this
can\u2019t be done by default, but you can enable those yourself if needed.`),pm.forEach(o),uy=d(t),er=s(t,"H2",{class:!0});var Q0=i(er);$a=s(Q0,"A",{id:!0,class:!0,href:!0});var BW=i($a);Cg=s(BW,"SPAN",{});var VW=i(Cg);g(xi.$$.fragment,VW),VW.forEach(o),BW.forEach(o),pD=d(Q0),Ig=s(Q0,"SPAN",{});var YW=i(Ig);mD=a(YW,"Specific GPUs Selection"),YW.forEach(o),Q0.forEach(o),fy=d(t),oc=s(t,"P",{});var XW=i(oc);hD=a(XW,"Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),XW.forEach(o),gy=d(t),xa=s(t,"P",{});var eT=i(xa);uD=a(eT,"When using "),ki=s(eT,"A",{href:!0,rel:!0});var ZW=i(ki);Ug=s(ZW,"CODE",{});var JW=i(Ug);fD=a(JW,"DistributedDataParallel"),JW.forEach(o),ZW.forEach(o),gD=a(eT," to use only a subset of your GPUs, you simply specify the number of GPUs to use. For example, if you have 4 GPUs, but you wish to use the first 2 you can do:"),eT.forEach(o),_y=d(t),g(Ai.$$.fragment,t),vy=d(t),Vt=s(t,"P",{});var mm=i(Vt);_D=a(mm,"if you have either "),qi=s(mm,"A",{href:!0,rel:!0});var KW=i(qi);Fg=s(KW,"CODE",{});var QW=i(Fg);vD=a(QW,"accelerate"),QW.forEach(o),KW.forEach(o),bD=a(mm," or "),Pi=s(mm,"A",{href:!0,rel:!0});var eG=i(Pi);zg=s(eG,"CODE",{});var tG=i(zg);yD=a(tG,"deepspeed"),tG.forEach(o),eG.forEach(o),wD=a(mm," installed you can also accomplish the same by using one of:"),mm.forEach(o),by=d(t),g(Di.$$.fragment,t),yy=d(t),g(Si.$$.fragment,t),wy=d(t),ka=s(t,"P",{});var tT=i(ka);TD=a(tT,"You don\u2019t need to use the Accelerate or "),rc=s(tT,"A",{href:!0});var oG=i(rc);ED=a(oG,"the Deepspeed integration"),oG.forEach(o),$D=a(tT," features to use these launchers."),tT.forEach(o),Ty=d(t),ac=s(t,"P",{});var rG=i(ac);xD=a(rG,"Until now you were able to tell the program how many GPUs to use. Now let\u2019s discuss how to select specific GPUs and control their order."),rG.forEach(o),Ey=d(t),nc=s(t,"P",{});var aG=i(nc);kD=a(aG,"The following environment variables help you control which GPUs to use and their order."),aG.forEach(o),$y=d(t),sc=s(t,"P",{});var nG=i(sc);Ng=s(nG,"STRONG",{});var sG=i(Ng);Lg=s(sG,"CODE",{});var iG=i(Lg);AD=a(iG,"CUDA_VISIBLE_DEVICES"),iG.forEach(o),sG.forEach(o),nG.forEach(o),xy=d(t),Aa=s(t,"P",{});var oT=i(Aa);qD=a(oT,"If you have multiple GPUs and you\u2019d like to use only 1 or a few of those GPUs, set the environment variable "),jg=s(oT,"CODE",{});var lG=i(jg);PD=a(lG,"CUDA_VISIBLE_DEVICES"),lG.forEach(o),DD=a(oT," to a list of the GPUs to be used."),oT.forEach(o),ky=d(t),ic=s(t,"P",{});var dG=i(ic);SD=a(dG,"For example, let\u2019s say you have 4 GPUs: 0, 1, 2 and 3. To run only on the physical GPUs 0 and 2, you can do:"),dG.forEach(o),Ay=d(t),g(Oi.$$.fragment,t),qy=d(t),Yt=s(t,"P",{});var hm=i(Yt);OD=a(hm,"So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),Rg=s(hm,"CODE",{});var cG=i(Rg);CD=a(cG,"cuda:0"),cG.forEach(o),ID=a(hm," and "),Wg=s(hm,"CODE",{});var pG=i(Wg);UD=a(pG,"cuda:1"),pG.forEach(o),FD=a(hm," correspondingly."),hm.forEach(o),Py=d(t),lc=s(t,"P",{});var mG=i(lc);zD=a(mG,"You can even change their order:"),mG.forEach(o),Dy=d(t),g(Ci.$$.fragment,t),Sy=d(t),Xt=s(t,"P",{});var um=i(Xt);ND=a(um,"Here your physical GPUs 0 and 2 are mapped to "),Gg=s(um,"CODE",{});var hG=i(Gg);LD=a(hG,"cuda:1"),hG.forEach(o),jD=a(um," and "),Mg=s(um,"CODE",{});var uG=i(Mg);RD=a(uG,"cuda:0"),uG.forEach(o),WD=a(um," correspondingly."),um.forEach(o),Oy=d(t),Zt=s(t,"P",{});var fm=i(Zt);GD=a(fm,"The above examples were all for "),Hg=s(fm,"CODE",{});var fG=i(Hg);MD=a(fG,"DistributedDataParallel"),fG.forEach(o),HD=a(fm," use pattern, but the same method works for "),Ii=s(fm,"A",{href:!0,rel:!0});var gG=i(Ii);Bg=s(gG,"CODE",{});var _G=i(Bg);BD=a(_G,"DataParallel"),_G.forEach(o),gG.forEach(o),VD=a(fm," as well:"),fm.forEach(o),Cy=d(t),g(Ui.$$.fragment,t),Iy=d(t),dc=s(t,"P",{});var vG=i(dc);YD=a(vG,"To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),vG.forEach(o),Uy=d(t),g(Fi.$$.fragment,t),Fy=d(t),cc=s(t,"P",{});var bG=i(cc);XD=a(bG,"As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),bG.forEach(o),zy=d(t),g(zi.$$.fragment,t),Ny=d(t),pc=s(t,"P",{});var yG=i(pc);ZD=a(yG,"but this approach can be confusing since you may forget you set up the environment variable earlier and not understand why the wrong GPUs are used. Therefore, it\u2019s a common practice to set the environment variable just for a specific run on the same command line as it\u2019s shown in most examples of this section."),yG.forEach(o),Ly=d(t),mc=s(t,"P",{});var wG=i(mc);Vg=s(wG,"STRONG",{});var TG=i(Vg);Yg=s(TG,"CODE",{});var EG=i(Yg);JD=a(EG,"CUDA_DEVICE_ORDER"),EG.forEach(o),TG.forEach(o),wG.forEach(o),jy=d(t),qa=s(t,"P",{});var rT=i(qa);KD=a(rT,"There is an additional environment variable "),Xg=s(rT,"CODE",{});var $G=i(Xg);QD=a($G,"CUDA_DEVICE_ORDER"),$G.forEach(o),e8=a(rT," that controls how the physical devices are ordered. The two choices are:"),rT.forEach(o),Ry=d(t),hc=s(t,"OL",{});var xG=i(hc);Ni=s(xG,"LI",{});var aT=i(Ni);t8=a(aT,"ordered by PCIe bus IDs (matches "),Zg=s(aT,"CODE",{});var kG=i(Zg);o8=a(kG,"nvidia-smi"),kG.forEach(o),r8=a(aT,"\u2019s order) - this is the default."),aT.forEach(o),xG.forEach(o),Wy=d(t),g(Li.$$.fragment,t),Gy=d(t),ji=s(t,"OL",{start:!0});var AG=i(ji);Jg=s(AG,"LI",{});var qG=i(Jg);a8=a(qG,"ordered by GPU compute capabilities"),qG.forEach(o),AG.forEach(o),My=d(t),g(Ri.$$.fragment,t),Hy=d(t),Jt=s(t,"P",{});var gm=i(Jt);n8=a(gm,"Most of the time you don\u2019t need to care about this environment variable, but it\u2019s very helpful if you have a lopsided setup where you have an old and a new GPUs physically inserted in such a way so that the slow older card appears to be first. One way to fix that is to swap the cards. But if you can\u2019t swap the cards (e.g., if the cooling of the devices gets impacted) then setting "),Kg=s(gm,"CODE",{});var PG=i(Kg);s8=a(PG,"CUDA_DEVICE_ORDER=FASTEST_FIRST"),PG.forEach(o),i8=a(gm," will always put the newer faster card first. It\u2019ll be somewhat confusing though since "),Qg=s(gm,"CODE",{});var DG=i(Qg);l8=a(DG,"nvidia-smi"),DG.forEach(o),d8=a(gm," will still report them in the PCIe order."),gm.forEach(o),By=d(t),uc=s(t,"P",{});var SG=i(uc);c8=a(SG,"The other solution to swapping the order is to use:"),SG.forEach(o),Vy=d(t),g(Wi.$$.fragment,t),Yy=d(t),fc=s(t,"P",{});var OG=i(fc);p8=a(OG,"In this example we are working with just 2 GPUs, but of course the same would apply to as many GPUs as your computer has."),OG.forEach(o),Xy=d(t),Pa=s(t,"P",{});var nT=i(Pa);m8=a(nT,"Also if you do set this environment variable it\u2019s the best to set it in your "),e_=s(nT,"CODE",{});var CG=i(e_);h8=a(CG,"~/.bashrc"),CG.forEach(o),u8=a(nT," file or some other startup config file and forget about it."),nT.forEach(o),Zy=d(t),tr=s(t,"H2",{class:!0});var sT=i(tr);Da=s(sT,"A",{id:!0,class:!0,href:!0});var IG=i(Da);t_=s(IG,"SPAN",{});var UG=i(t_);g(Gi.$$.fragment,UG),UG.forEach(o),IG.forEach(o),f8=d(sT),o_=s(sT,"SPAN",{});var FG=i(o_);g8=a(FG,"Trainer Integrations"),FG.forEach(o),sT.forEach(o),Jy=d(t),Sa=s(t,"P",{});var iT=i(Sa);_8=a(iT,"The "),gc=s(iT,"A",{href:!0});var zG=i(gc);v8=a(zG,"Trainer"),zG.forEach(o),b8=a(iT,` has been extended to support libraries that may dramatically improve your training
time and fit much bigger models.`),iT.forEach(o),Ky=d(t),ve=s(t,"P",{});var bo=i(ve);y8=a(bo,"Currently it supports third party solutions, "),Mi=s(bo,"A",{href:!0,rel:!0});var NG=i(Mi);w8=a(NG,"DeepSpeed"),NG.forEach(o),T8=a(bo,", "),Hi=s(bo,"A",{href:!0,rel:!0});var LG=i(Hi);E8=a(LG,"PyTorch FSDP"),LG.forEach(o),$8=a(bo," and "),Bi=s(bo,"A",{href:!0,rel:!0});var jG=i(Bi);x8=a(jG,"FairScale"),jG.forEach(o),k8=a(bo,", which implement parts of the paper "),Vi=s(bo,"A",{href:!0,rel:!0});var RG=i(Vi);A8=a(RG,`ZeRO: Memory Optimizations
Toward Training Trillion Parameter Models, by Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, Yuxiong He`),RG.forEach(o),q8=a(bo,"."),bo.forEach(o),Qy=d(t),Oa=s(t,"P",{});var lT=i(Oa);P8=a(lT,"This provided support is new and experimental as of this writing. While the support for DeepSpeed and PyTorch FSDP is active and we welcome issues around it, we don\u2019t support the FairScale integration anymore since it has been integrated in PyTorch main (see the "),_c=s(lT,"A",{href:!0});var WG=i(_c);D8=a(WG,"PyTorch FSDP integration"),WG.forEach(o),S8=a(lT,")"),lT.forEach(o),e2=d(t),vc=s(t,"A",{id:!0}),i(vc).forEach(o),t2=d(t),or=s(t,"H3",{class:!0});var dT=i(or);Ca=s(dT,"A",{id:!0,class:!0,href:!0});var GG=i(Ca);r_=s(GG,"SPAN",{});var MG=i(r_);g(Yi.$$.fragment,MG),MG.forEach(o),GG.forEach(o),O8=d(dT),a_=s(dT,"SPAN",{});var HG=i(a_);C8=a(HG,"CUDA Extension Installation Notes"),HG.forEach(o),dT.forEach(o),o2=d(t),bc=s(t,"P",{});var BG=i(bc);I8=a(BG,"As of this writing, both FairScale and Deepspeed require compilation of CUDA C++ code, before they can be used."),BG.forEach(o),r2=d(t),Kt=s(t,"P",{});var _m=i(Kt);U8=a(_m,"While all installation issues should be dealt with through the corresponding GitHub Issues of "),Xi=s(_m,"A",{href:!0,rel:!0});var VG=i(Xi);F8=a(VG,"FairScale"),VG.forEach(o),z8=a(_m," and "),Zi=s(_m,"A",{href:!0,rel:!0});var YG=i(Zi);N8=a(YG,"Deepspeed"),YG.forEach(o),L8=a(_m,`, there are a few common issues that one may encounter while building
any PyTorch extension that needs to build CUDA extensions.`),_m.forEach(o),a2=d(t),yc=s(t,"P",{});var XG=i(yc);j8=a(XG,"Therefore, if you encounter a CUDA-related build issue while doing one of the following or both:"),XG.forEach(o),n2=d(t),g(Ji.$$.fragment,t),s2=d(t),wc=s(t,"P",{});var ZG=i(wc);R8=a(ZG,"please, read the following notes first."),ZG.forEach(o),i2=d(t),Qt=s(t,"P",{});var vm=i(Qt);W8=a(vm,"In these notes we give examples for what to do when "),n_=s(vm,"CODE",{});var JG=i(n_);G8=a(JG,"pytorch"),JG.forEach(o),M8=a(vm," has been built with CUDA "),s_=s(vm,"CODE",{});var KG=i(s_);H8=a(KG,"10.2"),KG.forEach(o),B8=a(vm,`. If your situation is
different remember to adjust the version number to the one you are after.`),vm.forEach(o),l2=d(t),rr=s(t,"H4",{class:!0});var cT=i(rr);Ia=s(cT,"A",{id:!0,class:!0,href:!0});var QG=i(Ia);i_=s(QG,"SPAN",{});var eM=i(i_);g(Ki.$$.fragment,eM),eM.forEach(o),QG.forEach(o),V8=d(cT),l_=s(cT,"SPAN",{});var tM=i(l_);Y8=a(tM,"Possible problem #1"),tM.forEach(o),cT.forEach(o),d2=d(t),Tc=s(t,"P",{});var oM=i(Tc);X8=a(oM,`While, Pytorch comes with its own CUDA toolkit, to build these two projects you must have an identical version of CUDA
installed system-wide.`),oM.forEach(o),c2=d(t),Ve=s(t,"P",{});var vn=i(Ve);Z8=a(vn,"For example, if you installed "),d_=s(vn,"CODE",{});var rM=i(d_);J8=a(rM,"pytorch"),rM.forEach(o),K8=a(vn," with "),c_=s(vn,"CODE",{});var aM=i(c_);Q8=a(aM,"cudatoolkit==10.2"),aM.forEach(o),e9=a(vn,` in the Python environment, you also need to have
CUDA `),p_=s(vn,"CODE",{});var nM=i(p_);t9=a(nM,"10.2"),nM.forEach(o),o9=a(vn," installed system-wide."),vn.forEach(o),p2=d(t),eo=s(t,"P",{});var bm=i(eo);r9=a(bm,"The exact location may vary from system to system, but "),m_=s(bm,"CODE",{});var sM=i(m_);a9=a(sM,"/usr/local/cuda-10.2"),sM.forEach(o),n9=a(bm,` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),h_=s(bm,"CODE",{});var iM=i(h_);s9=a(iM,"PATH"),iM.forEach(o),i9=a(bm,` environment variable, one can find the
installation location by doing:`),bm.forEach(o),m2=d(t),g(Qi.$$.fragment,t),h2=d(t),Ua=s(t,"P",{});var pT=i(Ua);l9=a(pT,`If you don\u2019t have CUDA installed system-wide, install it first. You will find the instructions by using your favorite
search engine. For example, if you\u2019re on Ubuntu you may want to search for: `),el=s(pT,"A",{href:!0,rel:!0});var lM=i(el);d9=a(lM,"ubuntu cuda 10.2 install"),lM.forEach(o),c9=a(pT,"."),pT.forEach(o),u2=d(t),ar=s(t,"H4",{class:!0});var mT=i(ar);Fa=s(mT,"A",{id:!0,class:!0,href:!0});var dM=i(Fa);u_=s(dM,"SPAN",{});var cM=i(u_);g(tl.$$.fragment,cM),cM.forEach(o),dM.forEach(o),p9=d(mT),f_=s(mT,"SPAN",{});var pM=i(f_);m9=a(pM,"Possible problem #2"),pM.forEach(o),mT.forEach(o),f2=d(t),Ec=s(t,"P",{});var mM=i(Ec);h9=a(mM,`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),mM.forEach(o),g2=d(t),g(ol.$$.fragment,t),_2=d(t),to=s(t,"P",{});var ym=i(to);u9=a(ym,"Now, in this situation you need to make sure that your "),g_=s(ym,"CODE",{});var hM=i(g_);f9=a(hM,"PATH"),hM.forEach(o),g9=a(ym," and "),__=s(ym,"CODE",{});var uM=i(__);_9=a(uM,"LD_LIBRARY_PATH"),uM.forEach(o),v9=a(ym,` environment variables contain
the correct paths to the desired CUDA version. Typically, package installers will set these to contain whatever the
last version was installed. If you encounter the problem, where the package build fails because it can\u2019t find the right
CUDA version despite you having it installed system-wide, it means that you need to adjust the 2 aforementioned
environment variables.`),ym.forEach(o),v2=d(t),$c=s(t,"P",{});var fM=i($c);b9=a(fM,"First, you may look at their contents:"),fM.forEach(o),b2=d(t),g(rl.$$.fragment,t),y2=d(t),xc=s(t,"P",{});var gM=i(xc);y9=a(gM,"so you get an idea of what is inside."),gM.forEach(o),w2=d(t),za=s(t,"P",{});var hT=i(za);w9=a(hT,"It\u2019s possible that "),v_=s(hT,"CODE",{});var _M=i(v_);T9=a(_M,"LD_LIBRARY_PATH"),_M.forEach(o),E9=a(hT," is empty."),hT.forEach(o),T2=d(t),ht=s(t,"P",{});var id=i(ht);b_=s(id,"CODE",{});var vM=i(b_);$9=a(vM,"PATH"),vM.forEach(o),x9=a(id," lists the locations of where executables can be found and "),y_=s(id,"CODE",{});var bM=i(y_);k9=a(bM,"LD_LIBRARY_PATH"),bM.forEach(o),A9=a(id,` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),w_=s(id,"CODE",{});var yM=i(w_);q9=a(yM,":"),yM.forEach(o),P9=a(id,` is used to separate multiple
entries.`),id.forEach(o),E2=d(t),kc=s(t,"P",{});var wM=i(kc);D9=a(wM,`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),wM.forEach(o),$2=d(t),g(al.$$.fragment,t),x2=d(t),Ac=s(t,"P",{});var TM=i(Ac);S9=a(TM,"Note that we aren\u2019t overwriting the existing values, but prepending instead."),TM.forEach(o),k2=d(t),Ye=s(t,"P",{});var bn=i(Ye);O9=a(bn,`Of course, adjust the version number, the full path if need be. Check that the directories you assign actually do
exist. `),T_=s(bn,"CODE",{});var EM=i(T_);C9=a(EM,"lib64"),EM.forEach(o),I9=a(bn," sub-directory is where the various CUDA "),E_=s(bn,"CODE",{});var $M=i(E_);U9=a($M,".so"),$M.forEach(o),F9=a(bn," objects, like "),$_=s(bn,"CODE",{});var xM=i($_);z9=a(xM,"libcudart.so"),xM.forEach(o),N9=a(bn,` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),bn.forEach(o),A2=d(t),nr=s(t,"H4",{class:!0});var uT=i(nr);Na=s(uT,"A",{id:!0,class:!0,href:!0});var kM=i(Na);x_=s(kM,"SPAN",{});var AM=i(x_);g(nl.$$.fragment,AM),AM.forEach(o),kM.forEach(o),L9=d(uT),k_=s(uT,"SPAN",{});var qM=i(k_);j9=a(qM,"Possible problem #3"),qM.forEach(o),uT.forEach(o),q2=d(t),oo=s(t,"P",{});var wm=i(oo);R9=a(wm,"Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),A_=s(wm,"CODE",{});var PM=i(A_);W9=a(PM,"gcc-9"),PM.forEach(o),G9=a(wm,` but it wants
`),q_=s(wm,"CODE",{});var DM=i(q_);M9=a(DM,"gcc-7"),DM.forEach(o),H9=a(wm,"."),wm.forEach(o),P2=d(t),qc=s(t,"P",{});var SM=i(qc);B9=a(SM,"There are various ways to go about it."),SM.forEach(o),D2=d(t),Pc=s(t,"P",{});var OM=i(Pc);V9=a(OM,"If you can install the latest CUDA toolkit it typically should support the newer compiler."),OM.forEach(o),S2=d(t),La=s(t,"P",{});var fT=i(La);Y9=a(fT,`Alternatively, you could install the lower version of the compiler in addition to the one you already have, or you may
already have it but it\u2019s not the default one, so the build system can\u2019t see it. If you have `),P_=s(fT,"CODE",{});var CM=i(P_);X9=a(CM,"gcc-7"),CM.forEach(o),Z9=a(fT,` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),fT.forEach(o),O2=d(t),g(sl.$$.fragment,t),C2=d(t),ee=s(t,"P",{});var ye=i(ee);J9=a(ye,"Here, we are making a symlink to "),D_=s(ye,"CODE",{});var IM=i(D_);K9=a(IM,"gcc-7"),IM.forEach(o),Q9=a(ye," from "),S_=s(ye,"CODE",{});var UM=i(S_);eS=a(UM,"/usr/local/cuda-10.2/bin/gcc"),UM.forEach(o),tS=a(ye,` and since
`),O_=s(ye,"CODE",{});var FM=i(O_);oS=a(FM,"/usr/local/cuda-10.2/bin/"),FM.forEach(o),rS=a(ye," should be in the "),C_=s(ye,"CODE",{});var zM=i(C_);aS=a(zM,"PATH"),zM.forEach(o),nS=a(ye,` environment variable (see the previous problem\u2019s solution), it
should find `),I_=s(ye,"CODE",{});var NM=i(I_);sS=a(NM,"gcc-7"),NM.forEach(o),iS=a(ye," (and "),U_=s(ye,"CODE",{});var LM=i(U_);lS=a(LM,"g++7"),LM.forEach(o),dS=a(ye,") and then the build will succeed."),ye.forEach(o),I2=d(t),Dc=s(t,"P",{});var jM=i(Dc);cS=a(jM,"As always make sure to edit the paths in the example to match your situation."),jM.forEach(o),U2=d(t),sr=s(t,"H3",{class:!0});var gT=i(sr);ja=s(gT,"A",{id:!0,class:!0,href:!0});var RM=i(ja);F_=s(RM,"SPAN",{});var WM=i(F_);g(il.$$.fragment,WM),WM.forEach(o),RM.forEach(o),pS=d(gT),z_=s(gT,"SPAN",{});var GM=i(z_);mS=a(GM,"FairScale"),GM.forEach(o),gT.forEach(o),F2=d(t),g(Ra.$$.fragment,t),z2=d(t),Xe=s(t,"P",{});var yn=i(Xe);hS=a(yn,"By integrating "),ll=s(yn,"A",{href:!0,rel:!0});var MM=i(ll);uS=a(MM,"FairScale"),MM.forEach(o),fS=a(yn," the "),Sc=s(yn,"A",{href:!0});var HM=i(Sc);gS=a(HM,"Trainer"),HM.forEach(o),_S=a(yn,`
provides support for the following features from `),dl=s(yn,"A",{href:!0,rel:!0});var BM=i(dl);vS=a(BM,"the ZeRO paper"),BM.forEach(o),bS=a(yn,":"),yn.forEach(o),N2=d(t),Ze=s(t,"OL",{});var wn=i(Ze);N_=s(wn,"LI",{});var VM=i(N_);yS=a(VM,"Optimizer State Sharding"),VM.forEach(o),wS=d(wn),L_=s(wn,"LI",{});var YM=i(L_);TS=a(YM,"Gradient Sharding"),YM.forEach(o),ES=d(wn),j_=s(wn,"LI",{});var XM=i(j_);$S=a(XM,"Model Parameters Sharding (new and very experimental)"),XM.forEach(o),xS=d(wn),R_=s(wn,"LI",{});var ZM=i(R_);kS=a(ZM,"CPU offload (new and very experimental)"),ZM.forEach(o),wn.forEach(o),L2=d(t),Oc=s(t,"P",{});var JM=i(Oc);AS=a(JM,"You will need at least two GPUs to use this feature."),JM.forEach(o),j2=d(t),cl=s(t,"P",{});var oN=i(cl);W_=s(oN,"STRONG",{});var KM=i(W_);qS=a(KM,"Installation"),KM.forEach(o),PS=a(oN,":"),oN.forEach(o),R2=d(t),Cc=s(t,"P",{});var QM=i(Cc);DS=a(QM,"Install the library via pypi:"),QM.forEach(o),W2=d(t),g(pl.$$.fragment,t),G2=d(t),ro=s(t,"P",{});var Tm=i(ro);SS=a(Tm,"or via "),G_=s(Tm,"CODE",{});var eH=i(G_);OS=a(eH,"transformers"),eH.forEach(o),CS=a(Tm,"\u2019 "),M_=s(Tm,"CODE",{});var tH=i(M_);IS=a(tH,"extras"),tH.forEach(o),US=a(Tm,":"),Tm.forEach(o),M2=d(t),g(ml.$$.fragment,t),H2=d(t),ao=s(t,"P",{});var Em=i(ao);FS=a(Em,"(available starting from "),H_=s(Em,"CODE",{});var oH=i(H_);zS=a(oH,"transformers==4.6.0"),oH.forEach(o),NS=a(Em,") or find more details on "),hl=s(Em,"A",{href:!0,rel:!0});var rH=i(hl);LS=a(rH,"the FairScale\u2019s GitHub page"),rH.forEach(o),jS=a(Em,"."),Em.forEach(o),B2=d(t),Wa=s(t,"P",{});var _T=i(Wa);RS=a(_T,"If you\u2019re still struggling with the build, first make sure to read "),Ic=s(_T,"A",{href:!0});var aH=i(Ic);WS=a(aH,"CUDA Extension Installation Notes"),aH.forEach(o),GS=a(_T,"."),_T.forEach(o),V2=d(t),Uc=s(t,"P",{});var nH=i(Uc);MS=a(nH,"If it\u2019s still not resolved the build issue, here are a few more ideas."),nH.forEach(o),Y2=d(t),ul=s(t,"P",{});var rN=i(ul);B_=s(rN,"CODE",{});var sH=i(B_);HS=a(sH,"fairscale"),sH.forEach(o),BS=a(rN,` seems to have an issue with the recently introduced by pip build isolation feature. If you have a problem
with it, you may want to try one of:`),rN.forEach(o),X2=d(t),g(fl.$$.fragment,t),Z2=d(t),Fc=s(t,"P",{});var iH=i(Fc);VS=a(iH,"or:"),iH.forEach(o),J2=d(t),g(gl.$$.fragment,t),K2=d(t),_l=s(t,"P",{});var aN=i(_l);V_=s(aN,"CODE",{});var lH=i(V_);YS=a(lH,"fairscale"),lH.forEach(o),XS=a(aN," also has issues with building against pytorch-nightly, so if you use it you may have to try one of:"),aN.forEach(o),Q2=d(t),g(vl.$$.fragment,t),ew=d(t),zc=s(t,"P",{});var dH=i(zc);ZS=a(dH,"or:"),dH.forEach(o),tw=d(t),g(bl.$$.fragment,t),ow=d(t),Nc=s(t,"P",{});var cH=i(Nc);JS=a(cH,"Of course, adjust the urls to match the cuda version you use."),cH.forEach(o),rw=d(t),Ga=s(t,"P",{});var vT=i(Ga);KS=a(vT,`If after trying everything suggested you still encounter build issues, please, proceed with the GitHub Issue of
`),yl=s(vT,"A",{href:!0,rel:!0});var pH=i(yl);QS=a(pH,"FairScale"),pH.forEach(o),eO=a(vT,"."),vT.forEach(o),aw=d(t),wl=s(t,"P",{});var nN=i(wl);Y_=s(nN,"STRONG",{});var mH=i(Y_);tO=a(mH,"Usage"),mH.forEach(o),oO=a(nN,":"),nN.forEach(o),nw=d(t),no=s(t,"P",{});var $m=i(no);rO=a($m,"To use the first version of Sharded data-parallelism, add "),X_=s($m,"CODE",{});var hH=i(X_);aO=a(hH,"--sharded_ddp simple"),hH.forEach(o),nO=a($m,` to the command line arguments, and
make sure you have added the distributed launcher `),Z_=s($m,"CODE",{});var uH=i(Z_);sO=a(uH,"-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),uH.forEach(o),iO=a($m," if you haven\u2019t been using it already."),$m.forEach(o),sw=d(t),Ma=s(t,"P",{});var bT=i(Ma);lO=a(bT,"For example here is how you could use it for "),J_=s(bT,"CODE",{});var fH=i(J_);dO=a(fH,"run_translation.py"),fH.forEach(o),cO=a(bT," with 2 GPUs:"),bT.forEach(o),iw=d(t),g(Tl.$$.fragment,t),lw=d(t),Lc=s(t,"P",{});var gH=i(Lc);pO=a(gH,"Notes:"),gH.forEach(o),dw=d(t),Je=s(t,"UL",{});var Tn=i(Je);K_=s(Tn,"LI",{});var _H=i(K_);mO=a(_H,"This feature requires distributed training (so multiple GPUs)."),_H.forEach(o),hO=d(Tn),Q_=s(Tn,"LI",{});var vH=i(Q_);uO=a(vH,"It is not implemented for TPUs."),vH.forEach(o),fO=d(Tn),El=s(Tn,"LI",{});var yT=i(El);gO=a(yT,"It works with "),ev=s(yT,"CODE",{});var bH=i(ev);_O=a(bH,"--fp16"),bH.forEach(o),vO=a(yT," too, to make things even faster."),yT.forEach(o),bO=d(Tn),$l=s(Tn,"LI",{});var wT=i($l);yO=a(wT,"One of the main benefits of enabling "),tv=s(wT,"CODE",{});var yH=i(tv);wO=a(yH,"--sharded_ddp simple"),yH.forEach(o),TO=a(wT,` is that it uses a lot less GPU memory, so you should be
able to use significantly larger batch sizes using the same hardware (e.g. 3x and even bigger) which should lead to
significantly shorter training time.`),wT.forEach(o),Tn.forEach(o),cw=d(t),xl=s(t,"OL",{start:!0});var wH=i(xl);ut=s(wH,"LI",{});var En=i(ut);EO=a(En,"To use the second version of Sharded data-parallelism, add "),ov=s(En,"CODE",{});var TH=i(ov);$O=a(TH,"--sharded_ddp zero_dp_2"),TH.forEach(o),xO=a(En," or "),rv=s(En,"CODE",{});var EH=i(rv);kO=a(EH,"--sharded_ddp zero_dp_3"),EH.forEach(o),AO=a(En," to the command line arguments, and make sure you have added the distributed launcher "),av=s(En,"CODE",{});var $H=i(av);qO=a($H,"-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),$H.forEach(o),PO=a(En," if you haven\u2019t been using it already."),En.forEach(o),wH.forEach(o),pw=d(t),Ha=s(t,"P",{});var TT=i(Ha);DO=a(TT,"For example here is how you could use it for "),nv=s(TT,"CODE",{});var xH=i(nv);SO=a(xH,"run_translation.py"),xH.forEach(o),OO=a(TT," with 2 GPUs:"),TT.forEach(o),mw=d(t),g(kl.$$.fragment,t),hw=d(t),ir=s(t,"P",{});var $1=i(ir);sv=s($1,"CODE",{});var kH=i(sv);CO=a(kH,"zero_dp_2"),kH.forEach(o),IO=a($1," is an optimized version of the simple wrapper, while "),iv=s($1,"CODE",{});var AH=i(iv);UO=a(AH,"zero_dp_3"),AH.forEach(o),FO=a($1,` fully shards model weights,
gradients and optimizer states.`),$1.forEach(o),uw=d(t),so=s(t,"P",{});var xm=i(so);zO=a(xm,"Both are compatible with adding "),lv=s(xm,"CODE",{});var qH=i(lv);NO=a(qH,"cpu_offload"),qH.forEach(o),LO=a(xm," to enable ZeRO-offload (activate it like this: "),dv=s(xm,"CODE",{});var PH=i(dv);jO=a(PH,'--sharded_ddp "zero_dp_2 cpu_offload"'),PH.forEach(o),RO=a(xm,")."),xm.forEach(o),fw=d(t),jc=s(t,"P",{});var DH=i(jc);WO=a(DH,"Notes:"),DH.forEach(o),gw=d(t),be=s(t,"UL",{});var yo=i(be);cv=s(yo,"LI",{});var SH=i(cv);GO=a(SH,"This feature requires distributed training (so multiple GPUs)."),SH.forEach(o),MO=d(yo),pv=s(yo,"LI",{});var OH=i(pv);HO=a(OH,"It is not implemented for TPUs."),OH.forEach(o),BO=d(yo),Al=s(yo,"LI",{});var ET=i(Al);VO=a(ET,"It works with "),mv=s(ET,"CODE",{});var CH=i(mv);YO=a(CH,"--fp16"),CH.forEach(o),XO=a(ET," too, to make things even faster."),ET.forEach(o),ZO=d(yo),lr=s(yo,"LI",{});var km=i(lr);JO=a(km,"The "),hv=s(km,"CODE",{});var IH=i(hv);KO=a(IH,"cpu_offload"),IH.forEach(o),QO=a(km," additional option requires "),uv=s(km,"CODE",{});var UH=i(uv);eC=a(UH,"--fp16"),UH.forEach(o),tC=a(km,"."),km.forEach(o),oC=d(yo),fv=s(yo,"LI",{});var FH=i(fv);rC=a(FH,`This is an area of active development, so make sure you have a source install of fairscale to use this feature as
some bugs you encounter may have been fixed there already.`),FH.forEach(o),yo.forEach(o),_w=d(t),Rc=s(t,"P",{});var zH=i(Rc);aC=a(zH,"Known caveats:"),zH.forEach(o),vw=d(t),Ba=s(t,"UL",{});var $T=i(Ba);dr=s($T,"LI",{});var Am=i(dr);nC=a(Am,"This feature is incompatible with "),gv=s(Am,"CODE",{});var NH=i(gv);sC=a(NH,"--predict_with_generate"),NH.forEach(o),iC=a(Am," in the "),_v=s(Am,"EM",{});var LH=i(_v);lC=a(LH,"run_translation.py"),LH.forEach(o),dC=a(Am," script."),Am.forEach(o),cC=d($T),Pe=s($T,"LI",{});var wo=i(Pe);pC=a(wo,"Using "),vv=s(wo,"CODE",{});var jH=i(vv);mC=a(jH,"--sharded_ddp zero_dp_3"),jH.forEach(o),hC=a(wo,` requires wrapping each layer of the model in the special container
`),bv=s(wo,"CODE",{});var RH=i(bv);uC=a(RH,"FullyShardedDataParallelism"),RH.forEach(o),fC=a(wo," of fairscale. It should be used with the option "),yv=s(wo,"CODE",{});var WH=i(yv);gC=a(WH,"auto_wrap"),WH.forEach(o),_C=a(wo,` if you are not
doing this yourself: `),wv=s(wo,"CODE",{});var GH=i(wv);vC=a(GH,'--sharded_ddp "zero_dp_3 auto_wrap"'),GH.forEach(o),bC=a(wo,"."),wo.forEach(o),$T.forEach(o),bw=d(t),cr=s(t,"H3",{class:!0});var xT=i(cr);Va=s(xT,"A",{id:!0,class:!0,href:!0});var MH=i(Va);Tv=s(MH,"SPAN",{});var HH=i(Tv);g(ql.$$.fragment,HH),HH.forEach(o),MH.forEach(o),yC=d(xT),Ev=s(xT,"SPAN",{});var BH=i(Ev);wC=a(BH,"PyTorch Fully Sharded Data parallel"),BH.forEach(o),xT.forEach(o),yw=d(t),Ya=s(t,"P",{});var kT=i(Ya);TC=a(kT,`To accelerate training huge models on larger batch sizes, we can use a fully sharded data parallel model.
This type of data parallel paradigm enables fitting more data and larger models by sharding the optimizer states, gradients and parameters.
To read more about it and the benefits, check out the `),Pl=s(kT,"A",{href:!0,rel:!0});var VH=i(Pl);EC=a(VH,"Fully Sharded Data Parallel blog"),VH.forEach(o),$C=a(kT,`.
We have integrated the latest PyTorch\u2019s Fully Sharded Data Parallel (FSDP) training feature.
All you need to do is enable it through the config.`),kT.forEach(o),ww=d(t),Dl=s(t,"P",{});var sN=i(Dl);$v=s(sN,"STRONG",{});var YH=i($v);xC=a(YH,"Required PyTorch version for FSDP support"),YH.forEach(o),kC=a(sN,`: PyTorch Nightly (or 1.12.0 if you read this after it has been released)
as the model saving with FSDP activated is only available with recent fixes.`),sN.forEach(o),Tw=d(t),Sl=s(t,"P",{});var iN=i(Sl);xv=s(iN,"STRONG",{});var XH=i(xv);AC=a(XH,"Usage"),XH.forEach(o),qC=a(iN,":"),iN.forEach(o),Ew=d(t),pe=s(t,"UL",{});var st=i(pe);kv=s(st,"LI",{});var ZH=i(kv);Ol=s(ZH,"P",{});var AT=i(Ol);PC=a(AT,`Make sure you have added the distributed launcher
`),Av=s(AT,"CODE",{});var JH=i(Av);DC=a(JH,"-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),JH.forEach(o),SC=a(AT," if you haven\u2019t been using it already."),AT.forEach(o),ZH.forEach(o),OC=d(st),Cl=s(st,"LI",{});var qT=i(Cl);Wc=s(qT,"P",{});var lN=i(Wc);qv=s(lN,"STRONG",{});var KH=i(qv);CC=a(KH,"Sharding Strategy"),KH.forEach(o),IC=a(lN,":"),lN.forEach(o),UC=d(qT),pr=s(qT,"UL",{});var qm=i(pr);Il=s(qm,"LI",{});var PT=i(Il);FC=a(PT,`FULL_SHARD : Shards optimizer states + gradients + model parameters across data parallel workers/GPUs.
For this, add `),Pv=s(PT,"CODE",{});var QH=i(Pv);zC=a(QH,"--fsdp full_shard"),QH.forEach(o),NC=a(PT," to the command line arguments."),PT.forEach(o),LC=d(qm),Ul=s(qm,"LI",{});var DT=i(Ul);jC=a(DT,`SHARD_GRAD_OP : Shards optimizer states + gradients across data parallel workers/GPUs.
For this, add `),Dv=s(DT,"CODE",{});var eB=i(Dv);RC=a(eB,"--fsdp shard_grad_op"),eB.forEach(o),WC=a(DT," to the command line arguments."),DT.forEach(o),GC=d(qm),Fl=s(qm,"LI",{});var ST=i(Fl);MC=a(ST,"NO_SHARD : No sharding. For this, add "),Sv=s(ST,"CODE",{});var tB=i(Sv);HC=a(tB,"--fsdp no_shard"),tB.forEach(o),BC=a(ST," to the command line arguments."),ST.forEach(o),qm.forEach(o),qT.forEach(o),VC=d(st),Ov=s(st,"LI",{});var oB=i(Ov);mr=s(oB,"P",{});var Pm=i(mr);YC=a(Pm,`To offload the parameters and gradients to the CPU,
add `),Cv=s(Pm,"CODE",{});var rB=i(Cv);XC=a(rB,'--fsdp "full_shard offload"'),rB.forEach(o),ZC=a(Pm," or "),Iv=s(Pm,"CODE",{});var aB=i(Iv);JC=a(aB,'--fsdp "shard_grad_op offload"'),aB.forEach(o),KC=a(Pm," to the command line arguments."),Pm.forEach(o),oB.forEach(o),QC=d(st),Uv=s(st,"LI",{});var nB=i(Uv);ft=s(nB,"P",{});var $n=i(ft);eI=a($n,"To automatically recursively wrap layers with FSDP using "),Fv=s($n,"CODE",{});var sB=i(Fv);tI=a(sB,"default_auto_wrap_policy"),sB.forEach(o),oI=a($n,`,
add `),zv=s($n,"CODE",{});var iB=i(zv);rI=a(iB,'--fsdp "full_shard auto_wrap"'),iB.forEach(o),aI=a($n," or "),Nv=s($n,"CODE",{});var lB=i(Nv);nI=a(lB,'--fsdp "shard_grad_op auto_wrap"'),lB.forEach(o),sI=a($n," to the command line arguments."),$n.forEach(o),nB.forEach(o),iI=d(st),Lv=s(st,"LI",{});var dB=i(Lv);hr=s(dB,"P",{});var Dm=i(hr);lI=a(Dm,`To enable both CPU offloading and auto wrapping,
add `),jv=s(Dm,"CODE",{});var cB=i(jv);dI=a(cB,'--fsdp "full_shard offload auto_wrap"'),cB.forEach(o),cI=a(Dm," or "),Rv=s(Dm,"CODE",{});var pB=i(Rv);pI=a(pB,'--fsdp "shard_grad_op offload auto_wrap"'),pB.forEach(o),mI=a(Dm," to the command line arguments."),Dm.forEach(o),dB.forEach(o),hI=d(st),zl=s(st,"LI",{});var OT=i(zl);gt=s(OT,"P",{});var xn=i(gt);uI=a(xn,"Remaining FSDP config is passed via "),Wv=s(xn,"CODE",{});var mB=i(Wv);fI=a(mB,"--fsdp_config <path_to_fsdp_config.json>"),mB.forEach(o),gI=a(xn,`. It is either a location of
FSDP json config file (e.g., `),Gv=s(xn,"CODE",{});var hB=i(Gv);_I=a(hB,"fsdp_config.json"),hB.forEach(o),vI=a(xn,") or an already loaded json file as "),Mv=s(xn,"CODE",{});var uB=i(Mv);bI=a(uB,"dict"),uB.forEach(o),yI=a(xn,"."),xn.forEach(o),wI=d(OT),_t=s(OT,"UL",{});var kn=i(_t);Gc=s(kn,"LI",{});var dN=i(Gc);TI=a(dN,"If auto wrapping is enabled, you can either use transformer based auto wrap policy or size based auto wrap policy."),Nl=s(dN,"UL",{});var CT=i(Nl);De=s(CT,"LI",{});var To=i(De);EI=a(To,"For transformer based auto wrap policy, please specify "),Hv=s(To,"CODE",{});var fB=i(Hv);$I=a(fB,"fsdp_transformer_layer_cls_to_wrap"),fB.forEach(o),xI=a(To,` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),Bv=s(To,"CODE",{});var gB=i(Bv);kI=a(gB,"BertLayer"),gB.forEach(o),AI=a(To,", "),Vv=s(To,"CODE",{});var _B=i(Vv);qI=a(_B,"GPTJBlock"),_B.forEach(o),PI=a(To,", "),Yv=s(To,"CODE",{});var vB=i(Yv);DI=a(vB,"T5Block"),vB.forEach(o),SI=a(To,` \u2026
This is important because submodules that share weights (e.g., embedding layer) should not end up in different FSDP wrapped units.
Using this policy, wrapping happens for each block containing Multi-Head Attention followed by couple of MLP layers.
Remaining layers including the shared embeddings are conveniently wrapped in same outermost FSDP unit.
Therefore, use this for transformer based models.`),To.forEach(o),OI=d(CT),Ll=s(CT,"LI",{});var IT=i(Ll);CI=a(IT,"For size based auto wrap policy, please add "),Xv=s(IT,"CODE",{});var bB=i(Xv);II=a(bB,"fsdp_min_num_params"),bB.forEach(o),UI=a(IT,` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),IT.forEach(o),CT.forEach(o),dN.forEach(o),FI=d(kn),vt=s(kn,"LI",{});var An=i(vt);Zv=s(An,"CODE",{});var yB=i(Zv);zI=a(yB,"fsdp_backward_prefetch"),yB.forEach(o),NI=a(An,` can be specified in the config file. It controls when to prefetch next set of parameters.
`),Jv=s(An,"CODE",{});var wB=i(Jv);LI=a(wB,"backward_pre"),wB.forEach(o),jI=a(An," and "),Kv=s(An,"CODE",{});var TB=i(Kv);RI=a(TB,"backward_pos"),TB.forEach(o),WI=a(An,` are available options.
For more information refer `),Qv=s(An,"CODE",{});var EB=i(Qv);GI=a(EB,"torch.distributed.fsdp.fully_sharded_data_parallel.BackwardPrefetch"),EB.forEach(o),An.forEach(o),MI=d(kn),Xa=s(kn,"LI",{});var x1=i(Xa);eb=s(x1,"CODE",{});var $B=i(eb);HI=a($B,"fsdp_forward_prefetch"),$B.forEach(o),BI=a(x1,` can be specified in the config file. It controls when to prefetch next set of parameters.
If `),tb=s(x1,"CODE",{});var xB=i(tb);VI=a(xB,'"True"'),xB.forEach(o),YI=a(x1,", FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass."),x1.forEach(o),XI=d(kn),Za=s(kn,"LI",{});var k1=i(Za);ob=s(k1,"CODE",{});var kB=i(ob);ZI=a(kB,"limit_all_gathers"),kB.forEach(o),JI=a(k1,` can be specified in the config file.
If `),rb=s(k1,"CODE",{});var AB=i(rb);KI=a(AB,'"True"'),AB.forEach(o),QI=a(k1,", FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers."),k1.forEach(o),kn.forEach(o),OT.forEach(o),st.forEach(o),$w=d(t),Mc=s(t,"P",{});var qB=i(Mc);ab=s(qB,"STRONG",{});var PB=i(ab);eU=a(PB,"Few caveats to be aware of"),PB.forEach(o),qB.forEach(o),xw=d(t),Hc=s(t,"UL",{});var DB=i(Hc);Ke=s(DB,"LI",{});var Tr=i(Ke);tU=a(Tr,"it is incompatible with "),nb=s(Tr,"CODE",{});var SB=i(nb);oU=a(SB,"generate"),SB.forEach(o),rU=a(Tr,", thus is incompatible with "),sb=s(Tr,"CODE",{});var OB=i(sb);aU=a(OB,"--predict_with_generate"),OB.forEach(o),nU=a(Tr,`
in all seq2seq/clm scripts (translation/summarization/clm etc.).`),sU=s(Tr,"BR",{}),iU=a(Tr,`
Please refer issue `),jl=s(Tr,"A",{href:!0,rel:!0});var CB=i(jl);lU=a(CB,"#21667"),CB.forEach(o),Tr.forEach(o),DB.forEach(o),kw=d(t),ur=s(t,"H3",{class:!0});var UT=i(ur);Ja=s(UT,"A",{id:!0,class:!0,href:!0});var IB=i(Ja);ib=s(IB,"SPAN",{});var UB=i(ib);g(Rl.$$.fragment,UB),UB.forEach(o),IB.forEach(o),dU=d(UT),lb=s(UT,"SPAN",{});var FB=i(lb);cU=a(FB,"PyTorch/XLA Fully Sharded Data parallel"),FB.forEach(o),UT.forEach(o),Aw=d(t),io=s(t,"P",{});var Sm=i(io);pU=a(Sm,`For all the TPU users, great news! PyTorch/XLA now supports FSDP.
All the latest Fully Sharded Data Parallel (FSDP) training are supported.
For more information refer to the `),Wl=s(Sm,"A",{href:!0,rel:!0});var zB=i(Wl);mU=a(zB,"Scaling PyTorch models on Cloud TPUs with FSDP"),zB.forEach(o),hU=a(Sm," and "),Gl=s(Sm,"A",{href:!0,rel:!0});var NB=i(Gl);uU=a(NB,"PyTorch/XLA implementation of FSDP"),NB.forEach(o),fU=a(Sm,`
All you need to do is enable it through the config.`),Sm.forEach(o),qw=d(t),Ml=s(t,"P",{});var cN=i(Ml);db=s(cN,"STRONG",{});var LB=i(db);gU=a(LB,"Required PyTorch/XLA version for FSDP support"),LB.forEach(o),_U=a(cN,": >=2.0"),cN.forEach(o),Pw=d(t),Hl=s(t,"P",{});var pN=i(Hl);cb=s(pN,"STRONG",{});var jB=i(cb);vU=a(jB,"Usage"),jB.forEach(o),bU=a(pN,":"),pN.forEach(o),Dw=d(t),lo=s(t,"P",{});var Om=i(lo);yU=a(Om,"Pass "),pb=s(Om,"CODE",{});var RB=i(pb);wU=a(RB,'--fsdp "full shard"'),RB.forEach(o),TU=a(Om," along with following changes to be made in "),mb=s(Om,"CODE",{});var WB=i(mb);EU=a(WB,"--fsdp_config <path_to_fsdp_config.json>"),WB.forEach(o),$U=a(Om,":"),Om.forEach(o),Sw=d(t),Qe=s(t,"UL",{});var qn=i(Qe);Ka=s(qn,"LI",{});var A1=i(Ka);hb=s(A1,"CODE",{});var GB=i(hb);xU=a(GB,"xla"),GB.forEach(o),kU=a(A1," should be set to "),ub=s(A1,"CODE",{});var MB=i(ub);AU=a(MB,"True"),MB.forEach(o),qU=a(A1," to enable PyTorch/XLA FSDP."),A1.forEach(o),PU=d(qn),Qa=s(qn,"LI",{});var q1=i(Qa);fb=s(q1,"CODE",{});var HB=i(fb);DU=a(HB,"xla_fsdp_settings"),HB.forEach(o),SU=a(q1,` The value is a dictionary which stores the XLA FSDP wrapping parameters.
For a complete list of options, please see `),Bl=s(q1,"A",{href:!0,rel:!0});var BB=i(Bl);OU=a(BB,"here"),BB.forEach(o),CU=a(q1,"."),q1.forEach(o),IU=d(qn),et=s(qn,"LI",{});var Er=i(et);gb=s(Er,"CODE",{});var VB=i(gb);UU=a(VB,"xla_fsdp_grad_ckpt"),VB.forEach(o),FU=a(Er,". When "),_b=s(Er,"CODE",{});var YB=i(_b);zU=a(YB,"True"),YB.forEach(o),NU=a(Er,`, uses gradient checkpointing over each nested XLA FSDP wrapped layer.
This setting can only be used when the xla flag is set to true, and an auto wrapping policy is specified through
`),vb=s(Er,"CODE",{});var XB=i(vb);LU=a(XB,"fsdp_min_num_params"),XB.forEach(o),jU=a(Er," or "),bb=s(Er,"CODE",{});var ZB=i(bb);RU=a(ZB,"fsdp_transformer_layer_cls_to_wrap"),ZB.forEach(o),WU=a(Er,"."),Er.forEach(o),GU=d(qn),Bc=s(qn,"LI",{});var mN=i(Bc);MU=a(mN,"You can either use transformer based auto wrap policy or size based auto wrap policy."),Vl=s(mN,"UL",{});var FT=i(Vl);Se=s(FT,"LI",{});var Eo=i(Se);HU=a(Eo,"For transformer based auto wrap policy, please specify "),yb=s(Eo,"CODE",{});var JB=i(yb);BU=a(JB,"fsdp_transformer_layer_cls_to_wrap"),JB.forEach(o),VU=a(Eo,` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),wb=s(Eo,"CODE",{});var KB=i(wb);YU=a(KB,"BertLayer"),KB.forEach(o),XU=a(Eo,", "),Tb=s(Eo,"CODE",{});var QB=i(Tb);ZU=a(QB,"GPTJBlock"),QB.forEach(o),JU=a(Eo,", "),Eb=s(Eo,"CODE",{});var eV=i(Eb);KU=a(eV,"T5Block"),eV.forEach(o),QU=a(Eo,` \u2026
This is important because submodules that share weights (e.g., embedding layer) should not end up in different FSDP wrapped units.
Using this policy, wrapping happens for each block containing Multi-Head Attention followed by couple of MLP layers.
Remaining layers including the shared embeddings are conveniently wrapped in same outermost FSDP unit.
Therefore, use this for transformer based models.`),Eo.forEach(o),eF=d(FT),Yl=s(FT,"LI",{});var zT=i(Yl);tF=a(zT,"For size based auto wrap policy, please add "),$b=s(zT,"CODE",{});var tV=i($b);oF=a(tV,"fsdp_min_num_params"),tV.forEach(o),rF=a(zT,` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),zT.forEach(o),FT.forEach(o),mN.forEach(o),qn.forEach(o),Ow=d(t),fr=s(t,"H3",{class:!0});var NT=i(fr);en=s(NT,"A",{id:!0,class:!0,href:!0});var oV=i(en);xb=s(oV,"SPAN",{});var rV=i(xb);g(Xl.$$.fragment,rV),rV.forEach(o),oV.forEach(o),aF=d(NT),kb=s(NT,"SPAN",{});var aV=i(kb);nF=a(aV,"Using Trainer for accelerated PyTorch Training on Mac"),aV.forEach(o),NT.forEach(o),Cw=d(t),tt=s(t,"P",{});var Pn=i(tt);sF=a(Pn,`With PyTorch v1.12 release, developers and researchers can take advantage of Apple silicon GPUs for significantly faster model training.
This unlocks the ability to perform machine learning workflows like prototyping and fine-tuning locally, right on Mac.
Apple\u2019s Metal Performance Shaders (MPS) as a backend for PyTorch enables this and can be used via the new `),Ab=s(Pn,"CODE",{});var nV=i(Ab);iF=a(nV,'"mps"'),nV.forEach(o),lF=a(Pn,` device.
This will map computational graphs and primitives on the MPS Graph framework and tuned kernels provided by MPS.
For more information please refer official documents `),Zl=s(Pn,"A",{href:!0,rel:!0});var sV=i(Zl);dF=a(sV,"Introducing Accelerated PyTorch Training on Mac"),sV.forEach(o),cF=a(Pn,`
and `),Jl=s(Pn,"A",{href:!0,rel:!0});var iV=i(Jl);pF=a(iV,"MPS BACKEND"),iV.forEach(o),mF=a(Pn,"."),Pn.forEach(o),Iw=d(t),g(tn.$$.fragment,t),Uw=d(t),Vc=s(t,"P",{});var lV=i(Vc);qb=s(lV,"STRONG",{});var dV=i(qb);hF=a(dV,"Benefits of Training and Inference using Apple Silicon Chips"),dV.forEach(o),lV.forEach(o),Fw=d(t),co=s(t,"OL",{});var Cm=i(co);Pb=s(Cm,"LI",{});var cV=i(Pb);uF=a(cV,"Enables users to train larger networks or batch sizes locally"),cV.forEach(o),fF=d(Cm),Db=s(Cm,"LI",{});var pV=i(Db);gF=a(pV,`Reduces data retrieval latency and provides the GPU with direct access to the full memory store due to unified memory architecture.
Therefore, improving end-to-end performance.`),pV.forEach(o),_F=d(Cm),Sb=s(Cm,"LI",{});var mV=i(Sb);vF=a(mV,"Reduces costs associated with cloud-based development or the need for additional local GPUs."),mV.forEach(o),Cm.forEach(o),zw=d(t),gr=s(t,"P",{});var P1=i(gr);Ob=s(P1,"STRONG",{});var hV=i(Ob);bF=a(hV,"Pre-requisites"),hV.forEach(o),yF=a(P1,`: To install torch with mps support,
please follow this nice medium article `),Kl=s(P1,"A",{href:!0,rel:!0});var uV=i(Kl);wF=a(uV,"GPU-Acceleration Comes to PyTorch on M1 Macs"),uV.forEach(o),TF=a(P1,"."),P1.forEach(o),Nw=d(t),_r=s(t,"P",{});var D1=i(_r);Cb=s(D1,"STRONG",{});var fV=i(Cb);EF=a(fV,"Usage"),fV.forEach(o),$F=a(D1,`:
User has to just pass `),Ib=s(D1,"CODE",{});var gV=i(Ib);xF=a(gV,"--use_mps_device"),gV.forEach(o),kF=a(D1,` argument.
For example, you can run the official Glue text classififcation task (from the root folder) using Apple Silicon GPU with below command:`),D1.forEach(o),Lw=d(t),g(Ql.$$.fragment,t),jw=d(t),Yc=s(t,"P",{});var _V=i(Yc);Ub=s(_V,"STRONG",{});var vV=i(Ub);AF=a(vV,"A few caveats to be aware of"),vV.forEach(o),_V.forEach(o),Rw=d(t),on=s(t,"OL",{});var LT=i(on);ed=s(LT,"LI",{});var jT=i(ed);qF=a(jT,`Some PyTorch operations have not been implemented in mps and will throw an error.
One way to get around that is to set the environment variable `),Fb=s(jT,"CODE",{});var bV=i(Fb);PF=a(bV,"PYTORCH_ENABLE_MPS_FALLBACK=1"),bV.forEach(o),DF=a(jT,`,
which will fallback to CPU for these operations. It still throws a UserWarning however.`),jT.forEach(o),SF=d(LT),Oe=s(LT,"LI",{});var $o=i(Oe);OF=a($o,"Distributed setups "),zb=s($o,"CODE",{});var yV=i(zb);CF=a(yV,"gloo"),yV.forEach(o),IF=a($o," and "),Nb=s($o,"CODE",{});var wV=i(Nb);UF=a(wV,"nccl"),wV.forEach(o),FF=a($o," are not working with "),Lb=s($o,"CODE",{});var TV=i(Lb);zF=a(TV,"mps"),TV.forEach(o),NF=a($o,` device.
This means that currently only single GPU of `),jb=s($o,"CODE",{});var EV=i(jb);LF=a(EV,"mps"),EV.forEach(o),jF=a($o," device type can be used."),$o.forEach(o),LT.forEach(o),Ww=d(t),po=s(t,"P",{});var Im=i(po);RF=a(Im,"Finally, please, remember that, \u{1F917} "),Rb=s(Im,"CODE",{});var $V=i(Rb);WF=a($V,"Trainer"),$V.forEach(o),GF=a(Im,` only integrates MPS backend, therefore if you
have any problems or questions with regards to MPS backend usage, please,
file an issue with `),td=s(Im,"A",{href:!0,rel:!0});var xV=i(td);MF=a(xV,"PyTorch GitHub"),xV.forEach(o),HF=a(Im,"."),Im.forEach(o),Gw=d(t),Xc=s(t,"P",{});var kV=i(Xc);BF=a(kV,"Sections that were moved:"),kV.forEach(o),Mw=d(t),q=s(t,"P",{});var P=i(q);VF=a(P,"[ "),Zc=s(P,"A",{href:!0});var AV=i(Zc);YF=a(AV,"DeepSpeed"),AV.forEach(o),Wb=s(P,"A",{id:!0}),i(Wb).forEach(o),XF=a(P,`
| `),Jc=s(P,"A",{href:!0});var qV=i(Jc);ZF=a(qV,"Installation"),qV.forEach(o),Gb=s(P,"A",{id:!0}),i(Gb).forEach(o),JF=a(P,`
| `),Kc=s(P,"A",{href:!0});var PV=i(Kc);KF=a(PV,"Deployment with multiple GPUs"),PV.forEach(o),Mb=s(P,"A",{id:!0}),i(Mb).forEach(o),QF=a(P,`
| `),Qc=s(P,"A",{href:!0});var DV=i(Qc);ez=a(DV,"Deployment with one GPU"),DV.forEach(o),Hb=s(P,"A",{id:!0}),i(Hb).forEach(o),tz=a(P,`
| `),ep=s(P,"A",{href:!0});var SV=i(ep);oz=a(SV,"Deployment in Notebooks"),SV.forEach(o),Bb=s(P,"A",{id:!0}),i(Bb).forEach(o),rz=a(P,`
| `),tp=s(P,"A",{href:!0});var OV=i(tp);az=a(OV,"Configuration"),OV.forEach(o),Vb=s(P,"A",{id:!0}),i(Vb).forEach(o),nz=a(P,`
| `),op=s(P,"A",{href:!0});var CV=i(op);sz=a(CV,"Passing Configuration"),CV.forEach(o),Yb=s(P,"A",{id:!0}),i(Yb).forEach(o),iz=a(P,`
| `),rp=s(P,"A",{href:!0});var IV=i(rp);lz=a(IV,"Shared Configuration"),IV.forEach(o),Xb=s(P,"A",{id:!0}),i(Xb).forEach(o),dz=a(P,`
| `),ap=s(P,"A",{href:!0});var UV=i(ap);cz=a(UV,"ZeRO"),UV.forEach(o),Zb=s(P,"A",{id:!0}),i(Zb).forEach(o),pz=a(P,`
| `),np=s(P,"A",{href:!0});var FV=i(np);mz=a(FV,"ZeRO-2 Config"),FV.forEach(o),Jb=s(P,"A",{id:!0}),i(Jb).forEach(o),hz=a(P,`
| `),sp=s(P,"A",{href:!0});var zV=i(sp);uz=a(zV,"ZeRO-3 Config"),zV.forEach(o),Kb=s(P,"A",{id:!0}),i(Kb).forEach(o),fz=a(P,`
| `),ip=s(P,"A",{href:!0});var NV=i(ip);gz=a(NV,"NVMe Support"),NV.forEach(o),Qb=s(P,"A",{id:!0}),i(Qb).forEach(o),_z=a(P,`
| `),lp=s(P,"A",{href:!0});var LV=i(lp);vz=a(LV,"ZeRO-2 vs ZeRO-3 Performance"),LV.forEach(o),e1=s(P,"A",{id:!0}),i(e1).forEach(o),bz=a(P,`
| `),dp=s(P,"A",{href:!0});var jV=i(dp);yz=a(jV,"ZeRO-2 Example"),jV.forEach(o),t1=s(P,"A",{id:!0}),i(t1).forEach(o),wz=a(P,`
| `),cp=s(P,"A",{href:!0});var RV=i(cp);Tz=a(RV,"ZeRO-3 Example"),RV.forEach(o),o1=s(P,"A",{id:!0}),i(o1).forEach(o),Ez=a(P,`
| `),pp=s(P,"A",{href:!0});var WV=i(pp);$z=a(WV,"Optimizer"),WV.forEach(o),r1=s(P,"A",{id:!0}),i(r1).forEach(o),xz=a(P,`
| `),mp=s(P,"A",{href:!0});var GV=i(mp);kz=a(GV,"Scheduler"),GV.forEach(o),a1=s(P,"A",{id:!0}),i(a1).forEach(o),Az=a(P,`
| `),hp=s(P,"A",{href:!0});var MV=i(hp);qz=a(MV,"fp32 Precision"),MV.forEach(o),n1=s(P,"A",{id:!0}),i(n1).forEach(o),Pz=a(P,`
| `),up=s(P,"A",{href:!0});var HV=i(up);Dz=a(HV,"Automatic Mixed Precision"),HV.forEach(o),s1=s(P,"A",{id:!0}),i(s1).forEach(o),Sz=a(P,`
| `),fp=s(P,"A",{href:!0});var BV=i(fp);Oz=a(BV,"Batch Size"),BV.forEach(o),i1=s(P,"A",{id:!0}),i(i1).forEach(o),Cz=a(P,`
| `),gp=s(P,"A",{href:!0});var VV=i(gp);Iz=a(VV,"Gradient Accumulation"),VV.forEach(o),l1=s(P,"A",{id:!0}),i(l1).forEach(o),Uz=a(P,`
| `),_p=s(P,"A",{href:!0});var YV=i(_p);Fz=a(YV,"Gradient Clipping"),YV.forEach(o),d1=s(P,"A",{id:!0}),i(d1).forEach(o),zz=a(P,`
| `),vp=s(P,"A",{href:!0});var XV=i(vp);Nz=a(XV,"Getting The Model Weights Out"),XV.forEach(o),c1=s(P,"A",{id:!0}),i(c1).forEach(o),Lz=a(P,`
]`),P.forEach(o),this.h()},h(){m(u,"name","hf:doc:metadata"),m(u,"content",JSON.stringify(wY)),m(w,"id","trainer"),m(w,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(w,"href","#trainer"),m(T,"class","relative group"),m(Q,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(X,"href","https://github.com/huggingface/transformers/tree/main/examples"),m(X,"rel","nofollow"),m(N,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(ne,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.TrainingArguments"),m(Ee,"href","https://github.com/NVIDIA/apex"),m(Ee,"rel","nofollow"),m($e,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(Ed,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m($d,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(xd,"href","callback"),m(Pr,"id","transformers.Trainer"),m(Pr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Pr,"href","#transformers.Trainer"),m(qo,"class","relative group"),m(kd,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),m(Sr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Or,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Cr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ir,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m($t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ur,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qd,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),m(Fr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(At,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(zr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Lr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(jr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Rr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Dd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(gs,"href","https://github.com/pytorch/pytorch/issues/16266"),m(gs,"rel","nofollow"),m(Sd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(Od,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Gr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Mr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ot,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(It,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Br,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Vr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Cd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.log_metrics"),m(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Yr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Xr,"id","transformers.Seq2SeqTrainer"),m(Xr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Xr,"href","#transformers.Seq2SeqTrainer"),m(Lo,"class","relative group"),m(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Jr,"id","transformers.TrainingArguments"),m(Jr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Jr,"href","#transformers.TrainingArguments"),m(Mo,"class","relative group"),m(Id,"href","/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.HfArgumentParser"),m(Xs,"href","https://docs.python.org/3/library/argparse#module-argparse"),m(Xs,"rel","nofollow"),m(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Kr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Nt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(pa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ma,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ha,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ua,"id","transformers.Seq2SeqTrainingArguments"),m(ua,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(ua,"href","#transformers.Seq2SeqTrainingArguments"),m(Xo,"class","relative group"),m(Ud,"href","/docs/transformers/v4.27.1/en/internal/trainer_utils#transformers.HfArgumentParser"),m(gi,"href","https://docs.python.org/3/library/argparse#module-argparse"),m(gi,"rel","nofollow"),m(mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(fa,"id","checkpoints"),m(fa,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(fa,"href","#checkpoints"),m(Jo,"class","relative group"),m(Fd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(zd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.TrainingArguments"),m(Nd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer.train"),m(Rd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.TrainingArguments"),m(ya,"id","logging"),m(ya,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(ya,"href","#logging"),m(Ko,"class","relative group"),m(Gd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(Md,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.TrainingArguments"),m(Vd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.TrainingArguments"),m(Yd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(Xd,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(Ea,"id","randomness"),m(Ea,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ea,"href","#randomness"),m(Qo,"class","relative group"),m(tc,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m($i,"href","https://pytorch.org/docs/stable/notes/randomness"),m($i,"rel","nofollow"),m($a,"id","specific-gpus-selection"),m($a,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m($a,"href","#specific-gpus-selection"),m(er,"class","relative group"),m(ki,"href","https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html"),m(ki,"rel","nofollow"),m(qi,"href","https://github.com/huggingface/accelerate"),m(qi,"rel","nofollow"),m(Pi,"href","https://github.com/microsoft/DeepSpeed"),m(Pi,"rel","nofollow"),m(rc,"href","Deepspeed"),m(Ii,"href","https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html"),m(Ii,"rel","nofollow"),m(ji,"start","2"),m(Da,"id","trainer-integrations"),m(Da,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Da,"href","#trainer-integrations"),m(tr,"class","relative group"),m(gc,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(Mi,"href","https://github.com/microsoft/DeepSpeed"),m(Mi,"rel","nofollow"),m(Hi,"href","https://pytorch.org/docs/stable/fsdp.html"),m(Hi,"rel","nofollow"),m(Bi,"href","https://github.com/facebookresearch/fairscale/"),m(Bi,"rel","nofollow"),m(Vi,"href","https://arxiv.org/abs/1910.02054"),m(Vi,"rel","nofollow"),m(_c,"href","#pytorch-fully-sharded-data-parallel"),m(vc,"id","zero-install-notes"),m(Ca,"id","cuda-extension-installation-notes"),m(Ca,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ca,"href","#cuda-extension-installation-notes"),m(or,"class","relative group"),m(Xi,"href","https://github.com/facebookresearch/fairscale/issues"),m(Xi,"rel","nofollow"),m(Zi,"href","https://github.com/microsoft/DeepSpeed/issues"),m(Zi,"rel","nofollow"),m(Ia,"id","possible-problem-1"),m(Ia,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ia,"href","#possible-problem-1"),m(rr,"class","relative group"),m(el,"href","https://www.google.com/search?q=ubuntu+cuda+10.2+install"),m(el,"rel","nofollow"),m(Fa,"id","possible-problem-2"),m(Fa,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Fa,"href","#possible-problem-2"),m(ar,"class","relative group"),m(Na,"id","possible-problem-3"),m(Na,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Na,"href","#possible-problem-3"),m(nr,"class","relative group"),m(ja,"id","fairscale"),m(ja,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(ja,"href","#fairscale"),m(sr,"class","relative group"),m(ll,"href","https://github.com/facebookresearch/fairscale/"),m(ll,"rel","nofollow"),m(Sc,"href","/docs/transformers/v4.27.1/en/main_classes/trainer#transformers.Trainer"),m(dl,"href","https://arxiv.org/abs/1910.02054"),m(dl,"rel","nofollow"),m(hl,"href","https://github.com/facebookresearch/fairscale/#installation"),m(hl,"rel","nofollow"),m(Ic,"href","#zero-install-notes"),m(yl,"href","https://github.com/facebookresearch/fairscale/issues"),m(yl,"rel","nofollow"),m(xl,"start","3"),m(Va,"id","pytorch-fully-sharded-data-parallel"),m(Va,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Va,"href","#pytorch-fully-sharded-data-parallel"),m(cr,"class","relative group"),m(Pl,"href","https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/"),m(Pl,"rel","nofollow"),m(jl,"href","https://github.com/huggingface/transformers/issues/21667"),m(jl,"rel","nofollow"),m(Ja,"id","pytorchxla-fully-sharded-data-parallel"),m(Ja,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ja,"href","#pytorchxla-fully-sharded-data-parallel"),m(ur,"class","relative group"),m(Wl,"href","https://pytorch.org/blog/scaling-pytorch-models-on-cloud-tpus-with-fsdp/"),m(Wl,"rel","nofollow"),m(Gl,"href","https://github.com/pytorch/xla/tree/master/torch_xla/distributed/fsdp"),m(Gl,"rel","nofollow"),m(Bl,"href","https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py"),m(Bl,"rel","nofollow"),m(en,"id","using-trainer-for-accelerated-pytorch-training-on-mac"),m(en,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(en,"href","#using-trainer-for-accelerated-pytorch-training-on-mac"),m(fr,"class","relative group"),m(Zl,"href","https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/"),m(Zl,"rel","nofollow"),m(Jl,"href","https://pytorch.org/docs/stable/notes/mps.html"),m(Jl,"rel","nofollow"),m(Kl,"href","https://medium.com/towards-data-science/gpu-acceleration-comes-to-pytorch-on-m1-macs-195c399efcc1"),m(Kl,"rel","nofollow"),m(td,"href","https://github.com/pytorch/pytorch/issues"),m(td,"rel","nofollow"),m(Zc,"href","./deepspeed#deepspeed-trainer-integration"),m(Wb,"id","deepspeed"),m(Jc,"href","./deepspeed#deepspeed-installation"),m(Gb,"id","installation"),m(Kc,"href","./deepspeed#deepspeed-multi-gpu"),m(Mb,"id","deployment-with-multiple-gpus"),m(Qc,"href","./deepspeed#deepspeed-one-gpu"),m(Hb,"id","deployment-with-one-gpu"),m(ep,"href","./deepspeed#deepspeed-notebook"),m(Bb,"id","deployment-in-notebooks"),m(tp,"href","./deepspeed#deepspeed-config"),m(Vb,"id","configuration"),m(op,"href","./deepspeed#deepspeed-config-passing"),m(Yb,"id","passing-configuration"),m(rp,"href","./deepspeed#deepspeed-config-shared"),m(Xb,"id","shared-configuration"),m(ap,"href","./deepspeed#deepspeed-zero"),m(Zb,"id","zero"),m(np,"href","./deepspeed#deepspeed-zero2-config"),m(Jb,"id","zero-2-config"),m(sp,"href","./deepspeed#deepspeed-zero3-config"),m(Kb,"id","zero-3-config"),m(ip,"href","./deepspeed#deepspeed-nvme"),m(Qb,"id","nvme-support"),m(lp,"href","./deepspeed#deepspeed-zero2-zero3-performance"),m(e1,"id","zero-2-vs-zero-3-performance"),m(dp,"href","./deepspeed#deepspeed-zero2-example"),m(t1,"id","zero-2-example"),m(cp,"href","./deepspeed#deepspeed-zero3-example"),m(o1,"id","zero-3-example"),m(pp,"href","./deepspeed#deepspeed-optimizer"),m(r1,"id","optimizer"),m(mp,"href","./deepspeed#deepspeed-scheduler"),m(a1,"id","scheduler"),m(hp,"href","./deepspeed#deepspeed-fp32"),m(n1,"id","fp32-precision"),m(up,"href","./deepspeed#deepspeed-amp"),m(s1,"id","automatic-mixed-precision"),m(fp,"href","./deepspeed#deepspeed-bs"),m(i1,"id","batch-size"),m(gp,"href","./deepspeed#deepspeed-grad-acc"),m(l1,"id","gradient-accumulation"),m(_p,"href","./deepspeed#deepspeed-grad-clip"),m(d1,"id","gradient-clipping"),m(vp,"href","./deepspeed#deepspeed-weight-extraction"),m(c1,"id","getting-the-model-weights-out")},m(t,c){e(document.head,u),p(t,x,c),p(t,T,c),e(T,w),e(w,k),_(h,k,null),e(T,E),e(T,z),e(z,j),p(t,I,c),p(t,G,c),e(G,B),e(G,Q),e(Q,K),e(G,Z),e(G,X),e(X,me),e(G,J),p(t,M,c),p(t,R,c),e(R,ae),e(R,N),e(N,we),e(R,Te),e(R,ne),e(ne,bt),e(R,yt),p(t,ue,c),p(t,Ie,c),e(Ie,Dn),e(Ie,Ee),e(Ee,Sn),e(Ie,On),p(t,se,c),p(t,oe,c),e(oe,ld),e(oe,$e),e($e,xr),e(oe,dd),p(t,Ao,c),p(t,W,c),e(W,re),e(re,kr),e(kr,cd),e(re,pd),e(W,md),e(W,hd),e(hd,Um),e(Um,RT),e(hd,WT),e(W,GT),e(W,ud),e(ud,Fm),e(Fm,MT),e(ud,HT),e(W,BT),e(W,fd),e(fd,zm),e(zm,VT),e(fd,YT),e(W,XT),e(W,wt),e(wt,Nm),e(Nm,ZT),e(wt,JT),e(wt,Lm),e(Lm,KT),e(wt,QT),e(wt,jm),e(jm,e4),e(wt,t4),e(W,o4),e(W,gd),e(gd,Rm),e(Rm,r4),e(gd,a4),e(W,n4),e(W,_d),e(_d,Wm),e(Wm,s4),e(_d,i4),e(W,l4),e(W,vd),e(vd,Gm),e(Gm,d4),e(vd,c4),e(W,p4),e(W,bd),e(bd,Mm),e(Mm,m4),e(bd,h4),e(W,u4),e(W,yd),e(yd,Hm),e(Hm,f4),e(yd,g4),e(W,_4),e(W,wd),e(wd,Bm),e(Bm,v4),e(wd,b4),e(W,y4),e(W,Td),e(Td,Vm),e(Vm,w4),e(Td,T4),p(t,S1,c),_(Ar,t,c),p(t,O1,c),p(t,qr,c),e(qr,E4),e(qr,Ed),e(Ed,$4),e(qr,x4),p(t,C1,c),_(Cn,t,c),p(t,I1,c),p(t,Tt,c),e(Tt,k4),e(Tt,$d),e($d,A4),e(Tt,q4),e(Tt,xd),e(xd,P4),e(Tt,D4),p(t,U1,c),p(t,qo,c),e(qo,Pr),e(Pr,Ym),_(In,Ym,null),e(qo,S4),e(qo,Xm),e(Xm,O4),p(t,F1,c),p(t,$,c),_(Un,$,null),e($,C4),e($,Zm),e(Zm,I4),e($,U4),e($,Jm),e(Jm,F4),e($,z4),e($,xe),e(xe,Dr),e(Dr,Km),e(Km,N4),e(Dr,L4),e(Dr,kd),e(kd,j4),e(Dr,R4),e(xe,W4),e(xe,ie),e(ie,Qm),e(Qm,G4),e(ie,M4),e(ie,eh),e(eh,H4),e(ie,B4),e(ie,th),e(th,V4),e(ie,Y4),e(ie,oh),e(oh,X4),e(ie,Z4),e(ie,rh),e(rh,J4),e(ie,K4),e(ie,ah),e(ah,Q4),e(ie,eE),e(xe,tE),e(xe,Ad),e(Ad,nh),e(nh,oE),e(Ad,rE),e(xe,aE),e(xe,Ue),e(Ue,sh),e(sh,nE),e(Ue,sE),e(Ue,ih),e(ih,iE),e(Ue,lE),e(Ue,lh),e(lh,dE),e(Ue,cE),e(Ue,dh),e(dh,pE),e(Ue,mE),e(xe,hE),e(xe,Fe),e(Fe,ch),e(ch,uE),e(Fe,fE),e(Fe,ph),e(ph,gE),e(Fe,_E),e(Fe,mh),e(mh,vE),e(Fe,bE),e(Fe,hh),e(hh,yE),e(Fe,wE),e($,TE),e($,Sr),_(Fn,Sr,null),e(Sr,EE),e(Sr,zn),e(zn,$E),e(zn,uh),e(uh,xE),e(zn,kE),e($,AE),e($,Or),_(Nn,Or,null),e(Or,qE),e(Or,Ln),e(Ln,PE),e(Ln,fh),e(fh,DE),e(Ln,SE),e($,OE),e($,Et),_(jn,Et,null),e(Et,CE),e(Et,gh),e(gh,IE),e(Et,UE),e(Et,_h),e(_h,FE),e($,zE),e($,Cr),_(Rn,Cr,null),e(Cr,NE),e(Cr,vh),e(vh,LE),e($,jE),e($,Ir),_(Wn,Ir,null),e(Ir,RE),e(Ir,Gn),e(Gn,WE),e(Gn,bh),e(bh,GE),e(Gn,ME),e($,HE),e($,$t),_(Mn,$t,null),e($t,BE),e($t,yh),e(yh,VE),e($t,YE),e($t,Hn),e(Hn,XE),e(Hn,wh),e(wh,ZE),e(Hn,JE),e($,KE),e($,xt),_(Bn,xt,null),e(xt,QE),e(xt,Th),e(Th,e$),e(xt,t$),e(xt,it),e(it,o$),e(it,Eh),e(Eh,r$),e(it,a$),e(it,$h),e($h,n$),e(it,s$),e(it,xh),e(xh,i$),e(it,l$),e($,d$),e($,Ur),_(Vn,Ur,null),e(Ur,c$),e(Ur,kh),e(kh,p$),e($,m$),e($,ze),_(Yn,ze,null),e(ze,h$),e(ze,Ah),e(Ah,u$),e(ze,f$),e(ze,Xn),e(Xn,g$),e(Xn,qh),e(qh,_$),e(Xn,v$),e(ze,b$),e(ze,Ph),e(Ph,y$),e($,w$),e($,kt),_(Zn,kt,null),e(kt,T$),e(kt,Po),e(Po,E$),e(Po,Dh),e(Dh,$$),e(Po,x$),e(Po,Sh),e(Sh,k$),e(Po,A$),e(kt,q$),e(kt,Oh),e(Oh,P$),e($,D$),e($,Fr),_(Jn,Fr,null),e(Fr,S$),e(Fr,Kn),e(Kn,O$),e(Kn,qd),e(qd,C$),e(Kn,I$),e($,U$),e($,At),_(Qn,At,null),e(At,F$),e(At,es),e(es,z$),e(es,Ch),e(Ch,N$),e(es,L$),e(At,j$),e(At,Ih),e(Ih,R$),e($,W$),e($,zr),_(ts,zr,null),e(zr,G$),e(zr,Uh),e(Uh,M$),e($,H$),e($,qt),_(os,qt,null),e(qt,B$),e(qt,rs),e(rs,V$),e(rs,Fh),e(Fh,Y$),e(rs,X$),e(qt,Z$),e(qt,zh),e(zh,J$),e($,K$),e($,Ne),_(as,Ne,null),e(Ne,Q$),e(Ne,ns),e(ns,e3),e(ns,Nh),e(Nh,t3),e(ns,o3),e(Ne,r3),e(Ne,Do),e(Do,a3),e(Do,Lh),e(Lh,n3),e(Do,s3),e(Do,jh),e(jh,i3),e(Do,l3),e(Ne,d3),e(Ne,Rh),e(Rh,c3),e($,p3),e($,Pt),_(ss,Pt,null),e(Pt,m3),e(Pt,ke),e(ke,h3),e(ke,Wh),e(Wh,u3),e(ke,f3),e(ke,Gh),e(Gh,g3),e(ke,_3),e(ke,Mh),e(Mh,v3),e(ke,b3),e(ke,Hh),e(Hh,y3),e(ke,w3),e(Pt,T3),_(Nr,Pt,null),e($,E3),e($,Lr),_(is,Lr,null),e(Lr,$3),e(Lr,ls),e(ls,x3),e(ls,Bh),e(Bh,k3),e(ls,A3),e($,q3),e($,jr),_(ds,jr,null),e(jr,P3),e(jr,Vh),e(Vh,D3),e($,S3),e($,Rr),_(cs,Rr,null),e(Rr,O3),e(Rr,ps),e(ps,C3),e(ps,Yh),e(Yh,I3),e(ps,U3),e($,F3),e($,Dt),_(ms,Dt,null),e(Dt,z3),e(Dt,hs),e(hs,N3),e(hs,Xh),e(Xh,L3),e(hs,j3),e(Dt,R3),e(Dt,Zh),e(Zh,W3),e($,G3),e($,U),_(us,U,null),e(U,M3),e(U,Jh),e(Jh,H3),e(U,B3),e(U,Kh),e(Kh,V3),e(U,Y3),e(U,Qh),e(Qh,X3),e(U,Z3),e(U,So),e(So,J3),e(So,eu),e(eu,K3),e(So,Q3),e(So,tu),e(tu,ex),e(So,tx),e(U,ox),_(Wr,U,null),e(U,rx),e(U,ou),e(ou,ru),e(ru,ax),e(U,nx),e(U,lt),e(lt,Ae),e(Ae,sx),e(Ae,au),e(au,ix),e(Ae,lx),e(Ae,nu),e(nu,dx),e(Ae,cx),e(Ae,su),e(su,px),e(Ae,mx),e(Ae,iu),e(iu,hx),e(Ae,ux),e(lt,fx),e(lt,Oo),e(Oo,gx),e(Oo,lu),e(lu,_x),e(Oo,vx),e(Oo,du),e(du,bx),e(Oo,yx),e(lt,wx),e(lt,Pd),e(Pd,cu),e(cu,Tx),e(Pd,Ex),e(lt,$x),e(lt,St),e(St,pu),e(pu,xx),e(St,kx),e(St,mu),e(mu,Ax),e(St,qx),e(St,hu),e(hu,Px),e(St,Dx),e(U,Sx),e(U,uu),e(uu,Ox),e(U,Cx),e(U,fu),e(fu,Ix),e(U,Ux),e(U,fs),e(fs,Fx),e(fs,gu),e(gu,zx),e(fs,Nx),e(U,Lx),e(U,dt),e(dt,jx),e(dt,_u),e(_u,Rx),e(dt,Wx),e(dt,vu),e(vu,Gx),e(dt,Mx),e(dt,bu),e(bu,Hx),e(dt,Bx),e(U,Vx),e(U,he),e(he,Yx),e(he,Dd),e(Dd,Xx),e(he,Zx),e(he,yu),e(yu,Jx),e(he,Kx),e(he,wu),e(wu,Qx),e(he,ek),e(he,Tu),e(Tu,tk),e(he,ok),e(he,Eu),e(Eu,rk),e(he,ak),e(U,nk),e(U,V),e(V,sk),e(V,$u),e($u,ik),e(V,lk),e(V,xu),e(xu,dk),e(V,ck),e(V,ku),e(ku,pk),e(V,mk),e(V,Au),e(Au,hk),e(V,uk),e(V,gs),e(gs,fk),e(V,gk),e(V,qu),e(qu,_k),e(V,vk),e(V,Pu),e(Pu,bk),e(V,yk),e(V,Du),e(Du,wk),e(V,Tk),e(V,Su),e(Su,Ek),e(V,$k),e(V,Ou),e(Ou,xk),e(V,kk),e(U,Ak),e(U,qe),e(qe,qk),e(qe,Sd),e(Sd,Pk),e(qe,Dk),e(qe,Cu),e(Cu,Sk),e(qe,Ok),e(qe,Od),e(Od,Ck),e(qe,Ik),e(qe,Iu),e(Iu,Uk),e(qe,Fk),e(U,zk),e(U,Uu),e(Uu,Nk),e($,Lk),e($,Gr),_(_s,Gr,null),e(Gr,jk),e(Gr,Fu),e(Fu,Rk),e($,Wk),e($,Mr),_(vs,Mr,null),e(Mr,Gk),e(Mr,bs),e(bs,Mk),e(bs,zu),e(zu,Hk),e(bs,Bk),e($,Vk),e($,Ot),_(ys,Ot,null),e(Ot,Yk),e(Ot,ws),e(ws,Xk),e(ws,Nu),e(Nu,Zk),e(ws,Jk),e(Ot,Kk),e(Ot,Ts),e(Ts,Qk),e(Ts,Lu),e(Lu,eA),e(Ts,tA),e($,oA),e($,le),_(Es,le,null),e(le,rA),e(le,ju),e(ju,aA),e(le,nA),e(le,$s),e($s,sA),e($s,Ru),e(Ru,iA),e($s,lA),e(le,dA),_(Hr,le,null),e(le,cA),e(le,xs),e(xs,pA),e(xs,Wu),e(Wu,mA),e(xs,hA),e(le,uA),e(le,Co),e(Co,Io),e(Io,fA),e(Io,Gu),e(Gu,gA),e(Io,_A),e(Io,Mu),e(Mu,vA),e(Io,bA),e(Co,yA),e(Co,Uo),e(Uo,wA),e(Uo,Hu),e(Hu,TA),e(Uo,EA),e(Uo,Bu),e(Bu,$A),e(Uo,xA),e(Co,kA),e(Co,Fo),e(Fo,AA),e(Fo,Vu),e(Vu,qA),e(Fo,PA),e(Fo,Yu),e(Yu,DA),e(Fo,SA),e($,OA),e($,Ct),_(ks,Ct,null),e(Ct,CA),e(Ct,zo),e(zo,IA),e(zo,Xu),e(Xu,UA),e(zo,FA),e(zo,Zu),e(Zu,zA),e(zo,NA),e(Ct,LA),e(Ct,Ju),e(Ju,jA),e($,RA),e($,It),_(As,It,null),e(It,WA),e(It,No),e(No,GA),e(No,Ku),e(Ku,MA),e(No,HA),e(No,Qu),e(Qu,BA),e(No,VA),e(It,YA),e(It,ef),e(ef,XA),e($,ZA),e($,Br),_(qs,Br,null),e(Br,JA),e(Br,ct),e(ct,KA),e(ct,tf),e(tf,QA),e(ct,e5),e(ct,of),e(of,t5),e(ct,o5),e(ct,rf),e(rf,r5),e(ct,a5),e($,n5),e($,Vr),_(Ps,Vr,null),e(Vr,s5),e(Vr,Ds),e(Ds,i5),e(Ds,af),e(af,l5),e(Ds,d5),e($,c5),e($,Le),_(Ss,Le,null),e(Le,p5),e(Le,Os),e(Os,m5),e(Os,nf),e(nf,h5),e(Os,u5),e(Le,f5),e(Le,sf),e(sf,g5),e(Le,_5),e(Le,Cs),e(Cs,v5),e(Cs,Cd),e(Cd,b5),e(Cs,y5),e($,w5),e($,Ut),_(Is,Ut,null),e(Ut,T5),e(Ut,Us),e(Us,E5),e(Us,lf),e(lf,$5),e(Us,x5),e(Ut,k5),e(Ut,df),e(df,A5),e($,q5),e($,Ft),_(Fs,Ft,null),e(Ft,P5),e(Ft,cf),e(cf,D5),e(Ft,S5),e(Ft,pf),e(pf,O5),e($,C5),e($,Yr),_(zs,Yr,null),e(Yr,I5),e(Yr,mf),e(mf,U5),e($,F5),e($,zt),_(Ns,zt,null),e(zt,z5),e(zt,hf),e(hf,N5),e(zt,L5),e(zt,uf),e(uf,j5),p(t,z1,c),p(t,Lo,c),e(Lo,Xr),e(Xr,ff),_(Ls,ff,null),e(Lo,R5),e(Lo,gf),e(gf,W5),p(t,N1,c),p(t,pt,c),_(js,pt,null),e(pt,G5),e(pt,je),_(Rs,je,null),e(je,M5),e(je,_f),e(_f,H5),e(je,B5),e(je,Ws),e(Ws,V5),e(Ws,vf),e(vf,Y5),e(Ws,X5),e(je,Z5),e(je,bf),e(bf,J5),e(pt,K5),e(pt,de),_(Gs,de,null),e(de,Q5),e(de,yf),e(yf,e7),e(de,t7),e(de,Ms),e(Ms,o7),e(Ms,wf),e(wf,r7),e(Ms,a7),e(de,n7),_(Zr,de,null),e(de,s7),e(de,Hs),e(Hs,i7),e(Hs,Tf),e(Tf,l7),e(Hs,d7),e(de,c7),e(de,jo),e(jo,Ro),e(Ro,p7),e(Ro,Ef),e(Ef,m7),e(Ro,h7),e(Ro,$f),e($f,u7),e(Ro,f7),e(jo,g7),e(jo,Wo),e(Wo,_7),e(Wo,xf),e(xf,v7),e(Wo,b7),e(Wo,kf),e(kf,y7),e(Wo,w7),e(jo,T7),e(jo,Go),e(Go,E7),e(Go,Af),e(Af,$7),e(Go,x7),e(Go,qf),e(qf,k7),e(Go,A7),p(t,L1,c),p(t,Mo,c),e(Mo,Jr),e(Jr,Pf),_(Bs,Pf,null),e(Mo,q7),e(Mo,Df),e(Df,P7),p(t,j1,c),p(t,S,c),_(Vs,S,null),e(S,D7),e(S,Ys),e(Ys,S7),e(Ys,Sf),e(Sf,O7),e(Ys,C7),e(S,I7),e(S,Ho),e(Ho,U7),e(Ho,Id),e(Id,F7),e(Ho,z7),e(Ho,Xs),e(Xs,N7),e(Ho,L7),e(S,j7),e(S,fe),_(Zs,fe,null),e(fe,R7),e(fe,Of),e(Of,W7),e(fe,G7),e(fe,Bo),e(Bo,M7),e(Bo,Cf),e(Cf,H7),e(Bo,B7),e(Bo,If),e(If,V7),e(Bo,Y7),e(fe,X7),e(fe,Vo),e(Vo,Z7),e(Vo,Uf),e(Uf,J7),e(Vo,K7),e(Vo,Ff),e(Ff,Q7),e(Vo,eq),e(fe,tq),e(fe,Js),e(Js,oq),e(Js,zf),e(zf,rq),e(Js,aq),e(S,nq),e(S,Kr),_(Ks,Kr,null),e(Kr,sq),e(Kr,Nf),e(Nf,iq),e(S,lq),e(S,Nt),_(Qs,Nt,null),e(Nt,dq),e(Nt,Lf),e(Lf,cq),e(Nt,pq),e(Nt,Yo),e(Yo,mq),e(Yo,jf),e(jf,hq),e(Yo,uq),e(Yo,Rf),e(Rf,fq),e(Yo,gq),e(S,_q),e(S,Lt),_(ei,Lt,null),e(Lt,vq),e(Lt,Wf),e(Wf,bq),e(Lt,yq),_(Qr,Lt,null),e(S,wq),e(S,jt),_(ti,jt,null),e(jt,Tq),e(jt,Gf),e(Gf,Eq),e(jt,$q),_(ea,jt,null),e(S,xq),e(S,Rt),_(oi,Rt,null),e(Rt,kq),e(Rt,Mf),e(Mf,Aq),e(Rt,qq),_(ta,Rt,null),e(S,Pq),e(S,Wt),_(ri,Wt,null),e(Wt,Dq),e(Wt,Hf),e(Hf,Sq),e(Wt,Oq),_(oa,Wt,null),e(S,Cq),e(S,Gt),_(ai,Gt,null),e(Gt,Iq),e(Gt,Bf),e(Bf,Uq),e(Gt,Fq),_(ra,Gt,null),e(S,zq),e(S,Re),_(ni,Re,null),e(Re,Nq),e(Re,Vf),e(Vf,Lq),e(Re,jq),_(aa,Re,null),e(Re,Rq),_(na,Re,null),e(S,Wq),e(S,Mt),_(si,Mt,null),e(Mt,Gq),e(Mt,Yf),e(Yf,Mq),e(Mt,Hq),_(sa,Mt,null),e(S,Bq),e(S,We),_(ii,We,null),e(We,Vq),e(We,Xf),e(Xf,Yq),e(We,Xq),_(ia,We,null),e(We,Zq),_(la,We,null),e(S,Jq),e(S,Ge),_(li,Ge,null),e(Ge,Kq),e(Ge,Zf),e(Zf,Qq),e(Ge,eP),_(da,Ge,null),e(Ge,tP),_(ca,Ge,null),e(S,oP),e(S,pa),_(di,pa,null),e(pa,rP),e(pa,ci),e(ci,aP),e(ci,Jf),e(Jf,nP),e(ci,sP),e(S,iP),e(S,ma),_(pi,ma,null),e(ma,lP),e(ma,Kf),e(Kf,dP),e(S,cP),e(S,ha),_(mi,ha,null),e(ha,pP),e(ha,Qf),e(Qf,mP),p(t,R1,c),p(t,Xo,c),e(Xo,ua),e(ua,eg),_(hi,eg,null),e(Xo,hP),e(Xo,tg),e(tg,uP),p(t,W1,c),p(t,mt,c),_(ui,mt,null),e(mt,fP),e(mt,fi),e(fi,gP),e(fi,og),e(og,_P),e(fi,vP),e(mt,bP),e(mt,Zo),e(Zo,yP),e(Zo,Ud),e(Ud,wP),e(Zo,TP),e(Zo,gi),e(gi,EP),e(Zo,$P),p(t,G1,c),p(t,Jo,c),e(Jo,fa),e(fa,rg),_(_i,rg,null),e(Jo,xP),e(Jo,ag),e(ag,kP),p(t,M1,c),p(t,ge,c),e(ge,AP),e(ge,Fd),e(Fd,qP),e(ge,PP),e(ge,ng),e(ng,DP),e(ge,SP),e(ge,zd),e(zd,OP),e(ge,CP),e(ge,sg),e(sg,IP),e(ge,UP),p(t,H1,c),p(t,ga,c),e(ga,FP),e(ga,Nd),e(Nd,zP),e(ga,NP),p(t,B1,c),p(t,_a,c),e(_a,Ld),e(Ld,ig),e(ig,LP),e(Ld,jP),e(_a,RP),e(_a,jd),e(jd,lg),e(lg,WP),e(jd,GP),p(t,V1,c),p(t,Me,c),e(Me,MP),e(Me,dg),e(dg,HP),e(Me,BP),e(Me,cg),e(cg,VP),e(Me,YP),e(Me,Rd),e(Rd,XP),e(Me,ZP),p(t,Y1,c),p(t,va,c),e(va,ba),e(ba,pg),e(pg,JP),e(ba,KP),e(ba,mg),e(mg,QP),e(ba,e6),e(va,t6),e(va,Wd),e(Wd,hg),e(hg,o6),e(Wd,r6),p(t,X1,c),p(t,Ko,c),e(Ko,ya),e(ya,ug),_(vi,ug,null),e(Ko,a6),e(Ko,fg),e(fg,n6),p(t,Z1,c),p(t,He,c),e(He,s6),e(He,Gd),e(Gd,i6),e(He,l6),e(He,gg),e(gg,d6),e(He,c6),e(He,_g),e(_g,p6),e(He,m6),p(t,J1,c),p(t,Ht,c),e(Ht,h6),e(Ht,vg),e(vg,u6),e(Ht,f6),e(Ht,Md),e(Md,g6),e(Ht,_6),p(t,K1,c),p(t,wa,c),e(wa,Hd),e(Hd,bg),e(bg,v6),e(Hd,b6),e(wa,y6),e(wa,Bd),e(Bd,yg),e(yg,w6),e(Bd,T6),p(t,Q1,c),p(t,Be,c),e(Be,E6),e(Be,Vd),e(Vd,$6),e(Be,x6),e(Be,wg),e(wg,k6),e(Be,A6),e(Be,Tg),e(Tg,q6),e(Be,P6),p(t,ey,c),p(t,ce,c),e(ce,D6),e(ce,Yd),e(Yd,S6),e(ce,O6),e(ce,Eg),e(Eg,C6),e(ce,I6),e(ce,$g),e($g,U6),e(ce,F6),e(ce,xg),e(xg,z6),e(ce,N6),e(ce,Xd),e(Xd,L6),e(ce,j6),p(t,ty,c),p(t,Zd,c),e(Zd,R6),p(t,oy,c),_(bi,t,c),p(t,ry,c),p(t,Jd,c),e(Jd,W6),p(t,ay,c),_(yi,t,c),p(t,ny,c),p(t,Kd,c),e(Kd,G6),p(t,sy,c),_(wi,t,c),p(t,iy,c),p(t,Qd,c),e(Qd,M6),p(t,ly,c),p(t,ec,c),e(ec,H6),p(t,dy,c),_(Ti,t,c),p(t,cy,c),p(t,Ta,c),e(Ta,B6),e(Ta,kg),e(kg,V6),e(Ta,Y6),p(t,py,c),p(t,Qo,c),e(Qo,Ea),e(Ea,Ag),_(Ei,Ag,null),e(Qo,X6),e(Qo,qg),e(qg,Z6),p(t,my,c),p(t,_e,c),e(_e,J6),e(_e,tc),e(tc,K6),e(_e,Q6),e(_e,Pg),e(Pg,eD),e(_e,tD),e(_e,Dg),e(Dg,oD),e(_e,rD),e(_e,Sg),e(Sg,aD),e(_e,nD),p(t,hy,c),p(t,Bt,c),e(Bt,sD),e(Bt,$i),e($i,iD),e(Bt,lD),e(Bt,Og),e(Og,dD),e(Bt,cD),p(t,uy,c),p(t,er,c),e(er,$a),e($a,Cg),_(xi,Cg,null),e(er,pD),e(er,Ig),e(Ig,mD),p(t,fy,c),p(t,oc,c),e(oc,hD),p(t,gy,c),p(t,xa,c),e(xa,uD),e(xa,ki),e(ki,Ug),e(Ug,fD),e(xa,gD),p(t,_y,c),_(Ai,t,c),p(t,vy,c),p(t,Vt,c),e(Vt,_D),e(Vt,qi),e(qi,Fg),e(Fg,vD),e(Vt,bD),e(Vt,Pi),e(Pi,zg),e(zg,yD),e(Vt,wD),p(t,by,c),_(Di,t,c),p(t,yy,c),_(Si,t,c),p(t,wy,c),p(t,ka,c),e(ka,TD),e(ka,rc),e(rc,ED),e(ka,$D),p(t,Ty,c),p(t,ac,c),e(ac,xD),p(t,Ey,c),p(t,nc,c),e(nc,kD),p(t,$y,c),p(t,sc,c),e(sc,Ng),e(Ng,Lg),e(Lg,AD),p(t,xy,c),p(t,Aa,c),e(Aa,qD),e(Aa,jg),e(jg,PD),e(Aa,DD),p(t,ky,c),p(t,ic,c),e(ic,SD),p(t,Ay,c),_(Oi,t,c),p(t,qy,c),p(t,Yt,c),e(Yt,OD),e(Yt,Rg),e(Rg,CD),e(Yt,ID),e(Yt,Wg),e(Wg,UD),e(Yt,FD),p(t,Py,c),p(t,lc,c),e(lc,zD),p(t,Dy,c),_(Ci,t,c),p(t,Sy,c),p(t,Xt,c),e(Xt,ND),e(Xt,Gg),e(Gg,LD),e(Xt,jD),e(Xt,Mg),e(Mg,RD),e(Xt,WD),p(t,Oy,c),p(t,Zt,c),e(Zt,GD),e(Zt,Hg),e(Hg,MD),e(Zt,HD),e(Zt,Ii),e(Ii,Bg),e(Bg,BD),e(Zt,VD),p(t,Cy,c),_(Ui,t,c),p(t,Iy,c),p(t,dc,c),e(dc,YD),p(t,Uy,c),_(Fi,t,c),p(t,Fy,c),p(t,cc,c),e(cc,XD),p(t,zy,c),_(zi,t,c),p(t,Ny,c),p(t,pc,c),e(pc,ZD),p(t,Ly,c),p(t,mc,c),e(mc,Vg),e(Vg,Yg),e(Yg,JD),p(t,jy,c),p(t,qa,c),e(qa,KD),e(qa,Xg),e(Xg,QD),e(qa,e8),p(t,Ry,c),p(t,hc,c),e(hc,Ni),e(Ni,t8),e(Ni,Zg),e(Zg,o8),e(Ni,r8),p(t,Wy,c),_(Li,t,c),p(t,Gy,c),p(t,ji,c),e(ji,Jg),e(Jg,a8),p(t,My,c),_(Ri,t,c),p(t,Hy,c),p(t,Jt,c),e(Jt,n8),e(Jt,Kg),e(Kg,s8),e(Jt,i8),e(Jt,Qg),e(Qg,l8),e(Jt,d8),p(t,By,c),p(t,uc,c),e(uc,c8),p(t,Vy,c),_(Wi,t,c),p(t,Yy,c),p(t,fc,c),e(fc,p8),p(t,Xy,c),p(t,Pa,c),e(Pa,m8),e(Pa,e_),e(e_,h8),e(Pa,u8),p(t,Zy,c),p(t,tr,c),e(tr,Da),e(Da,t_),_(Gi,t_,null),e(tr,f8),e(tr,o_),e(o_,g8),p(t,Jy,c),p(t,Sa,c),e(Sa,_8),e(Sa,gc),e(gc,v8),e(Sa,b8),p(t,Ky,c),p(t,ve,c),e(ve,y8),e(ve,Mi),e(Mi,w8),e(ve,T8),e(ve,Hi),e(Hi,E8),e(ve,$8),e(ve,Bi),e(Bi,x8),e(ve,k8),e(ve,Vi),e(Vi,A8),e(ve,q8),p(t,Qy,c),p(t,Oa,c),e(Oa,P8),e(Oa,_c),e(_c,D8),e(Oa,S8),p(t,e2,c),p(t,vc,c),p(t,t2,c),p(t,or,c),e(or,Ca),e(Ca,r_),_(Yi,r_,null),e(or,O8),e(or,a_),e(a_,C8),p(t,o2,c),p(t,bc,c),e(bc,I8),p(t,r2,c),p(t,Kt,c),e(Kt,U8),e(Kt,Xi),e(Xi,F8),e(Kt,z8),e(Kt,Zi),e(Zi,N8),e(Kt,L8),p(t,a2,c),p(t,yc,c),e(yc,j8),p(t,n2,c),_(Ji,t,c),p(t,s2,c),p(t,wc,c),e(wc,R8),p(t,i2,c),p(t,Qt,c),e(Qt,W8),e(Qt,n_),e(n_,G8),e(Qt,M8),e(Qt,s_),e(s_,H8),e(Qt,B8),p(t,l2,c),p(t,rr,c),e(rr,Ia),e(Ia,i_),_(Ki,i_,null),e(rr,V8),e(rr,l_),e(l_,Y8),p(t,d2,c),p(t,Tc,c),e(Tc,X8),p(t,c2,c),p(t,Ve,c),e(Ve,Z8),e(Ve,d_),e(d_,J8),e(Ve,K8),e(Ve,c_),e(c_,Q8),e(Ve,e9),e(Ve,p_),e(p_,t9),e(Ve,o9),p(t,p2,c),p(t,eo,c),e(eo,r9),e(eo,m_),e(m_,a9),e(eo,n9),e(eo,h_),e(h_,s9),e(eo,i9),p(t,m2,c),_(Qi,t,c),p(t,h2,c),p(t,Ua,c),e(Ua,l9),e(Ua,el),e(el,d9),e(Ua,c9),p(t,u2,c),p(t,ar,c),e(ar,Fa),e(Fa,u_),_(tl,u_,null),e(ar,p9),e(ar,f_),e(f_,m9),p(t,f2,c),p(t,Ec,c),e(Ec,h9),p(t,g2,c),_(ol,t,c),p(t,_2,c),p(t,to,c),e(to,u9),e(to,g_),e(g_,f9),e(to,g9),e(to,__),e(__,_9),e(to,v9),p(t,v2,c),p(t,$c,c),e($c,b9),p(t,b2,c),_(rl,t,c),p(t,y2,c),p(t,xc,c),e(xc,y9),p(t,w2,c),p(t,za,c),e(za,w9),e(za,v_),e(v_,T9),e(za,E9),p(t,T2,c),p(t,ht,c),e(ht,b_),e(b_,$9),e(ht,x9),e(ht,y_),e(y_,k9),e(ht,A9),e(ht,w_),e(w_,q9),e(ht,P9),p(t,E2,c),p(t,kc,c),e(kc,D9),p(t,$2,c),_(al,t,c),p(t,x2,c),p(t,Ac,c),e(Ac,S9),p(t,k2,c),p(t,Ye,c),e(Ye,O9),e(Ye,T_),e(T_,C9),e(Ye,I9),e(Ye,E_),e(E_,U9),e(Ye,F9),e(Ye,$_),e($_,z9),e(Ye,N9),p(t,A2,c),p(t,nr,c),e(nr,Na),e(Na,x_),_(nl,x_,null),e(nr,L9),e(nr,k_),e(k_,j9),p(t,q2,c),p(t,oo,c),e(oo,R9),e(oo,A_),e(A_,W9),e(oo,G9),e(oo,q_),e(q_,M9),e(oo,H9),p(t,P2,c),p(t,qc,c),e(qc,B9),p(t,D2,c),p(t,Pc,c),e(Pc,V9),p(t,S2,c),p(t,La,c),e(La,Y9),e(La,P_),e(P_,X9),e(La,Z9),p(t,O2,c),_(sl,t,c),p(t,C2,c),p(t,ee,c),e(ee,J9),e(ee,D_),e(D_,K9),e(ee,Q9),e(ee,S_),e(S_,eS),e(ee,tS),e(ee,O_),e(O_,oS),e(ee,rS),e(ee,C_),e(C_,aS),e(ee,nS),e(ee,I_),e(I_,sS),e(ee,iS),e(ee,U_),e(U_,lS),e(ee,dS),p(t,I2,c),p(t,Dc,c),e(Dc,cS),p(t,U2,c),p(t,sr,c),e(sr,ja),e(ja,F_),_(il,F_,null),e(sr,pS),e(sr,z_),e(z_,mS),p(t,F2,c),_(Ra,t,c),p(t,z2,c),p(t,Xe,c),e(Xe,hS),e(Xe,ll),e(ll,uS),e(Xe,fS),e(Xe,Sc),e(Sc,gS),e(Xe,_S),e(Xe,dl),e(dl,vS),e(Xe,bS),p(t,N2,c),p(t,Ze,c),e(Ze,N_),e(N_,yS),e(Ze,wS),e(Ze,L_),e(L_,TS),e(Ze,ES),e(Ze,j_),e(j_,$S),e(Ze,xS),e(Ze,R_),e(R_,kS),p(t,L2,c),p(t,Oc,c),e(Oc,AS),p(t,j2,c),p(t,cl,c),e(cl,W_),e(W_,qS),e(cl,PS),p(t,R2,c),p(t,Cc,c),e(Cc,DS),p(t,W2,c),_(pl,t,c),p(t,G2,c),p(t,ro,c),e(ro,SS),e(ro,G_),e(G_,OS),e(ro,CS),e(ro,M_),e(M_,IS),e(ro,US),p(t,M2,c),_(ml,t,c),p(t,H2,c),p(t,ao,c),e(ao,FS),e(ao,H_),e(H_,zS),e(ao,NS),e(ao,hl),e(hl,LS),e(ao,jS),p(t,B2,c),p(t,Wa,c),e(Wa,RS),e(Wa,Ic),e(Ic,WS),e(Wa,GS),p(t,V2,c),p(t,Uc,c),e(Uc,MS),p(t,Y2,c),p(t,ul,c),e(ul,B_),e(B_,HS),e(ul,BS),p(t,X2,c),_(fl,t,c),p(t,Z2,c),p(t,Fc,c),e(Fc,VS),p(t,J2,c),_(gl,t,c),p(t,K2,c),p(t,_l,c),e(_l,V_),e(V_,YS),e(_l,XS),p(t,Q2,c),_(vl,t,c),p(t,ew,c),p(t,zc,c),e(zc,ZS),p(t,tw,c),_(bl,t,c),p(t,ow,c),p(t,Nc,c),e(Nc,JS),p(t,rw,c),p(t,Ga,c),e(Ga,KS),e(Ga,yl),e(yl,QS),e(Ga,eO),p(t,aw,c),p(t,wl,c),e(wl,Y_),e(Y_,tO),e(wl,oO),p(t,nw,c),p(t,no,c),e(no,rO),e(no,X_),e(X_,aO),e(no,nO),e(no,Z_),e(Z_,sO),e(no,iO),p(t,sw,c),p(t,Ma,c),e(Ma,lO),e(Ma,J_),e(J_,dO),e(Ma,cO),p(t,iw,c),_(Tl,t,c),p(t,lw,c),p(t,Lc,c),e(Lc,pO),p(t,dw,c),p(t,Je,c),e(Je,K_),e(K_,mO),e(Je,hO),e(Je,Q_),e(Q_,uO),e(Je,fO),e(Je,El),e(El,gO),e(El,ev),e(ev,_O),e(El,vO),e(Je,bO),e(Je,$l),e($l,yO),e($l,tv),e(tv,wO),e($l,TO),p(t,cw,c),p(t,xl,c),e(xl,ut),e(ut,EO),e(ut,ov),e(ov,$O),e(ut,xO),e(ut,rv),e(rv,kO),e(ut,AO),e(ut,av),e(av,qO),e(ut,PO),p(t,pw,c),p(t,Ha,c),e(Ha,DO),e(Ha,nv),e(nv,SO),e(Ha,OO),p(t,mw,c),_(kl,t,c),p(t,hw,c),p(t,ir,c),e(ir,sv),e(sv,CO),e(ir,IO),e(ir,iv),e(iv,UO),e(ir,FO),p(t,uw,c),p(t,so,c),e(so,zO),e(so,lv),e(lv,NO),e(so,LO),e(so,dv),e(dv,jO),e(so,RO),p(t,fw,c),p(t,jc,c),e(jc,WO),p(t,gw,c),p(t,be,c),e(be,cv),e(cv,GO),e(be,MO),e(be,pv),e(pv,HO),e(be,BO),e(be,Al),e(Al,VO),e(Al,mv),e(mv,YO),e(Al,XO),e(be,ZO),e(be,lr),e(lr,JO),e(lr,hv),e(hv,KO),e(lr,QO),e(lr,uv),e(uv,eC),e(lr,tC),e(be,oC),e(be,fv),e(fv,rC),p(t,_w,c),p(t,Rc,c),e(Rc,aC),p(t,vw,c),p(t,Ba,c),e(Ba,dr),e(dr,nC),e(dr,gv),e(gv,sC),e(dr,iC),e(dr,_v),e(_v,lC),e(dr,dC),e(Ba,cC),e(Ba,Pe),e(Pe,pC),e(Pe,vv),e(vv,mC),e(Pe,hC),e(Pe,bv),e(bv,uC),e(Pe,fC),e(Pe,yv),e(yv,gC),e(Pe,_C),e(Pe,wv),e(wv,vC),e(Pe,bC),p(t,bw,c),p(t,cr,c),e(cr,Va),e(Va,Tv),_(ql,Tv,null),e(cr,yC),e(cr,Ev),e(Ev,wC),p(t,yw,c),p(t,Ya,c),e(Ya,TC),e(Ya,Pl),e(Pl,EC),e(Ya,$C),p(t,ww,c),p(t,Dl,c),e(Dl,$v),e($v,xC),e(Dl,kC),p(t,Tw,c),p(t,Sl,c),e(Sl,xv),e(xv,AC),e(Sl,qC),p(t,Ew,c),p(t,pe,c),e(pe,kv),e(kv,Ol),e(Ol,PC),e(Ol,Av),e(Av,DC),e(Ol,SC),e(pe,OC),e(pe,Cl),e(Cl,Wc),e(Wc,qv),e(qv,CC),e(Wc,IC),e(Cl,UC),e(Cl,pr),e(pr,Il),e(Il,FC),e(Il,Pv),e(Pv,zC),e(Il,NC),e(pr,LC),e(pr,Ul),e(Ul,jC),e(Ul,Dv),e(Dv,RC),e(Ul,WC),e(pr,GC),e(pr,Fl),e(Fl,MC),e(Fl,Sv),e(Sv,HC),e(Fl,BC),e(pe,VC),e(pe,Ov),e(Ov,mr),e(mr,YC),e(mr,Cv),e(Cv,XC),e(mr,ZC),e(mr,Iv),e(Iv,JC),e(mr,KC),e(pe,QC),e(pe,Uv),e(Uv,ft),e(ft,eI),e(ft,Fv),e(Fv,tI),e(ft,oI),e(ft,zv),e(zv,rI),e(ft,aI),e(ft,Nv),e(Nv,nI),e(ft,sI),e(pe,iI),e(pe,Lv),e(Lv,hr),e(hr,lI),e(hr,jv),e(jv,dI),e(hr,cI),e(hr,Rv),e(Rv,pI),e(hr,mI),e(pe,hI),e(pe,zl),e(zl,gt),e(gt,uI),e(gt,Wv),e(Wv,fI),e(gt,gI),e(gt,Gv),e(Gv,_I),e(gt,vI),e(gt,Mv),e(Mv,bI),e(gt,yI),e(zl,wI),e(zl,_t),e(_t,Gc),e(Gc,TI),e(Gc,Nl),e(Nl,De),e(De,EI),e(De,Hv),e(Hv,$I),e(De,xI),e(De,Bv),e(Bv,kI),e(De,AI),e(De,Vv),e(Vv,qI),e(De,PI),e(De,Yv),e(Yv,DI),e(De,SI),e(Nl,OI),e(Nl,Ll),e(Ll,CI),e(Ll,Xv),e(Xv,II),e(Ll,UI),e(_t,FI),e(_t,vt),e(vt,Zv),e(Zv,zI),e(vt,NI),e(vt,Jv),e(Jv,LI),e(vt,jI),e(vt,Kv),e(Kv,RI),e(vt,WI),e(vt,Qv),e(Qv,GI),e(_t,MI),e(_t,Xa),e(Xa,eb),e(eb,HI),e(Xa,BI),e(Xa,tb),e(tb,VI),e(Xa,YI),e(_t,XI),e(_t,Za),e(Za,ob),e(ob,ZI),e(Za,JI),e(Za,rb),e(rb,KI),e(Za,QI),p(t,$w,c),p(t,Mc,c),e(Mc,ab),e(ab,eU),p(t,xw,c),p(t,Hc,c),e(Hc,Ke),e(Ke,tU),e(Ke,nb),e(nb,oU),e(Ke,rU),e(Ke,sb),e(sb,aU),e(Ke,nU),e(Ke,sU),e(Ke,iU),e(Ke,jl),e(jl,lU),p(t,kw,c),p(t,ur,c),e(ur,Ja),e(Ja,ib),_(Rl,ib,null),e(ur,dU),e(ur,lb),e(lb,cU),p(t,Aw,c),p(t,io,c),e(io,pU),e(io,Wl),e(Wl,mU),e(io,hU),e(io,Gl),e(Gl,uU),e(io,fU),p(t,qw,c),p(t,Ml,c),e(Ml,db),e(db,gU),e(Ml,_U),p(t,Pw,c),p(t,Hl,c),e(Hl,cb),e(cb,vU),e(Hl,bU),p(t,Dw,c),p(t,lo,c),e(lo,yU),e(lo,pb),e(pb,wU),e(lo,TU),e(lo,mb),e(mb,EU),e(lo,$U),p(t,Sw,c),p(t,Qe,c),e(Qe,Ka),e(Ka,hb),e(hb,xU),e(Ka,kU),e(Ka,ub),e(ub,AU),e(Ka,qU),e(Qe,PU),e(Qe,Qa),e(Qa,fb),e(fb,DU),e(Qa,SU),e(Qa,Bl),e(Bl,OU),e(Qa,CU),e(Qe,IU),e(Qe,et),e(et,gb),e(gb,UU),e(et,FU),e(et,_b),e(_b,zU),e(et,NU),e(et,vb),e(vb,LU),e(et,jU),e(et,bb),e(bb,RU),e(et,WU),e(Qe,GU),e(Qe,Bc),e(Bc,MU),e(Bc,Vl),e(Vl,Se),e(Se,HU),e(Se,yb),e(yb,BU),e(Se,VU),e(Se,wb),e(wb,YU),e(Se,XU),e(Se,Tb),e(Tb,ZU),e(Se,JU),e(Se,Eb),e(Eb,KU),e(Se,QU),e(Vl,eF),e(Vl,Yl),e(Yl,tF),e(Yl,$b),e($b,oF),e(Yl,rF),p(t,Ow,c),p(t,fr,c),e(fr,en),e(en,xb),_(Xl,xb,null),e(fr,aF),e(fr,kb),e(kb,nF),p(t,Cw,c),p(t,tt,c),e(tt,sF),e(tt,Ab),e(Ab,iF),e(tt,lF),e(tt,Zl),e(Zl,dF),e(tt,cF),e(tt,Jl),e(Jl,pF),e(tt,mF),p(t,Iw,c),_(tn,t,c),p(t,Uw,c),p(t,Vc,c),e(Vc,qb),e(qb,hF),p(t,Fw,c),p(t,co,c),e(co,Pb),e(Pb,uF),e(co,fF),e(co,Db),e(Db,gF),e(co,_F),e(co,Sb),e(Sb,vF),p(t,zw,c),p(t,gr,c),e(gr,Ob),e(Ob,bF),e(gr,yF),e(gr,Kl),e(Kl,wF),e(gr,TF),p(t,Nw,c),p(t,_r,c),e(_r,Cb),e(Cb,EF),e(_r,$F),e(_r,Ib),e(Ib,xF),e(_r,kF),p(t,Lw,c),_(Ql,t,c),p(t,jw,c),p(t,Yc,c),e(Yc,Ub),e(Ub,AF),p(t,Rw,c),p(t,on,c),e(on,ed),e(ed,qF),e(ed,Fb),e(Fb,PF),e(ed,DF),e(on,SF),e(on,Oe),e(Oe,OF),e(Oe,zb),e(zb,CF),e(Oe,IF),e(Oe,Nb),e(Nb,UF),e(Oe,FF),e(Oe,Lb),e(Lb,zF),e(Oe,NF),e(Oe,jb),e(jb,LF),e(Oe,jF),p(t,Ww,c),p(t,po,c),e(po,RF),e(po,Rb),e(Rb,WF),e(po,GF),e(po,td),e(td,MF),e(po,HF),p(t,Gw,c),p(t,Xc,c),e(Xc,BF),p(t,Mw,c),p(t,q,c),e(q,VF),e(q,Zc),e(Zc,YF),e(q,Wb),e(q,XF),e(q,Jc),e(Jc,ZF),e(q,Gb),e(q,JF),e(q,Kc),e(Kc,KF),e(q,Mb),e(q,QF),e(q,Qc),e(Qc,ez),e(q,Hb),e(q,tz),e(q,ep),e(ep,oz),e(q,Bb),e(q,rz),e(q,tp),e(tp,az),e(q,Vb),e(q,nz),e(q,op),e(op,sz),e(q,Yb),e(q,iz),e(q,rp),e(rp,lz),e(q,Xb),e(q,dz),e(q,ap),e(ap,cz),e(q,Zb),e(q,pz),e(q,np),e(np,mz),e(q,Jb),e(q,hz),e(q,sp),e(sp,uz),e(q,Kb),e(q,fz),e(q,ip),e(ip,gz),e(q,Qb),e(q,_z),e(q,lp),e(lp,vz),e(q,e1),e(q,bz),e(q,dp),e(dp,yz),e(q,t1),e(q,wz),e(q,cp),e(cp,Tz),e(q,o1),e(q,Ez),e(q,pp),e(pp,$z),e(q,r1),e(q,xz),e(q,mp),e(mp,kz),e(q,a1),e(q,Az),e(q,hp),e(hp,qz),e(q,n1),e(q,Pz),e(q,up),e(up,Dz),e(q,s1),e(q,Sz),e(q,fp),e(fp,Oz),e(q,i1),e(q,Cz),e(q,gp),e(gp,Iz),e(q,l1),e(q,Uz),e(q,_p),e(_p,Fz),e(q,d1),e(q,zz),e(q,vp),e(vp,Nz),e(q,c1),e(q,Lz),Hw=!0},p(t,[c]){const od={};c&2&&(od.$$scope={dirty:c,ctx:t}),Ar.$set(od);const p1={};c&2&&(p1.$$scope={dirty:c,ctx:t}),Nr.$set(p1);const m1={};c&2&&(m1.$$scope={dirty:c,ctx:t}),Wr.$set(m1);const h1={};c&2&&(h1.$$scope={dirty:c,ctx:t}),Hr.$set(h1);const vr={};c&2&&(vr.$$scope={dirty:c,ctx:t}),Zr.$set(vr);const u1={};c&2&&(u1.$$scope={dirty:c,ctx:t}),Qr.$set(u1);const f1={};c&2&&(f1.$$scope={dirty:c,ctx:t}),ea.$set(f1);const br={};c&2&&(br.$$scope={dirty:c,ctx:t}),ta.$set(br);const g1={};c&2&&(g1.$$scope={dirty:c,ctx:t}),oa.$set(g1);const _1={};c&2&&(_1.$$scope={dirty:c,ctx:t}),ra.$set(_1);const rd={};c&2&&(rd.$$scope={dirty:c,ctx:t}),aa.$set(rd);const v1={};c&2&&(v1.$$scope={dirty:c,ctx:t}),na.$set(v1);const ad={};c&2&&(ad.$$scope={dirty:c,ctx:t}),sa.$set(ad);const b1={};c&2&&(b1.$$scope={dirty:c,ctx:t}),ia.$set(b1);const H={};c&2&&(H.$$scope={dirty:c,ctx:t}),la.$set(H);const bp={};c&2&&(bp.$$scope={dirty:c,ctx:t}),da.$set(bp);const y1={};c&2&&(y1.$$scope={dirty:c,ctx:t}),ca.$set(y1);const yp={};c&2&&(yp.$$scope={dirty:c,ctx:t}),Ra.$set(yp);const w1={};c&2&&(w1.$$scope={dirty:c,ctx:t}),tn.$set(w1)},i(t){Hw||(v(h.$$.fragment,t),v(Ar.$$.fragment,t),v(Cn.$$.fragment,t),v(In.$$.fragment,t),v(Un.$$.fragment,t),v(Fn.$$.fragment,t),v(Nn.$$.fragment,t),v(jn.$$.fragment,t),v(Rn.$$.fragment,t),v(Wn.$$.fragment,t),v(Mn.$$.fragment,t),v(Bn.$$.fragment,t),v(Vn.$$.fragment,t),v(Yn.$$.fragment,t),v(Zn.$$.fragment,t),v(Jn.$$.fragment,t),v(Qn.$$.fragment,t),v(ts.$$.fragment,t),v(os.$$.fragment,t),v(as.$$.fragment,t),v(ss.$$.fragment,t),v(Nr.$$.fragment,t),v(is.$$.fragment,t),v(ds.$$.fragment,t),v(cs.$$.fragment,t),v(ms.$$.fragment,t),v(us.$$.fragment,t),v(Wr.$$.fragment,t),v(_s.$$.fragment,t),v(vs.$$.fragment,t),v(ys.$$.fragment,t),v(Es.$$.fragment,t),v(Hr.$$.fragment,t),v(ks.$$.fragment,t),v(As.$$.fragment,t),v(qs.$$.fragment,t),v(Ps.$$.fragment,t),v(Ss.$$.fragment,t),v(Is.$$.fragment,t),v(Fs.$$.fragment,t),v(zs.$$.fragment,t),v(Ns.$$.fragment,t),v(Ls.$$.fragment,t),v(js.$$.fragment,t),v(Rs.$$.fragment,t),v(Gs.$$.fragment,t),v(Zr.$$.fragment,t),v(Bs.$$.fragment,t),v(Vs.$$.fragment,t),v(Zs.$$.fragment,t),v(Ks.$$.fragment,t),v(Qs.$$.fragment,t),v(ei.$$.fragment,t),v(Qr.$$.fragment,t),v(ti.$$.fragment,t),v(ea.$$.fragment,t),v(oi.$$.fragment,t),v(ta.$$.fragment,t),v(ri.$$.fragment,t),v(oa.$$.fragment,t),v(ai.$$.fragment,t),v(ra.$$.fragment,t),v(ni.$$.fragment,t),v(aa.$$.fragment,t),v(na.$$.fragment,t),v(si.$$.fragment,t),v(sa.$$.fragment,t),v(ii.$$.fragment,t),v(ia.$$.fragment,t),v(la.$$.fragment,t),v(li.$$.fragment,t),v(da.$$.fragment,t),v(ca.$$.fragment,t),v(di.$$.fragment,t),v(pi.$$.fragment,t),v(mi.$$.fragment,t),v(hi.$$.fragment,t),v(ui.$$.fragment,t),v(_i.$$.fragment,t),v(vi.$$.fragment,t),v(bi.$$.fragment,t),v(yi.$$.fragment,t),v(wi.$$.fragment,t),v(Ti.$$.fragment,t),v(Ei.$$.fragment,t),v(xi.$$.fragment,t),v(Ai.$$.fragment,t),v(Di.$$.fragment,t),v(Si.$$.fragment,t),v(Oi.$$.fragment,t),v(Ci.$$.fragment,t),v(Ui.$$.fragment,t),v(Fi.$$.fragment,t),v(zi.$$.fragment,t),v(Li.$$.fragment,t),v(Ri.$$.fragment,t),v(Wi.$$.fragment,t),v(Gi.$$.fragment,t),v(Yi.$$.fragment,t),v(Ji.$$.fragment,t),v(Ki.$$.fragment,t),v(Qi.$$.fragment,t),v(tl.$$.fragment,t),v(ol.$$.fragment,t),v(rl.$$.fragment,t),v(al.$$.fragment,t),v(nl.$$.fragment,t),v(sl.$$.fragment,t),v(il.$$.fragment,t),v(Ra.$$.fragment,t),v(pl.$$.fragment,t),v(ml.$$.fragment,t),v(fl.$$.fragment,t),v(gl.$$.fragment,t),v(vl.$$.fragment,t),v(bl.$$.fragment,t),v(Tl.$$.fragment,t),v(kl.$$.fragment,t),v(ql.$$.fragment,t),v(Rl.$$.fragment,t),v(Xl.$$.fragment,t),v(tn.$$.fragment,t),v(Ql.$$.fragment,t),Hw=!0)},o(t){b(h.$$.fragment,t),b(Ar.$$.fragment,t),b(Cn.$$.fragment,t),b(In.$$.fragment,t),b(Un.$$.fragment,t),b(Fn.$$.fragment,t),b(Nn.$$.fragment,t),b(jn.$$.fragment,t),b(Rn.$$.fragment,t),b(Wn.$$.fragment,t),b(Mn.$$.fragment,t),b(Bn.$$.fragment,t),b(Vn.$$.fragment,t),b(Yn.$$.fragment,t),b(Zn.$$.fragment,t),b(Jn.$$.fragment,t),b(Qn.$$.fragment,t),b(ts.$$.fragment,t),b(os.$$.fragment,t),b(as.$$.fragment,t),b(ss.$$.fragment,t),b(Nr.$$.fragment,t),b(is.$$.fragment,t),b(ds.$$.fragment,t),b(cs.$$.fragment,t),b(ms.$$.fragment,t),b(us.$$.fragment,t),b(Wr.$$.fragment,t),b(_s.$$.fragment,t),b(vs.$$.fragment,t),b(ys.$$.fragment,t),b(Es.$$.fragment,t),b(Hr.$$.fragment,t),b(ks.$$.fragment,t),b(As.$$.fragment,t),b(qs.$$.fragment,t),b(Ps.$$.fragment,t),b(Ss.$$.fragment,t),b(Is.$$.fragment,t),b(Fs.$$.fragment,t),b(zs.$$.fragment,t),b(Ns.$$.fragment,t),b(Ls.$$.fragment,t),b(js.$$.fragment,t),b(Rs.$$.fragment,t),b(Gs.$$.fragment,t),b(Zr.$$.fragment,t),b(Bs.$$.fragment,t),b(Vs.$$.fragment,t),b(Zs.$$.fragment,t),b(Ks.$$.fragment,t),b(Qs.$$.fragment,t),b(ei.$$.fragment,t),b(Qr.$$.fragment,t),b(ti.$$.fragment,t),b(ea.$$.fragment,t),b(oi.$$.fragment,t),b(ta.$$.fragment,t),b(ri.$$.fragment,t),b(oa.$$.fragment,t),b(ai.$$.fragment,t),b(ra.$$.fragment,t),b(ni.$$.fragment,t),b(aa.$$.fragment,t),b(na.$$.fragment,t),b(si.$$.fragment,t),b(sa.$$.fragment,t),b(ii.$$.fragment,t),b(ia.$$.fragment,t),b(la.$$.fragment,t),b(li.$$.fragment,t),b(da.$$.fragment,t),b(ca.$$.fragment,t),b(di.$$.fragment,t),b(pi.$$.fragment,t),b(mi.$$.fragment,t),b(hi.$$.fragment,t),b(ui.$$.fragment,t),b(_i.$$.fragment,t),b(vi.$$.fragment,t),b(bi.$$.fragment,t),b(yi.$$.fragment,t),b(wi.$$.fragment,t),b(Ti.$$.fragment,t),b(Ei.$$.fragment,t),b(xi.$$.fragment,t),b(Ai.$$.fragment,t),b(Di.$$.fragment,t),b(Si.$$.fragment,t),b(Oi.$$.fragment,t),b(Ci.$$.fragment,t),b(Ui.$$.fragment,t),b(Fi.$$.fragment,t),b(zi.$$.fragment,t),b(Li.$$.fragment,t),b(Ri.$$.fragment,t),b(Wi.$$.fragment,t),b(Gi.$$.fragment,t),b(Yi.$$.fragment,t),b(Ji.$$.fragment,t),b(Ki.$$.fragment,t),b(Qi.$$.fragment,t),b(tl.$$.fragment,t),b(ol.$$.fragment,t),b(rl.$$.fragment,t),b(al.$$.fragment,t),b(nl.$$.fragment,t),b(sl.$$.fragment,t),b(il.$$.fragment,t),b(Ra.$$.fragment,t),b(pl.$$.fragment,t),b(ml.$$.fragment,t),b(fl.$$.fragment,t),b(gl.$$.fragment,t),b(vl.$$.fragment,t),b(bl.$$.fragment,t),b(Tl.$$.fragment,t),b(kl.$$.fragment,t),b(ql.$$.fragment,t),b(Rl.$$.fragment,t),b(Xl.$$.fragment,t),b(tn.$$.fragment,t),b(Ql.$$.fragment,t),Hw=!1},d(t){o(u),t&&o(x),t&&o(T),y(h),t&&o(I),t&&o(G),t&&o(M),t&&o(R),t&&o(ue),t&&o(Ie),t&&o(se),t&&o(oe),t&&o(Ao),t&&o(W),t&&o(S1),y(Ar,t),t&&o(O1),t&&o(qr),t&&o(C1),y(Cn,t),t&&o(I1),t&&o(Tt),t&&o(U1),t&&o(qo),y(In),t&&o(F1),t&&o($),y(Un),y(Fn),y(Nn),y(jn),y(Rn),y(Wn),y(Mn),y(Bn),y(Vn),y(Yn),y(Zn),y(Jn),y(Qn),y(ts),y(os),y(as),y(ss),y(Nr),y(is),y(ds),y(cs),y(ms),y(us),y(Wr),y(_s),y(vs),y(ys),y(Es),y(Hr),y(ks),y(As),y(qs),y(Ps),y(Ss),y(Is),y(Fs),y(zs),y(Ns),t&&o(z1),t&&o(Lo),y(Ls),t&&o(N1),t&&o(pt),y(js),y(Rs),y(Gs),y(Zr),t&&o(L1),t&&o(Mo),y(Bs),t&&o(j1),t&&o(S),y(Vs),y(Zs),y(Ks),y(Qs),y(ei),y(Qr),y(ti),y(ea),y(oi),y(ta),y(ri),y(oa),y(ai),y(ra),y(ni),y(aa),y(na),y(si),y(sa),y(ii),y(ia),y(la),y(li),y(da),y(ca),y(di),y(pi),y(mi),t&&o(R1),t&&o(Xo),y(hi),t&&o(W1),t&&o(mt),y(ui),t&&o(G1),t&&o(Jo),y(_i),t&&o(M1),t&&o(ge),t&&o(H1),t&&o(ga),t&&o(B1),t&&o(_a),t&&o(V1),t&&o(Me),t&&o(Y1),t&&o(va),t&&o(X1),t&&o(Ko),y(vi),t&&o(Z1),t&&o(He),t&&o(J1),t&&o(Ht),t&&o(K1),t&&o(wa),t&&o(Q1),t&&o(Be),t&&o(ey),t&&o(ce),t&&o(ty),t&&o(Zd),t&&o(oy),y(bi,t),t&&o(ry),t&&o(Jd),t&&o(ay),y(yi,t),t&&o(ny),t&&o(Kd),t&&o(sy),y(wi,t),t&&o(iy),t&&o(Qd),t&&o(ly),t&&o(ec),t&&o(dy),y(Ti,t),t&&o(cy),t&&o(Ta),t&&o(py),t&&o(Qo),y(Ei),t&&o(my),t&&o(_e),t&&o(hy),t&&o(Bt),t&&o(uy),t&&o(er),y(xi),t&&o(fy),t&&o(oc),t&&o(gy),t&&o(xa),t&&o(_y),y(Ai,t),t&&o(vy),t&&o(Vt),t&&o(by),y(Di,t),t&&o(yy),y(Si,t),t&&o(wy),t&&o(ka),t&&o(Ty),t&&o(ac),t&&o(Ey),t&&o(nc),t&&o($y),t&&o(sc),t&&o(xy),t&&o(Aa),t&&o(ky),t&&o(ic),t&&o(Ay),y(Oi,t),t&&o(qy),t&&o(Yt),t&&o(Py),t&&o(lc),t&&o(Dy),y(Ci,t),t&&o(Sy),t&&o(Xt),t&&o(Oy),t&&o(Zt),t&&o(Cy),y(Ui,t),t&&o(Iy),t&&o(dc),t&&o(Uy),y(Fi,t),t&&o(Fy),t&&o(cc),t&&o(zy),y(zi,t),t&&o(Ny),t&&o(pc),t&&o(Ly),t&&o(mc),t&&o(jy),t&&o(qa),t&&o(Ry),t&&o(hc),t&&o(Wy),y(Li,t),t&&o(Gy),t&&o(ji),t&&o(My),y(Ri,t),t&&o(Hy),t&&o(Jt),t&&o(By),t&&o(uc),t&&o(Vy),y(Wi,t),t&&o(Yy),t&&o(fc),t&&o(Xy),t&&o(Pa),t&&o(Zy),t&&o(tr),y(Gi),t&&o(Jy),t&&o(Sa),t&&o(Ky),t&&o(ve),t&&o(Qy),t&&o(Oa),t&&o(e2),t&&o(vc),t&&o(t2),t&&o(or),y(Yi),t&&o(o2),t&&o(bc),t&&o(r2),t&&o(Kt),t&&o(a2),t&&o(yc),t&&o(n2),y(Ji,t),t&&o(s2),t&&o(wc),t&&o(i2),t&&o(Qt),t&&o(l2),t&&o(rr),y(Ki),t&&o(d2),t&&o(Tc),t&&o(c2),t&&o(Ve),t&&o(p2),t&&o(eo),t&&o(m2),y(Qi,t),t&&o(h2),t&&o(Ua),t&&o(u2),t&&o(ar),y(tl),t&&o(f2),t&&o(Ec),t&&o(g2),y(ol,t),t&&o(_2),t&&o(to),t&&o(v2),t&&o($c),t&&o(b2),y(rl,t),t&&o(y2),t&&o(xc),t&&o(w2),t&&o(za),t&&o(T2),t&&o(ht),t&&o(E2),t&&o(kc),t&&o($2),y(al,t),t&&o(x2),t&&o(Ac),t&&o(k2),t&&o(Ye),t&&o(A2),t&&o(nr),y(nl),t&&o(q2),t&&o(oo),t&&o(P2),t&&o(qc),t&&o(D2),t&&o(Pc),t&&o(S2),t&&o(La),t&&o(O2),y(sl,t),t&&o(C2),t&&o(ee),t&&o(I2),t&&o(Dc),t&&o(U2),t&&o(sr),y(il),t&&o(F2),y(Ra,t),t&&o(z2),t&&o(Xe),t&&o(N2),t&&o(Ze),t&&o(L2),t&&o(Oc),t&&o(j2),t&&o(cl),t&&o(R2),t&&o(Cc),t&&o(W2),y(pl,t),t&&o(G2),t&&o(ro),t&&o(M2),y(ml,t),t&&o(H2),t&&o(ao),t&&o(B2),t&&o(Wa),t&&o(V2),t&&o(Uc),t&&o(Y2),t&&o(ul),t&&o(X2),y(fl,t),t&&o(Z2),t&&o(Fc),t&&o(J2),y(gl,t),t&&o(K2),t&&o(_l),t&&o(Q2),y(vl,t),t&&o(ew),t&&o(zc),t&&o(tw),y(bl,t),t&&o(ow),t&&o(Nc),t&&o(rw),t&&o(Ga),t&&o(aw),t&&o(wl),t&&o(nw),t&&o(no),t&&o(sw),t&&o(Ma),t&&o(iw),y(Tl,t),t&&o(lw),t&&o(Lc),t&&o(dw),t&&o(Je),t&&o(cw),t&&o(xl),t&&o(pw),t&&o(Ha),t&&o(mw),y(kl,t),t&&o(hw),t&&o(ir),t&&o(uw),t&&o(so),t&&o(fw),t&&o(jc),t&&o(gw),t&&o(be),t&&o(_w),t&&o(Rc),t&&o(vw),t&&o(Ba),t&&o(bw),t&&o(cr),y(ql),t&&o(yw),t&&o(Ya),t&&o(ww),t&&o(Dl),t&&o(Tw),t&&o(Sl),t&&o(Ew),t&&o(pe),t&&o($w),t&&o(Mc),t&&o(xw),t&&o(Hc),t&&o(kw),t&&o(ur),y(Rl),t&&o(Aw),t&&o(io),t&&o(qw),t&&o(Ml),t&&o(Pw),t&&o(Hl),t&&o(Dw),t&&o(lo),t&&o(Sw),t&&o(Qe),t&&o(Ow),t&&o(fr),y(Xl),t&&o(Cw),t&&o(tt),t&&o(Iw),y(tn,t),t&&o(Uw),t&&o(Vc),t&&o(Fw),t&&o(co),t&&o(zw),t&&o(gr),t&&o(Nw),t&&o(_r),t&&o(Lw),y(Ql,t),t&&o(jw),t&&o(Yc),t&&o(Rw),t&&o(on),t&&o(Ww),t&&o(po),t&&o(Gw),t&&o(Xc),t&&o(Mw),t&&o(q)}}}const wY={local:"trainer",sections:[{local:"transformers.Trainer",title:"Trainer"},{local:"transformers.Seq2SeqTrainer",title:"Seq2SeqTrainer"},{local:"transformers.TrainingArguments",title:"TrainingArguments"},{local:"transformers.Seq2SeqTrainingArguments",title:"Seq2SeqTrainingArguments"},{local:"checkpoints",title:"Checkpoints"},{local:"logging",title:"Logging"},{local:"randomness",title:"Randomness"},{local:"specific-gpus-selection",title:"Specific GPUs Selection"},{local:"trainer-integrations",sections:[{local:"cuda-extension-installation-notes",sections:[{local:"possible-problem-1",title:"Possible problem #1"},{local:"possible-problem-2",title:"Possible problem #2"},{local:"possible-problem-3",title:"Possible problem #3"}],title:"CUDA Extension Installation Notes"},{local:"fairscale",title:"FairScale"},{local:"pytorch-fully-sharded-data-parallel",title:"PyTorch Fully Sharded Data parallel"},{local:"pytorchxla-fully-sharded-data-parallel",title:"PyTorch/XLA Fully Sharded Data parallel"},{local:"using-trainer-for-accelerated-pytorch-training-on-mac",title:"Using Trainer for accelerated PyTorch Training on Mac "}],title:"Trainer Integrations"}],title:"Trainer"};function TY(C){return eY(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class PY extends ZV{constructor(u){super();JV(this,u,TY,yY,KV,{})}}export{PY as default,wY as metadata};
