import{S as mY,i as hY,s as uY,e as n,k as l,w as f,t as r,M as fY,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 gY,L as ko}from"../../chunks/vendor-hf-doc-builder.js";import{T as xr}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 _Y(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,Fe,Cn,Ee,In,Fn;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"),Fe=r("Trainer"),Cn=r(") but none of them should be named "),Ee=n("code"),In=r('"label"'),Fn=r("."),this.h()},l(se){u=s(se,"P",{});var oe=i(u);x=a(oe,"The "),T=s(oe,"A",{href:!0});var md=i(T);w=a(md,"Trainer"),md.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 kr=i(z);j=a(kr,"your model always return tuples or subclasses of "),I=s(kr,"A",{href:!0});var hd=i(I);G=a(hd,"ModelOutput"),hd.forEach(o),B=a(kr,"."),kr.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 Ar=i(N);we=a(Ar,"label_names"),Ar.forEach(o),Te=a(re," in your "),ne=s(re,"A",{href:!0});var ud=i(ne);bt=a(ud,"TrainingArguments"),ud.forEach(o),yt=a(re," to indicate their name to the "),ue=s(re,"A",{href:!0});var fd=i(ue);Fe=a(fd,"Trainer"),fd.forEach(o),Cn=a(re,") but none of them should be named "),Ee=s(re,"CODE",{});var gd=i(Ee);In=a(gd,'"label"'),gd.forEach(o),Fn=a(re,"."),re.forEach(o),$e.forEach(o),this.h()},h(){m(T,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(I,"href","/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput"),m(ne,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),m(ue,"href","/docs/transformers/v4.29.0/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,Fe),e(R,Cn),e(R,Ee),e(Ee,In),e(R,Fn)},d(se){se&&o(u),se&&o(h),se&&o(E)}}}function vY(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.29.0/en/main_classes/trainer#transformers.Trainer"),m(B,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(Z,"href","/docs/transformers/v4.29.0/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 bY(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 yY(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 wY(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 TY(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 EY(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 $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_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 xY(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 kY(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 AY(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.29.0/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 qY(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 PY(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 DY(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 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_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 OY(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 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_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 IY(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 FY(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 UY(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,Fe,Cn,Ee,In,Fn,se,oe,md,$e,kr,hd,Ao,W,re,Ar,ud,fd,gd,_d,Lm,YT,XT,ZT,vd,jm,JT,KT,QT,bd,Rm,eE,tE,oE,wt,Wm,rE,aE,Gm,nE,sE,Mm,iE,lE,dE,yd,Hm,cE,pE,mE,wd,Bm,hE,uE,fE,Td,Vm,gE,_E,vE,Ed,Ym,bE,yE,wE,$d,Xm,TE,EE,$E,xd,Zm,xE,kE,AE,kd,Jm,qE,PE,z1,qr,N1,Pr,DE,Ad,SE,OE,L1,Un,j1,Tt,CE,qd,IE,FE,Pd,UE,zE,R1,qo,Dr,Km,zn,NE,Qm,LE,W1,$,Nn,jE,eh,RE,WE,th,GE,ME,xe,Sr,oh,HE,BE,Dd,VE,YE,XE,ie,rh,ZE,JE,ah,KE,QE,nh,e4,t4,sh,o4,r4,ih,a4,n4,lh,s4,i4,l4,Sd,dh,d4,c4,p4,Ue,ch,m4,h4,ph,u4,f4,mh,g4,_4,hh,v4,b4,y4,ze,uh,w4,T4,fh,E4,$4,gh,x4,k4,_h,A4,q4,P4,Or,Ln,D4,jn,S4,vh,O4,C4,I4,Cr,Rn,F4,Wn,U4,bh,z4,N4,L4,Et,Gn,j4,yh,R4,W4,wh,G4,M4,Ir,Mn,H4,Th,B4,V4,Fr,Hn,Y4,Bn,X4,Eh,Z4,J4,K4,$t,Vn,Q4,$h,e$,t$,Yn,o$,xh,r$,a$,n$,xt,Xn,s$,kh,i$,l$,lt,d$,Ah,c$,p$,qh,m$,h$,Ph,u$,f$,g$,Ur,Zn,_$,Dh,v$,b$,Ne,Jn,y$,Sh,w$,T$,Kn,E$,Oh,$$,x$,k$,Ch,A$,q$,kt,Qn,P$,Po,D$,Ih,S$,O$,Fh,C$,I$,F$,Uh,U$,z$,zr,es,N$,ts,L$,Od,j$,R$,W$,At,os,G$,rs,M$,zh,H$,B$,V$,Nh,Y$,X$,Nr,as,Z$,Lh,J$,K$,qt,ns,Q$,ss,e3,jh,t3,o3,r3,Rh,a3,n3,Le,is,s3,ls,i3,Wh,l3,d3,c3,Do,p3,Gh,m3,h3,Mh,u3,f3,g3,Hh,_3,v3,Pt,ds,b3,ke,y3,Bh,w3,T3,Vh,E3,$3,Yh,x3,k3,Xh,A3,q3,P3,Lr,D3,jr,cs,S3,ps,O3,Zh,C3,I3,F3,Rr,ms,U3,Jh,z3,N3,Wr,hs,L3,us,j3,Kh,R3,W3,G3,Dt,fs,M3,gs,H3,Qh,B3,V3,Y3,eu,X3,Z3,F,_s,J3,tu,K3,Q3,ou,ex,tx,ru,ox,rx,So,ax,au,nx,sx,nu,ix,lx,dx,Gr,cx,su,iu,px,mx,dt,Ae,hx,lu,ux,fx,du,gx,_x,cu,vx,bx,pu,yx,wx,Tx,Oo,Ex,mu,$x,xx,hu,kx,Ax,qx,Cd,uu,Px,Dx,Sx,St,fu,Ox,Cx,gu,Ix,Fx,_u,Ux,zx,Nx,vu,Lx,jx,bu,Rx,Wx,vs,Gx,yu,Mx,Hx,Bx,ct,Vx,wu,Yx,Xx,Tu,Zx,Jx,Eu,Kx,Qx,ek,he,tk,Id,ok,rk,$u,ak,nk,xu,sk,ik,ku,lk,dk,Au,ck,pk,mk,V,hk,qu,uk,fk,Pu,gk,_k,Du,vk,bk,Su,yk,wk,bs,Tk,Ek,Ou,$k,xk,Cu,kk,Ak,Iu,qk,Pk,Fu,Dk,Sk,Uu,Ok,Ck,Ik,qe,Fk,Fd,Uk,zk,zu,Nk,Lk,Ud,jk,Rk,Nu,Wk,Gk,Mk,Lu,Hk,Bk,Mr,ys,Vk,ju,Yk,Xk,Hr,ws,Zk,Ts,Jk,Ru,Kk,Qk,eA,Ot,Es,tA,$s,oA,Wu,rA,aA,nA,xs,sA,Gu,iA,lA,dA,le,ks,cA,Mu,pA,mA,As,hA,Hu,uA,fA,gA,Br,_A,qs,vA,Bu,bA,yA,wA,Co,Io,TA,Vu,EA,$A,Yu,xA,kA,AA,Fo,qA,Xu,PA,DA,Zu,SA,OA,CA,Uo,IA,Ju,FA,UA,Ku,zA,NA,LA,Ct,Ps,jA,zo,RA,Qu,WA,GA,ef,MA,HA,BA,tf,VA,YA,It,Ds,XA,No,ZA,of,JA,KA,rf,QA,e9,t9,af,o9,r9,Vr,Ss,a9,pt,n9,nf,s9,i9,sf,l9,d9,lf,c9,p9,m9,Yr,Os,h9,Cs,u9,df,f9,g9,_9,je,Is,v9,Fs,b9,cf,y9,w9,T9,pf,E9,$9,Us,x9,zd,k9,A9,q9,Ft,zs,P9,Ns,D9,mf,S9,O9,C9,hf,I9,F9,Ut,Ls,U9,uf,z9,N9,ff,L9,j9,Xr,js,R9,gf,W9,G9,zt,Rs,M9,_f,H9,B9,vf,V9,G1,Lo,Zr,bf,Ws,Y9,yf,X9,M1,mt,Gs,Z9,Re,Ms,J9,wf,K9,Q9,Hs,e5,Tf,t5,o5,r5,Ef,a5,n5,de,Bs,s5,$f,i5,l5,Vs,d5,xf,c5,p5,m5,Jr,h5,Ys,u5,kf,f5,g5,_5,jo,Ro,v5,Af,b5,y5,qf,w5,T5,E5,Wo,$5,Pf,x5,k5,Df,A5,q5,P5,Go,D5,Sf,S5,O5,Of,C5,I5,H1,Mo,Kr,Cf,Xs,F5,If,U5,B1,S,Zs,z5,Js,N5,Ff,L5,j5,R5,Ho,W5,Nd,G5,M5,Ks,H5,B5,V5,fe,Qs,Y5,Uf,X5,Z5,Bo,J5,zf,K5,Q5,Nf,eq,tq,oq,Vo,rq,Lf,aq,nq,jf,sq,iq,lq,ei,dq,Rf,cq,pq,mq,Qr,ti,hq,Wf,uq,fq,Nt,oi,gq,Gf,_q,vq,Yo,bq,Mf,yq,wq,Hf,Tq,Eq,$q,Lt,ri,xq,Bf,kq,Aq,ea,qq,jt,ai,Pq,Vf,Dq,Sq,ta,Oq,Rt,ni,Cq,Yf,Iq,Fq,oa,Uq,Wt,si,zq,Xf,Nq,Lq,ra,jq,Gt,ii,Rq,Zf,Wq,Gq,aa,Mq,We,li,Hq,Jf,Bq,Vq,na,Yq,sa,Xq,Mt,di,Zq,Kf,Jq,Kq,ia,Qq,Ge,ci,eP,Qf,tP,oP,la,rP,da,aP,Me,pi,nP,eg,sP,iP,ca,lP,pa,dP,ma,mi,cP,hi,pP,tg,mP,hP,uP,ha,ui,fP,og,gP,_P,ua,fi,vP,rg,bP,V1,Xo,fa,ag,gi,yP,ng,wP,Y1,Pe,_i,TP,vi,EP,sg,$P,xP,kP,Zo,AP,Ld,qP,PP,bi,DP,SP,OP,ga,yi,CP,Jo,IP,ig,FP,UP,lg,zP,NP,X1,Ko,_a,dg,wi,LP,cg,jP,Z1,ge,RP,jd,WP,GP,pg,MP,HP,Rd,BP,VP,mg,YP,XP,J1,va,ZP,Wd,JP,KP,K1,ba,Gd,hg,QP,e6,t6,Md,ug,o6,r6,Q1,He,a6,fg,n6,s6,gg,i6,l6,Hd,d6,c6,ey,ya,wa,_g,p6,m6,vg,h6,u6,f6,Bd,bg,g6,_6,ty,Qo,Ta,yg,Ti,v6,wg,b6,oy,Be,y6,Vd,w6,T6,Tg,E6,$6,Eg,x6,k6,ry,Ht,A6,$g,q6,P6,Yd,D6,S6,ay,Ea,Xd,xg,O6,C6,I6,Zd,kg,F6,U6,ny,Ve,z6,Jd,N6,L6,Ag,j6,R6,qg,W6,G6,sy,ce,M6,Kd,H6,B6,Pg,V6,Y6,Dg,X6,Z6,Sg,J6,K6,Qd,Q6,eD,iy,ec,tD,ly,Ei,dy,tc,oD,cy,$i,py,oc,rD,my,xi,hy,rc,aD,uy,ac,nD,fy,ki,gy,$a,sD,Og,iD,lD,_y,er,xa,Cg,Ai,dD,Ig,cD,vy,_e,pD,nc,mD,hD,Fg,uD,fD,Ug,gD,_D,zg,vD,bD,by,Bt,yD,qi,wD,TD,Ng,ED,$D,yy,tr,ka,Lg,Pi,xD,jg,kD,wy,sc,AD,Ty,Aa,qD,Di,Rg,PD,DD,Ey,Si,$y,Vt,SD,Oi,Wg,OD,CD,Ci,Gg,ID,FD,xy,Ii,ky,Fi,Ay,qa,UD,ic,zD,ND,qy,lc,LD,Py,dc,jD,Dy,cc,Mg,Hg,RD,Sy,Pa,WD,Bg,GD,MD,Oy,pc,HD,Cy,Ui,Iy,Yt,BD,Vg,VD,YD,Yg,XD,ZD,Fy,mc,JD,Uy,zi,zy,Xt,KD,Xg,QD,e8,Zg,t8,o8,Ny,Zt,r8,Jg,a8,n8,Ni,Kg,s8,i8,Ly,Li,jy,hc,l8,Ry,ji,Wy,uc,d8,Gy,Ri,My,fc,c8,Hy,gc,Qg,e_,p8,By,Da,m8,t_,h8,u8,Vy,_c,Wi,f8,o_,g8,_8,Yy,Gi,Xy,Mi,r_,v8,Zy,Hi,Jy,Jt,b8,a_,y8,w8,n_,T8,E8,Ky,vc,$8,Qy,Bi,e2,bc,x8,t2,Sa,k8,s_,A8,q8,o2,or,Oa,i_,Vi,P8,l_,D8,r2,Ca,S8,yc,O8,C8,a2,ve,I8,Yi,F8,U8,Xi,z8,N8,Zi,L8,j8,Ji,R8,W8,n2,Ia,G8,wc,M8,H8,s2,Tc,i2,rr,Fa,d_,Ki,B8,c_,V8,l2,Ec,Y8,d2,Kt,X8,Qi,Z8,J8,el,K8,Q8,c2,$c,eS,p2,tl,m2,xc,tS,h2,Qt,oS,p_,rS,aS,m_,nS,sS,u2,ar,Ua,h_,ol,iS,u_,lS,f2,kc,dS,g2,Ye,cS,f_,pS,mS,g_,hS,uS,__,fS,gS,_2,eo,_S,v_,vS,bS,b_,yS,wS,v2,rl,b2,za,TS,al,ES,$S,y2,nr,Na,y_,nl,xS,w_,kS,w2,Ac,AS,T2,sl,E2,to,qS,T_,PS,DS,E_,SS,OS,$2,qc,CS,x2,il,k2,Pc,IS,A2,La,FS,$_,US,zS,q2,ht,x_,NS,LS,k_,jS,RS,A_,WS,GS,P2,Dc,MS,D2,ll,S2,Sc,HS,O2,Xe,BS,q_,VS,YS,P_,XS,ZS,D_,JS,KS,C2,sr,ja,S_,dl,QS,O_,e7,I2,oo,t7,C_,o7,r7,I_,a7,n7,F2,Oc,s7,U2,Cc,i7,z2,Ra,l7,F_,d7,c7,N2,cl,L2,ee,p7,U_,m7,h7,z_,u7,f7,N_,g7,_7,L_,v7,b7,j_,y7,w7,R_,T7,E7,j2,Ic,$7,R2,ir,Wa,W_,pl,x7,G_,k7,W2,Ga,G2,Ze,A7,ml,q7,P7,Fc,D7,S7,hl,O7,C7,M2,Je,M_,I7,F7,H_,U7,z7,B_,N7,L7,V_,j7,H2,Uc,R7,B2,ul,Y_,W7,G7,V2,zc,M7,Y2,fl,X2,ro,H7,X_,B7,V7,Z_,Y7,X7,Z2,gl,J2,ao,Z7,J_,J7,K7,_l,Q7,eO,K2,Ma,tO,Nc,oO,rO,Q2,Lc,aO,e0,vl,K_,nO,sO,t0,bl,o0,jc,iO,r0,yl,a0,wl,Q_,lO,dO,n0,Tl,s0,Rc,cO,i0,El,l0,Wc,pO,d0,Ha,mO,$l,hO,uO,c0,xl,ev,fO,gO,p0,no,_O,tv,vO,bO,ov,yO,wO,m0,Ba,TO,rv,EO,$O,h0,kl,u0,Gc,xO,f0,Ke,av,kO,AO,nv,qO,PO,Al,DO,sv,SO,OO,CO,ql,IO,iv,FO,UO,g0,Pl,ut,zO,lv,NO,LO,dv,jO,RO,cv,WO,GO,_0,Va,MO,pv,HO,BO,v0,Dl,b0,lr,mv,VO,YO,hv,XO,ZO,y0,so,JO,uv,KO,QO,fv,eC,tC,w0,Mc,oC,T0,be,gv,rC,aC,_v,nC,sC,Sl,iC,vv,lC,dC,cC,dr,pC,bv,mC,hC,yv,uC,fC,gC,wv,_C,E0,Hc,vC,$0,Ya,cr,bC,Tv,yC,wC,Ev,TC,EC,$C,De,xC,$v,kC,AC,xv,qC,PC,kv,DC,SC,Av,OC,CC,x0,pr,Xa,qv,Ol,IC,Pv,FC,k0,Za,UC,Cl,zC,NC,A0,Il,Dv,LC,jC,q0,Fl,Sv,RC,WC,P0,pe,Ov,Ul,GC,Cv,MC,HC,BC,zl,Bc,Iv,VC,YC,XC,mr,Nl,ZC,Fv,JC,KC,QC,Ll,eI,Uv,tI,oI,rI,jl,aI,zv,nI,sI,iI,Nv,hr,lI,Lv,dI,cI,jv,pI,mI,hI,Rv,ft,uI,Wv,fI,gI,Gv,_I,vI,Mv,bI,yI,wI,Hv,ur,TI,Bv,EI,$I,Vv,xI,kI,AI,Rl,gt,qI,Yv,PI,DI,Xv,SI,OI,Zv,CI,II,FI,_t,Vc,UI,Wl,Se,zI,Jv,NI,LI,Kv,jI,RI,Qv,WI,GI,eb,MI,HI,BI,Gl,VI,tb,YI,XI,ZI,vt,ob,JI,KI,rb,QI,eF,ab,tF,oF,nb,rF,aF,Ja,sb,nF,sF,ib,iF,lF,dF,Ka,lb,cF,pF,db,mF,hF,D0,Yc,cb,uF,S0,Xc,Qe,fF,pb,gF,_F,mb,vF,bF,yF,wF,Ml,TF,O0,fr,Qa,hb,Hl,EF,ub,$F,C0,io,xF,Bl,kF,AF,Vl,qF,PF,I0,Yl,fb,DF,SF,F0,Xl,gb,OF,CF,U0,lo,IF,_b,FF,UF,vb,zF,NF,z0,et,en,bb,LF,jF,yb,RF,WF,GF,tn,wb,MF,HF,Zl,BF,VF,YF,tt,Tb,XF,ZF,Eb,JF,KF,$b,QF,eU,xb,tU,oU,rU,Zc,aU,Jl,Oe,nU,kb,sU,iU,Ab,lU,dU,qb,cU,pU,Pb,mU,hU,uU,Kl,fU,Db,gU,_U,N0,gr,on,Sb,Ql,vU,Ob,bU,L0,ot,yU,Cb,wU,TU,ed,EU,$U,td,xU,kU,j0,rn,R0,Jc,Ib,AU,W0,co,Fb,qU,PU,Ub,DU,SU,zb,OU,G0,_r,Nb,CU,IU,od,FU,UU,M0,vr,Lb,zU,NU,jb,LU,jU,H0,rd,B0,Kc,Rb,RU,V0,an,ad,WU,Wb,GU,MU,HU,Ce,BU,Gb,VU,YU,Mb,XU,ZU,Hb,JU,KU,Bb,QU,ez,Y0,po,tz,Vb,oz,rz,nd,az,nz,X0,Qc,sz,Z0,q,iz,ep,lz,Yb,dz,tp,cz,Xb,pz,op,mz,Zb,hz,rp,uz,Jb,fz,ap,gz,Kb,_z,np,vz,Qb,bz,sp,yz,e1,wz,ip,Tz,t1,Ez,lp,$z,o1,xz,dp,kz,r1,Az,cp,qz,a1,Pz,pp,Dz,n1,Sz,mp,Oz,s1,Cz,hp,Iz,i1,Fz,up,Uz,l1,zz,fp,Nz,d1,Lz,gp,jz,c1,Rz,_p,Wz,p1,Gz,vp,Mz,m1,Hz,bp,Bz,h1,Vz,yp,Yz,u1,Xz,wp,Zz,f1,Jz,Tp,Kz,g1,Qz,J0;return h=new te({}),qr=new xr({props:{warning:!0,$$slots:{default:[_Y]},$$scope:{ctx:C}}}),Un=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`}}),zn=new te({}),Nn=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.29.0/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.29.0/en/main_classes/trainer#transformers.Trainer">Trainer</a> is optimized to work with the <a href="/docs/transformers/v4.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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 <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, 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 <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, 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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> on your model
and a scheduler given by <a href="/docs/transformers/v4.29.0/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.29.0/src/transformers/trainer.py#L230"}}),Ln=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.29.0/src/transformers/trainer.py#L702"}}),Rn=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.29.0/src/transformers/trainer.py#L2690"}}),Gn=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.29.0/src/transformers/trainer.py#L2757"}}),Mn=new D({props:{name:"compute_loss_context_manager",anchor:"transformers.Trainer.compute_loss_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer.py#L2684"}}),Hn=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.29.0/src/transformers/trainer.py#L3559"}}),Vn=new D({props:{name:"create_optimizer",anchor:"transformers.Trainer.create_optimizer",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer.py#L1062"}}),Xn=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.29.0/src/transformers/trainer.py#L1046"}}),Zn=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.29.0/src/transformers/trainer.py#L1209"}}),Jn=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 <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, 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>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.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.29.0/src/transformers/trainer.py#L2992",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>
`}}),Qn=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.29.0/src/transformers/trainer.py#L3125"}}),es=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.29.0/src/transformers/trainer.py#L3494",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),os=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 <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, 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.29.0/src/transformers/trainer.py#L948"}}),as=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.29.0/src/transformers/trainer.py#L1118"}}),ns=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 <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, 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.29.0/src/transformers/trainer.py#L998"}}),is=new D({props:{name:"get_train_dataloader",anchor:"transformers.Trainer.get_train_dataloader",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer.py#L869"}}),ds=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.29.0/src/transformers/trainer.py#L2537",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>
`}}),Lr=new xr({props:{warning:!0,$$slots:{default:[vY]},$$scope:{ctx:C}}}),cs=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.29.0/src/transformers/trainer.py#L3512"}}),ms=new D({props:{name:"is_local_process_zero",anchor:"transformers.Trainer.is_local_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer.py#L2789"}}),hs=new D({props:{name:"is_world_process_zero",anchor:"transformers.Trainer.is_world_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer.py#L2796"}}),fs=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.29.0/src/transformers/trainer.py#L2633"}}),_s=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.29.0/src/transformers/trainer_pt_utils.py#L895"}}),Gr=new xo({props:{anchor:"transformers.Trainer.log_metrics.example",$$slots:{default:[bY]},$$scope:{ctx:C}}}),ys=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.29.0/src/transformers/trainer_pt_utils.py#L869",returnDescription:`
<p>The reformatted metrics</p>
`,returnType:`
<p>metrics (<code>Dict[str, float]</code>)</p>
`}}),ws=new D({props:{name:"num_examples",anchor:"transformers.Trainer.num_examples",parameters:[{name:"dataloader",val:": DataLoader"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer.py#L1226"}}),Es=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.29.0/src/transformers/trainer.py#L713",returnDescription:`
<p>The callback removed, if found.</p>
`,returnType:`
<p><code>~transformer.TrainerCallback</code></p>
`}}),ks=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>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.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.29.0/src/transformers/trainer.py#L3063"}}),Br=new xr({props:{$$slots:{default:[yY]},$$scope:{ctx:C}}}),Ps=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.29.0/src/transformers/trainer.py#L3717"}}),Ds=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>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"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer.py#L3389",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>
`}}),Ss=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.29.0/en/main_classes/trainer#transformers.Trainer.create_model_card">create_model_card()</a>.`,name:"blocking"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer.py#L3657",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>
`}}),Os=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.29.0/src/transformers/trainer.py#L729"}}),Is=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.29.0/src/transformers/trainer_pt_utils.py#L985"}}),zs=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.29.0/src/transformers/trainer.py#L2808"}}),Ls=new D({props:{name:"save_state",anchor:"transformers.Trainer.save_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/trainer_pt_utils.py#L1023"}}),js=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.29.0/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.29.0/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.29.0/src/transformers/trainer.py#L1585"}}),Rs=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.29.0/src/transformers/trainer.py#L2709",returnDescription:`
<p>The tensor with training loss on this batch.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Ws=new te({}),Gs=new D({props:{name:"class transformers.Seq2SeqTrainer",anchor:"transformers.Seq2SeqTrainer",parameters:[{name:"model",val:": typing.Union[ForwardRef('PreTrainedModel'), torch.nn.modules.module.Module] = None"},{name:"args",val:": TrainingArguments = None"},{name:"data_collator",val:": typing.Optional[ForwardRef('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[ForwardRef('PreTrainedTokenizerBase')] = None"},{name:"model_init",val:": typing.Union[typing.Callable[[], ForwardRef('PreTrainedModel')], NoneType] = None"},{name:"compute_metrics",val:": typing.Union[typing.Callable[[ForwardRef('EvalPrediction')], typing.Dict], NoneType] = None"},{name:"callbacks",val:": typing.Optional[typing.List[ForwardRef('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.29.0/src/transformers/trainer_seq2seq.py#L41"}}),Ms=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 <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, 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.29.0/src/transformers/trainer_seq2seq.py#L112",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>
`}}),Bs=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 <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, 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.29.0/src/transformers/trainer_seq2seq.py#L161"}}),Jr=new xr({props:{$$slots:{default:[wY]},$$scope:{ctx:C}}}),Xs=new te({}),Zs=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:": float = 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:": float = 500"},{name:"save_total_limit",val:": typing.Optional[int] = None"},{name:"save_safetensors",val:": typing.Optional[bool] = False"},{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:"ddp_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[float] = 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:"xpu_backend",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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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> or <code>float</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of update steps between two logs if <code>logging_strategy=&quot;steps&quot;</code>. Should be an integer or a float in
range <code>[0,1)</code>. If smaller than 1, will be interpreted as ratio of total training steps.`,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.29.0/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> or <code>float</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of updates steps before two checkpoint saves if <code>save_strategy=&quot;steps&quot;</code>. Should be an integer or a
float in range <code>[0,1)</code>. If smaller than 1, will be interpreted as ratio of total training steps.`,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_safetensors",description:`<strong>save_safetensors</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use <a href="https://huggingface.co/docs/safetensors" rel="nofollow">safetensors</a> saving and loading for state dicts instead of
default <code>torch.load</code> and <code>torch.save</code>.`,name:"save_safetensors"},{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.ddp_backend",description:`<strong>ddp_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use for distributed training. Must be one of <code>&quot;nccl&quot;</code>, <code>&quot;mpi&quot;</code>, <code>&quot;ccl&quot;</code>, <code>&quot;gloo&quot;</code>.`,name:"ddp_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> or <code>float</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. Should be an integer or a float in range <code>[0,1)</code>. If smaller than 1,
will be interpreted as ratio of total training steps.`,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.29.0/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.29.0/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.29.0/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.29.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.29.0/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.29.0/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.29.0/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.29.0/en/internal/trainer_utils#transformers.set_seed">set_seed()</a> to ensure reproducible results in
distributed training. Important: this will negatively impact the performance, so only use it for debugging.`,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>.</p>
<p>This will use the best defaults for the <a href="https://pytorch.org/docs/stable/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.29.0/src/transformers/training_args.py#L149"}}),Qs=new D({props:{name:"get_process_log_level",anchor:"transformers.TrainingArguments.get_process_log_level",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/training_args.py#L1813"}}),ti=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.29.0/src/transformers/training_args.py#L1906"}}),oi=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.29.0/src/transformers/training_args.py#L1851"}}),ri=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.29.0/src/transformers/training_args.py#L2412"}}),ea=new xo({props:{anchor:"transformers.TrainingArguments.set_dataloader.example",$$slots:{default:[TY]},$$scope:{ctx:C}}}),ai=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.29.0/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.29.0/src/transformers/training_args.py#L2027"}}),ta=new xo({props:{anchor:"transformers.TrainingArguments.set_evaluate.example",$$slots:{default:[EY]},$$scope:{ctx:C}}}),ni=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.29.0/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.29.0/src/transformers/training_args.py#L2177"}}),oa=new xo({props:{anchor:"transformers.TrainingArguments.set_logging.example",$$slots:{default:[$Y]},$$scope:{ctx:C}}}),si=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.29.0/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.29.0/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.29.0/src/transformers/training_args.py#L2367"}}),ra=new xo({props:{anchor:"transformers.TrainingArguments.set_lr_scheduler.example",$$slots:{default:[xY]},$$scope:{ctx:C}}}),ii=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.29.0/src/transformers/training_args.py#L2316"}}),aa=new xo({props:{anchor:"transformers.TrainingArguments.set_optimizer.example",$$slots:{default:[kY]},$$scope:{ctx:C}}}),li=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.29.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.29.0/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.29.0/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.29.0/src/transformers/training_args.py#L2251"}}),na=new xr({props:{$$slots:{default:[AY]},$$scope:{ctx:C}}}),sa=new xo({props:{anchor:"transformers.TrainingArguments.set_push_to_hub.example",$$slots:{default:[qY]},$$scope:{ctx:C}}}),di=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.29.0/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.29.0/src/transformers/training_args.py#L2128"}}),ia=new xo({props:{anchor:"transformers.TrainingArguments.set_save.example",$$slots:{default:[PY]},$$scope:{ctx:C}}}),ci=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.29.0/src/transformers/training_args.py#L2088"}}),la=new xr({props:{$$slots:{default:[DY]},$$scope:{ctx:C}}}),da=new xo({props:{anchor:"transformers.TrainingArguments.set_testing.example",$$slots:{default:[SY]},$$scope:{ctx:C}}}),pi=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.29.0/src/transformers/training_args.py#L1952"}}),ca=new xr({props:{$$slots:{default:[OY]},$$scope:{ctx:C}}}),pa=new xo({props:{anchor:"transformers.TrainingArguments.set_training.example",$$slots:{default:[CY]},$$scope:{ctx:C}}}),mi=new D({props:{name:"to_dict",anchor:"transformers.TrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/training_args.py#L1915"}}),ui=new D({props:{name:"to_json_string",anchor:"transformers.TrainingArguments.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/training_args.py#L1932"}}),fi=new D({props:{name:"to_sanitized_dict",anchor:"transformers.TrainingArguments.to_sanitized_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/training_args.py#L1938"}}),gi=new te({}),_i=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:": float = 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:": float = 500"},{name:"save_total_limit",val:": typing.Optional[int] = None"},{name:"save_safetensors",val:": typing.Optional[bool] = False"},{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:"ddp_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[float] = 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:"xpu_backend",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"},{name:"generation_config",val:": typing.Union[str, pathlib.Path, transformers.generation.configuration_utils.GenerationConfig, NoneType] = 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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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.29.0/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> or <code>float</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of update steps between two logs if <code>logging_strategy=&quot;steps&quot;</code>. Should be an integer or a float in
range <code>[0,1)</code>. If smaller than 1, will be interpreted as ratio of total training steps.`,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.29.0/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> or <code>float</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of updates steps before two checkpoint saves if <code>save_strategy=&quot;steps&quot;</code>. Should be an integer or a
float in range <code>[0,1)</code>. If smaller than 1, will be interpreted as ratio of total training steps.`,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_safetensors",description:`<strong>save_safetensors</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use <a href="https://huggingface.co/docs/safetensors" rel="nofollow">safetensors</a> saving and loading for state dicts instead of
default <code>torch.load</code> and <code>torch.save</code>.`,name:"save_safetensors"},{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.ddp_backend",description:`<strong>ddp_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use for distributed training. Must be one of <code>&quot;nccl&quot;</code>, <code>&quot;mpi&quot;</code>, <code>&quot;ccl&quot;</code>, <code>&quot;gloo&quot;</code>.`,name:"ddp_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> or <code>float</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. Should be an integer or a float in range <code>[0,1)</code>. If smaller than 1,
will be interpreted as ratio of total training steps.`,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.29.0/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.29.0/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.29.0/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.29.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.29.0/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.29.0/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.29.0/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.29.0/en/internal/trainer_utils#transformers.set_seed">set_seed()</a> to ensure reproducible results in
distributed training. Important: this will negatively impact the performance, so only use it for debugging.`,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>.</p>
<p>This will use the best defaults for the <a href="https://pytorch.org/docs/stable/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"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_config",description:`<strong>generation_config</strong> (<code>str</code> or <code>Path</code> or <a href="/docs/transformers/v4.29.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a>, <em>optional</em>) &#x2014;
Allows to load a <a href="/docs/transformers/v4.29.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a> from the <code>from_pretrained</code> method. This can be either:</p>
<ul>
<li>a string, the <em>model id</em> of a pretrained model configuration hosted inside a model repo on
huggingface.co. Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced
under a user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>a path to a <em>directory</em> containing a configuration file saved using the
<a href="/docs/transformers/v4.29.0/en/main_classes/text_generation#transformers.GenerationConfig.save_pretrained">save_pretrained()</a> method, e.g., <code>./my_model_directory/</code>.</li>
<li>a <a href="/docs/transformers/v4.29.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a> object.</li>
</ul>`,name:"generation_config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/training_args_seq2seq.py#L30"}}),yi=new D({props:{name:"to_dict",anchor:"transformers.Seq2SeqTrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/training_args_seq2seq.py#L87"}}),wi=new te({}),Ti=new te({}),Ei=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(...)`}}),$i=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"}}),xi=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"}}),ki=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"}}),Ai=new te({}),Pi=new te({}),Si=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 ..."}}),Ii=new O({props:{code:"accelerate launch --num_processes 2 trainer-program.py ...",highlighted:"accelerate launch --num_processes 2 trainer-program.py ..."}}),Fi=new O({props:{code:"deepspeed --num_gpus 2 trainer-program.py ...",highlighted:"deepspeed --num_gpus 2 trainer-program.py ..."}}),Ui=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 ..."}}),zi=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 ..."}}),Li=new O({props:{code:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ..."}}),ji=new O({props:{code:"CUDA_VISIBLE_DEVICES= python trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES= python trainer-program.py ..."}}),Ri=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 ...`}}),Gi=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'}}),Hi=new O({props:{code:"export CUDA_DEVICE_ORDER=FASTEST_FIRST",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=FASTEST_FIRST'}}),Bi=new O({props:{code:"export CUDA_VISIBLE_DEVICES=1,0",highlighted:'<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=1,0'}}),Vi=new te({}),Ki=new te({}),tl=new O({props:{code:`pip install fairscale
pip install deepspeed`,highlighted:`pip install fairscale
pip install deepspeed`}}),ol=new te({}),rl=new O({props:{code:"which nvcc",highlighted:'<span class="hljs-built_in">which</span> nvcc'}}),nl=new te({}),sl=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`}}),il=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>`}}),ll=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>`}}),dl=new te({}),cl=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++`}}),pl=new te({}),Ga=new xr({props:{warning:!0,$$slots:{default:[IY]},$$scope:{ctx:C}}}),fl=new O({props:{code:"pip install fairscale",highlighted:"pip install fairscale"}}),gl=new O({props:{code:"pip install transformers[fairscale]",highlighted:"pip install transformers[fairscale]"}}),bl=new O({props:{code:"pip install fairscale --no-build-isolation .",highlighted:"pip install fairscale --no-build-isolation ."}}),yl=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`}}),Tl=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`}}),El=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`}}),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 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`}}),Dl=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`}}),Ol=new te({}),Hl=new te({}),Ql=new te({}),rn=new xr({props:{warning:!1,$$slots:{default:[FY]},$$scope:{ctx:C}}}),rd=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(),Fe=n("p"),Cn=r("The API supports distributed training on multiple GPUs/TPUs, mixed precision through "),Ee=n("a"),In=r("NVIDIA Apex"),Fn=r(" and Native AMP for PyTorch."),se=l(),oe=n("p"),md=r("The "),$e=n("a"),kr=r("Trainer"),hd=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"),Ar=n("strong"),ud=r("get_train_dataloader"),fd=r(" \u2014 Creates the training DataLoader."),gd=l(),_d=n("li"),Lm=n("strong"),YT=r("get_eval_dataloader"),XT=r(" \u2014 Creates the evaluation DataLoader."),ZT=l(),vd=n("li"),jm=n("strong"),JT=r("get_test_dataloader"),KT=r(" \u2014 Creates the test DataLoader."),QT=l(),bd=n("li"),Rm=n("strong"),eE=r("log"),tE=r(" \u2014 Logs information on the various objects watching training."),oE=l(),wt=n("li"),Wm=n("strong"),rE=r("create_optimizer_and_scheduler"),aE=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 `),Gm=n("code"),nE=r("create_optimizer"),sE=r(" and "),Mm=n("code"),iE=r("create_scheduler"),lE=r(` methods
separately.`),dE=l(),yd=n("li"),Hm=n("strong"),cE=r("create_optimizer"),pE=r(" \u2014 Sets up the optimizer if it wasn\u2019t passed at init."),mE=l(),wd=n("li"),Bm=n("strong"),hE=r("create_scheduler"),uE=r(" \u2014 Sets up the learning rate scheduler if it wasn\u2019t passed at init."),fE=l(),Td=n("li"),Vm=n("strong"),gE=r("compute_loss"),_E=r(" - Computes the loss on a batch of training inputs."),vE=l(),Ed=n("li"),Ym=n("strong"),bE=r("training_step"),yE=r(" \u2014 Performs a training step."),wE=l(),$d=n("li"),Xm=n("strong"),TE=r("prediction_step"),EE=r(" \u2014 Performs an evaluation/test step."),$E=l(),xd=n("li"),Zm=n("strong"),xE=r("evaluate"),kE=r(" \u2014 Runs an evaluation loop and returns metrics."),AE=l(),kd=n("li"),Jm=n("strong"),qE=r("predict"),PE=r(" \u2014 Returns predictions (with metrics if labels are available) on a test set."),z1=l(),f(qr.$$.fragment),N1=l(),Pr=n("p"),DE=r("Here is an example of how to customize "),Ad=n("a"),SE=r("Trainer"),OE=r(" to use a weighted loss (useful when you have an unbalanced training set):"),L1=l(),f(Un.$$.fragment),j1=l(),Tt=n("p"),CE=r("Another way to customize the training loop behavior for the PyTorch "),qd=n("a"),IE=r("Trainer"),FE=r(" is to use "),Pd=n("a"),UE=r("callbacks"),zE=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)."),R1=l(),qo=n("h2"),Dr=n("a"),Km=n("span"),f(zn.$$.fragment),NE=l(),Qm=n("span"),LE=r("Trainer"),W1=l(),$=n("div"),f(Nn.$$.fragment),jE=l(),eh=n("p"),RE=r("Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for \u{1F917} Transformers."),WE=l(),th=n("p"),GE=r("Important attributes:"),ME=l(),xe=n("ul"),Sr=n("li"),oh=n("strong"),HE=r("model"),BE=r(" \u2014 Always points to the core model. If using a transformers model, it will be a "),Dd=n("a"),VE=r("PreTrainedModel"),YE=r(`
subclass.`),XE=l(),ie=n("li"),rh=n("strong"),ZE=r("model_wrapped"),JE=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 `),ah=n("code"),KE=r("DeepSpeed"),QE=r(`,
the inner model is wrapped in `),nh=n("code"),e4=r("DeepSpeed"),t4=r(" and then again in "),sh=n("code"),o4=r("torch.nn.DistributedDataParallel"),r4=r(`. If the inner
model hasn\u2019t been wrapped, then `),ih=n("code"),a4=r("self.model_wrapped"),n4=r(" is the same as "),lh=n("code"),s4=r("self.model"),i4=r("."),l4=l(),Sd=n("li"),dh=n("strong"),d4=r("is_model_parallel"),c4=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).`),p4=l(),Ue=n("li"),ch=n("strong"),m4=r("place_model_on_device"),h4=r(` \u2014 Whether or not to automatically place the model on the device - it will be set
to `),ph=n("code"),u4=r("False"),f4=r(` if model parallel or deepspeed is used, or if the default
`),mh=n("code"),g4=r("TrainingArguments.place_model_on_device"),_4=r(" is overridden to return "),hh=n("code"),v4=r("False"),b4=r(" ."),y4=l(),ze=n("li"),uh=n("strong"),w4=r("is_in_train"),T4=r(" \u2014 Whether or not a model is currently running "),fh=n("code"),E4=r("train"),$4=r(" (e.g. when "),gh=n("code"),x4=r("evaluate"),k4=r(` is called while
in `),_h=n("code"),A4=r("train"),q4=r(")"),P4=l(),Or=n("div"),f(Ln.$$.fragment),D4=l(),jn=n("p"),S4=r("Add a callback to the current list of "),vh=n("code"),O4=r("~transformer.TrainerCallback"),C4=r("."),I4=l(),Cr=n("div"),f(Rn.$$.fragment),F4=l(),Wn=n("p"),U4=r("A helper wrapper that creates an appropriate context manager for "),bh=n("code"),z4=r("autocast"),N4=r(` while feeding it the desired
arguments, depending on the situation.`),L4=l(),Et=n("div"),f(Gn.$$.fragment),j4=l(),yh=n("p"),R4=r("How the loss is computed by Trainer. By default, all models return the loss in the first element."),W4=l(),wh=n("p"),G4=r("Subclass and override for custom behavior."),M4=l(),Ir=n("div"),f(Mn.$$.fragment),H4=l(),Th=n("p"),B4=r("A helper wrapper to group together context managers."),V4=l(),Fr=n("div"),f(Hn.$$.fragment),Y4=l(),Bn=n("p"),X4=r("Creates a draft of a model card using the information available to the "),Eh=n("code"),Z4=r("Trainer"),J4=r("."),K4=l(),$t=n("div"),f(Vn.$$.fragment),Q4=l(),$h=n("p"),e$=r("Setup the optimizer."),t$=l(),Yn=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 `),xh=n("code"),r$=r("optimizers"),a$=r(", or subclass and override this method in a subclass."),n$=l(),xt=n("div"),f(Xn.$$.fragment),s$=l(),kh=n("p"),i$=r("Setup the optimizer and the learning rate scheduler."),l$=l(),lt=n("p"),d$=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 `),Ah=n("code"),c$=r("optimizers"),p$=r(", or subclass and override this method (or "),qh=n("code"),m$=r("create_optimizer"),h$=r(` and/or
`),Ph=n("code"),u$=r("create_scheduler"),f$=r(") in a subclass."),g$=l(),Ur=n("div"),f(Zn.$$.fragment),_$=l(),Dh=n("p"),v$=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.`),b$=l(),Ne=n("div"),f(Jn.$$.fragment),y$=l(),Sh=n("p"),w$=r("Run evaluation and returns metrics."),T$=l(),Kn=n("p"),E$=r(`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Oh=n("code"),$$=r("compute_metrics"),x$=r(" argument)."),k$=l(),Ch=n("p"),A$=r("You can also subclass and override this method to inject custom behavior."),q$=l(),kt=n("div"),f(Qn.$$.fragment),P$=l(),Po=n("p"),D$=r("Prediction/evaluation loop, shared by "),Ih=n("code"),S$=r("Trainer.evaluate()"),O$=r(" and "),Fh=n("code"),C$=r("Trainer.predict()"),I$=r("."),F$=l(),Uh=n("p"),U$=r("Works both with or without labels."),z$=l(),zr=n("div"),f(es.$$.fragment),N$=l(),ts=n("p"),L$=r("For models that inherit from "),Od=n("a"),j$=r("PreTrainedModel"),R$=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.`),W$=l(),At=n("div"),f(os.$$.fragment),G$=l(),rs=n("p"),M$=r("Returns the evaluation "),zh=n("code"),H$=r("~torch.utils.data.DataLoader"),B$=r("."),V$=l(),Nh=n("p"),Y$=r("Subclass and override this method if you want to inject some custom behavior."),X$=l(),Nr=n("div"),f(as.$$.fragment),Z$=l(),Lh=n("p"),J$=r("Returns the optimizer class and optimizer parameters based on the training arguments."),K$=l(),qt=n("div"),f(ns.$$.fragment),Q$=l(),ss=n("p"),e3=r("Returns the test "),jh=n("code"),t3=r("~torch.utils.data.DataLoader"),o3=r("."),r3=l(),Rh=n("p"),a3=r("Subclass and override this method if you want to inject some custom behavior."),n3=l(),Le=n("div"),f(is.$$.fragment),s3=l(),ls=n("p"),i3=r("Returns the training "),Wh=n("code"),l3=r("~torch.utils.data.DataLoader"),d3=r("."),c3=l(),Do=n("p"),p3=r("Will use no sampler if "),Gh=n("code"),m3=r("train_dataset"),h3=r(" does not implement "),Mh=n("code"),u3=r("__len__"),f3=r(`, a random sampler (adapted to distributed
training if necessary) otherwise.`),g3=l(),Hh=n("p"),_3=r("Subclass and override this method if you want to inject some custom behavior."),v3=l(),Pt=n("div"),f(ds.$$.fragment),b3=l(),ke=n("p"),y3=r("Launch an hyperparameter search using "),Bh=n("code"),w3=r("optuna"),T3=r(" or "),Vh=n("code"),E3=r("Ray Tune"),$3=r(" or "),Yh=n("code"),x3=r("SigOpt"),k3=r(`. The optimized quantity is determined
by `),Xh=n("code"),A3=r("compute_objective"),q3=r(`, which defaults to a function returning the evaluation loss when no metric is provided,
the sum of all metrics otherwise.`),P3=l(),f(Lr.$$.fragment),D3=l(),jr=n("div"),f(cs.$$.fragment),S3=l(),ps=n("p"),O3=r("Initializes a git repo in "),Zh=n("code"),C3=r("self.args.hub_model_id"),I3=r("."),F3=l(),Rr=n("div"),f(ms.$$.fragment),U3=l(),Jh=n("p"),z3=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.`),N3=l(),Wr=n("div"),f(hs.$$.fragment),L3=l(),us=n("p"),j3=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 `),Kh=n("code"),R3=r("True"),W3=r(" for one process)."),G3=l(),Dt=n("div"),f(fs.$$.fragment),M3=l(),gs=n("p"),H3=r("Log "),Qh=n("code"),B3=r("logs"),V3=r(" on the various objects watching training."),Y3=l(),eu=n("p"),X3=r("Subclass and override this method to inject custom behavior."),Z3=l(),F=n("div"),f(_s.$$.fragment),J3=l(),tu=n("p"),K3=r("Log metrics in a specially formatted way"),Q3=l(),ou=n("p"),ex=r("Under distributed environment this is done only for a process with rank 0."),tx=l(),ru=n("p"),ox=r("Notes on memory reports:"),rx=l(),So=n("p"),ax=r("In order to get memory usage report you need to install "),au=n("code"),nx=r("psutil"),sx=r(". You can do that with "),nu=n("code"),ix=r("pip install psutil"),lx=r("."),dx=l(),f(Gr.$$.fragment),cx=l(),su=n("p"),iu=n("strong"),px=r("Understanding the reports:"),mx=l(),dt=n("ul"),Ae=n("li"),hx=r("the first segment, e.g., "),lu=n("code"),ux=r("train__"),fx=r(", tells you which stage the metrics are for. Reports starting with "),du=n("code"),gx=r("init_"),_x=r(`
will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the
`),cu=n("code"),vx=r("__init__"),bx=r(" will be reported along with the "),pu=n("code"),yx=r("eval_"),wx=r(" metrics."),Tx=l(),Oo=n("li"),Ex=r("the third segment, is either "),mu=n("code"),$x=r("cpu"),xx=r(" or "),hu=n("code"),kx=r("gpu"),Ax=r(`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),qx=l(),Cd=n("li"),uu=n("code"),Px=r("*_alloc_delta"),Dx=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.`),Sx=l(),St=n("li"),fu=n("code"),Ox=r("*_peaked_delta"),Cx=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 `),gu=n("code"),Ix=r("alloc_delta"),Fx=r(` +
`),_u=n("code"),Ux=r("peaked_delta"),zx=r(" and you know how much memory was needed to complete that stage."),Nx=l(),vu=n("p"),Lx=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.`),jx=l(),bu=n("p"),Rx=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.`),Wx=l(),vs=n("p"),Gx=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 `),yu=n("code"),Mx=r("tracemalloc"),Hx=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.`),Bx=l(),ct=n("p"),Vx=r("The GPU allocated and peak memory reporting is done with "),wu=n("code"),Yx=r("torch.cuda.memory_allocated()"),Xx=r(` and
`),Tu=n("code"),Zx=r("torch.cuda.max_memory_allocated()"),Jx=r(`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),Eu=n("code"),Kx=r("torch.cuda"),Qx=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.`),ek=l(),he=n("p"),tk=r("Note that this tracker doesn\u2019t account for memory allocations outside of "),Id=n("a"),ok=r("Trainer"),rk=r("\u2019s "),$u=n("code"),ak=r("__init__"),nk=r(", "),xu=n("code"),sk=r("train"),ik=r(`,
`),ku=n("code"),lk=r("evaluate"),dk=r(" and "),Au=n("code"),ck=r("predict"),pk=r(" calls."),mk=l(),V=n("p"),hk=r("Because "),qu=n("code"),uk=r("evaluation"),fk=r(" calls may happen during "),Pu=n("code"),gk=r("train"),_k=r(`, we can\u2019t handle nested invocations because
`),Du=n("code"),vk=r("torch.cuda.max_memory_allocated"),bk=r(" is a single counter, so if it gets reset by a nested eval call, "),Su=n("code"),yk=r("train"),wk=r(`\u2019s tracker
will report incorrect info. If this `),bs=n("a"),Tk=r("pytorch issue"),Ek=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
`),Ou=n("code"),$k=r("train"),xk=r(", "),Cu=n("code"),kk=r("evaluate"),Ak=r(" and "),Iu=n("code"),qk=r("predict"),Pk=r(" methods. Which means that if "),Fu=n("code"),Dk=r("eval"),Sk=r(" is called during "),Uu=n("code"),Ok=r("train"),Ck=r(`, it\u2019s the latter
that will account for its memory usage and that of the former.`),Ik=l(),qe=n("p"),Fk=r("This also means that if any other tool that is used along the "),Fd=n("a"),Uk=r("Trainer"),zk=r(` calls
`),zu=n("code"),Nk=r("torch.cuda.reset_peak_memory_stats"),Lk=r(", the gpu peak memory stats could be invalid. And the "),Ud=n("a"),jk=r("Trainer"),Rk=r(` will disrupt
the normal behavior of any such tools that rely on calling `),Nu=n("code"),Wk=r("torch.cuda.reset_peak_memory_stats"),Gk=r(" themselves."),Mk=l(),Lu=n("p"),Hk=r("For best performance you may want to consider turning the memory profiling off for production runs."),Bk=l(),Mr=n("div"),f(ys.$$.fragment),Vk=l(),ju=n("p"),Yk=r("Reformat Trainer metrics values to a human-readable format"),Xk=l(),Hr=n("div"),f(ws.$$.fragment),Zk=l(),Ts=n("p"),Jk=r("Helper to get number of samples in a "),Ru=n("code"),Kk=r("~torch.utils.data.DataLoader"),Qk=r(` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),eA=l(),Ot=n("div"),f(Es.$$.fragment),tA=l(),$s=n("p"),oA=r("Remove a callback from the current list of "),Wu=n("code"),rA=r("~transformer.TrainerCallback"),aA=r(" and returns it."),nA=l(),xs=n("p"),sA=r("If the callback is not found, returns "),Gu=n("code"),iA=r("None"),lA=r(" (and no error is raised)."),dA=l(),le=n("div"),f(ks.$$.fragment),cA=l(),Mu=n("p"),pA=r("Run prediction and returns predictions and potential metrics."),mA=l(),As=n("p"),hA=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 `),Hu=n("code"),uA=r("evaluate()"),fA=r("."),gA=l(),f(Br.$$.fragment),_A=l(),qs=n("p"),vA=r("Returns: "),Bu=n("em"),bA=r("NamedTuple"),yA=r(" A namedtuple with the following keys:"),wA=l(),Co=n("ul"),Io=n("li"),TA=r("predictions ("),Vu=n("code"),EA=r("np.ndarray"),$A=r("): The predictions on "),Yu=n("code"),xA=r("test_dataset"),kA=r("."),AA=l(),Fo=n("li"),qA=r("label_ids ("),Xu=n("code"),PA=r("np.ndarray"),DA=r(", "),Zu=n("em"),SA=r("optional"),OA=r("): The labels (if the dataset contained some)."),CA=l(),Uo=n("li"),IA=r("metrics ("),Ju=n("code"),FA=r("Dict[str, float]"),UA=r(", "),Ku=n("em"),zA=r("optional"),NA=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),LA=l(),Ct=n("div"),f(Ps.$$.fragment),jA=l(),zo=n("p"),RA=r("Prediction/evaluation loop, shared by "),Qu=n("code"),WA=r("Trainer.evaluate()"),GA=r(" and "),ef=n("code"),MA=r("Trainer.predict()"),HA=r("."),BA=l(),tf=n("p"),VA=r("Works both with or without labels."),YA=l(),It=n("div"),f(Ds.$$.fragment),XA=l(),No=n("p"),ZA=r("Perform an evaluation step on "),of=n("code"),JA=r("model"),KA=r(" using "),rf=n("code"),QA=r("inputs"),e9=r("."),t9=l(),af=n("p"),o9=r("Subclass and override to inject custom behavior."),r9=l(),Vr=n("div"),f(Ss.$$.fragment),a9=l(),pt=n("p"),n9=r("Upload "),nf=n("em"),s9=r("self.model"),i9=r(" and "),sf=n("em"),l9=r("self.tokenizer"),d9=r(" to the \u{1F917} model hub on the repo "),lf=n("em"),c9=r("self.args.hub_model_id"),p9=r("."),m9=l(),Yr=n("div"),f(Os.$$.fragment),h9=l(),Cs=n("p"),u9=r("Remove a callback from the current list of "),df=n("code"),f9=r("~transformer.TrainerCallback"),g9=r("."),_9=l(),je=n("div"),f(Is.$$.fragment),v9=l(),Fs=n("p"),b9=r("Save metrics into a json file for that split, e.g. "),cf=n("code"),y9=r("train_results.json"),w9=r("."),T9=l(),pf=n("p"),E9=r("Under distributed environment this is done only for a process with rank 0."),$9=l(),Us=n("p"),x9=r("To understand the metrics please read the docstring of "),zd=n("a"),k9=r("log_metrics()"),A9=r(`. The only difference is that raw
unformatted numbers are saved in the current method.`),q9=l(),Ft=n("div"),f(zs.$$.fragment),P9=l(),Ns=n("p"),D9=r("Will save the model, so you can reload it using "),mf=n("code"),S9=r("from_pretrained()"),O9=r("."),C9=l(),hf=n("p"),I9=r("Will only save from the main process."),F9=l(),Ut=n("div"),f(Ls.$$.fragment),U9=l(),uf=n("p"),z9=r("Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),N9=l(),ff=n("p"),L9=r("Under distributed environment this is done only for a process with rank 0."),j9=l(),Xr=n("div"),f(js.$$.fragment),R9=l(),gf=n("p"),W9=r("Main training entry point."),G9=l(),zt=n("div"),f(Rs.$$.fragment),M9=l(),_f=n("p"),H9=r("Perform a training step on a batch of inputs."),B9=l(),vf=n("p"),V9=r("Subclass and override to inject custom behavior."),G1=l(),Lo=n("h2"),Zr=n("a"),bf=n("span"),f(Ws.$$.fragment),Y9=l(),yf=n("span"),X9=r("Seq2SeqTrainer"),M1=l(),mt=n("div"),f(Gs.$$.fragment),Z9=l(),Re=n("div"),f(Ms.$$.fragment),J9=l(),wf=n("p"),K9=r("Run evaluation and returns metrics."),Q9=l(),Hs=n("p"),e5=r(`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Tf=n("code"),t5=r("compute_metrics"),o5=r(" argument)."),r5=l(),Ef=n("p"),a5=r("You can also subclass and override this method to inject custom behavior."),n5=l(),de=n("div"),f(Bs.$$.fragment),s5=l(),$f=n("p"),i5=r("Run prediction and returns predictions and potential metrics."),l5=l(),Vs=n("p"),d5=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 `),xf=n("code"),c5=r("evaluate()"),p5=r("."),m5=l(),f(Jr.$$.fragment),h5=l(),Ys=n("p"),u5=r("Returns: "),kf=n("em"),f5=r("NamedTuple"),g5=r(" A namedtuple with the following keys:"),_5=l(),jo=n("ul"),Ro=n("li"),v5=r("predictions ("),Af=n("code"),b5=r("np.ndarray"),y5=r("): The predictions on "),qf=n("code"),w5=r("test_dataset"),T5=r("."),E5=l(),Wo=n("li"),$5=r("label_ids ("),Pf=n("code"),x5=r("np.ndarray"),k5=r(", "),Df=n("em"),A5=r("optional"),q5=r("): The labels (if the dataset contained some)."),P5=l(),Go=n("li"),D5=r("metrics ("),Sf=n("code"),S5=r("Dict[str, float]"),O5=r(", "),Of=n("em"),C5=r("optional"),I5=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),H1=l(),Mo=n("h2"),Kr=n("a"),Cf=n("span"),f(Xs.$$.fragment),F5=l(),If=n("span"),U5=r("TrainingArguments"),B1=l(),S=n("div"),f(Zs.$$.fragment),z5=l(),Js=n("p"),N5=r("TrainingArguments is the subset of the arguments we use in our example scripts "),Ff=n("strong"),L5=r(`which relate to the training loop
itself`),j5=r("."),R5=l(),Ho=n("p"),W5=r("Using "),Nd=n("a"),G5=r("HfArgumentParser"),M5=r(` we can turn this class into
`),Ks=n("a"),H5=r("argparse"),B5=r(` arguments that can be specified on the
command line.`),V5=l(),fe=n("div"),f(Qs.$$.fragment),Y5=l(),Uf=n("p"),X5=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.`),Z5=l(),Bo=n("p"),J5=r("For the main process the log level defaults to the logging level set ("),zf=n("code"),K5=r("logging.WARNING"),Q5=r(` if you didn\u2019t do
anything) unless overridden by `),Nf=n("code"),eq=r("log_level"),tq=r(" argument."),oq=l(),Vo=n("p"),rq=r("For the replica processes the log level defaults to "),Lf=n("code"),aq=r("logging.WARNING"),nq=r(" unless overridden by "),jf=n("code"),sq=r("log_level_replica"),iq=r(`
argument.`),lq=l(),ei=n("p"),dq=r("The choice between the main and replica process settings is made according to the return value of "),Rf=n("code"),cq=r("should_log"),pq=r("."),mq=l(),Qr=n("div"),f(ti.$$.fragment),hq=l(),Wf=n("p"),uq=r("Get number of steps used for a linear warmup."),fq=l(),Nt=n("div"),f(oi.$$.fragment),gq=l(),Gf=n("p"),_q=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.`),vq=l(),Yo=n("p"),bq=r("One such use is for "),Mf=n("code"),yq=r("datasets"),wq=r("\u2019s "),Hf=n("code"),Tq=r("map"),Eq=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(ri.$$.fragment),xq=l(),Bf=n("p"),kq=r("A method that regroups all arguments linked to the dataloaders creation."),Aq=l(),f(ea.$$.fragment),qq=l(),jt=n("div"),f(ai.$$.fragment),Pq=l(),Vf=n("p"),Dq=r("A method that regroups all arguments linked to the evaluation."),Sq=l(),f(ta.$$.fragment),Oq=l(),Rt=n("div"),f(ni.$$.fragment),Cq=l(),Yf=n("p"),Iq=r("A method that regroups all arguments linked to the evaluation."),Fq=l(),f(oa.$$.fragment),Uq=l(),Wt=n("div"),f(si.$$.fragment),zq=l(),Xf=n("p"),Nq=r("A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters."),Lq=l(),f(ra.$$.fragment),jq=l(),Gt=n("div"),f(ii.$$.fragment),Rq=l(),Zf=n("p"),Wq=r("A method that regroups all arguments linked to the optimizer and its hyperparameters."),Gq=l(),f(aa.$$.fragment),Mq=l(),We=n("div"),f(li.$$.fragment),Hq=l(),Jf=n("p"),Bq=r("A method that regroups all arguments linked to synchronizing checkpoints with the Hub."),Vq=l(),f(na.$$.fragment),Yq=l(),f(sa.$$.fragment),Xq=l(),Mt=n("div"),f(di.$$.fragment),Zq=l(),Kf=n("p"),Jq=r("A method that regroups all arguments linked to the evaluation."),Kq=l(),f(ia.$$.fragment),Qq=l(),Ge=n("div"),f(ci.$$.fragment),eP=l(),Qf=n("p"),tP=r("A method that regroups all basic arguments linked to testing on a held-out dataset."),oP=l(),f(la.$$.fragment),rP=l(),f(da.$$.fragment),aP=l(),Me=n("div"),f(pi.$$.fragment),nP=l(),eg=n("p"),sP=r("A method that regroups all basic arguments linked to the training."),iP=l(),f(ca.$$.fragment),lP=l(),f(pa.$$.fragment),dP=l(),ma=n("div"),f(mi.$$.fragment),cP=l(),hi=n("p"),pP=r("Serializes this instance while replace "),tg=n("code"),mP=r("Enum"),hP=r(` by their values (for JSON serialization support). It obfuscates
the token values by removing their value.`),uP=l(),ha=n("div"),f(ui.$$.fragment),fP=l(),og=n("p"),gP=r("Serializes this instance to a JSON string."),_P=l(),ua=n("div"),f(fi.$$.fragment),vP=l(),rg=n("p"),bP=r("Sanitized serialization to use with TensorBoard\u2019s hparams"),V1=l(),Xo=n("h2"),fa=n("a"),ag=n("span"),f(gi.$$.fragment),yP=l(),ng=n("span"),wP=r("Seq2SeqTrainingArguments"),Y1=l(),Pe=n("div"),f(_i.$$.fragment),TP=l(),vi=n("p"),EP=r("TrainingArguments is the subset of the arguments we use in our example scripts "),sg=n("strong"),$P=r(`which relate to the training loop
itself`),xP=r("."),kP=l(),Zo=n("p"),AP=r("Using "),Ld=n("a"),qP=r("HfArgumentParser"),PP=r(` we can turn this class into
`),bi=n("a"),DP=r("argparse"),SP=r(` arguments that can be specified on the
command line.`),OP=l(),ga=n("div"),f(yi.$$.fragment),CP=l(),Jo=n("p"),IP=r("Serializes this instance while replace "),ig=n("code"),FP=r("Enum"),UP=r(" by their values and "),lg=n("code"),zP=r("GenerationConfig"),NP=r(` by dictionaries (for JSON
serialization support). It obfuscates the token values by removing their value.`),X1=l(),Ko=n("h2"),_a=n("a"),dg=n("span"),f(wi.$$.fragment),LP=l(),cg=n("span"),jP=r("Checkpoints"),Z1=l(),ge=n("p"),RP=r("By default, "),jd=n("a"),WP=r("Trainer"),GP=r(" will save all checkpoints in the "),pg=n("code"),MP=r("output_dir"),HP=r(` you set in the
`),Rd=n("a"),BP=r("TrainingArguments"),VP=r(" you are using. Those will go in subfolder named "),mg=n("code"),YP=r("checkpoint-xxx"),XP=r(` with xxx
being the step at which the training was at.`),J1=l(),va=n("p"),ZP=r("Resuming training from a checkpoint can be done when calling "),Wd=n("a"),JP=r("Trainer.train()"),KP=r(" with either:"),K1=l(),ba=n("ul"),Gd=n("li"),hg=n("code"),QP=r("resume_from_checkpoint=True"),e6=r(" which will resume training from the latest checkpoint"),t6=l(),Md=n("li"),ug=n("code"),o6=r("resume_from_checkpoint=checkpoint_dir"),r6=r(` which will resume training from the specific checkpoint in the directory
passed.`),Q1=l(),He=n("p"),a6=r("In addition, you can easily save your checkpoints on the Model Hub when using "),fg=n("code"),n6=r("push_to_hub=True"),s6=r(`. By default, all
the models saved in intermediate checkpoints are saved in different commits, but not the optimizer state. You can adapt
the `),gg=n("code"),i6=r("hub-strategy"),l6=r(" value of your "),Hd=n("a"),d6=r("TrainingArguments"),c6=r(" to either:"),ey=l(),ya=n("ul"),wa=n("li"),_g=n("code"),p6=r('"checkpoint"'),m6=r(`: the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to
resume training easily with `),vg=n("code"),h6=r('trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")'),u6=r("."),f6=l(),Bd=n("li"),bg=n("code"),g6=r('"all_checkpoints"'),_6=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)`),ty=l(),Qo=n("h2"),Ta=n("a"),yg=n("span"),f(Ti.$$.fragment),v6=l(),wg=n("span"),b6=r("Logging"),oy=l(),Be=n("p"),y6=r("By default "),Vd=n("a"),w6=r("Trainer"),T6=r(" will use "),Tg=n("code"),E6=r("logging.INFO"),$6=r(" for the main process and "),Eg=n("code"),x6=r("logging.WARNING"),k6=r(" for the replicas if any."),ry=l(),Ht=n("p"),A6=r("These defaults can be overridden to use any of the 5 "),$g=n("code"),q6=r("logging"),P6=r(" levels with "),Yd=n("a"),D6=r("TrainingArguments"),S6=r(`\u2019s
arguments:`),ay=l(),Ea=n("ul"),Xd=n("li"),xg=n("code"),O6=r("log_level"),C6=r(" - for the main process"),I6=l(),Zd=n("li"),kg=n("code"),F6=r("log_level_replica"),U6=r(" - for the replicas"),ny=l(),Ve=n("p"),z6=r("Further, if "),Jd=n("a"),N6=r("TrainingArguments"),L6=r("\u2019s "),Ag=n("code"),j6=r("log_on_each_node"),R6=r(" is set to "),qg=n("code"),W6=r("False"),G6=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.`),sy=l(),ce=n("p"),M6=r("Note that "),Kd=n("a"),H6=r("Trainer"),B6=r(" is going to set "),Pg=n("code"),V6=r("transformers"),Y6=r(`\u2019s log level separately for each node in its
`),Dg=n("code"),X6=r("Trainer.__init__()"),Z6=r(`. So you may want to set this sooner (see the next example) if you tap into other
`),Sg=n("code"),J6=r("transformers"),K6=r(" functionality before creating the "),Qd=n("a"),Q6=r("Trainer"),eD=r(" object."),iy=l(),ec=n("p"),tD=r("Here is an example of how this can be used in an application:"),ly=l(),f(Ei.$$.fragment),dy=l(),tc=n("p"),oD=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:`),cy=l(),f($i.$$.fragment),py=l(),oc=n("p"),rD=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:`),my=l(),f(xi.$$.fragment),hy=l(),rc=n("p"),aD=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.`),uy=l(),ac=n("p"),nD=r("If you need your application to be as quiet as possible you could do:"),fy=l(),f(ki.$$.fragment),gy=l(),$a=n("p"),sD=r("(add "),Og=n("code"),iD=r("--log_on_each_node 0"),lD=r(" if on multi-node environment)"),_y=l(),er=n("h2"),xa=n("a"),Cg=n("span"),f(Ai.$$.fragment),dD=l(),Ig=n("span"),cD=r("Randomness"),vy=l(),_e=n("p"),pD=r("When resuming from a checkpoint generated by "),nc=n("a"),mD=r("Trainer"),hD=r(` all efforts are made to restore the
`),Fg=n("em"),uD=r("python"),fD=r(", "),Ug=n("em"),gD=r("numpy"),_D=r(" and "),zg=n("em"),vD=r("pytorch"),bD=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.`),by=l(),Bt=n("p"),yD=r(`However, due to various default non-deterministic pytorch settings this might not fully work. If you want full
determinism please refer to `),qi=n("a"),wD=r("Controlling sources of randomness"),TD=r(`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),Ng=n("code"),ED=r("torch.backends.cudnn.deterministic"),$D=r(`) may slow things down, therefore this
can\u2019t be done by default, but you can enable those yourself if needed.`),yy=l(),tr=n("h2"),ka=n("a"),Lg=n("span"),f(Pi.$$.fragment),xD=l(),jg=n("span"),kD=r("Specific GPUs Selection"),wy=l(),sc=n("p"),AD=r("Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),Ty=l(),Aa=n("p"),qD=r("When using "),Di=n("a"),Rg=n("code"),PD=r("DistributedDataParallel"),DD=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:"),Ey=l(),f(Si.$$.fragment),$y=l(),Vt=n("p"),SD=r("if you have either "),Oi=n("a"),Wg=n("code"),OD=r("accelerate"),CD=r(" or "),Ci=n("a"),Gg=n("code"),ID=r("deepspeed"),FD=r(" installed you can also accomplish the same by using one of:"),xy=l(),f(Ii.$$.fragment),ky=l(),f(Fi.$$.fragment),Ay=l(),qa=n("p"),UD=r("You don\u2019t need to use the Accelerate or "),ic=n("a"),zD=r("the Deepspeed integration"),ND=r(" features to use these launchers."),qy=l(),lc=n("p"),LD=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."),Py=l(),dc=n("p"),jD=r("The following environment variables help you control which GPUs to use and their order."),Dy=l(),cc=n("p"),Mg=n("strong"),Hg=n("code"),RD=r("CUDA_VISIBLE_DEVICES"),Sy=l(),Pa=n("p"),WD=r("If you have multiple GPUs and you\u2019d like to use only 1 or a few of those GPUs, set the environment variable "),Bg=n("code"),GD=r("CUDA_VISIBLE_DEVICES"),MD=r(" to a list of the GPUs to be used."),Oy=l(),pc=n("p"),HD=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:"),Cy=l(),f(Ui.$$.fragment),Iy=l(),Yt=n("p"),BD=r("So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),Vg=n("code"),VD=r("cuda:0"),YD=r(" and "),Yg=n("code"),XD=r("cuda:1"),ZD=r(" correspondingly."),Fy=l(),mc=n("p"),JD=r("You can even change their order:"),Uy=l(),f(zi.$$.fragment),zy=l(),Xt=n("p"),KD=r("Here your physical GPUs 0 and 2 are mapped to "),Xg=n("code"),QD=r("cuda:1"),e8=r(" and "),Zg=n("code"),t8=r("cuda:0"),o8=r(" correspondingly."),Ny=l(),Zt=n("p"),r8=r("The above examples were all for "),Jg=n("code"),a8=r("DistributedDataParallel"),n8=r(" use pattern, but the same method works for "),Ni=n("a"),Kg=n("code"),s8=r("DataParallel"),i8=r(" as well:"),Ly=l(),f(Li.$$.fragment),jy=l(),hc=n("p"),l8=r("To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),Ry=l(),f(ji.$$.fragment),Wy=l(),uc=n("p"),d8=r("As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),Gy=l(),f(Ri.$$.fragment),My=l(),fc=n("p"),c8=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."),Hy=l(),gc=n("p"),Qg=n("strong"),e_=n("code"),p8=r("CUDA_DEVICE_ORDER"),By=l(),Da=n("p"),m8=r("There is an additional environment variable "),t_=n("code"),h8=r("CUDA_DEVICE_ORDER"),u8=r(" that controls how the physical devices are ordered. The two choices are:"),Vy=l(),_c=n("ol"),Wi=n("li"),f8=r("ordered by PCIe bus IDs (matches "),o_=n("code"),g8=r("nvidia-smi"),_8=r("\u2019s order) - this is the default."),Yy=l(),f(Gi.$$.fragment),Xy=l(),Mi=n("ol"),r_=n("li"),v8=r("ordered by GPU compute capabilities"),Zy=l(),f(Hi.$$.fragment),Jy=l(),Jt=n("p"),b8=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 "),a_=n("code"),y8=r("CUDA_DEVICE_ORDER=FASTEST_FIRST"),w8=r(" will always put the newer faster card first. It\u2019ll be somewhat confusing though since "),n_=n("code"),T8=r("nvidia-smi"),E8=r(" will still report them in the PCIe order."),Ky=l(),vc=n("p"),$8=r("The other solution to swapping the order is to use:"),Qy=l(),f(Bi.$$.fragment),e2=l(),bc=n("p"),x8=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."),t2=l(),Sa=n("p"),k8=r("Also if you do set this environment variable it\u2019s the best to set it in your "),s_=n("code"),A8=r("~/.bashrc"),q8=r(" file or some other startup config file and forget about it."),o2=l(),or=n("h2"),Oa=n("a"),i_=n("span"),f(Vi.$$.fragment),P8=l(),l_=n("span"),D8=r("Trainer Integrations"),r2=l(),Ca=n("p"),S8=r("The "),yc=n("a"),O8=r("Trainer"),C8=r(` has been extended to support libraries that may dramatically improve your training
time and fit much bigger models.`),a2=l(),ve=n("p"),I8=r("Currently it supports third party solutions, "),Yi=n("a"),F8=r("DeepSpeed"),U8=r(", "),Xi=n("a"),z8=r("PyTorch FSDP"),N8=r(" and "),Zi=n("a"),L8=r("FairScale"),j8=r(", which implement parts of the paper "),Ji=n("a"),R8=r(`ZeRO: Memory Optimizations
Toward Training Trillion Parameter Models, by Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, Yuxiong He`),W8=r("."),n2=l(),Ia=n("p"),G8=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 "),wc=n("a"),M8=r("PyTorch FSDP integration"),H8=r(")"),s2=l(),Tc=n("a"),i2=l(),rr=n("h3"),Fa=n("a"),d_=n("span"),f(Ki.$$.fragment),B8=l(),c_=n("span"),V8=r("CUDA Extension Installation Notes"),l2=l(),Ec=n("p"),Y8=r("As of this writing, both FairScale and Deepspeed require compilation of CUDA C++ code, before they can be used."),d2=l(),Kt=n("p"),X8=r("While all installation issues should be dealt with through the corresponding GitHub Issues of "),Qi=n("a"),Z8=r("FairScale"),J8=r(" and "),el=n("a"),K8=r("Deepspeed"),Q8=r(`, there are a few common issues that one may encounter while building
any PyTorch extension that needs to build CUDA extensions.`),c2=l(),$c=n("p"),eS=r("Therefore, if you encounter a CUDA-related build issue while doing one of the following or both:"),p2=l(),f(tl.$$.fragment),m2=l(),xc=n("p"),tS=r("please, read the following notes first."),h2=l(),Qt=n("p"),oS=r("In these notes we give examples for what to do when "),p_=n("code"),rS=r("pytorch"),aS=r(" has been built with CUDA "),m_=n("code"),nS=r("10.2"),sS=r(`. If your situation is
different remember to adjust the version number to the one you are after.`),u2=l(),ar=n("h4"),Ua=n("a"),h_=n("span"),f(ol.$$.fragment),iS=l(),u_=n("span"),lS=r("Possible problem #1"),f2=l(),kc=n("p"),dS=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.`),g2=l(),Ye=n("p"),cS=r("For example, if you installed "),f_=n("code"),pS=r("pytorch"),mS=r(" with "),g_=n("code"),hS=r("cudatoolkit==10.2"),uS=r(` in the Python environment, you also need to have
CUDA `),__=n("code"),fS=r("10.2"),gS=r(" installed system-wide."),_2=l(),eo=n("p"),_S=r("The exact location may vary from system to system, but "),v_=n("code"),vS=r("/usr/local/cuda-10.2"),bS=r(` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),b_=n("code"),yS=r("PATH"),wS=r(` environment variable, one can find the
installation location by doing:`),v2=l(),f(rl.$$.fragment),b2=l(),za=n("p"),TS=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: `),al=n("a"),ES=r("ubuntu cuda 10.2 install"),$S=r("."),y2=l(),nr=n("h4"),Na=n("a"),y_=n("span"),f(nl.$$.fragment),xS=l(),w_=n("span"),kS=r("Possible problem #2"),w2=l(),Ac=n("p"),AS=r(`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),T2=l(),f(sl.$$.fragment),E2=l(),to=n("p"),qS=r("Now, in this situation you need to make sure that your "),T_=n("code"),PS=r("PATH"),DS=r(" and "),E_=n("code"),SS=r("LD_LIBRARY_PATH"),OS=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.`),$2=l(),qc=n("p"),CS=r("First, you may look at their contents:"),x2=l(),f(il.$$.fragment),k2=l(),Pc=n("p"),IS=r("so you get an idea of what is inside."),A2=l(),La=n("p"),FS=r("It\u2019s possible that "),$_=n("code"),US=r("LD_LIBRARY_PATH"),zS=r(" is empty."),q2=l(),ht=n("p"),x_=n("code"),NS=r("PATH"),LS=r(" lists the locations of where executables can be found and "),k_=n("code"),jS=r("LD_LIBRARY_PATH"),RS=r(` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),A_=n("code"),WS=r(":"),GS=r(` is used to separate multiple
entries.`),P2=l(),Dc=n("p"),MS=r(`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),D2=l(),f(ll.$$.fragment),S2=l(),Sc=n("p"),HS=r("Note that we aren\u2019t overwriting the existing values, but prepending instead."),O2=l(),Xe=n("p"),BS=r(`Of course, adjust the version number, the full path if need be. Check that the directories you assign actually do
exist. `),q_=n("code"),VS=r("lib64"),YS=r(" sub-directory is where the various CUDA "),P_=n("code"),XS=r(".so"),ZS=r(" objects, like "),D_=n("code"),JS=r("libcudart.so"),KS=r(` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),C2=l(),sr=n("h4"),ja=n("a"),S_=n("span"),f(dl.$$.fragment),QS=l(),O_=n("span"),e7=r("Possible problem #3"),I2=l(),oo=n("p"),t7=r("Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),C_=n("code"),o7=r("gcc-9"),r7=r(` but it wants
`),I_=n("code"),a7=r("gcc-7"),n7=r("."),F2=l(),Oc=n("p"),s7=r("There are various ways to go about it."),U2=l(),Cc=n("p"),i7=r("If you can install the latest CUDA toolkit it typically should support the newer compiler."),z2=l(),Ra=n("p"),l7=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 `),F_=n("code"),d7=r("gcc-7"),c7=r(` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),N2=l(),f(cl.$$.fragment),L2=l(),ee=n("p"),p7=r("Here, we are making a symlink to "),U_=n("code"),m7=r("gcc-7"),h7=r(" from "),z_=n("code"),u7=r("/usr/local/cuda-10.2/bin/gcc"),f7=r(` and since
`),N_=n("code"),g7=r("/usr/local/cuda-10.2/bin/"),_7=r(" should be in the "),L_=n("code"),v7=r("PATH"),b7=r(` environment variable (see the previous problem\u2019s solution), it
should find `),j_=n("code"),y7=r("gcc-7"),w7=r(" (and "),R_=n("code"),T7=r("g++7"),E7=r(") and then the build will succeed."),j2=l(),Ic=n("p"),$7=r("As always make sure to edit the paths in the example to match your situation."),R2=l(),ir=n("h3"),Wa=n("a"),W_=n("span"),f(pl.$$.fragment),x7=l(),G_=n("span"),k7=r("FairScale"),W2=l(),f(Ga.$$.fragment),G2=l(),Ze=n("p"),A7=r("By integrating "),ml=n("a"),q7=r("FairScale"),P7=r(" the "),Fc=n("a"),D7=r("Trainer"),S7=r(`
provides support for the following features from `),hl=n("a"),O7=r("the ZeRO paper"),C7=r(":"),M2=l(),Je=n("ol"),M_=n("li"),I7=r("Optimizer State Sharding"),F7=l(),H_=n("li"),U7=r("Gradient Sharding"),z7=l(),B_=n("li"),N7=r("Model Parameters Sharding (new and very experimental)"),L7=l(),V_=n("li"),j7=r("CPU offload (new and very experimental)"),H2=l(),Uc=n("p"),R7=r("You will need at least two GPUs to use this feature."),B2=l(),ul=n("p"),Y_=n("strong"),W7=r("Installation"),G7=r(":"),V2=l(),zc=n("p"),M7=r("Install the library via pypi:"),Y2=l(),f(fl.$$.fragment),X2=l(),ro=n("p"),H7=r("or via "),X_=n("code"),B7=r("transformers"),V7=r("\u2019 "),Z_=n("code"),Y7=r("extras"),X7=r(":"),Z2=l(),f(gl.$$.fragment),J2=l(),ao=n("p"),Z7=r("(available starting from "),J_=n("code"),J7=r("transformers==4.6.0"),K7=r(") or find more details on "),_l=n("a"),Q7=r("the FairScale\u2019s GitHub page"),eO=r("."),K2=l(),Ma=n("p"),tO=r("If you\u2019re still struggling with the build, first make sure to read "),Nc=n("a"),oO=r("CUDA Extension Installation Notes"),rO=r("."),Q2=l(),Lc=n("p"),aO=r("If it\u2019s still not resolved the build issue, here are a few more ideas."),e0=l(),vl=n("p"),K_=n("code"),nO=r("fairscale"),sO=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:`),t0=l(),f(bl.$$.fragment),o0=l(),jc=n("p"),iO=r("or:"),r0=l(),f(yl.$$.fragment),a0=l(),wl=n("p"),Q_=n("code"),lO=r("fairscale"),dO=r(" also has issues with building against pytorch-nightly, so if you use it you may have to try one of:"),n0=l(),f(Tl.$$.fragment),s0=l(),Rc=n("p"),cO=r("or:"),i0=l(),f(El.$$.fragment),l0=l(),Wc=n("p"),pO=r("Of course, adjust the urls to match the cuda version you use."),d0=l(),Ha=n("p"),mO=r(`If after trying everything suggested you still encounter build issues, please, proceed with the GitHub Issue of
`),$l=n("a"),hO=r("FairScale"),uO=r("."),c0=l(),xl=n("p"),ev=n("strong"),fO=r("Usage"),gO=r(":"),p0=l(),no=n("p"),_O=r("To use the first version of Sharded data-parallelism, add "),tv=n("code"),vO=r("--sharded_ddp simple"),bO=r(` to the command line arguments, and
make sure you have added the distributed launcher `),ov=n("code"),yO=r("-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),wO=r(" if you haven\u2019t been using it already."),m0=l(),Ba=n("p"),TO=r("For example here is how you could use it for "),rv=n("code"),EO=r("run_translation.py"),$O=r(" with 2 GPUs:"),h0=l(),f(kl.$$.fragment),u0=l(),Gc=n("p"),xO=r("Notes:"),f0=l(),Ke=n("ul"),av=n("li"),kO=r("This feature requires distributed training (so multiple GPUs)."),AO=l(),nv=n("li"),qO=r("It is not implemented for TPUs."),PO=l(),Al=n("li"),DO=r("It works with "),sv=n("code"),SO=r("--fp16"),OO=r(" too, to make things even faster."),CO=l(),ql=n("li"),IO=r("One of the main benefits of enabling "),iv=n("code"),FO=r("--sharded_ddp simple"),UO=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.`),g0=l(),Pl=n("ol"),ut=n("li"),zO=r("To use the second version of Sharded data-parallelism, add "),lv=n("code"),NO=r("--sharded_ddp zero_dp_2"),LO=r(" or "),dv=n("code"),jO=r("--sharded_ddp zero_dp_3"),RO=r(" to the command line arguments, and make sure you have added the distributed launcher "),cv=n("code"),WO=r("-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),GO=r(" if you haven\u2019t been using it already."),_0=l(),Va=n("p"),MO=r("For example here is how you could use it for "),pv=n("code"),HO=r("run_translation.py"),BO=r(" with 2 GPUs:"),v0=l(),f(Dl.$$.fragment),b0=l(),lr=n("p"),mv=n("code"),VO=r("zero_dp_2"),YO=r(" is an optimized version of the simple wrapper, while "),hv=n("code"),XO=r("zero_dp_3"),ZO=r(` fully shards model weights,
gradients and optimizer states.`),y0=l(),so=n("p"),JO=r("Both are compatible with adding "),uv=n("code"),KO=r("cpu_offload"),QO=r(" to enable ZeRO-offload (activate it like this: "),fv=n("code"),eC=r('--sharded_ddp "zero_dp_2 cpu_offload"'),tC=r(")."),w0=l(),Mc=n("p"),oC=r("Notes:"),T0=l(),be=n("ul"),gv=n("li"),rC=r("This feature requires distributed training (so multiple GPUs)."),aC=l(),_v=n("li"),nC=r("It is not implemented for TPUs."),sC=l(),Sl=n("li"),iC=r("It works with "),vv=n("code"),lC=r("--fp16"),dC=r(" too, to make things even faster."),cC=l(),dr=n("li"),pC=r("The "),bv=n("code"),mC=r("cpu_offload"),hC=r(" additional option requires "),yv=n("code"),uC=r("--fp16"),fC=r("."),gC=l(),wv=n("li"),_C=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.`),E0=l(),Hc=n("p"),vC=r("Known caveats:"),$0=l(),Ya=n("ul"),cr=n("li"),bC=r("This feature is incompatible with "),Tv=n("code"),yC=r("--predict_with_generate"),wC=r(" in the "),Ev=n("em"),TC=r("run_translation.py"),EC=r(" script."),$C=l(),De=n("li"),xC=r("Using "),$v=n("code"),kC=r("--sharded_ddp zero_dp_3"),AC=r(` requires wrapping each layer of the model in the special container
`),xv=n("code"),qC=r("FullyShardedDataParallelism"),PC=r(" of fairscale. It should be used with the option "),kv=n("code"),DC=r("auto_wrap"),SC=r(` if you are not
doing this yourself: `),Av=n("code"),OC=r('--sharded_ddp "zero_dp_3 auto_wrap"'),CC=r("."),x0=l(),pr=n("h3"),Xa=n("a"),qv=n("span"),f(Ol.$$.fragment),IC=l(),Pv=n("span"),FC=r("PyTorch Fully Sharded Data parallel"),k0=l(),Za=n("p"),UC=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 `),Cl=n("a"),zC=r("Fully Sharded Data Parallel blog"),NC=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.`),A0=l(),Il=n("p"),Dv=n("strong"),LC=r("Required PyTorch version for FSDP support"),jC=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.`),q0=l(),Fl=n("p"),Sv=n("strong"),RC=r("Usage"),WC=r(":"),P0=l(),pe=n("ul"),Ov=n("li"),Ul=n("p"),GC=r(`Make sure you have added the distributed launcher
`),Cv=n("code"),MC=r("-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),HC=r(" if you haven\u2019t been using it already."),BC=l(),zl=n("li"),Bc=n("p"),Iv=n("strong"),VC=r("Sharding Strategy"),YC=r(":"),XC=l(),mr=n("ul"),Nl=n("li"),ZC=r(`FULL_SHARD : Shards optimizer states + gradients + model parameters across data parallel workers/GPUs.
For this, add `),Fv=n("code"),JC=r("--fsdp full_shard"),KC=r(" to the command line arguments."),QC=l(),Ll=n("li"),eI=r(`SHARD_GRAD_OP : Shards optimizer states + gradients across data parallel workers/GPUs.
For this, add `),Uv=n("code"),tI=r("--fsdp shard_grad_op"),oI=r(" to the command line arguments."),rI=l(),jl=n("li"),aI=r("NO_SHARD : No sharding. For this, add "),zv=n("code"),nI=r("--fsdp no_shard"),sI=r(" to the command line arguments."),iI=l(),Nv=n("li"),hr=n("p"),lI=r(`To offload the parameters and gradients to the CPU,
add `),Lv=n("code"),dI=r('--fsdp "full_shard offload"'),cI=r(" or "),jv=n("code"),pI=r('--fsdp "shard_grad_op offload"'),mI=r(" to the command line arguments."),hI=l(),Rv=n("li"),ft=n("p"),uI=r("To automatically recursively wrap layers with FSDP using "),Wv=n("code"),fI=r("default_auto_wrap_policy"),gI=r(`,
add `),Gv=n("code"),_I=r('--fsdp "full_shard auto_wrap"'),vI=r(" or "),Mv=n("code"),bI=r('--fsdp "shard_grad_op auto_wrap"'),yI=r(" to the command line arguments."),wI=l(),Hv=n("li"),ur=n("p"),TI=r(`To enable both CPU offloading and auto wrapping,
add `),Bv=n("code"),EI=r('--fsdp "full_shard offload auto_wrap"'),$I=r(" or "),Vv=n("code"),xI=r('--fsdp "shard_grad_op offload auto_wrap"'),kI=r(" to the command line arguments."),AI=l(),Rl=n("li"),gt=n("p"),qI=r("Remaining FSDP config is passed via "),Yv=n("code"),PI=r("--fsdp_config <path_to_fsdp_config.json>"),DI=r(`. It is either a location of
FSDP json config file (e.g., `),Xv=n("code"),SI=r("fsdp_config.json"),OI=r(") or an already loaded json file as "),Zv=n("code"),CI=r("dict"),II=r("."),FI=l(),_t=n("ul"),Vc=n("li"),UI=r("If auto wrapping is enabled, you can either use transformer based auto wrap policy or size based auto wrap policy."),Wl=n("ul"),Se=n("li"),zI=r("For transformer based auto wrap policy, please specify "),Jv=n("code"),NI=r("fsdp_transformer_layer_cls_to_wrap"),LI=r(` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),Kv=n("code"),jI=r("BertLayer"),RI=r(", "),Qv=n("code"),WI=r("GPTJBlock"),GI=r(", "),eb=n("code"),MI=r("T5Block"),HI=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.`),BI=l(),Gl=n("li"),VI=r("For size based auto wrap policy, please add "),tb=n("code"),YI=r("fsdp_min_num_params"),XI=r(` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),ZI=l(),vt=n("li"),ob=n("code"),JI=r("fsdp_backward_prefetch"),KI=r(` can be specified in the config file. It controls when to prefetch next set of parameters.
`),rb=n("code"),QI=r("backward_pre"),eF=r(" and "),ab=n("code"),tF=r("backward_pos"),oF=r(` are available options.
For more information refer `),nb=n("code"),rF=r("torch.distributed.fsdp.fully_sharded_data_parallel.BackwardPrefetch"),aF=l(),Ja=n("li"),sb=n("code"),nF=r("fsdp_forward_prefetch"),sF=r(` can be specified in the config file. It controls when to prefetch next set of parameters.
If `),ib=n("code"),iF=r('"True"'),lF=r(", FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass."),dF=l(),Ka=n("li"),lb=n("code"),cF=r("limit_all_gathers"),pF=r(` can be specified in the config file.
If `),db=n("code"),mF=r('"True"'),hF=r(", FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers."),D0=l(),Yc=n("p"),cb=n("strong"),uF=r("Few caveats to be aware of"),S0=l(),Xc=n("ul"),Qe=n("li"),fF=r("it is incompatible with "),pb=n("code"),gF=r("generate"),_F=r(", thus is incompatible with "),mb=n("code"),vF=r("--predict_with_generate"),bF=r(`
in all seq2seq/clm scripts (translation/summarization/clm etc.).`),yF=n("br"),wF=r(`
Please refer issue `),Ml=n("a"),TF=r("#21667"),O0=l(),fr=n("h3"),Qa=n("a"),hb=n("span"),f(Hl.$$.fragment),EF=l(),ub=n("span"),$F=r("PyTorch/XLA Fully Sharded Data parallel"),C0=l(),io=n("p"),xF=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 `),Bl=n("a"),kF=r("Scaling PyTorch models on Cloud TPUs with FSDP"),AF=r(" and "),Vl=n("a"),qF=r("PyTorch/XLA implementation of FSDP"),PF=r(`
All you need to do is enable it through the config.`),I0=l(),Yl=n("p"),fb=n("strong"),DF=r("Required PyTorch/XLA version for FSDP support"),SF=r(": >=2.0"),F0=l(),Xl=n("p"),gb=n("strong"),OF=r("Usage"),CF=r(":"),U0=l(),lo=n("p"),IF=r("Pass "),_b=n("code"),FF=r('--fsdp "full shard"'),UF=r(" along with following changes to be made in "),vb=n("code"),zF=r("--fsdp_config <path_to_fsdp_config.json>"),NF=r(":"),z0=l(),et=n("ul"),en=n("li"),bb=n("code"),LF=r("xla"),jF=r(" should be set to "),yb=n("code"),RF=r("True"),WF=r(" to enable PyTorch/XLA FSDP."),GF=l(),tn=n("li"),wb=n("code"),MF=r("xla_fsdp_settings"),HF=r(` The value is a dictionary which stores the XLA FSDP wrapping parameters.
For a complete list of options, please see `),Zl=n("a"),BF=r("here"),VF=r("."),YF=l(),tt=n("li"),Tb=n("code"),XF=r("xla_fsdp_grad_ckpt"),ZF=r(". When "),Eb=n("code"),JF=r("True"),KF=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
`),$b=n("code"),QF=r("fsdp_min_num_params"),eU=r(" or "),xb=n("code"),tU=r("fsdp_transformer_layer_cls_to_wrap"),oU=r("."),rU=l(),Zc=n("li"),aU=r("You can either use transformer based auto wrap policy or size based auto wrap policy."),Jl=n("ul"),Oe=n("li"),nU=r("For transformer based auto wrap policy, please specify "),kb=n("code"),sU=r("fsdp_transformer_layer_cls_to_wrap"),iU=r(` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),Ab=n("code"),lU=r("BertLayer"),dU=r(", "),qb=n("code"),cU=r("GPTJBlock"),pU=r(", "),Pb=n("code"),mU=r("T5Block"),hU=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.`),uU=l(),Kl=n("li"),fU=r("For size based auto wrap policy, please add "),Db=n("code"),gU=r("fsdp_min_num_params"),_U=r(` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),N0=l(),gr=n("h3"),on=n("a"),Sb=n("span"),f(Ql.$$.fragment),vU=l(),Ob=n("span"),bU=r("Using Trainer for accelerated PyTorch Training on Mac"),L0=l(),ot=n("p"),yU=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 `),Cb=n("code"),wU=r('"mps"'),TU=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 `),ed=n("a"),EU=r("Introducing Accelerated PyTorch Training on Mac"),$U=r(`
and `),td=n("a"),xU=r("MPS BACKEND"),kU=r("."),j0=l(),f(rn.$$.fragment),R0=l(),Jc=n("p"),Ib=n("strong"),AU=r("Benefits of Training and Inference using Apple Silicon Chips"),W0=l(),co=n("ol"),Fb=n("li"),qU=r("Enables users to train larger networks or batch sizes locally"),PU=l(),Ub=n("li"),DU=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.`),SU=l(),zb=n("li"),OU=r("Reduces costs associated with cloud-based development or the need for additional local GPUs."),G0=l(),_r=n("p"),Nb=n("strong"),CU=r("Pre-requisites"),IU=r(`: To install torch with mps support,
please follow this nice medium article `),od=n("a"),FU=r("GPU-Acceleration Comes to PyTorch on M1 Macs"),UU=r("."),M0=l(),vr=n("p"),Lb=n("strong"),zU=r("Usage"),NU=r(`:
User has to just pass `),jb=n("code"),LU=r("--use_mps_device"),jU=r(` argument.
For example, you can run the official Glue text classififcation task (from the root folder) using Apple Silicon GPU with below command:`),H0=l(),f(rd.$$.fragment),B0=l(),Kc=n("p"),Rb=n("strong"),RU=r("A few caveats to be aware of"),V0=l(),an=n("ol"),ad=n("li"),WU=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 `),Wb=n("code"),GU=r("PYTORCH_ENABLE_MPS_FALLBACK=1"),MU=r(`,
which will fallback to CPU for these operations. It still throws a UserWarning however.`),HU=l(),Ce=n("li"),BU=r("Distributed setups "),Gb=n("code"),VU=r("gloo"),YU=r(" and "),Mb=n("code"),XU=r("nccl"),ZU=r(" are not working with "),Hb=n("code"),JU=r("mps"),KU=r(` device.
This means that currently only single GPU of `),Bb=n("code"),QU=r("mps"),ez=r(" device type can be used."),Y0=l(),po=n("p"),tz=r("Finally, please, remember that, \u{1F917} "),Vb=n("code"),oz=r("Trainer"),rz=r(` only integrates MPS backend, therefore if you
have any problems or questions with regards to MPS backend usage, please,
file an issue with `),nd=n("a"),az=r("PyTorch GitHub"),nz=r("."),X0=l(),Qc=n("p"),sz=r("Sections that were moved:"),Z0=l(),q=n("p"),iz=r("[ "),ep=n("a"),lz=r("DeepSpeed"),Yb=n("a"),dz=r(`
| `),tp=n("a"),cz=r("Installation"),Xb=n("a"),pz=r(`
| `),op=n("a"),mz=r("Deployment with multiple GPUs"),Zb=n("a"),hz=r(`
| `),rp=n("a"),uz=r("Deployment with one GPU"),Jb=n("a"),fz=r(`
| `),ap=n("a"),gz=r("Deployment in Notebooks"),Kb=n("a"),_z=r(`
| `),np=n("a"),vz=r("Configuration"),Qb=n("a"),bz=r(`
| `),sp=n("a"),yz=r("Passing Configuration"),e1=n("a"),wz=r(`
| `),ip=n("a"),Tz=r("Shared Configuration"),t1=n("a"),Ez=r(`
| `),lp=n("a"),$z=r("ZeRO"),o1=n("a"),xz=r(`
| `),dp=n("a"),kz=r("ZeRO-2 Config"),r1=n("a"),Az=r(`
| `),cp=n("a"),qz=r("ZeRO-3 Config"),a1=n("a"),Pz=r(`
| `),pp=n("a"),Dz=r("NVMe Support"),n1=n("a"),Sz=r(`
| `),mp=n("a"),Oz=r("ZeRO-2 vs ZeRO-3 Performance"),s1=n("a"),Cz=r(`
| `),hp=n("a"),Iz=r("ZeRO-2 Example"),i1=n("a"),Fz=r(`
| `),up=n("a"),Uz=r("ZeRO-3 Example"),l1=n("a"),zz=r(`
| `),fp=n("a"),Nz=r("Optimizer"),d1=n("a"),Lz=r(`
| `),gp=n("a"),jz=r("Scheduler"),c1=n("a"),Rz=r(`
| `),_p=n("a"),Wz=r("fp32 Precision"),p1=n("a"),Gz=r(`
| `),vp=n("a"),Mz=r("Automatic Mixed Precision"),m1=n("a"),Hz=r(`
| `),bp=n("a"),Bz=r("Batch Size"),h1=n("a"),Vz=r(`
| `),yp=n("a"),Yz=r("Gradient Accumulation"),u1=n("a"),Xz=r(`
| `),wp=n("a"),Zz=r("Gradient Clipping"),f1=n("a"),Jz=r(`
| `),Tp=n("a"),Kz=r("Getting The Model Weights Out"),g1=n("a"),Qz=r(`
]`),this.h()},l(t){const c=fY('[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 sd=i(T);w=s(sd,"A",{id:!0,class:!0,href:!0});var _1=i(w);k=s(_1,"SPAN",{});var v1=i(k);g(h.$$.fragment,v1),v1.forEach(o),_1.forEach(o),E=d(sd),z=s(sd,"SPAN",{});var b1=i(z);j=a(b1,"Trainer"),b1.forEach(o),sd.forEach(o),I=d(t),G=s(t,"P",{});var br=i(G);B=a(br,"The "),Q=s(br,"A",{href:!0});var y1=i(Q);K=a(y1,"Trainer"),y1.forEach(o),Z=a(br," class provides an API for feature-complete training in PyTorch for most standard use cases. It\u2019s used in most of the "),X=s(br,"A",{href:!0,rel:!0});var w1=i(X);me=a(w1,"example scripts"),w1.forEach(o),J=a(br,"."),br.forEach(o),M=d(t),R=s(t,"P",{});var yr=i(R);ae=a(yr,"Before instantiating your "),N=s(yr,"A",{href:!0});var T1=i(N);we=a(T1,"Trainer"),T1.forEach(o),Te=a(yr,", create a "),ne=s(yr,"A",{href:!0});var E1=i(ne);bt=a(E1,"TrainingArguments"),E1.forEach(o),yt=a(yr," to access all the points of customization during training."),yr.forEach(o),ue=d(t),Fe=s(t,"P",{});var id=i(Fe);Cn=a(id,"The API supports distributed training on multiple GPUs/TPUs, mixed precision through "),Ee=s(id,"A",{href:!0,rel:!0});var $1=i(Ee);In=a($1,"NVIDIA Apex"),$1.forEach(o),Fn=a(id," and Native AMP for PyTorch."),id.forEach(o),se=d(t),oe=s(t,"P",{});var ld=i(oe);md=a(ld,"The "),$e=s(ld,"A",{href:!0});var x1=i($e);kr=a(x1,"Trainer"),x1.forEach(o),hd=a(ld," contains the basic training loop which supports the above features. To inject custom behavior you can subclass them and override the following methods:"),ld.forEach(o),Ao=d(t),W=s(t,"UL",{});var H=i(W);re=s(H,"LI",{});var Ep=i(re);Ar=s(Ep,"STRONG",{});var k1=i(Ar);ud=a(k1,"get_train_dataloader"),k1.forEach(o),fd=a(Ep," \u2014 Creates the training DataLoader."),Ep.forEach(o),gd=d(H),_d=s(H,"LI",{});var $p=i(_d);Lm=s($p,"STRONG",{});var A1=i(Lm);YT=a(A1,"get_eval_dataloader"),A1.forEach(o),XT=a($p," \u2014 Creates the evaluation DataLoader."),$p.forEach(o),ZT=d(H),vd=s(H,"LI",{});var eN=i(vd);jm=s(eN,"STRONG",{});var AN=i(jm);JT=a(AN,"get_test_dataloader"),AN.forEach(o),KT=a(eN," \u2014 Creates the test DataLoader."),eN.forEach(o),QT=d(H),bd=s(H,"LI",{});var tN=i(bd);Rm=s(tN,"STRONG",{});var qN=i(Rm);eE=a(qN,"log"),qN.forEach(o),tE=a(tN," \u2014 Logs information on the various objects watching training."),tN.forEach(o),oE=d(H),wt=s(H,"LI",{});var dd=i(wt);Wm=s(dd,"STRONG",{});var PN=i(Wm);rE=a(PN,"create_optimizer_and_scheduler"),PN.forEach(o),aE=a(dd,` \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 `),Gm=s(dd,"CODE",{});var DN=i(Gm);nE=a(DN,"create_optimizer"),DN.forEach(o),sE=a(dd," and "),Mm=s(dd,"CODE",{});var SN=i(Mm);iE=a(SN,"create_scheduler"),SN.forEach(o),lE=a(dd,` methods
separately.`),dd.forEach(o),dE=d(H),yd=s(H,"LI",{});var oN=i(yd);Hm=s(oN,"STRONG",{});var ON=i(Hm);cE=a(ON,"create_optimizer"),ON.forEach(o),pE=a(oN," \u2014 Sets up the optimizer if it wasn\u2019t passed at init."),oN.forEach(o),mE=d(H),wd=s(H,"LI",{});var rN=i(wd);Bm=s(rN,"STRONG",{});var CN=i(Bm);hE=a(CN,"create_scheduler"),CN.forEach(o),uE=a(rN," \u2014 Sets up the learning rate scheduler if it wasn\u2019t passed at init."),rN.forEach(o),fE=d(H),Td=s(H,"LI",{});var aN=i(Td);Vm=s(aN,"STRONG",{});var IN=i(Vm);gE=a(IN,"compute_loss"),IN.forEach(o),_E=a(aN," - Computes the loss on a batch of training inputs."),aN.forEach(o),vE=d(H),Ed=s(H,"LI",{});var nN=i(Ed);Ym=s(nN,"STRONG",{});var FN=i(Ym);bE=a(FN,"training_step"),FN.forEach(o),yE=a(nN," \u2014 Performs a training step."),nN.forEach(o),wE=d(H),$d=s(H,"LI",{});var sN=i($d);Xm=s(sN,"STRONG",{});var UN=i(Xm);TE=a(UN,"prediction_step"),UN.forEach(o),EE=a(sN," \u2014 Performs an evaluation/test step."),sN.forEach(o),$E=d(H),xd=s(H,"LI",{});var iN=i(xd);Zm=s(iN,"STRONG",{});var zN=i(Zm);xE=a(zN,"evaluate"),zN.forEach(o),kE=a(iN," \u2014 Runs an evaluation loop and returns metrics."),iN.forEach(o),AE=d(H),kd=s(H,"LI",{});var lN=i(kd);Jm=s(lN,"STRONG",{});var NN=i(Jm);qE=a(NN,"predict"),NN.forEach(o),PE=a(lN," \u2014 Returns predictions (with metrics if labels are available) on a test set."),lN.forEach(o),H.forEach(o),z1=d(t),g(qr.$$.fragment,t),N1=d(t),Pr=s(t,"P",{});var K0=i(Pr);DE=a(K0,"Here is an example of how to customize "),Ad=s(K0,"A",{href:!0});var LN=i(Ad);SE=a(LN,"Trainer"),LN.forEach(o),OE=a(K0," to use a weighted loss (useful when you have an unbalanced training set):"),K0.forEach(o),L1=d(t),g(Un.$$.fragment,t),j1=d(t),Tt=s(t,"P",{});var xp=i(Tt);CE=a(xp,"Another way to customize the training loop behavior for the PyTorch "),qd=s(xp,"A",{href:!0});var jN=i(qd);IE=a(jN,"Trainer"),jN.forEach(o),FE=a(xp," is to use "),Pd=s(xp,"A",{href:!0});var RN=i(Pd);UE=a(RN,"callbacks"),RN.forEach(o),zE=a(xp," that can inspect the training loop state (for progress reporting, logging on TensorBoard or other ML platforms\u2026) and take decisions (like early stopping)."),xp.forEach(o),R1=d(t),qo=s(t,"H2",{class:!0});var Q0=i(qo);Dr=s(Q0,"A",{id:!0,class:!0,href:!0});var WN=i(Dr);Km=s(WN,"SPAN",{});var GN=i(Km);g(zn.$$.fragment,GN),GN.forEach(o),WN.forEach(o),NE=d(Q0),Qm=s(Q0,"SPAN",{});var MN=i(Qm);LE=a(MN,"Trainer"),MN.forEach(o),Q0.forEach(o),W1=d(t),$=s(t,"DIV",{class:!0});var A=i($);g(Nn.$$.fragment,A),jE=d(A),eh=s(A,"P",{});var HN=i(eh);RE=a(HN,"Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for \u{1F917} Transformers."),HN.forEach(o),WE=d(A),th=s(A,"P",{});var BN=i(th);GE=a(BN,"Important attributes:"),BN.forEach(o),ME=d(A),xe=s(A,"UL",{});var mo=i(xe);Sr=s(mo,"LI",{});var q1=i(Sr);oh=s(q1,"STRONG",{});var VN=i(oh);HE=a(VN,"model"),VN.forEach(o),BE=a(q1," \u2014 Always points to the core model. If using a transformers model, it will be a "),Dd=s(q1,"A",{href:!0});var YN=i(Dd);VE=a(YN,"PreTrainedModel"),YN.forEach(o),YE=a(q1,`
subclass.`),q1.forEach(o),XE=d(mo),ie=s(mo,"LI",{});var Ie=i(ie);rh=s(Ie,"STRONG",{});var XN=i(rh);ZE=a(XN,"model_wrapped"),XN.forEach(o),JE=a(Ie,` \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 `),ah=s(Ie,"CODE",{});var ZN=i(ah);KE=a(ZN,"DeepSpeed"),ZN.forEach(o),QE=a(Ie,`,
the inner model is wrapped in `),nh=s(Ie,"CODE",{});var JN=i(nh);e4=a(JN,"DeepSpeed"),JN.forEach(o),t4=a(Ie," and then again in "),sh=s(Ie,"CODE",{});var KN=i(sh);o4=a(KN,"torch.nn.DistributedDataParallel"),KN.forEach(o),r4=a(Ie,`. If the inner
model hasn\u2019t been wrapped, then `),ih=s(Ie,"CODE",{});var QN=i(ih);a4=a(QN,"self.model_wrapped"),QN.forEach(o),n4=a(Ie," is the same as "),lh=s(Ie,"CODE",{});var eL=i(lh);s4=a(eL,"self.model"),eL.forEach(o),i4=a(Ie,"."),Ie.forEach(o),l4=d(mo),Sd=s(mo,"LI",{});var dN=i(Sd);dh=s(dN,"STRONG",{});var tL=i(dh);d4=a(tL,"is_model_parallel"),tL.forEach(o),c4=a(dN,` \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).`),dN.forEach(o),p4=d(mo),Ue=s(mo,"LI",{});var wr=i(Ue);ch=s(wr,"STRONG",{});var oL=i(ch);m4=a(oL,"place_model_on_device"),oL.forEach(o),h4=a(wr,` \u2014 Whether or not to automatically place the model on the device - it will be set
to `),ph=s(wr,"CODE",{});var rL=i(ph);u4=a(rL,"False"),rL.forEach(o),f4=a(wr,` if model parallel or deepspeed is used, or if the default
`),mh=s(wr,"CODE",{});var aL=i(mh);g4=a(aL,"TrainingArguments.place_model_on_device"),aL.forEach(o),_4=a(wr," is overridden to return "),hh=s(wr,"CODE",{});var nL=i(hh);v4=a(nL,"False"),nL.forEach(o),b4=a(wr," ."),wr.forEach(o),y4=d(mo),ze=s(mo,"LI",{});var Tr=i(ze);uh=s(Tr,"STRONG",{});var sL=i(uh);w4=a(sL,"is_in_train"),sL.forEach(o),T4=a(Tr," \u2014 Whether or not a model is currently running "),fh=s(Tr,"CODE",{});var iL=i(fh);E4=a(iL,"train"),iL.forEach(o),$4=a(Tr," (e.g. when "),gh=s(Tr,"CODE",{});var lL=i(gh);x4=a(lL,"evaluate"),lL.forEach(o),k4=a(Tr,` is called while
in `),_h=s(Tr,"CODE",{});var dL=i(_h);A4=a(dL,"train"),dL.forEach(o),q4=a(Tr,")"),Tr.forEach(o),mo.forEach(o),P4=d(A),Or=s(A,"DIV",{class:!0});var ew=i(Or);g(Ln.$$.fragment,ew),D4=d(ew),jn=s(ew,"P",{});var tw=i(jn);S4=a(tw,"Add a callback to the current list of "),vh=s(tw,"CODE",{});var cL=i(vh);O4=a(cL,"~transformer.TrainerCallback"),cL.forEach(o),C4=a(tw,"."),tw.forEach(o),ew.forEach(o),I4=d(A),Cr=s(A,"DIV",{class:!0});var ow=i(Cr);g(Rn.$$.fragment,ow),F4=d(ow),Wn=s(ow,"P",{});var rw=i(Wn);U4=a(rw,"A helper wrapper that creates an appropriate context manager for "),bh=s(rw,"CODE",{});var pL=i(bh);z4=a(pL,"autocast"),pL.forEach(o),N4=a(rw,` while feeding it the desired
arguments, depending on the situation.`),rw.forEach(o),ow.forEach(o),L4=d(A),Et=s(A,"DIV",{class:!0});var kp=i(Et);g(Gn.$$.fragment,kp),j4=d(kp),yh=s(kp,"P",{});var mL=i(yh);R4=a(mL,"How the loss is computed by Trainer. By default, all models return the loss in the first element."),mL.forEach(o),W4=d(kp),wh=s(kp,"P",{});var hL=i(wh);G4=a(hL,"Subclass and override for custom behavior."),hL.forEach(o),kp.forEach(o),M4=d(A),Ir=s(A,"DIV",{class:!0});var aw=i(Ir);g(Mn.$$.fragment,aw),H4=d(aw),Th=s(aw,"P",{});var uL=i(Th);B4=a(uL,"A helper wrapper to group together context managers."),uL.forEach(o),aw.forEach(o),V4=d(A),Fr=s(A,"DIV",{class:!0});var nw=i(Fr);g(Hn.$$.fragment,nw),Y4=d(nw),Bn=s(nw,"P",{});var sw=i(Bn);X4=a(sw,"Creates a draft of a model card using the information available to the "),Eh=s(sw,"CODE",{});var fL=i(Eh);Z4=a(fL,"Trainer"),fL.forEach(o),J4=a(sw,"."),sw.forEach(o),nw.forEach(o),K4=d(A),$t=s(A,"DIV",{class:!0});var Ap=i($t);g(Vn.$$.fragment,Ap),Q4=d(Ap),$h=s(Ap,"P",{});var gL=i($h);e$=a(gL,"Setup the optimizer."),gL.forEach(o),t$=d(Ap),Yn=s(Ap,"P",{});var iw=i(Yn);o$=a(iw,`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 `),xh=s(iw,"CODE",{});var _L=i(xh);r$=a(_L,"optimizers"),_L.forEach(o),a$=a(iw,", or subclass and override this method in a subclass."),iw.forEach(o),Ap.forEach(o),n$=d(A),xt=s(A,"DIV",{class:!0});var qp=i(xt);g(Xn.$$.fragment,qp),s$=d(qp),kh=s(qp,"P",{});var vL=i(kh);i$=a(vL,"Setup the optimizer and the learning rate scheduler."),vL.forEach(o),l$=d(qp),lt=s(qp,"P",{});var nn=i(lt);d$=a(nn,`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 `),Ah=s(nn,"CODE",{});var bL=i(Ah);c$=a(bL,"optimizers"),bL.forEach(o),p$=a(nn,", or subclass and override this method (or "),qh=s(nn,"CODE",{});var yL=i(qh);m$=a(yL,"create_optimizer"),yL.forEach(o),h$=a(nn,` and/or
`),Ph=s(nn,"CODE",{});var wL=i(Ph);u$=a(wL,"create_scheduler"),wL.forEach(o),f$=a(nn,") in a subclass."),nn.forEach(o),qp.forEach(o),g$=d(A),Ur=s(A,"DIV",{class:!0});var lw=i(Ur);g(Zn.$$.fragment,lw),_$=d(lw),Dh=s(lw,"P",{});var TL=i(Dh);v$=a(TL,`Setup the scheduler. The optimizer of the trainer must have been set up either before this method is called or
passed as an argument.`),TL.forEach(o),lw.forEach(o),b$=d(A),Ne=s(A,"DIV",{class:!0});var sn=i(Ne);g(Jn.$$.fragment,sn),y$=d(sn),Sh=s(sn,"P",{});var EL=i(Sh);w$=a(EL,"Run evaluation and returns metrics."),EL.forEach(o),T$=d(sn),Kn=s(sn,"P",{});var dw=i(Kn);E$=a(dw,`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Oh=s(dw,"CODE",{});var $L=i(Oh);$$=a($L,"compute_metrics"),$L.forEach(o),x$=a(dw," argument)."),dw.forEach(o),k$=d(sn),Ch=s(sn,"P",{});var xL=i(Ch);A$=a(xL,"You can also subclass and override this method to inject custom behavior."),xL.forEach(o),sn.forEach(o),q$=d(A),kt=s(A,"DIV",{class:!0});var Pp=i(kt);g(Qn.$$.fragment,Pp),P$=d(Pp),Po=s(Pp,"P",{});var Dp=i(Po);D$=a(Dp,"Prediction/evaluation loop, shared by "),Ih=s(Dp,"CODE",{});var kL=i(Ih);S$=a(kL,"Trainer.evaluate()"),kL.forEach(o),O$=a(Dp," and "),Fh=s(Dp,"CODE",{});var AL=i(Fh);C$=a(AL,"Trainer.predict()"),AL.forEach(o),I$=a(Dp,"."),Dp.forEach(o),F$=d(Pp),Uh=s(Pp,"P",{});var qL=i(Uh);U$=a(qL,"Works both with or without labels."),qL.forEach(o),Pp.forEach(o),z$=d(A),zr=s(A,"DIV",{class:!0});var cw=i(zr);g(es.$$.fragment,cw),N$=d(cw),ts=s(cw,"P",{});var pw=i(ts);L$=a(pw,"For models that inherit from "),Od=s(pw,"A",{href:!0});var PL=i(Od);j$=a(PL,"PreTrainedModel"),PL.forEach(o),R$=a(pw,`, 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.`),pw.forEach(o),cw.forEach(o),W$=d(A),At=s(A,"DIV",{class:!0});var Sp=i(At);g(os.$$.fragment,Sp),G$=d(Sp),rs=s(Sp,"P",{});var mw=i(rs);M$=a(mw,"Returns the evaluation "),zh=s(mw,"CODE",{});var DL=i(zh);H$=a(DL,"~torch.utils.data.DataLoader"),DL.forEach(o),B$=a(mw,"."),mw.forEach(o),V$=d(Sp),Nh=s(Sp,"P",{});var SL=i(Nh);Y$=a(SL,"Subclass and override this method if you want to inject some custom behavior."),SL.forEach(o),Sp.forEach(o),X$=d(A),Nr=s(A,"DIV",{class:!0});var hw=i(Nr);g(as.$$.fragment,hw),Z$=d(hw),Lh=s(hw,"P",{});var OL=i(Lh);J$=a(OL,"Returns the optimizer class and optimizer parameters based on the training arguments."),OL.forEach(o),hw.forEach(o),K$=d(A),qt=s(A,"DIV",{class:!0});var Op=i(qt);g(ns.$$.fragment,Op),Q$=d(Op),ss=s(Op,"P",{});var uw=i(ss);e3=a(uw,"Returns the test "),jh=s(uw,"CODE",{});var CL=i(jh);t3=a(CL,"~torch.utils.data.DataLoader"),CL.forEach(o),o3=a(uw,"."),uw.forEach(o),r3=d(Op),Rh=s(Op,"P",{});var IL=i(Rh);a3=a(IL,"Subclass and override this method if you want to inject some custom behavior."),IL.forEach(o),Op.forEach(o),n3=d(A),Le=s(A,"DIV",{class:!0});var ln=i(Le);g(is.$$.fragment,ln),s3=d(ln),ls=s(ln,"P",{});var fw=i(ls);i3=a(fw,"Returns the training "),Wh=s(fw,"CODE",{});var FL=i(Wh);l3=a(FL,"~torch.utils.data.DataLoader"),FL.forEach(o),d3=a(fw,"."),fw.forEach(o),c3=d(ln),Do=s(ln,"P",{});var Cp=i(Do);p3=a(Cp,"Will use no sampler if "),Gh=s(Cp,"CODE",{});var UL=i(Gh);m3=a(UL,"train_dataset"),UL.forEach(o),h3=a(Cp," does not implement "),Mh=s(Cp,"CODE",{});var zL=i(Mh);u3=a(zL,"__len__"),zL.forEach(o),f3=a(Cp,`, a random sampler (adapted to distributed
training if necessary) otherwise.`),Cp.forEach(o),g3=d(ln),Hh=s(ln,"P",{});var NL=i(Hh);_3=a(NL,"Subclass and override this method if you want to inject some custom behavior."),NL.forEach(o),ln.forEach(o),v3=d(A),Pt=s(A,"DIV",{class:!0});var Ip=i(Pt);g(ds.$$.fragment,Ip),b3=d(Ip),ke=s(Ip,"P",{});var ho=i(ke);y3=a(ho,"Launch an hyperparameter search using "),Bh=s(ho,"CODE",{});var LL=i(Bh);w3=a(LL,"optuna"),LL.forEach(o),T3=a(ho," or "),Vh=s(ho,"CODE",{});var jL=i(Vh);E3=a(jL,"Ray Tune"),jL.forEach(o),$3=a(ho," or "),Yh=s(ho,"CODE",{});var RL=i(Yh);x3=a(RL,"SigOpt"),RL.forEach(o),k3=a(ho,`. The optimized quantity is determined
by `),Xh=s(ho,"CODE",{});var WL=i(Xh);A3=a(WL,"compute_objective"),WL.forEach(o),q3=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),P3=d(Ip),g(Lr.$$.fragment,Ip),Ip.forEach(o),D3=d(A),jr=s(A,"DIV",{class:!0});var gw=i(jr);g(cs.$$.fragment,gw),S3=d(gw),ps=s(gw,"P",{});var _w=i(ps);O3=a(_w,"Initializes a git repo in "),Zh=s(_w,"CODE",{});var GL=i(Zh);C3=a(GL,"self.args.hub_model_id"),GL.forEach(o),I3=a(_w,"."),_w.forEach(o),gw.forEach(o),F3=d(A),Rr=s(A,"DIV",{class:!0});var vw=i(Rr);g(ms.$$.fragment,vw),U3=d(vw),Jh=s(vw,"P",{});var ML=i(Jh);z3=a(ML,`Whether or not this process is the local (e.g., on one machine if training in a distributed fashion on several
machines) main process.`),ML.forEach(o),vw.forEach(o),N3=d(A),Wr=s(A,"DIV",{class:!0});var bw=i(Wr);g(hs.$$.fragment,bw),L3=d(bw),us=s(bw,"P",{});var yw=i(us);j3=a(yw,`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 `),Kh=s(yw,"CODE",{});var HL=i(Kh);R3=a(HL,"True"),HL.forEach(o),W3=a(yw," for one process)."),yw.forEach(o),bw.forEach(o),G3=d(A),Dt=s(A,"DIV",{class:!0});var Fp=i(Dt);g(fs.$$.fragment,Fp),M3=d(Fp),gs=s(Fp,"P",{});var ww=i(gs);H3=a(ww,"Log "),Qh=s(ww,"CODE",{});var BL=i(Qh);B3=a(BL,"logs"),BL.forEach(o),V3=a(ww," on the various objects watching training."),ww.forEach(o),Y3=d(Fp),eu=s(Fp,"P",{});var VL=i(eu);X3=a(VL,"Subclass and override this method to inject custom behavior."),VL.forEach(o),Fp.forEach(o),Z3=d(A),F=s(A,"DIV",{class:!0});var L=i(F);g(_s.$$.fragment,L),J3=d(L),tu=s(L,"P",{});var YL=i(tu);K3=a(YL,"Log metrics in a specially formatted way"),YL.forEach(o),Q3=d(L),ou=s(L,"P",{});var XL=i(ou);ex=a(XL,"Under distributed environment this is done only for a process with rank 0."),XL.forEach(o),tx=d(L),ru=s(L,"P",{});var ZL=i(ru);ox=a(ZL,"Notes on memory reports:"),ZL.forEach(o),rx=d(L),So=s(L,"P",{});var Up=i(So);ax=a(Up,"In order to get memory usage report you need to install "),au=s(Up,"CODE",{});var JL=i(au);nx=a(JL,"psutil"),JL.forEach(o),sx=a(Up,". You can do that with "),nu=s(Up,"CODE",{});var KL=i(nu);ix=a(KL,"pip install psutil"),KL.forEach(o),lx=a(Up,"."),Up.forEach(o),dx=d(L),g(Gr.$$.fragment,L),cx=d(L),su=s(L,"P",{});var QL=i(su);iu=s(QL,"STRONG",{});var ej=i(iu);px=a(ej,"Understanding the reports:"),ej.forEach(o),QL.forEach(o),mx=d(L),dt=s(L,"UL",{});var dn=i(dt);Ae=s(dn,"LI",{});var uo=i(Ae);hx=a(uo,"the first segment, e.g., "),lu=s(uo,"CODE",{});var tj=i(lu);ux=a(tj,"train__"),tj.forEach(o),fx=a(uo,", tells you which stage the metrics are for. Reports starting with "),du=s(uo,"CODE",{});var oj=i(du);gx=a(oj,"init_"),oj.forEach(o),_x=a(uo,`
will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the
`),cu=s(uo,"CODE",{});var rj=i(cu);vx=a(rj,"__init__"),rj.forEach(o),bx=a(uo," will be reported along with the "),pu=s(uo,"CODE",{});var aj=i(pu);yx=a(aj,"eval_"),aj.forEach(o),wx=a(uo," metrics."),uo.forEach(o),Tx=d(dn),Oo=s(dn,"LI",{});var zp=i(Oo);Ex=a(zp,"the third segment, is either "),mu=s(zp,"CODE",{});var nj=i(mu);$x=a(nj,"cpu"),nj.forEach(o),xx=a(zp," or "),hu=s(zp,"CODE",{});var sj=i(hu);kx=a(sj,"gpu"),sj.forEach(o),Ax=a(zp,`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),zp.forEach(o),qx=d(dn),Cd=s(dn,"LI",{});var cN=i(Cd);uu=s(cN,"CODE",{});var ij=i(uu);Px=a(ij,"*_alloc_delta"),ij.forEach(o),Dx=a(cN,` - 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.`),cN.forEach(o),Sx=d(dn),St=s(dn,"LI",{});var cd=i(St);fu=s(cd,"CODE",{});var lj=i(fu);Ox=a(lj,"*_peaked_delta"),lj.forEach(o),Cx=a(cd,` - 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 `),gu=s(cd,"CODE",{});var dj=i(gu);Ix=a(dj,"alloc_delta"),dj.forEach(o),Fx=a(cd,` +
`),_u=s(cd,"CODE",{});var cj=i(_u);Ux=a(cj,"peaked_delta"),cj.forEach(o),zx=a(cd," and you know how much memory was needed to complete that stage."),cd.forEach(o),dn.forEach(o),Nx=d(L),vu=s(L,"P",{});var pj=i(vu);Lx=a(pj,`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.`),pj.forEach(o),jx=d(L),bu=s(L,"P",{});var mj=i(bu);Rx=a(mj,`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.`),mj.forEach(o),Wx=d(L),vs=s(L,"P",{});var Tw=i(vs);Gx=a(Tw,`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 `),yu=s(Tw,"CODE",{});var hj=i(yu);Mx=a(hj,"tracemalloc"),hj.forEach(o),Hx=a(Tw,` 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.`),Tw.forEach(o),Bx=d(L),ct=s(L,"P",{});var cn=i(ct);Vx=a(cn,"The GPU allocated and peak memory reporting is done with "),wu=s(cn,"CODE",{});var uj=i(wu);Yx=a(uj,"torch.cuda.memory_allocated()"),uj.forEach(o),Xx=a(cn,` and
`),Tu=s(cn,"CODE",{});var fj=i(Tu);Zx=a(fj,"torch.cuda.max_memory_allocated()"),fj.forEach(o),Jx=a(cn,`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),Eu=s(cn,"CODE",{});var gj=i(Eu);Kx=a(gj,"torch.cuda"),gj.forEach(o),Qx=a(cn,` 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.`),cn.forEach(o),ek=d(L),he=s(L,"P",{});var rt=i(he);tk=a(rt,"Note that this tracker doesn\u2019t account for memory allocations outside of "),Id=s(rt,"A",{href:!0});var _j=i(Id);ok=a(_j,"Trainer"),_j.forEach(o),rk=a(rt,"\u2019s "),$u=s(rt,"CODE",{});var vj=i($u);ak=a(vj,"__init__"),vj.forEach(o),nk=a(rt,", "),xu=s(rt,"CODE",{});var bj=i(xu);sk=a(bj,"train"),bj.forEach(o),ik=a(rt,`,
`),ku=s(rt,"CODE",{});var yj=i(ku);lk=a(yj,"evaluate"),yj.forEach(o),dk=a(rt," and "),Au=s(rt,"CODE",{});var wj=i(Au);ck=a(wj,"predict"),wj.forEach(o),pk=a(rt," calls."),rt.forEach(o),mk=d(L),V=s(L,"P",{});var Y=i(V);hk=a(Y,"Because "),qu=s(Y,"CODE",{});var Tj=i(qu);uk=a(Tj,"evaluation"),Tj.forEach(o),fk=a(Y," calls may happen during "),Pu=s(Y,"CODE",{});var Ej=i(Pu);gk=a(Ej,"train"),Ej.forEach(o),_k=a(Y,`, we can\u2019t handle nested invocations because
`),Du=s(Y,"CODE",{});var $j=i(Du);vk=a($j,"torch.cuda.max_memory_allocated"),$j.forEach(o),bk=a(Y," is a single counter, so if it gets reset by a nested eval call, "),Su=s(Y,"CODE",{});var xj=i(Su);yk=a(xj,"train"),xj.forEach(o),wk=a(Y,`\u2019s tracker
will report incorrect info. If this `),bs=s(Y,"A",{href:!0,rel:!0});var kj=i(bs);Tk=a(kj,"pytorch issue"),kj.forEach(o),Ek=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
`),Ou=s(Y,"CODE",{});var Aj=i(Ou);$k=a(Aj,"train"),Aj.forEach(o),xk=a(Y,", "),Cu=s(Y,"CODE",{});var qj=i(Cu);kk=a(qj,"evaluate"),qj.forEach(o),Ak=a(Y," and "),Iu=s(Y,"CODE",{});var Pj=i(Iu);qk=a(Pj,"predict"),Pj.forEach(o),Pk=a(Y," methods. Which means that if "),Fu=s(Y,"CODE",{});var Dj=i(Fu);Dk=a(Dj,"eval"),Dj.forEach(o),Sk=a(Y," is called during "),Uu=s(Y,"CODE",{});var Sj=i(Uu);Ok=a(Sj,"train"),Sj.forEach(o),Ck=a(Y,`, it\u2019s the latter
that will account for its memory usage and that of the former.`),Y.forEach(o),Ik=d(L),qe=s(L,"P",{});var fo=i(qe);Fk=a(fo,"This also means that if any other tool that is used along the "),Fd=s(fo,"A",{href:!0});var Oj=i(Fd);Uk=a(Oj,"Trainer"),Oj.forEach(o),zk=a(fo,` calls
`),zu=s(fo,"CODE",{});var Cj=i(zu);Nk=a(Cj,"torch.cuda.reset_peak_memory_stats"),Cj.forEach(o),Lk=a(fo,", the gpu peak memory stats could be invalid. And the "),Ud=s(fo,"A",{href:!0});var Ij=i(Ud);jk=a(Ij,"Trainer"),Ij.forEach(o),Rk=a(fo,` will disrupt
the normal behavior of any such tools that rely on calling `),Nu=s(fo,"CODE",{});var Fj=i(Nu);Wk=a(Fj,"torch.cuda.reset_peak_memory_stats"),Fj.forEach(o),Gk=a(fo," themselves."),fo.forEach(o),Mk=d(L),Lu=s(L,"P",{});var Uj=i(Lu);Hk=a(Uj,"For best performance you may want to consider turning the memory profiling off for production runs."),Uj.forEach(o),L.forEach(o),Bk=d(A),Mr=s(A,"DIV",{class:!0});var Ew=i(Mr);g(ys.$$.fragment,Ew),Vk=d(Ew),ju=s(Ew,"P",{});var zj=i(ju);Yk=a(zj,"Reformat Trainer metrics values to a human-readable format"),zj.forEach(o),Ew.forEach(o),Xk=d(A),Hr=s(A,"DIV",{class:!0});var $w=i(Hr);g(ws.$$.fragment,$w),Zk=d($w),Ts=s($w,"P",{});var xw=i(Ts);Jk=a(xw,"Helper to get number of samples in a "),Ru=s(xw,"CODE",{});var Nj=i(Ru);Kk=a(Nj,"~torch.utils.data.DataLoader"),Nj.forEach(o),Qk=a(xw,` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),xw.forEach(o),$w.forEach(o),eA=d(A),Ot=s(A,"DIV",{class:!0});var Np=i(Ot);g(Es.$$.fragment,Np),tA=d(Np),$s=s(Np,"P",{});var kw=i($s);oA=a(kw,"Remove a callback from the current list of "),Wu=s(kw,"CODE",{});var Lj=i(Wu);rA=a(Lj,"~transformer.TrainerCallback"),Lj.forEach(o),aA=a(kw," and returns it."),kw.forEach(o),nA=d(Np),xs=s(Np,"P",{});var Aw=i(xs);sA=a(Aw,"If the callback is not found, returns "),Gu=s(Aw,"CODE",{});var jj=i(Gu);iA=a(jj,"None"),jj.forEach(o),lA=a(Aw," (and no error is raised)."),Aw.forEach(o),Np.forEach(o),dA=d(A),le=s(A,"DIV",{class:!0});var at=i(le);g(ks.$$.fragment,at),cA=d(at),Mu=s(at,"P",{});var Rj=i(Mu);pA=a(Rj,"Run prediction and returns predictions and potential metrics."),Rj.forEach(o),mA=d(at),As=s(at,"P",{});var qw=i(As);hA=a(qw,`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 `),Hu=s(qw,"CODE",{});var Wj=i(Hu);uA=a(Wj,"evaluate()"),Wj.forEach(o),fA=a(qw,"."),qw.forEach(o),gA=d(at),g(Br.$$.fragment,at),_A=d(at),qs=s(at,"P",{});var Pw=i(qs);vA=a(Pw,"Returns: "),Bu=s(Pw,"EM",{});var Gj=i(Bu);bA=a(Gj,"NamedTuple"),Gj.forEach(o),yA=a(Pw," A namedtuple with the following keys:"),Pw.forEach(o),wA=d(at),Co=s(at,"UL",{});var Lp=i(Co);Io=s(Lp,"LI",{});var jp=i(Io);TA=a(jp,"predictions ("),Vu=s(jp,"CODE",{});var Mj=i(Vu);EA=a(Mj,"np.ndarray"),Mj.forEach(o),$A=a(jp,"): The predictions on "),Yu=s(jp,"CODE",{});var Hj=i(Yu);xA=a(Hj,"test_dataset"),Hj.forEach(o),kA=a(jp,"."),jp.forEach(o),AA=d(Lp),Fo=s(Lp,"LI",{});var Rp=i(Fo);qA=a(Rp,"label_ids ("),Xu=s(Rp,"CODE",{});var Bj=i(Xu);PA=a(Bj,"np.ndarray"),Bj.forEach(o),DA=a(Rp,", "),Zu=s(Rp,"EM",{});var Vj=i(Zu);SA=a(Vj,"optional"),Vj.forEach(o),OA=a(Rp,"): The labels (if the dataset contained some)."),Rp.forEach(o),CA=d(Lp),Uo=s(Lp,"LI",{});var Wp=i(Uo);IA=a(Wp,"metrics ("),Ju=s(Wp,"CODE",{});var Yj=i(Ju);FA=a(Yj,"Dict[str, float]"),Yj.forEach(o),UA=a(Wp,", "),Ku=s(Wp,"EM",{});var Xj=i(Ku);zA=a(Xj,"optional"),Xj.forEach(o),NA=a(Wp,`): The potential dictionary of metrics (if the dataset contained
labels).`),Wp.forEach(o),Lp.forEach(o),at.forEach(o),LA=d(A),Ct=s(A,"DIV",{class:!0});var Gp=i(Ct);g(Ps.$$.fragment,Gp),jA=d(Gp),zo=s(Gp,"P",{});var Mp=i(zo);RA=a(Mp,"Prediction/evaluation loop, shared by "),Qu=s(Mp,"CODE",{});var Zj=i(Qu);WA=a(Zj,"Trainer.evaluate()"),Zj.forEach(o),GA=a(Mp," and "),ef=s(Mp,"CODE",{});var Jj=i(ef);MA=a(Jj,"Trainer.predict()"),Jj.forEach(o),HA=a(Mp,"."),Mp.forEach(o),BA=d(Gp),tf=s(Gp,"P",{});var Kj=i(tf);VA=a(Kj,"Works both with or without labels."),Kj.forEach(o),Gp.forEach(o),YA=d(A),It=s(A,"DIV",{class:!0});var Hp=i(It);g(Ds.$$.fragment,Hp),XA=d(Hp),No=s(Hp,"P",{});var Bp=i(No);ZA=a(Bp,"Perform an evaluation step on "),of=s(Bp,"CODE",{});var Qj=i(of);JA=a(Qj,"model"),Qj.forEach(o),KA=a(Bp," using "),rf=s(Bp,"CODE",{});var eR=i(rf);QA=a(eR,"inputs"),eR.forEach(o),e9=a(Bp,"."),Bp.forEach(o),t9=d(Hp),af=s(Hp,"P",{});var tR=i(af);o9=a(tR,"Subclass and override to inject custom behavior."),tR.forEach(o),Hp.forEach(o),r9=d(A),Vr=s(A,"DIV",{class:!0});var Dw=i(Vr);g(Ss.$$.fragment,Dw),a9=d(Dw),pt=s(Dw,"P",{});var pn=i(pt);n9=a(pn,"Upload "),nf=s(pn,"EM",{});var oR=i(nf);s9=a(oR,"self.model"),oR.forEach(o),i9=a(pn," and "),sf=s(pn,"EM",{});var rR=i(sf);l9=a(rR,"self.tokenizer"),rR.forEach(o),d9=a(pn," to the \u{1F917} model hub on the repo "),lf=s(pn,"EM",{});var aR=i(lf);c9=a(aR,"self.args.hub_model_id"),aR.forEach(o),p9=a(pn,"."),pn.forEach(o),Dw.forEach(o),m9=d(A),Yr=s(A,"DIV",{class:!0});var Sw=i(Yr);g(Os.$$.fragment,Sw),h9=d(Sw),Cs=s(Sw,"P",{});var Ow=i(Cs);u9=a(Ow,"Remove a callback from the current list of "),df=s(Ow,"CODE",{});var nR=i(df);f9=a(nR,"~transformer.TrainerCallback"),nR.forEach(o),g9=a(Ow,"."),Ow.forEach(o),Sw.forEach(o),_9=d(A),je=s(A,"DIV",{class:!0});var mn=i(je);g(Is.$$.fragment,mn),v9=d(mn),Fs=s(mn,"P",{});var Cw=i(Fs);b9=a(Cw,"Save metrics into a json file for that split, e.g. "),cf=s(Cw,"CODE",{});var sR=i(cf);y9=a(sR,"train_results.json"),sR.forEach(o),w9=a(Cw,"."),Cw.forEach(o),T9=d(mn),pf=s(mn,"P",{});var iR=i(pf);E9=a(iR,"Under distributed environment this is done only for a process with rank 0."),iR.forEach(o),$9=d(mn),Us=s(mn,"P",{});var Iw=i(Us);x9=a(Iw,"To understand the metrics please read the docstring of "),zd=s(Iw,"A",{href:!0});var lR=i(zd);k9=a(lR,"log_metrics()"),lR.forEach(o),A9=a(Iw,`. The only difference is that raw
unformatted numbers are saved in the current method.`),Iw.forEach(o),mn.forEach(o),q9=d(A),Ft=s(A,"DIV",{class:!0});var Vp=i(Ft);g(zs.$$.fragment,Vp),P9=d(Vp),Ns=s(Vp,"P",{});var Fw=i(Ns);D9=a(Fw,"Will save the model, so you can reload it using "),mf=s(Fw,"CODE",{});var dR=i(mf);S9=a(dR,"from_pretrained()"),dR.forEach(o),O9=a(Fw,"."),Fw.forEach(o),C9=d(Vp),hf=s(Vp,"P",{});var cR=i(hf);I9=a(cR,"Will only save from the main process."),cR.forEach(o),Vp.forEach(o),F9=d(A),Ut=s(A,"DIV",{class:!0});var Yp=i(Ut);g(Ls.$$.fragment,Yp),U9=d(Yp),uf=s(Yp,"P",{});var pR=i(uf);z9=a(pR,"Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),pR.forEach(o),N9=d(Yp),ff=s(Yp,"P",{});var mR=i(ff);L9=a(mR,"Under distributed environment this is done only for a process with rank 0."),mR.forEach(o),Yp.forEach(o),j9=d(A),Xr=s(A,"DIV",{class:!0});var Uw=i(Xr);g(js.$$.fragment,Uw),R9=d(Uw),gf=s(Uw,"P",{});var hR=i(gf);W9=a(hR,"Main training entry point."),hR.forEach(o),Uw.forEach(o),G9=d(A),zt=s(A,"DIV",{class:!0});var Xp=i(zt);g(Rs.$$.fragment,Xp),M9=d(Xp),_f=s(Xp,"P",{});var uR=i(_f);H9=a(uR,"Perform a training step on a batch of inputs."),uR.forEach(o),B9=d(Xp),vf=s(Xp,"P",{});var fR=i(vf);V9=a(fR,"Subclass and override to inject custom behavior."),fR.forEach(o),Xp.forEach(o),A.forEach(o),G1=d(t),Lo=s(t,"H2",{class:!0});var zw=i(Lo);Zr=s(zw,"A",{id:!0,class:!0,href:!0});var gR=i(Zr);bf=s(gR,"SPAN",{});var _R=i(bf);g(Ws.$$.fragment,_R),_R.forEach(o),gR.forEach(o),Y9=d(zw),yf=s(zw,"SPAN",{});var vR=i(yf);X9=a(vR,"Seq2SeqTrainer"),vR.forEach(o),zw.forEach(o),M1=d(t),mt=s(t,"DIV",{class:!0});var Zp=i(mt);g(Gs.$$.fragment,Zp),Z9=d(Zp),Re=s(Zp,"DIV",{class:!0});var hn=i(Re);g(Ms.$$.fragment,hn),J9=d(hn),wf=s(hn,"P",{});var bR=i(wf);K9=a(bR,"Run evaluation and returns metrics."),bR.forEach(o),Q9=d(hn),Hs=s(hn,"P",{});var Nw=i(Hs);e5=a(Nw,`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Tf=s(Nw,"CODE",{});var yR=i(Tf);t5=a(yR,"compute_metrics"),yR.forEach(o),o5=a(Nw," argument)."),Nw.forEach(o),r5=d(hn),Ef=s(hn,"P",{});var wR=i(Ef);a5=a(wR,"You can also subclass and override this method to inject custom behavior."),wR.forEach(o),hn.forEach(o),n5=d(Zp),de=s(Zp,"DIV",{class:!0});var nt=i(de);g(Bs.$$.fragment,nt),s5=d(nt),$f=s(nt,"P",{});var TR=i($f);i5=a(TR,"Run prediction and returns predictions and potential metrics."),TR.forEach(o),l5=d(nt),Vs=s(nt,"P",{});var Lw=i(Vs);d5=a(Lw,`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 `),xf=s(Lw,"CODE",{});var ER=i(xf);c5=a(ER,"evaluate()"),ER.forEach(o),p5=a(Lw,"."),Lw.forEach(o),m5=d(nt),g(Jr.$$.fragment,nt),h5=d(nt),Ys=s(nt,"P",{});var jw=i(Ys);u5=a(jw,"Returns: "),kf=s(jw,"EM",{});var $R=i(kf);f5=a($R,"NamedTuple"),$R.forEach(o),g5=a(jw," A namedtuple with the following keys:"),jw.forEach(o),_5=d(nt),jo=s(nt,"UL",{});var Jp=i(jo);Ro=s(Jp,"LI",{});var Kp=i(Ro);v5=a(Kp,"predictions ("),Af=s(Kp,"CODE",{});var xR=i(Af);b5=a(xR,"np.ndarray"),xR.forEach(o),y5=a(Kp,"): The predictions on "),qf=s(Kp,"CODE",{});var kR=i(qf);w5=a(kR,"test_dataset"),kR.forEach(o),T5=a(Kp,"."),Kp.forEach(o),E5=d(Jp),Wo=s(Jp,"LI",{});var Qp=i(Wo);$5=a(Qp,"label_ids ("),Pf=s(Qp,"CODE",{});var AR=i(Pf);x5=a(AR,"np.ndarray"),AR.forEach(o),k5=a(Qp,", "),Df=s(Qp,"EM",{});var qR=i(Df);A5=a(qR,"optional"),qR.forEach(o),q5=a(Qp,"): The labels (if the dataset contained some)."),Qp.forEach(o),P5=d(Jp),Go=s(Jp,"LI",{});var em=i(Go);D5=a(em,"metrics ("),Sf=s(em,"CODE",{});var PR=i(Sf);S5=a(PR,"Dict[str, float]"),PR.forEach(o),O5=a(em,", "),Of=s(em,"EM",{});var DR=i(Of);C5=a(DR,"optional"),DR.forEach(o),I5=a(em,`): The potential dictionary of metrics (if the dataset contained
labels).`),em.forEach(o),Jp.forEach(o),nt.forEach(o),Zp.forEach(o),H1=d(t),Mo=s(t,"H2",{class:!0});var Rw=i(Mo);Kr=s(Rw,"A",{id:!0,class:!0,href:!0});var SR=i(Kr);Cf=s(SR,"SPAN",{});var OR=i(Cf);g(Xs.$$.fragment,OR),OR.forEach(o),SR.forEach(o),F5=d(Rw),If=s(Rw,"SPAN",{});var CR=i(If);U5=a(CR,"TrainingArguments"),CR.forEach(o),Rw.forEach(o),B1=d(t),S=s(t,"DIV",{class:!0});var U=i(S);g(Zs.$$.fragment,U),z5=d(U),Js=s(U,"P",{});var Ww=i(Js);N5=a(Ww,"TrainingArguments is the subset of the arguments we use in our example scripts "),Ff=s(Ww,"STRONG",{});var IR=i(Ff);L5=a(IR,`which relate to the training loop
itself`),IR.forEach(o),j5=a(Ww,"."),Ww.forEach(o),R5=d(U),Ho=s(U,"P",{});var tm=i(Ho);W5=a(tm,"Using "),Nd=s(tm,"A",{href:!0});var FR=i(Nd);G5=a(FR,"HfArgumentParser"),FR.forEach(o),M5=a(tm,` we can turn this class into
`),Ks=s(tm,"A",{href:!0,rel:!0});var UR=i(Ks);H5=a(UR,"argparse"),UR.forEach(o),B5=a(tm,` arguments that can be specified on the
command line.`),tm.forEach(o),V5=d(U),fe=s(U,"DIV",{class:!0});var go=i(fe);g(Qs.$$.fragment,go),Y5=d(go),Uf=s(go,"P",{});var zR=i(Uf);X5=a(zR,`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.`),zR.forEach(o),Z5=d(go),Bo=s(go,"P",{});var om=i(Bo);J5=a(om,"For the main process the log level defaults to the logging level set ("),zf=s(om,"CODE",{});var NR=i(zf);K5=a(NR,"logging.WARNING"),NR.forEach(o),Q5=a(om,` if you didn\u2019t do
anything) unless overridden by `),Nf=s(om,"CODE",{});var LR=i(Nf);eq=a(LR,"log_level"),LR.forEach(o),tq=a(om," argument."),om.forEach(o),oq=d(go),Vo=s(go,"P",{});var rm=i(Vo);rq=a(rm,"For the replica processes the log level defaults to "),Lf=s(rm,"CODE",{});var jR=i(Lf);aq=a(jR,"logging.WARNING"),jR.forEach(o),nq=a(rm," unless overridden by "),jf=s(rm,"CODE",{});var RR=i(jf);sq=a(RR,"log_level_replica"),RR.forEach(o),iq=a(rm,`
argument.`),rm.forEach(o),lq=d(go),ei=s(go,"P",{});var Gw=i(ei);dq=a(Gw,"The choice between the main and replica process settings is made according to the return value of "),Rf=s(Gw,"CODE",{});var WR=i(Rf);cq=a(WR,"should_log"),WR.forEach(o),pq=a(Gw,"."),Gw.forEach(o),go.forEach(o),mq=d(U),Qr=s(U,"DIV",{class:!0});var Mw=i(Qr);g(ti.$$.fragment,Mw),hq=d(Mw),Wf=s(Mw,"P",{});var GR=i(Wf);uq=a(GR,"Get number of steps used for a linear warmup."),GR.forEach(o),Mw.forEach(o),fq=d(U),Nt=s(U,"DIV",{class:!0});var am=i(Nt);g(oi.$$.fragment,am),gq=d(am),Gf=s(am,"P",{});var MR=i(Gf);_q=a(MR,`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.`),MR.forEach(o),vq=d(am),Yo=s(am,"P",{});var nm=i(Yo);bq=a(nm,"One such use is for "),Mf=s(nm,"CODE",{});var HR=i(Mf);yq=a(HR,"datasets"),HR.forEach(o),wq=a(nm,"\u2019s "),Hf=s(nm,"CODE",{});var BR=i(Hf);Tq=a(BR,"map"),BR.forEach(o),Eq=a(nm,` 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.`),nm.forEach(o),am.forEach(o),$q=d(U),Lt=s(U,"DIV",{class:!0});var sm=i(Lt);g(ri.$$.fragment,sm),xq=d(sm),Bf=s(sm,"P",{});var VR=i(Bf);kq=a(VR,"A method that regroups all arguments linked to the dataloaders creation."),VR.forEach(o),Aq=d(sm),g(ea.$$.fragment,sm),sm.forEach(o),qq=d(U),jt=s(U,"DIV",{class:!0});var im=i(jt);g(ai.$$.fragment,im),Pq=d(im),Vf=s(im,"P",{});var YR=i(Vf);Dq=a(YR,"A method that regroups all arguments linked to the evaluation."),YR.forEach(o),Sq=d(im),g(ta.$$.fragment,im),im.forEach(o),Oq=d(U),Rt=s(U,"DIV",{class:!0});var lm=i(Rt);g(ni.$$.fragment,lm),Cq=d(lm),Yf=s(lm,"P",{});var XR=i(Yf);Iq=a(XR,"A method that regroups all arguments linked to the evaluation."),XR.forEach(o),Fq=d(lm),g(oa.$$.fragment,lm),lm.forEach(o),Uq=d(U),Wt=s(U,"DIV",{class:!0});var dm=i(Wt);g(si.$$.fragment,dm),zq=d(dm),Xf=s(dm,"P",{});var ZR=i(Xf);Nq=a(ZR,"A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters."),ZR.forEach(o),Lq=d(dm),g(ra.$$.fragment,dm),dm.forEach(o),jq=d(U),Gt=s(U,"DIV",{class:!0});var cm=i(Gt);g(ii.$$.fragment,cm),Rq=d(cm),Zf=s(cm,"P",{});var JR=i(Zf);Wq=a(JR,"A method that regroups all arguments linked to the optimizer and its hyperparameters."),JR.forEach(o),Gq=d(cm),g(aa.$$.fragment,cm),cm.forEach(o),Mq=d(U),We=s(U,"DIV",{class:!0});var un=i(We);g(li.$$.fragment,un),Hq=d(un),Jf=s(un,"P",{});var KR=i(Jf);Bq=a(KR,"A method that regroups all arguments linked to synchronizing checkpoints with the Hub."),KR.forEach(o),Vq=d(un),g(na.$$.fragment,un),Yq=d(un),g(sa.$$.fragment,un),un.forEach(o),Xq=d(U),Mt=s(U,"DIV",{class:!0});var pm=i(Mt);g(di.$$.fragment,pm),Zq=d(pm),Kf=s(pm,"P",{});var QR=i(Kf);Jq=a(QR,"A method that regroups all arguments linked to the evaluation."),QR.forEach(o),Kq=d(pm),g(ia.$$.fragment,pm),pm.forEach(o),Qq=d(U),Ge=s(U,"DIV",{class:!0});var fn=i(Ge);g(ci.$$.fragment,fn),eP=d(fn),Qf=s(fn,"P",{});var eW=i(Qf);tP=a(eW,"A method that regroups all basic arguments linked to testing on a held-out dataset."),eW.forEach(o),oP=d(fn),g(la.$$.fragment,fn),rP=d(fn),g(da.$$.fragment,fn),fn.forEach(o),aP=d(U),Me=s(U,"DIV",{class:!0});var gn=i(Me);g(pi.$$.fragment,gn),nP=d(gn),eg=s(gn,"P",{});var tW=i(eg);sP=a(tW,"A method that regroups all basic arguments linked to the training."),tW.forEach(o),iP=d(gn),g(ca.$$.fragment,gn),lP=d(gn),g(pa.$$.fragment,gn),gn.forEach(o),dP=d(U),ma=s(U,"DIV",{class:!0});var Hw=i(ma);g(mi.$$.fragment,Hw),cP=d(Hw),hi=s(Hw,"P",{});var Bw=i(hi);pP=a(Bw,"Serializes this instance while replace "),tg=s(Bw,"CODE",{});var oW=i(tg);mP=a(oW,"Enum"),oW.forEach(o),hP=a(Bw,` by their values (for JSON serialization support). It obfuscates
the token values by removing their value.`),Bw.forEach(o),Hw.forEach(o),uP=d(U),ha=s(U,"DIV",{class:!0});var Vw=i(ha);g(ui.$$.fragment,Vw),fP=d(Vw),og=s(Vw,"P",{});var rW=i(og);gP=a(rW,"Serializes this instance to a JSON string."),rW.forEach(o),Vw.forEach(o),_P=d(U),ua=s(U,"DIV",{class:!0});var Yw=i(ua);g(fi.$$.fragment,Yw),vP=d(Yw),rg=s(Yw,"P",{});var aW=i(rg);bP=a(aW,"Sanitized serialization to use with TensorBoard\u2019s hparams"),aW.forEach(o),Yw.forEach(o),U.forEach(o),V1=d(t),Xo=s(t,"H2",{class:!0});var Xw=i(Xo);fa=s(Xw,"A",{id:!0,class:!0,href:!0});var nW=i(fa);ag=s(nW,"SPAN",{});var sW=i(ag);g(gi.$$.fragment,sW),sW.forEach(o),nW.forEach(o),yP=d(Xw),ng=s(Xw,"SPAN",{});var iW=i(ng);wP=a(iW,"Seq2SeqTrainingArguments"),iW.forEach(o),Xw.forEach(o),Y1=d(t),Pe=s(t,"DIV",{class:!0});var _n=i(Pe);g(_i.$$.fragment,_n),TP=d(_n),vi=s(_n,"P",{});var Zw=i(vi);EP=a(Zw,"TrainingArguments is the subset of the arguments we use in our example scripts "),sg=s(Zw,"STRONG",{});var lW=i(sg);$P=a(lW,`which relate to the training loop
itself`),lW.forEach(o),xP=a(Zw,"."),Zw.forEach(o),kP=d(_n),Zo=s(_n,"P",{});var mm=i(Zo);AP=a(mm,"Using "),Ld=s(mm,"A",{href:!0});var dW=i(Ld);qP=a(dW,"HfArgumentParser"),dW.forEach(o),PP=a(mm,` we can turn this class into
`),bi=s(mm,"A",{href:!0,rel:!0});var cW=i(bi);DP=a(cW,"argparse"),cW.forEach(o),SP=a(mm,` arguments that can be specified on the
command line.`),mm.forEach(o),OP=d(_n),ga=s(_n,"DIV",{class:!0});var Jw=i(ga);g(yi.$$.fragment,Jw),CP=d(Jw),Jo=s(Jw,"P",{});var hm=i(Jo);IP=a(hm,"Serializes this instance while replace "),ig=s(hm,"CODE",{});var pW=i(ig);FP=a(pW,"Enum"),pW.forEach(o),UP=a(hm," by their values and "),lg=s(hm,"CODE",{});var mW=i(lg);zP=a(mW,"GenerationConfig"),mW.forEach(o),NP=a(hm,` by dictionaries (for JSON
serialization support). It obfuscates the token values by removing their value.`),hm.forEach(o),Jw.forEach(o),_n.forEach(o),X1=d(t),Ko=s(t,"H2",{class:!0});var Kw=i(Ko);_a=s(Kw,"A",{id:!0,class:!0,href:!0});var hW=i(_a);dg=s(hW,"SPAN",{});var uW=i(dg);g(wi.$$.fragment,uW),uW.forEach(o),hW.forEach(o),LP=d(Kw),cg=s(Kw,"SPAN",{});var fW=i(cg);jP=a(fW,"Checkpoints"),fW.forEach(o),Kw.forEach(o),Z1=d(t),ge=s(t,"P",{});var _o=i(ge);RP=a(_o,"By default, "),jd=s(_o,"A",{href:!0});var gW=i(jd);WP=a(gW,"Trainer"),gW.forEach(o),GP=a(_o," will save all checkpoints in the "),pg=s(_o,"CODE",{});var _W=i(pg);MP=a(_W,"output_dir"),_W.forEach(o),HP=a(_o,` you set in the
`),Rd=s(_o,"A",{href:!0});var vW=i(Rd);BP=a(vW,"TrainingArguments"),vW.forEach(o),VP=a(_o," you are using. Those will go in subfolder named "),mg=s(_o,"CODE",{});var bW=i(mg);YP=a(bW,"checkpoint-xxx"),bW.forEach(o),XP=a(_o,` with xxx
being the step at which the training was at.`),_o.forEach(o),J1=d(t),va=s(t,"P",{});var Qw=i(va);ZP=a(Qw,"Resuming training from a checkpoint can be done when calling "),Wd=s(Qw,"A",{href:!0});var yW=i(Wd);JP=a(yW,"Trainer.train()"),yW.forEach(o),KP=a(Qw," with either:"),Qw.forEach(o),K1=d(t),ba=s(t,"UL",{});var eT=i(ba);Gd=s(eT,"LI",{});var pN=i(Gd);hg=s(pN,"CODE",{});var wW=i(hg);QP=a(wW,"resume_from_checkpoint=True"),wW.forEach(o),e6=a(pN," which will resume training from the latest checkpoint"),pN.forEach(o),t6=d(eT),Md=s(eT,"LI",{});var mN=i(Md);ug=s(mN,"CODE",{});var TW=i(ug);o6=a(TW,"resume_from_checkpoint=checkpoint_dir"),TW.forEach(o),r6=a(mN,` which will resume training from the specific checkpoint in the directory
passed.`),mN.forEach(o),eT.forEach(o),Q1=d(t),He=s(t,"P",{});var vn=i(He);a6=a(vn,"In addition, you can easily save your checkpoints on the Model Hub when using "),fg=s(vn,"CODE",{});var EW=i(fg);n6=a(EW,"push_to_hub=True"),EW.forEach(o),s6=a(vn,`. By default, all
the models saved in intermediate checkpoints are saved in different commits, but not the optimizer state. You can adapt
the `),gg=s(vn,"CODE",{});var $W=i(gg);i6=a($W,"hub-strategy"),$W.forEach(o),l6=a(vn," value of your "),Hd=s(vn,"A",{href:!0});var xW=i(Hd);d6=a(xW,"TrainingArguments"),xW.forEach(o),c6=a(vn," to either:"),vn.forEach(o),ey=d(t),ya=s(t,"UL",{});var tT=i(ya);wa=s(tT,"LI",{});var P1=i(wa);_g=s(P1,"CODE",{});var kW=i(_g);p6=a(kW,'"checkpoint"'),kW.forEach(o),m6=a(P1,`: the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to
resume training easily with `),vg=s(P1,"CODE",{});var AW=i(vg);h6=a(AW,'trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")'),AW.forEach(o),u6=a(P1,"."),P1.forEach(o),f6=d(tT),Bd=s(tT,"LI",{});var hN=i(Bd);bg=s(hN,"CODE",{});var qW=i(bg);g6=a(qW,'"all_checkpoints"'),qW.forEach(o),_6=a(hN,`: all checkpoints are pushed like they appear in the output folder (so you will get one
checkpoint folder per folder in your final repository)`),hN.forEach(o),tT.forEach(o),ty=d(t),Qo=s(t,"H2",{class:!0});var oT=i(Qo);Ta=s(oT,"A",{id:!0,class:!0,href:!0});var PW=i(Ta);yg=s(PW,"SPAN",{});var DW=i(yg);g(Ti.$$.fragment,DW),DW.forEach(o),PW.forEach(o),v6=d(oT),wg=s(oT,"SPAN",{});var SW=i(wg);b6=a(SW,"Logging"),SW.forEach(o),oT.forEach(o),oy=d(t),Be=s(t,"P",{});var bn=i(Be);y6=a(bn,"By default "),Vd=s(bn,"A",{href:!0});var OW=i(Vd);w6=a(OW,"Trainer"),OW.forEach(o),T6=a(bn," will use "),Tg=s(bn,"CODE",{});var CW=i(Tg);E6=a(CW,"logging.INFO"),CW.forEach(o),$6=a(bn," for the main process and "),Eg=s(bn,"CODE",{});var IW=i(Eg);x6=a(IW,"logging.WARNING"),IW.forEach(o),k6=a(bn," for the replicas if any."),bn.forEach(o),ry=d(t),Ht=s(t,"P",{});var um=i(Ht);A6=a(um,"These defaults can be overridden to use any of the 5 "),$g=s(um,"CODE",{});var FW=i($g);q6=a(FW,"logging"),FW.forEach(o),P6=a(um," levels with "),Yd=s(um,"A",{href:!0});var UW=i(Yd);D6=a(UW,"TrainingArguments"),UW.forEach(o),S6=a(um,`\u2019s
arguments:`),um.forEach(o),ay=d(t),Ea=s(t,"UL",{});var rT=i(Ea);Xd=s(rT,"LI",{});var uN=i(Xd);xg=s(uN,"CODE",{});var zW=i(xg);O6=a(zW,"log_level"),zW.forEach(o),C6=a(uN," - for the main process"),uN.forEach(o),I6=d(rT),Zd=s(rT,"LI",{});var fN=i(Zd);kg=s(fN,"CODE",{});var NW=i(kg);F6=a(NW,"log_level_replica"),NW.forEach(o),U6=a(fN," - for the replicas"),fN.forEach(o),rT.forEach(o),ny=d(t),Ve=s(t,"P",{});var yn=i(Ve);z6=a(yn,"Further, if "),Jd=s(yn,"A",{href:!0});var LW=i(Jd);N6=a(LW,"TrainingArguments"),LW.forEach(o),L6=a(yn,"\u2019s "),Ag=s(yn,"CODE",{});var jW=i(Ag);j6=a(jW,"log_on_each_node"),jW.forEach(o),R6=a(yn," is set to "),qg=s(yn,"CODE",{});var RW=i(qg);W6=a(RW,"False"),RW.forEach(o),G6=a(yn,` 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.`),yn.forEach(o),sy=d(t),ce=s(t,"P",{});var st=i(ce);M6=a(st,"Note that "),Kd=s(st,"A",{href:!0});var WW=i(Kd);H6=a(WW,"Trainer"),WW.forEach(o),B6=a(st," is going to set "),Pg=s(st,"CODE",{});var GW=i(Pg);V6=a(GW,"transformers"),GW.forEach(o),Y6=a(st,`\u2019s log level separately for each node in its
`),Dg=s(st,"CODE",{});var MW=i(Dg);X6=a(MW,"Trainer.__init__()"),MW.forEach(o),Z6=a(st,`. So you may want to set this sooner (see the next example) if you tap into other
`),Sg=s(st,"CODE",{});var HW=i(Sg);J6=a(HW,"transformers"),HW.forEach(o),K6=a(st," functionality before creating the "),Qd=s(st,"A",{href:!0});var BW=i(Qd);Q6=a(BW,"Trainer"),BW.forEach(o),eD=a(st," object."),st.forEach(o),iy=d(t),ec=s(t,"P",{});var VW=i(ec);tD=a(VW,"Here is an example of how this can be used in an application:"),VW.forEach(o),ly=d(t),g(Ei.$$.fragment,t),dy=d(t),tc=s(t,"P",{});var YW=i(tc);oD=a(YW,`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:`),YW.forEach(o),cy=d(t),g($i.$$.fragment,t),py=d(t),oc=s(t,"P",{});var XW=i(oc);rD=a(XW,`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:`),XW.forEach(o),my=d(t),g(xi.$$.fragment,t),hy=d(t),rc=s(t,"P",{});var ZW=i(rc);aD=a(ZW,`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.`),ZW.forEach(o),uy=d(t),ac=s(t,"P",{});var JW=i(ac);nD=a(JW,"If you need your application to be as quiet as possible you could do:"),JW.forEach(o),fy=d(t),g(ki.$$.fragment,t),gy=d(t),$a=s(t,"P",{});var aT=i($a);sD=a(aT,"(add "),Og=s(aT,"CODE",{});var KW=i(Og);iD=a(KW,"--log_on_each_node 0"),KW.forEach(o),lD=a(aT," if on multi-node environment)"),aT.forEach(o),_y=d(t),er=s(t,"H2",{class:!0});var nT=i(er);xa=s(nT,"A",{id:!0,class:!0,href:!0});var QW=i(xa);Cg=s(QW,"SPAN",{});var eG=i(Cg);g(Ai.$$.fragment,eG),eG.forEach(o),QW.forEach(o),dD=d(nT),Ig=s(nT,"SPAN",{});var tG=i(Ig);cD=a(tG,"Randomness"),tG.forEach(o),nT.forEach(o),vy=d(t),_e=s(t,"P",{});var vo=i(_e);pD=a(vo,"When resuming from a checkpoint generated by "),nc=s(vo,"A",{href:!0});var oG=i(nc);mD=a(oG,"Trainer"),oG.forEach(o),hD=a(vo,` all efforts are made to restore the
`),Fg=s(vo,"EM",{});var rG=i(Fg);uD=a(rG,"python"),rG.forEach(o),fD=a(vo,", "),Ug=s(vo,"EM",{});var aG=i(Ug);gD=a(aG,"numpy"),aG.forEach(o),_D=a(vo," and "),zg=s(vo,"EM",{});var nG=i(zg);vD=a(nG,"pytorch"),nG.forEach(o),bD=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),by=d(t),Bt=s(t,"P",{});var fm=i(Bt);yD=a(fm,`However, due to various default non-deterministic pytorch settings this might not fully work. If you want full
determinism please refer to `),qi=s(fm,"A",{href:!0,rel:!0});var sG=i(qi);wD=a(sG,"Controlling sources of randomness"),sG.forEach(o),TD=a(fm,`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),Ng=s(fm,"CODE",{});var iG=i(Ng);ED=a(iG,"torch.backends.cudnn.deterministic"),iG.forEach(o),$D=a(fm,`) may slow things down, therefore this
can\u2019t be done by default, but you can enable those yourself if needed.`),fm.forEach(o),yy=d(t),tr=s(t,"H2",{class:!0});var sT=i(tr);ka=s(sT,"A",{id:!0,class:!0,href:!0});var lG=i(ka);Lg=s(lG,"SPAN",{});var dG=i(Lg);g(Pi.$$.fragment,dG),dG.forEach(o),lG.forEach(o),xD=d(sT),jg=s(sT,"SPAN",{});var cG=i(jg);kD=a(cG,"Specific GPUs Selection"),cG.forEach(o),sT.forEach(o),wy=d(t),sc=s(t,"P",{});var pG=i(sc);AD=a(pG,"Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),pG.forEach(o),Ty=d(t),Aa=s(t,"P",{});var iT=i(Aa);qD=a(iT,"When using "),Di=s(iT,"A",{href:!0,rel:!0});var mG=i(Di);Rg=s(mG,"CODE",{});var hG=i(Rg);PD=a(hG,"DistributedDataParallel"),hG.forEach(o),mG.forEach(o),DD=a(iT," 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:"),iT.forEach(o),Ey=d(t),g(Si.$$.fragment,t),$y=d(t),Vt=s(t,"P",{});var gm=i(Vt);SD=a(gm,"if you have either "),Oi=s(gm,"A",{href:!0,rel:!0});var uG=i(Oi);Wg=s(uG,"CODE",{});var fG=i(Wg);OD=a(fG,"accelerate"),fG.forEach(o),uG.forEach(o),CD=a(gm," or "),Ci=s(gm,"A",{href:!0,rel:!0});var gG=i(Ci);Gg=s(gG,"CODE",{});var _G=i(Gg);ID=a(_G,"deepspeed"),_G.forEach(o),gG.forEach(o),FD=a(gm," installed you can also accomplish the same by using one of:"),gm.forEach(o),xy=d(t),g(Ii.$$.fragment,t),ky=d(t),g(Fi.$$.fragment,t),Ay=d(t),qa=s(t,"P",{});var lT=i(qa);UD=a(lT,"You don\u2019t need to use the Accelerate or "),ic=s(lT,"A",{href:!0});var vG=i(ic);zD=a(vG,"the Deepspeed integration"),vG.forEach(o),ND=a(lT," features to use these launchers."),lT.forEach(o),qy=d(t),lc=s(t,"P",{});var bG=i(lc);LD=a(bG,"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."),bG.forEach(o),Py=d(t),dc=s(t,"P",{});var yG=i(dc);jD=a(yG,"The following environment variables help you control which GPUs to use and their order."),yG.forEach(o),Dy=d(t),cc=s(t,"P",{});var wG=i(cc);Mg=s(wG,"STRONG",{});var TG=i(Mg);Hg=s(TG,"CODE",{});var EG=i(Hg);RD=a(EG,"CUDA_VISIBLE_DEVICES"),EG.forEach(o),TG.forEach(o),wG.forEach(o),Sy=d(t),Pa=s(t,"P",{});var dT=i(Pa);WD=a(dT,"If you have multiple GPUs and you\u2019d like to use only 1 or a few of those GPUs, set the environment variable "),Bg=s(dT,"CODE",{});var $G=i(Bg);GD=a($G,"CUDA_VISIBLE_DEVICES"),$G.forEach(o),MD=a(dT," to a list of the GPUs to be used."),dT.forEach(o),Oy=d(t),pc=s(t,"P",{});var xG=i(pc);HD=a(xG,"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:"),xG.forEach(o),Cy=d(t),g(Ui.$$.fragment,t),Iy=d(t),Yt=s(t,"P",{});var _m=i(Yt);BD=a(_m,"So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),Vg=s(_m,"CODE",{});var kG=i(Vg);VD=a(kG,"cuda:0"),kG.forEach(o),YD=a(_m," and "),Yg=s(_m,"CODE",{});var AG=i(Yg);XD=a(AG,"cuda:1"),AG.forEach(o),ZD=a(_m," correspondingly."),_m.forEach(o),Fy=d(t),mc=s(t,"P",{});var qG=i(mc);JD=a(qG,"You can even change their order:"),qG.forEach(o),Uy=d(t),g(zi.$$.fragment,t),zy=d(t),Xt=s(t,"P",{});var vm=i(Xt);KD=a(vm,"Here your physical GPUs 0 and 2 are mapped to "),Xg=s(vm,"CODE",{});var PG=i(Xg);QD=a(PG,"cuda:1"),PG.forEach(o),e8=a(vm," and "),Zg=s(vm,"CODE",{});var DG=i(Zg);t8=a(DG,"cuda:0"),DG.forEach(o),o8=a(vm," correspondingly."),vm.forEach(o),Ny=d(t),Zt=s(t,"P",{});var bm=i(Zt);r8=a(bm,"The above examples were all for "),Jg=s(bm,"CODE",{});var SG=i(Jg);a8=a(SG,"DistributedDataParallel"),SG.forEach(o),n8=a(bm," use pattern, but the same method works for "),Ni=s(bm,"A",{href:!0,rel:!0});var OG=i(Ni);Kg=s(OG,"CODE",{});var CG=i(Kg);s8=a(CG,"DataParallel"),CG.forEach(o),OG.forEach(o),i8=a(bm," as well:"),bm.forEach(o),Ly=d(t),g(Li.$$.fragment,t),jy=d(t),hc=s(t,"P",{});var IG=i(hc);l8=a(IG,"To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),IG.forEach(o),Ry=d(t),g(ji.$$.fragment,t),Wy=d(t),uc=s(t,"P",{});var FG=i(uc);d8=a(FG,"As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),FG.forEach(o),Gy=d(t),g(Ri.$$.fragment,t),My=d(t),fc=s(t,"P",{});var UG=i(fc);c8=a(UG,"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."),UG.forEach(o),Hy=d(t),gc=s(t,"P",{});var zG=i(gc);Qg=s(zG,"STRONG",{});var NG=i(Qg);e_=s(NG,"CODE",{});var LG=i(e_);p8=a(LG,"CUDA_DEVICE_ORDER"),LG.forEach(o),NG.forEach(o),zG.forEach(o),By=d(t),Da=s(t,"P",{});var cT=i(Da);m8=a(cT,"There is an additional environment variable "),t_=s(cT,"CODE",{});var jG=i(t_);h8=a(jG,"CUDA_DEVICE_ORDER"),jG.forEach(o),u8=a(cT," that controls how the physical devices are ordered. The two choices are:"),cT.forEach(o),Vy=d(t),_c=s(t,"OL",{});var RG=i(_c);Wi=s(RG,"LI",{});var pT=i(Wi);f8=a(pT,"ordered by PCIe bus IDs (matches "),o_=s(pT,"CODE",{});var WG=i(o_);g8=a(WG,"nvidia-smi"),WG.forEach(o),_8=a(pT,"\u2019s order) - this is the default."),pT.forEach(o),RG.forEach(o),Yy=d(t),g(Gi.$$.fragment,t),Xy=d(t),Mi=s(t,"OL",{start:!0});var GG=i(Mi);r_=s(GG,"LI",{});var MG=i(r_);v8=a(MG,"ordered by GPU compute capabilities"),MG.forEach(o),GG.forEach(o),Zy=d(t),g(Hi.$$.fragment,t),Jy=d(t),Jt=s(t,"P",{});var ym=i(Jt);b8=a(ym,"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 "),a_=s(ym,"CODE",{});var HG=i(a_);y8=a(HG,"CUDA_DEVICE_ORDER=FASTEST_FIRST"),HG.forEach(o),w8=a(ym," will always put the newer faster card first. It\u2019ll be somewhat confusing though since "),n_=s(ym,"CODE",{});var BG=i(n_);T8=a(BG,"nvidia-smi"),BG.forEach(o),E8=a(ym," will still report them in the PCIe order."),ym.forEach(o),Ky=d(t),vc=s(t,"P",{});var VG=i(vc);$8=a(VG,"The other solution to swapping the order is to use:"),VG.forEach(o),Qy=d(t),g(Bi.$$.fragment,t),e2=d(t),bc=s(t,"P",{});var YG=i(bc);x8=a(YG,"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."),YG.forEach(o),t2=d(t),Sa=s(t,"P",{});var mT=i(Sa);k8=a(mT,"Also if you do set this environment variable it\u2019s the best to set it in your "),s_=s(mT,"CODE",{});var XG=i(s_);A8=a(XG,"~/.bashrc"),XG.forEach(o),q8=a(mT," file or some other startup config file and forget about it."),mT.forEach(o),o2=d(t),or=s(t,"H2",{class:!0});var hT=i(or);Oa=s(hT,"A",{id:!0,class:!0,href:!0});var ZG=i(Oa);i_=s(ZG,"SPAN",{});var JG=i(i_);g(Vi.$$.fragment,JG),JG.forEach(o),ZG.forEach(o),P8=d(hT),l_=s(hT,"SPAN",{});var KG=i(l_);D8=a(KG,"Trainer Integrations"),KG.forEach(o),hT.forEach(o),r2=d(t),Ca=s(t,"P",{});var uT=i(Ca);S8=a(uT,"The "),yc=s(uT,"A",{href:!0});var QG=i(yc);O8=a(QG,"Trainer"),QG.forEach(o),C8=a(uT,` has been extended to support libraries that may dramatically improve your training
time and fit much bigger models.`),uT.forEach(o),a2=d(t),ve=s(t,"P",{});var bo=i(ve);I8=a(bo,"Currently it supports third party solutions, "),Yi=s(bo,"A",{href:!0,rel:!0});var eM=i(Yi);F8=a(eM,"DeepSpeed"),eM.forEach(o),U8=a(bo,", "),Xi=s(bo,"A",{href:!0,rel:!0});var tM=i(Xi);z8=a(tM,"PyTorch FSDP"),tM.forEach(o),N8=a(bo," and "),Zi=s(bo,"A",{href:!0,rel:!0});var oM=i(Zi);L8=a(oM,"FairScale"),oM.forEach(o),j8=a(bo,", which implement parts of the paper "),Ji=s(bo,"A",{href:!0,rel:!0});var rM=i(Ji);R8=a(rM,`ZeRO: Memory Optimizations
Toward Training Trillion Parameter Models, by Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, Yuxiong He`),rM.forEach(o),W8=a(bo,"."),bo.forEach(o),n2=d(t),Ia=s(t,"P",{});var fT=i(Ia);G8=a(fT,"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 "),wc=s(fT,"A",{href:!0});var aM=i(wc);M8=a(aM,"PyTorch FSDP integration"),aM.forEach(o),H8=a(fT,")"),fT.forEach(o),s2=d(t),Tc=s(t,"A",{id:!0}),i(Tc).forEach(o),i2=d(t),rr=s(t,"H3",{class:!0});var gT=i(rr);Fa=s(gT,"A",{id:!0,class:!0,href:!0});var nM=i(Fa);d_=s(nM,"SPAN",{});var sM=i(d_);g(Ki.$$.fragment,sM),sM.forEach(o),nM.forEach(o),B8=d(gT),c_=s(gT,"SPAN",{});var iM=i(c_);V8=a(iM,"CUDA Extension Installation Notes"),iM.forEach(o),gT.forEach(o),l2=d(t),Ec=s(t,"P",{});var lM=i(Ec);Y8=a(lM,"As of this writing, both FairScale and Deepspeed require compilation of CUDA C++ code, before they can be used."),lM.forEach(o),d2=d(t),Kt=s(t,"P",{});var wm=i(Kt);X8=a(wm,"While all installation issues should be dealt with through the corresponding GitHub Issues of "),Qi=s(wm,"A",{href:!0,rel:!0});var dM=i(Qi);Z8=a(dM,"FairScale"),dM.forEach(o),J8=a(wm," and "),el=s(wm,"A",{href:!0,rel:!0});var cM=i(el);K8=a(cM,"Deepspeed"),cM.forEach(o),Q8=a(wm,`, there are a few common issues that one may encounter while building
any PyTorch extension that needs to build CUDA extensions.`),wm.forEach(o),c2=d(t),$c=s(t,"P",{});var pM=i($c);eS=a(pM,"Therefore, if you encounter a CUDA-related build issue while doing one of the following or both:"),pM.forEach(o),p2=d(t),g(tl.$$.fragment,t),m2=d(t),xc=s(t,"P",{});var mM=i(xc);tS=a(mM,"please, read the following notes first."),mM.forEach(o),h2=d(t),Qt=s(t,"P",{});var Tm=i(Qt);oS=a(Tm,"In these notes we give examples for what to do when "),p_=s(Tm,"CODE",{});var hM=i(p_);rS=a(hM,"pytorch"),hM.forEach(o),aS=a(Tm," has been built with CUDA "),m_=s(Tm,"CODE",{});var uM=i(m_);nS=a(uM,"10.2"),uM.forEach(o),sS=a(Tm,`. If your situation is
different remember to adjust the version number to the one you are after.`),Tm.forEach(o),u2=d(t),ar=s(t,"H4",{class:!0});var _T=i(ar);Ua=s(_T,"A",{id:!0,class:!0,href:!0});var fM=i(Ua);h_=s(fM,"SPAN",{});var gM=i(h_);g(ol.$$.fragment,gM),gM.forEach(o),fM.forEach(o),iS=d(_T),u_=s(_T,"SPAN",{});var _M=i(u_);lS=a(_M,"Possible problem #1"),_M.forEach(o),_T.forEach(o),f2=d(t),kc=s(t,"P",{});var vM=i(kc);dS=a(vM,`While, Pytorch comes with its own CUDA toolkit, to build these two projects you must have an identical version of CUDA
installed system-wide.`),vM.forEach(o),g2=d(t),Ye=s(t,"P",{});var wn=i(Ye);cS=a(wn,"For example, if you installed "),f_=s(wn,"CODE",{});var bM=i(f_);pS=a(bM,"pytorch"),bM.forEach(o),mS=a(wn," with "),g_=s(wn,"CODE",{});var yM=i(g_);hS=a(yM,"cudatoolkit==10.2"),yM.forEach(o),uS=a(wn,` in the Python environment, you also need to have
CUDA `),__=s(wn,"CODE",{});var wM=i(__);fS=a(wM,"10.2"),wM.forEach(o),gS=a(wn," installed system-wide."),wn.forEach(o),_2=d(t),eo=s(t,"P",{});var Em=i(eo);_S=a(Em,"The exact location may vary from system to system, but "),v_=s(Em,"CODE",{});var TM=i(v_);vS=a(TM,"/usr/local/cuda-10.2"),TM.forEach(o),bS=a(Em,` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),b_=s(Em,"CODE",{});var EM=i(b_);yS=a(EM,"PATH"),EM.forEach(o),wS=a(Em,` environment variable, one can find the
installation location by doing:`),Em.forEach(o),v2=d(t),g(rl.$$.fragment,t),b2=d(t),za=s(t,"P",{});var vT=i(za);TS=a(vT,`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: `),al=s(vT,"A",{href:!0,rel:!0});var $M=i(al);ES=a($M,"ubuntu cuda 10.2 install"),$M.forEach(o),$S=a(vT,"."),vT.forEach(o),y2=d(t),nr=s(t,"H4",{class:!0});var bT=i(nr);Na=s(bT,"A",{id:!0,class:!0,href:!0});var xM=i(Na);y_=s(xM,"SPAN",{});var kM=i(y_);g(nl.$$.fragment,kM),kM.forEach(o),xM.forEach(o),xS=d(bT),w_=s(bT,"SPAN",{});var AM=i(w_);kS=a(AM,"Possible problem #2"),AM.forEach(o),bT.forEach(o),w2=d(t),Ac=s(t,"P",{});var qM=i(Ac);AS=a(qM,`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),qM.forEach(o),T2=d(t),g(sl.$$.fragment,t),E2=d(t),to=s(t,"P",{});var $m=i(to);qS=a($m,"Now, in this situation you need to make sure that your "),T_=s($m,"CODE",{});var PM=i(T_);PS=a(PM,"PATH"),PM.forEach(o),DS=a($m," and "),E_=s($m,"CODE",{});var DM=i(E_);SS=a(DM,"LD_LIBRARY_PATH"),DM.forEach(o),OS=a($m,` 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.`),$m.forEach(o),$2=d(t),qc=s(t,"P",{});var SM=i(qc);CS=a(SM,"First, you may look at their contents:"),SM.forEach(o),x2=d(t),g(il.$$.fragment,t),k2=d(t),Pc=s(t,"P",{});var OM=i(Pc);IS=a(OM,"so you get an idea of what is inside."),OM.forEach(o),A2=d(t),La=s(t,"P",{});var yT=i(La);FS=a(yT,"It\u2019s possible that "),$_=s(yT,"CODE",{});var CM=i($_);US=a(CM,"LD_LIBRARY_PATH"),CM.forEach(o),zS=a(yT," is empty."),yT.forEach(o),q2=d(t),ht=s(t,"P",{});var pd=i(ht);x_=s(pd,"CODE",{});var IM=i(x_);NS=a(IM,"PATH"),IM.forEach(o),LS=a(pd," lists the locations of where executables can be found and "),k_=s(pd,"CODE",{});var FM=i(k_);jS=a(FM,"LD_LIBRARY_PATH"),FM.forEach(o),RS=a(pd,` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),A_=s(pd,"CODE",{});var UM=i(A_);WS=a(UM,":"),UM.forEach(o),GS=a(pd,` is used to separate multiple
entries.`),pd.forEach(o),P2=d(t),Dc=s(t,"P",{});var zM=i(Dc);MS=a(zM,`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),zM.forEach(o),D2=d(t),g(ll.$$.fragment,t),S2=d(t),Sc=s(t,"P",{});var NM=i(Sc);HS=a(NM,"Note that we aren\u2019t overwriting the existing values, but prepending instead."),NM.forEach(o),O2=d(t),Xe=s(t,"P",{});var Tn=i(Xe);BS=a(Tn,`Of course, adjust the version number, the full path if need be. Check that the directories you assign actually do
exist. `),q_=s(Tn,"CODE",{});var LM=i(q_);VS=a(LM,"lib64"),LM.forEach(o),YS=a(Tn," sub-directory is where the various CUDA "),P_=s(Tn,"CODE",{});var jM=i(P_);XS=a(jM,".so"),jM.forEach(o),ZS=a(Tn," objects, like "),D_=s(Tn,"CODE",{});var RM=i(D_);JS=a(RM,"libcudart.so"),RM.forEach(o),KS=a(Tn,` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),Tn.forEach(o),C2=d(t),sr=s(t,"H4",{class:!0});var wT=i(sr);ja=s(wT,"A",{id:!0,class:!0,href:!0});var WM=i(ja);S_=s(WM,"SPAN",{});var GM=i(S_);g(dl.$$.fragment,GM),GM.forEach(o),WM.forEach(o),QS=d(wT),O_=s(wT,"SPAN",{});var MM=i(O_);e7=a(MM,"Possible problem #3"),MM.forEach(o),wT.forEach(o),I2=d(t),oo=s(t,"P",{});var xm=i(oo);t7=a(xm,"Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),C_=s(xm,"CODE",{});var HM=i(C_);o7=a(HM,"gcc-9"),HM.forEach(o),r7=a(xm,` but it wants
`),I_=s(xm,"CODE",{});var BM=i(I_);a7=a(BM,"gcc-7"),BM.forEach(o),n7=a(xm,"."),xm.forEach(o),F2=d(t),Oc=s(t,"P",{});var VM=i(Oc);s7=a(VM,"There are various ways to go about it."),VM.forEach(o),U2=d(t),Cc=s(t,"P",{});var YM=i(Cc);i7=a(YM,"If you can install the latest CUDA toolkit it typically should support the newer compiler."),YM.forEach(o),z2=d(t),Ra=s(t,"P",{});var TT=i(Ra);l7=a(TT,`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 `),F_=s(TT,"CODE",{});var XM=i(F_);d7=a(XM,"gcc-7"),XM.forEach(o),c7=a(TT,` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),TT.forEach(o),N2=d(t),g(cl.$$.fragment,t),L2=d(t),ee=s(t,"P",{});var ye=i(ee);p7=a(ye,"Here, we are making a symlink to "),U_=s(ye,"CODE",{});var ZM=i(U_);m7=a(ZM,"gcc-7"),ZM.forEach(o),h7=a(ye," from "),z_=s(ye,"CODE",{});var JM=i(z_);u7=a(JM,"/usr/local/cuda-10.2/bin/gcc"),JM.forEach(o),f7=a(ye,` and since
`),N_=s(ye,"CODE",{});var KM=i(N_);g7=a(KM,"/usr/local/cuda-10.2/bin/"),KM.forEach(o),_7=a(ye," should be in the "),L_=s(ye,"CODE",{});var QM=i(L_);v7=a(QM,"PATH"),QM.forEach(o),b7=a(ye,` environment variable (see the previous problem\u2019s solution), it
should find `),j_=s(ye,"CODE",{});var eH=i(j_);y7=a(eH,"gcc-7"),eH.forEach(o),w7=a(ye," (and "),R_=s(ye,"CODE",{});var tH=i(R_);T7=a(tH,"g++7"),tH.forEach(o),E7=a(ye,") and then the build will succeed."),ye.forEach(o),j2=d(t),Ic=s(t,"P",{});var oH=i(Ic);$7=a(oH,"As always make sure to edit the paths in the example to match your situation."),oH.forEach(o),R2=d(t),ir=s(t,"H3",{class:!0});var ET=i(ir);Wa=s(ET,"A",{id:!0,class:!0,href:!0});var rH=i(Wa);W_=s(rH,"SPAN",{});var aH=i(W_);g(pl.$$.fragment,aH),aH.forEach(o),rH.forEach(o),x7=d(ET),G_=s(ET,"SPAN",{});var nH=i(G_);k7=a(nH,"FairScale"),nH.forEach(o),ET.forEach(o),W2=d(t),g(Ga.$$.fragment,t),G2=d(t),Ze=s(t,"P",{});var En=i(Ze);A7=a(En,"By integrating "),ml=s(En,"A",{href:!0,rel:!0});var sH=i(ml);q7=a(sH,"FairScale"),sH.forEach(o),P7=a(En," the "),Fc=s(En,"A",{href:!0});var iH=i(Fc);D7=a(iH,"Trainer"),iH.forEach(o),S7=a(En,`
provides support for the following features from `),hl=s(En,"A",{href:!0,rel:!0});var lH=i(hl);O7=a(lH,"the ZeRO paper"),lH.forEach(o),C7=a(En,":"),En.forEach(o),M2=d(t),Je=s(t,"OL",{});var $n=i(Je);M_=s($n,"LI",{});var dH=i(M_);I7=a(dH,"Optimizer State Sharding"),dH.forEach(o),F7=d($n),H_=s($n,"LI",{});var cH=i(H_);U7=a(cH,"Gradient Sharding"),cH.forEach(o),z7=d($n),B_=s($n,"LI",{});var pH=i(B_);N7=a(pH,"Model Parameters Sharding (new and very experimental)"),pH.forEach(o),L7=d($n),V_=s($n,"LI",{});var mH=i(V_);j7=a(mH,"CPU offload (new and very experimental)"),mH.forEach(o),$n.forEach(o),H2=d(t),Uc=s(t,"P",{});var hH=i(Uc);R7=a(hH,"You will need at least two GPUs to use this feature."),hH.forEach(o),B2=d(t),ul=s(t,"P",{});var gN=i(ul);Y_=s(gN,"STRONG",{});var uH=i(Y_);W7=a(uH,"Installation"),uH.forEach(o),G7=a(gN,":"),gN.forEach(o),V2=d(t),zc=s(t,"P",{});var fH=i(zc);M7=a(fH,"Install the library via pypi:"),fH.forEach(o),Y2=d(t),g(fl.$$.fragment,t),X2=d(t),ro=s(t,"P",{});var km=i(ro);H7=a(km,"or via "),X_=s(km,"CODE",{});var gH=i(X_);B7=a(gH,"transformers"),gH.forEach(o),V7=a(km,"\u2019 "),Z_=s(km,"CODE",{});var _H=i(Z_);Y7=a(_H,"extras"),_H.forEach(o),X7=a(km,":"),km.forEach(o),Z2=d(t),g(gl.$$.fragment,t),J2=d(t),ao=s(t,"P",{});var Am=i(ao);Z7=a(Am,"(available starting from "),J_=s(Am,"CODE",{});var vH=i(J_);J7=a(vH,"transformers==4.6.0"),vH.forEach(o),K7=a(Am,") or find more details on "),_l=s(Am,"A",{href:!0,rel:!0});var bH=i(_l);Q7=a(bH,"the FairScale\u2019s GitHub page"),bH.forEach(o),eO=a(Am,"."),Am.forEach(o),K2=d(t),Ma=s(t,"P",{});var $T=i(Ma);tO=a($T,"If you\u2019re still struggling with the build, first make sure to read "),Nc=s($T,"A",{href:!0});var yH=i(Nc);oO=a(yH,"CUDA Extension Installation Notes"),yH.forEach(o),rO=a($T,"."),$T.forEach(o),Q2=d(t),Lc=s(t,"P",{});var wH=i(Lc);aO=a(wH,"If it\u2019s still not resolved the build issue, here are a few more ideas."),wH.forEach(o),e0=d(t),vl=s(t,"P",{});var _N=i(vl);K_=s(_N,"CODE",{});var TH=i(K_);nO=a(TH,"fairscale"),TH.forEach(o),sO=a(_N,` 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:`),_N.forEach(o),t0=d(t),g(bl.$$.fragment,t),o0=d(t),jc=s(t,"P",{});var EH=i(jc);iO=a(EH,"or:"),EH.forEach(o),r0=d(t),g(yl.$$.fragment,t),a0=d(t),wl=s(t,"P",{});var vN=i(wl);Q_=s(vN,"CODE",{});var $H=i(Q_);lO=a($H,"fairscale"),$H.forEach(o),dO=a(vN," also has issues with building against pytorch-nightly, so if you use it you may have to try one of:"),vN.forEach(o),n0=d(t),g(Tl.$$.fragment,t),s0=d(t),Rc=s(t,"P",{});var xH=i(Rc);cO=a(xH,"or:"),xH.forEach(o),i0=d(t),g(El.$$.fragment,t),l0=d(t),Wc=s(t,"P",{});var kH=i(Wc);pO=a(kH,"Of course, adjust the urls to match the cuda version you use."),kH.forEach(o),d0=d(t),Ha=s(t,"P",{});var xT=i(Ha);mO=a(xT,`If after trying everything suggested you still encounter build issues, please, proceed with the GitHub Issue of
`),$l=s(xT,"A",{href:!0,rel:!0});var AH=i($l);hO=a(AH,"FairScale"),AH.forEach(o),uO=a(xT,"."),xT.forEach(o),c0=d(t),xl=s(t,"P",{});var bN=i(xl);ev=s(bN,"STRONG",{});var qH=i(ev);fO=a(qH,"Usage"),qH.forEach(o),gO=a(bN,":"),bN.forEach(o),p0=d(t),no=s(t,"P",{});var qm=i(no);_O=a(qm,"To use the first version of Sharded data-parallelism, add "),tv=s(qm,"CODE",{});var PH=i(tv);vO=a(PH,"--sharded_ddp simple"),PH.forEach(o),bO=a(qm,` to the command line arguments, and
make sure you have added the distributed launcher `),ov=s(qm,"CODE",{});var DH=i(ov);yO=a(DH,"-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),DH.forEach(o),wO=a(qm," if you haven\u2019t been using it already."),qm.forEach(o),m0=d(t),Ba=s(t,"P",{});var kT=i(Ba);TO=a(kT,"For example here is how you could use it for "),rv=s(kT,"CODE",{});var SH=i(rv);EO=a(SH,"run_translation.py"),SH.forEach(o),$O=a(kT," with 2 GPUs:"),kT.forEach(o),h0=d(t),g(kl.$$.fragment,t),u0=d(t),Gc=s(t,"P",{});var OH=i(Gc);xO=a(OH,"Notes:"),OH.forEach(o),f0=d(t),Ke=s(t,"UL",{});var xn=i(Ke);av=s(xn,"LI",{});var CH=i(av);kO=a(CH,"This feature requires distributed training (so multiple GPUs)."),CH.forEach(o),AO=d(xn),nv=s(xn,"LI",{});var IH=i(nv);qO=a(IH,"It is not implemented for TPUs."),IH.forEach(o),PO=d(xn),Al=s(xn,"LI",{});var AT=i(Al);DO=a(AT,"It works with "),sv=s(AT,"CODE",{});var FH=i(sv);SO=a(FH,"--fp16"),FH.forEach(o),OO=a(AT," too, to make things even faster."),AT.forEach(o),CO=d(xn),ql=s(xn,"LI",{});var qT=i(ql);IO=a(qT,"One of the main benefits of enabling "),iv=s(qT,"CODE",{});var UH=i(iv);FO=a(UH,"--sharded_ddp simple"),UH.forEach(o),UO=a(qT,` 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.`),qT.forEach(o),xn.forEach(o),g0=d(t),Pl=s(t,"OL",{start:!0});var zH=i(Pl);ut=s(zH,"LI",{});var kn=i(ut);zO=a(kn,"To use the second version of Sharded data-parallelism, add "),lv=s(kn,"CODE",{});var NH=i(lv);NO=a(NH,"--sharded_ddp zero_dp_2"),NH.forEach(o),LO=a(kn," or "),dv=s(kn,"CODE",{});var LH=i(dv);jO=a(LH,"--sharded_ddp zero_dp_3"),LH.forEach(o),RO=a(kn," to the command line arguments, and make sure you have added the distributed launcher "),cv=s(kn,"CODE",{});var jH=i(cv);WO=a(jH,"-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),jH.forEach(o),GO=a(kn," if you haven\u2019t been using it already."),kn.forEach(o),zH.forEach(o),_0=d(t),Va=s(t,"P",{});var PT=i(Va);MO=a(PT,"For example here is how you could use it for "),pv=s(PT,"CODE",{});var RH=i(pv);HO=a(RH,"run_translation.py"),RH.forEach(o),BO=a(PT," with 2 GPUs:"),PT.forEach(o),v0=d(t),g(Dl.$$.fragment,t),b0=d(t),lr=s(t,"P",{});var D1=i(lr);mv=s(D1,"CODE",{});var WH=i(mv);VO=a(WH,"zero_dp_2"),WH.forEach(o),YO=a(D1," is an optimized version of the simple wrapper, while "),hv=s(D1,"CODE",{});var GH=i(hv);XO=a(GH,"zero_dp_3"),GH.forEach(o),ZO=a(D1,` fully shards model weights,
gradients and optimizer states.`),D1.forEach(o),y0=d(t),so=s(t,"P",{});var Pm=i(so);JO=a(Pm,"Both are compatible with adding "),uv=s(Pm,"CODE",{});var MH=i(uv);KO=a(MH,"cpu_offload"),MH.forEach(o),QO=a(Pm," to enable ZeRO-offload (activate it like this: "),fv=s(Pm,"CODE",{});var HH=i(fv);eC=a(HH,'--sharded_ddp "zero_dp_2 cpu_offload"'),HH.forEach(o),tC=a(Pm,")."),Pm.forEach(o),w0=d(t),Mc=s(t,"P",{});var BH=i(Mc);oC=a(BH,"Notes:"),BH.forEach(o),T0=d(t),be=s(t,"UL",{});var yo=i(be);gv=s(yo,"LI",{});var VH=i(gv);rC=a(VH,"This feature requires distributed training (so multiple GPUs)."),VH.forEach(o),aC=d(yo),_v=s(yo,"LI",{});var YH=i(_v);nC=a(YH,"It is not implemented for TPUs."),YH.forEach(o),sC=d(yo),Sl=s(yo,"LI",{});var DT=i(Sl);iC=a(DT,"It works with "),vv=s(DT,"CODE",{});var XH=i(vv);lC=a(XH,"--fp16"),XH.forEach(o),dC=a(DT," too, to make things even faster."),DT.forEach(o),cC=d(yo),dr=s(yo,"LI",{});var Dm=i(dr);pC=a(Dm,"The "),bv=s(Dm,"CODE",{});var ZH=i(bv);mC=a(ZH,"cpu_offload"),ZH.forEach(o),hC=a(Dm," additional option requires "),yv=s(Dm,"CODE",{});var JH=i(yv);uC=a(JH,"--fp16"),JH.forEach(o),fC=a(Dm,"."),Dm.forEach(o),gC=d(yo),wv=s(yo,"LI",{});var KH=i(wv);_C=a(KH,`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.`),KH.forEach(o),yo.forEach(o),E0=d(t),Hc=s(t,"P",{});var QH=i(Hc);vC=a(QH,"Known caveats:"),QH.forEach(o),$0=d(t),Ya=s(t,"UL",{});var ST=i(Ya);cr=s(ST,"LI",{});var Sm=i(cr);bC=a(Sm,"This feature is incompatible with "),Tv=s(Sm,"CODE",{});var eB=i(Tv);yC=a(eB,"--predict_with_generate"),eB.forEach(o),wC=a(Sm," in the "),Ev=s(Sm,"EM",{});var tB=i(Ev);TC=a(tB,"run_translation.py"),tB.forEach(o),EC=a(Sm," script."),Sm.forEach(o),$C=d(ST),De=s(ST,"LI",{});var wo=i(De);xC=a(wo,"Using "),$v=s(wo,"CODE",{});var oB=i($v);kC=a(oB,"--sharded_ddp zero_dp_3"),oB.forEach(o),AC=a(wo,` requires wrapping each layer of the model in the special container
`),xv=s(wo,"CODE",{});var rB=i(xv);qC=a(rB,"FullyShardedDataParallelism"),rB.forEach(o),PC=a(wo," of fairscale. It should be used with the option "),kv=s(wo,"CODE",{});var aB=i(kv);DC=a(aB,"auto_wrap"),aB.forEach(o),SC=a(wo,` if you are not
doing this yourself: `),Av=s(wo,"CODE",{});var nB=i(Av);OC=a(nB,'--sharded_ddp "zero_dp_3 auto_wrap"'),nB.forEach(o),CC=a(wo,"."),wo.forEach(o),ST.forEach(o),x0=d(t),pr=s(t,"H3",{class:!0});var OT=i(pr);Xa=s(OT,"A",{id:!0,class:!0,href:!0});var sB=i(Xa);qv=s(sB,"SPAN",{});var iB=i(qv);g(Ol.$$.fragment,iB),iB.forEach(o),sB.forEach(o),IC=d(OT),Pv=s(OT,"SPAN",{});var lB=i(Pv);FC=a(lB,"PyTorch Fully Sharded Data parallel"),lB.forEach(o),OT.forEach(o),k0=d(t),Za=s(t,"P",{});var CT=i(Za);UC=a(CT,`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 `),Cl=s(CT,"A",{href:!0,rel:!0});var dB=i(Cl);zC=a(dB,"Fully Sharded Data Parallel blog"),dB.forEach(o),NC=a(CT,`.
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.`),CT.forEach(o),A0=d(t),Il=s(t,"P",{});var yN=i(Il);Dv=s(yN,"STRONG",{});var cB=i(Dv);LC=a(cB,"Required PyTorch version for FSDP support"),cB.forEach(o),jC=a(yN,`: 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.`),yN.forEach(o),q0=d(t),Fl=s(t,"P",{});var wN=i(Fl);Sv=s(wN,"STRONG",{});var pB=i(Sv);RC=a(pB,"Usage"),pB.forEach(o),WC=a(wN,":"),wN.forEach(o),P0=d(t),pe=s(t,"UL",{});var it=i(pe);Ov=s(it,"LI",{});var mB=i(Ov);Ul=s(mB,"P",{});var IT=i(Ul);GC=a(IT,`Make sure you have added the distributed launcher
`),Cv=s(IT,"CODE",{});var hB=i(Cv);MC=a(hB,"-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),hB.forEach(o),HC=a(IT," if you haven\u2019t been using it already."),IT.forEach(o),mB.forEach(o),BC=d(it),zl=s(it,"LI",{});var FT=i(zl);Bc=s(FT,"P",{});var TN=i(Bc);Iv=s(TN,"STRONG",{});var uB=i(Iv);VC=a(uB,"Sharding Strategy"),uB.forEach(o),YC=a(TN,":"),TN.forEach(o),XC=d(FT),mr=s(FT,"UL",{});var Om=i(mr);Nl=s(Om,"LI",{});var UT=i(Nl);ZC=a(UT,`FULL_SHARD : Shards optimizer states + gradients + model parameters across data parallel workers/GPUs.
For this, add `),Fv=s(UT,"CODE",{});var fB=i(Fv);JC=a(fB,"--fsdp full_shard"),fB.forEach(o),KC=a(UT," to the command line arguments."),UT.forEach(o),QC=d(Om),Ll=s(Om,"LI",{});var zT=i(Ll);eI=a(zT,`SHARD_GRAD_OP : Shards optimizer states + gradients across data parallel workers/GPUs.
For this, add `),Uv=s(zT,"CODE",{});var gB=i(Uv);tI=a(gB,"--fsdp shard_grad_op"),gB.forEach(o),oI=a(zT," to the command line arguments."),zT.forEach(o),rI=d(Om),jl=s(Om,"LI",{});var NT=i(jl);aI=a(NT,"NO_SHARD : No sharding. For this, add "),zv=s(NT,"CODE",{});var _B=i(zv);nI=a(_B,"--fsdp no_shard"),_B.forEach(o),sI=a(NT," to the command line arguments."),NT.forEach(o),Om.forEach(o),FT.forEach(o),iI=d(it),Nv=s(it,"LI",{});var vB=i(Nv);hr=s(vB,"P",{});var Cm=i(hr);lI=a(Cm,`To offload the parameters and gradients to the CPU,
add `),Lv=s(Cm,"CODE",{});var bB=i(Lv);dI=a(bB,'--fsdp "full_shard offload"'),bB.forEach(o),cI=a(Cm," or "),jv=s(Cm,"CODE",{});var yB=i(jv);pI=a(yB,'--fsdp "shard_grad_op offload"'),yB.forEach(o),mI=a(Cm," to the command line arguments."),Cm.forEach(o),vB.forEach(o),hI=d(it),Rv=s(it,"LI",{});var wB=i(Rv);ft=s(wB,"P",{});var An=i(ft);uI=a(An,"To automatically recursively wrap layers with FSDP using "),Wv=s(An,"CODE",{});var TB=i(Wv);fI=a(TB,"default_auto_wrap_policy"),TB.forEach(o),gI=a(An,`,
add `),Gv=s(An,"CODE",{});var EB=i(Gv);_I=a(EB,'--fsdp "full_shard auto_wrap"'),EB.forEach(o),vI=a(An," or "),Mv=s(An,"CODE",{});var $B=i(Mv);bI=a($B,'--fsdp "shard_grad_op auto_wrap"'),$B.forEach(o),yI=a(An," to the command line arguments."),An.forEach(o),wB.forEach(o),wI=d(it),Hv=s(it,"LI",{});var xB=i(Hv);ur=s(xB,"P",{});var Im=i(ur);TI=a(Im,`To enable both CPU offloading and auto wrapping,
add `),Bv=s(Im,"CODE",{});var kB=i(Bv);EI=a(kB,'--fsdp "full_shard offload auto_wrap"'),kB.forEach(o),$I=a(Im," or "),Vv=s(Im,"CODE",{});var AB=i(Vv);xI=a(AB,'--fsdp "shard_grad_op offload auto_wrap"'),AB.forEach(o),kI=a(Im," to the command line arguments."),Im.forEach(o),xB.forEach(o),AI=d(it),Rl=s(it,"LI",{});var LT=i(Rl);gt=s(LT,"P",{});var qn=i(gt);qI=a(qn,"Remaining FSDP config is passed via "),Yv=s(qn,"CODE",{});var qB=i(Yv);PI=a(qB,"--fsdp_config <path_to_fsdp_config.json>"),qB.forEach(o),DI=a(qn,`. It is either a location of
FSDP json config file (e.g., `),Xv=s(qn,"CODE",{});var PB=i(Xv);SI=a(PB,"fsdp_config.json"),PB.forEach(o),OI=a(qn,") or an already loaded json file as "),Zv=s(qn,"CODE",{});var DB=i(Zv);CI=a(DB,"dict"),DB.forEach(o),II=a(qn,"."),qn.forEach(o),FI=d(LT),_t=s(LT,"UL",{});var Pn=i(_t);Vc=s(Pn,"LI",{});var EN=i(Vc);UI=a(EN,"If auto wrapping is enabled, you can either use transformer based auto wrap policy or size based auto wrap policy."),Wl=s(EN,"UL",{});var jT=i(Wl);Se=s(jT,"LI",{});var To=i(Se);zI=a(To,"For transformer based auto wrap policy, please specify "),Jv=s(To,"CODE",{});var SB=i(Jv);NI=a(SB,"fsdp_transformer_layer_cls_to_wrap"),SB.forEach(o),LI=a(To,` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),Kv=s(To,"CODE",{});var OB=i(Kv);jI=a(OB,"BertLayer"),OB.forEach(o),RI=a(To,", "),Qv=s(To,"CODE",{});var CB=i(Qv);WI=a(CB,"GPTJBlock"),CB.forEach(o),GI=a(To,", "),eb=s(To,"CODE",{});var IB=i(eb);MI=a(IB,"T5Block"),IB.forEach(o),HI=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),BI=d(jT),Gl=s(jT,"LI",{});var RT=i(Gl);VI=a(RT,"For size based auto wrap policy, please add "),tb=s(RT,"CODE",{});var FB=i(tb);YI=a(FB,"fsdp_min_num_params"),FB.forEach(o),XI=a(RT,` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),RT.forEach(o),jT.forEach(o),EN.forEach(o),ZI=d(Pn),vt=s(Pn,"LI",{});var Dn=i(vt);ob=s(Dn,"CODE",{});var UB=i(ob);JI=a(UB,"fsdp_backward_prefetch"),UB.forEach(o),KI=a(Dn,` can be specified in the config file. It controls when to prefetch next set of parameters.
`),rb=s(Dn,"CODE",{});var zB=i(rb);QI=a(zB,"backward_pre"),zB.forEach(o),eF=a(Dn," and "),ab=s(Dn,"CODE",{});var NB=i(ab);tF=a(NB,"backward_pos"),NB.forEach(o),oF=a(Dn,` are available options.
For more information refer `),nb=s(Dn,"CODE",{});var LB=i(nb);rF=a(LB,"torch.distributed.fsdp.fully_sharded_data_parallel.BackwardPrefetch"),LB.forEach(o),Dn.forEach(o),aF=d(Pn),Ja=s(Pn,"LI",{});var S1=i(Ja);sb=s(S1,"CODE",{});var jB=i(sb);nF=a(jB,"fsdp_forward_prefetch"),jB.forEach(o),sF=a(S1,` can be specified in the config file. It controls when to prefetch next set of parameters.
If `),ib=s(S1,"CODE",{});var RB=i(ib);iF=a(RB,'"True"'),RB.forEach(o),lF=a(S1,", FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass."),S1.forEach(o),dF=d(Pn),Ka=s(Pn,"LI",{});var O1=i(Ka);lb=s(O1,"CODE",{});var WB=i(lb);cF=a(WB,"limit_all_gathers"),WB.forEach(o),pF=a(O1,` can be specified in the config file.
If `),db=s(O1,"CODE",{});var GB=i(db);mF=a(GB,'"True"'),GB.forEach(o),hF=a(O1,", FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers."),O1.forEach(o),Pn.forEach(o),LT.forEach(o),it.forEach(o),D0=d(t),Yc=s(t,"P",{});var MB=i(Yc);cb=s(MB,"STRONG",{});var HB=i(cb);uF=a(HB,"Few caveats to be aware of"),HB.forEach(o),MB.forEach(o),S0=d(t),Xc=s(t,"UL",{});var BB=i(Xc);Qe=s(BB,"LI",{});var Er=i(Qe);fF=a(Er,"it is incompatible with "),pb=s(Er,"CODE",{});var VB=i(pb);gF=a(VB,"generate"),VB.forEach(o),_F=a(Er,", thus is incompatible with "),mb=s(Er,"CODE",{});var YB=i(mb);vF=a(YB,"--predict_with_generate"),YB.forEach(o),bF=a(Er,`
in all seq2seq/clm scripts (translation/summarization/clm etc.).`),yF=s(Er,"BR",{}),wF=a(Er,`
Please refer issue `),Ml=s(Er,"A",{href:!0,rel:!0});var XB=i(Ml);TF=a(XB,"#21667"),XB.forEach(o),Er.forEach(o),BB.forEach(o),O0=d(t),fr=s(t,"H3",{class:!0});var WT=i(fr);Qa=s(WT,"A",{id:!0,class:!0,href:!0});var ZB=i(Qa);hb=s(ZB,"SPAN",{});var JB=i(hb);g(Hl.$$.fragment,JB),JB.forEach(o),ZB.forEach(o),EF=d(WT),ub=s(WT,"SPAN",{});var KB=i(ub);$F=a(KB,"PyTorch/XLA Fully Sharded Data parallel"),KB.forEach(o),WT.forEach(o),C0=d(t),io=s(t,"P",{});var Fm=i(io);xF=a(Fm,`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 `),Bl=s(Fm,"A",{href:!0,rel:!0});var QB=i(Bl);kF=a(QB,"Scaling PyTorch models on Cloud TPUs with FSDP"),QB.forEach(o),AF=a(Fm," and "),Vl=s(Fm,"A",{href:!0,rel:!0});var eV=i(Vl);qF=a(eV,"PyTorch/XLA implementation of FSDP"),eV.forEach(o),PF=a(Fm,`
All you need to do is enable it through the config.`),Fm.forEach(o),I0=d(t),Yl=s(t,"P",{});var $N=i(Yl);fb=s($N,"STRONG",{});var tV=i(fb);DF=a(tV,"Required PyTorch/XLA version for FSDP support"),tV.forEach(o),SF=a($N,": >=2.0"),$N.forEach(o),F0=d(t),Xl=s(t,"P",{});var xN=i(Xl);gb=s(xN,"STRONG",{});var oV=i(gb);OF=a(oV,"Usage"),oV.forEach(o),CF=a(xN,":"),xN.forEach(o),U0=d(t),lo=s(t,"P",{});var Um=i(lo);IF=a(Um,"Pass "),_b=s(Um,"CODE",{});var rV=i(_b);FF=a(rV,'--fsdp "full shard"'),rV.forEach(o),UF=a(Um," along with following changes to be made in "),vb=s(Um,"CODE",{});var aV=i(vb);zF=a(aV,"--fsdp_config <path_to_fsdp_config.json>"),aV.forEach(o),NF=a(Um,":"),Um.forEach(o),z0=d(t),et=s(t,"UL",{});var Sn=i(et);en=s(Sn,"LI",{});var C1=i(en);bb=s(C1,"CODE",{});var nV=i(bb);LF=a(nV,"xla"),nV.forEach(o),jF=a(C1," should be set to "),yb=s(C1,"CODE",{});var sV=i(yb);RF=a(sV,"True"),sV.forEach(o),WF=a(C1," to enable PyTorch/XLA FSDP."),C1.forEach(o),GF=d(Sn),tn=s(Sn,"LI",{});var I1=i(tn);wb=s(I1,"CODE",{});var iV=i(wb);MF=a(iV,"xla_fsdp_settings"),iV.forEach(o),HF=a(I1,` The value is a dictionary which stores the XLA FSDP wrapping parameters.
For a complete list of options, please see `),Zl=s(I1,"A",{href:!0,rel:!0});var lV=i(Zl);BF=a(lV,"here"),lV.forEach(o),VF=a(I1,"."),I1.forEach(o),YF=d(Sn),tt=s(Sn,"LI",{});var $r=i(tt);Tb=s($r,"CODE",{});var dV=i(Tb);XF=a(dV,"xla_fsdp_grad_ckpt"),dV.forEach(o),ZF=a($r,". When "),Eb=s($r,"CODE",{});var cV=i(Eb);JF=a(cV,"True"),cV.forEach(o),KF=a($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
`),$b=s($r,"CODE",{});var pV=i($b);QF=a(pV,"fsdp_min_num_params"),pV.forEach(o),eU=a($r," or "),xb=s($r,"CODE",{});var mV=i(xb);tU=a(mV,"fsdp_transformer_layer_cls_to_wrap"),mV.forEach(o),oU=a($r,"."),$r.forEach(o),rU=d(Sn),Zc=s(Sn,"LI",{});var kN=i(Zc);aU=a(kN,"You can either use transformer based auto wrap policy or size based auto wrap policy."),Jl=s(kN,"UL",{});var GT=i(Jl);Oe=s(GT,"LI",{});var Eo=i(Oe);nU=a(Eo,"For transformer based auto wrap policy, please specify "),kb=s(Eo,"CODE",{});var hV=i(kb);sU=a(hV,"fsdp_transformer_layer_cls_to_wrap"),hV.forEach(o),iU=a(Eo,` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),Ab=s(Eo,"CODE",{});var uV=i(Ab);lU=a(uV,"BertLayer"),uV.forEach(o),dU=a(Eo,", "),qb=s(Eo,"CODE",{});var fV=i(qb);cU=a(fV,"GPTJBlock"),fV.forEach(o),pU=a(Eo,", "),Pb=s(Eo,"CODE",{});var gV=i(Pb);mU=a(gV,"T5Block"),gV.forEach(o),hU=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),uU=d(GT),Kl=s(GT,"LI",{});var MT=i(Kl);fU=a(MT,"For size based auto wrap policy, please add "),Db=s(MT,"CODE",{});var _V=i(Db);gU=a(_V,"fsdp_min_num_params"),_V.forEach(o),_U=a(MT,` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),MT.forEach(o),GT.forEach(o),kN.forEach(o),Sn.forEach(o),N0=d(t),gr=s(t,"H3",{class:!0});var HT=i(gr);on=s(HT,"A",{id:!0,class:!0,href:!0});var vV=i(on);Sb=s(vV,"SPAN",{});var bV=i(Sb);g(Ql.$$.fragment,bV),bV.forEach(o),vV.forEach(o),vU=d(HT),Ob=s(HT,"SPAN",{});var yV=i(Ob);bU=a(yV,"Using Trainer for accelerated PyTorch Training on Mac"),yV.forEach(o),HT.forEach(o),L0=d(t),ot=s(t,"P",{});var On=i(ot);yU=a(On,`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 `),Cb=s(On,"CODE",{});var wV=i(Cb);wU=a(wV,'"mps"'),wV.forEach(o),TU=a(On,` 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 `),ed=s(On,"A",{href:!0,rel:!0});var TV=i(ed);EU=a(TV,"Introducing Accelerated PyTorch Training on Mac"),TV.forEach(o),$U=a(On,`
and `),td=s(On,"A",{href:!0,rel:!0});var EV=i(td);xU=a(EV,"MPS BACKEND"),EV.forEach(o),kU=a(On,"."),On.forEach(o),j0=d(t),g(rn.$$.fragment,t),R0=d(t),Jc=s(t,"P",{});var $V=i(Jc);Ib=s($V,"STRONG",{});var xV=i(Ib);AU=a(xV,"Benefits of Training and Inference using Apple Silicon Chips"),xV.forEach(o),$V.forEach(o),W0=d(t),co=s(t,"OL",{});var zm=i(co);Fb=s(zm,"LI",{});var kV=i(Fb);qU=a(kV,"Enables users to train larger networks or batch sizes locally"),kV.forEach(o),PU=d(zm),Ub=s(zm,"LI",{});var AV=i(Ub);DU=a(AV,`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.`),AV.forEach(o),SU=d(zm),zb=s(zm,"LI",{});var qV=i(zb);OU=a(qV,"Reduces costs associated with cloud-based development or the need for additional local GPUs."),qV.forEach(o),zm.forEach(o),G0=d(t),_r=s(t,"P",{});var F1=i(_r);Nb=s(F1,"STRONG",{});var PV=i(Nb);CU=a(PV,"Pre-requisites"),PV.forEach(o),IU=a(F1,`: To install torch with mps support,
please follow this nice medium article `),od=s(F1,"A",{href:!0,rel:!0});var DV=i(od);FU=a(DV,"GPU-Acceleration Comes to PyTorch on M1 Macs"),DV.forEach(o),UU=a(F1,"."),F1.forEach(o),M0=d(t),vr=s(t,"P",{});var U1=i(vr);Lb=s(U1,"STRONG",{});var SV=i(Lb);zU=a(SV,"Usage"),SV.forEach(o),NU=a(U1,`:
User has to just pass `),jb=s(U1,"CODE",{});var OV=i(jb);LU=a(OV,"--use_mps_device"),OV.forEach(o),jU=a(U1,` argument.
For example, you can run the official Glue text classififcation task (from the root folder) using Apple Silicon GPU with below command:`),U1.forEach(o),H0=d(t),g(rd.$$.fragment,t),B0=d(t),Kc=s(t,"P",{});var CV=i(Kc);Rb=s(CV,"STRONG",{});var IV=i(Rb);RU=a(IV,"A few caveats to be aware of"),IV.forEach(o),CV.forEach(o),V0=d(t),an=s(t,"OL",{});var BT=i(an);ad=s(BT,"LI",{});var VT=i(ad);WU=a(VT,`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 `),Wb=s(VT,"CODE",{});var FV=i(Wb);GU=a(FV,"PYTORCH_ENABLE_MPS_FALLBACK=1"),FV.forEach(o),MU=a(VT,`,
which will fallback to CPU for these operations. It still throws a UserWarning however.`),VT.forEach(o),HU=d(BT),Ce=s(BT,"LI",{});var $o=i(Ce);BU=a($o,"Distributed setups "),Gb=s($o,"CODE",{});var UV=i(Gb);VU=a(UV,"gloo"),UV.forEach(o),YU=a($o," and "),Mb=s($o,"CODE",{});var zV=i(Mb);XU=a(zV,"nccl"),zV.forEach(o),ZU=a($o," are not working with "),Hb=s($o,"CODE",{});var NV=i(Hb);JU=a(NV,"mps"),NV.forEach(o),KU=a($o,` device.
This means that currently only single GPU of `),Bb=s($o,"CODE",{});var LV=i(Bb);QU=a(LV,"mps"),LV.forEach(o),ez=a($o," device type can be used."),$o.forEach(o),BT.forEach(o),Y0=d(t),po=s(t,"P",{});var Nm=i(po);tz=a(Nm,"Finally, please, remember that, \u{1F917} "),Vb=s(Nm,"CODE",{});var jV=i(Vb);oz=a(jV,"Trainer"),jV.forEach(o),rz=a(Nm,` only integrates MPS backend, therefore if you
have any problems or questions with regards to MPS backend usage, please,
file an issue with `),nd=s(Nm,"A",{href:!0,rel:!0});var RV=i(nd);az=a(RV,"PyTorch GitHub"),RV.forEach(o),nz=a(Nm,"."),Nm.forEach(o),X0=d(t),Qc=s(t,"P",{});var WV=i(Qc);sz=a(WV,"Sections that were moved:"),WV.forEach(o),Z0=d(t),q=s(t,"P",{});var P=i(q);iz=a(P,"[ "),ep=s(P,"A",{href:!0});var GV=i(ep);lz=a(GV,"DeepSpeed"),GV.forEach(o),Yb=s(P,"A",{id:!0}),i(Yb).forEach(o),dz=a(P,`
| `),tp=s(P,"A",{href:!0});var MV=i(tp);cz=a(MV,"Installation"),MV.forEach(o),Xb=s(P,"A",{id:!0}),i(Xb).forEach(o),pz=a(P,`
| `),op=s(P,"A",{href:!0});var HV=i(op);mz=a(HV,"Deployment with multiple GPUs"),HV.forEach(o),Zb=s(P,"A",{id:!0}),i(Zb).forEach(o),hz=a(P,`
| `),rp=s(P,"A",{href:!0});var BV=i(rp);uz=a(BV,"Deployment with one GPU"),BV.forEach(o),Jb=s(P,"A",{id:!0}),i(Jb).forEach(o),fz=a(P,`
| `),ap=s(P,"A",{href:!0});var VV=i(ap);gz=a(VV,"Deployment in Notebooks"),VV.forEach(o),Kb=s(P,"A",{id:!0}),i(Kb).forEach(o),_z=a(P,`
| `),np=s(P,"A",{href:!0});var YV=i(np);vz=a(YV,"Configuration"),YV.forEach(o),Qb=s(P,"A",{id:!0}),i(Qb).forEach(o),bz=a(P,`
| `),sp=s(P,"A",{href:!0});var XV=i(sp);yz=a(XV,"Passing Configuration"),XV.forEach(o),e1=s(P,"A",{id:!0}),i(e1).forEach(o),wz=a(P,`
| `),ip=s(P,"A",{href:!0});var ZV=i(ip);Tz=a(ZV,"Shared Configuration"),ZV.forEach(o),t1=s(P,"A",{id:!0}),i(t1).forEach(o),Ez=a(P,`
| `),lp=s(P,"A",{href:!0});var JV=i(lp);$z=a(JV,"ZeRO"),JV.forEach(o),o1=s(P,"A",{id:!0}),i(o1).forEach(o),xz=a(P,`
| `),dp=s(P,"A",{href:!0});var KV=i(dp);kz=a(KV,"ZeRO-2 Config"),KV.forEach(o),r1=s(P,"A",{id:!0}),i(r1).forEach(o),Az=a(P,`
| `),cp=s(P,"A",{href:!0});var QV=i(cp);qz=a(QV,"ZeRO-3 Config"),QV.forEach(o),a1=s(P,"A",{id:!0}),i(a1).forEach(o),Pz=a(P,`
| `),pp=s(P,"A",{href:!0});var eY=i(pp);Dz=a(eY,"NVMe Support"),eY.forEach(o),n1=s(P,"A",{id:!0}),i(n1).forEach(o),Sz=a(P,`
| `),mp=s(P,"A",{href:!0});var tY=i(mp);Oz=a(tY,"ZeRO-2 vs ZeRO-3 Performance"),tY.forEach(o),s1=s(P,"A",{id:!0}),i(s1).forEach(o),Cz=a(P,`
| `),hp=s(P,"A",{href:!0});var oY=i(hp);Iz=a(oY,"ZeRO-2 Example"),oY.forEach(o),i1=s(P,"A",{id:!0}),i(i1).forEach(o),Fz=a(P,`
| `),up=s(P,"A",{href:!0});var rY=i(up);Uz=a(rY,"ZeRO-3 Example"),rY.forEach(o),l1=s(P,"A",{id:!0}),i(l1).forEach(o),zz=a(P,`
| `),fp=s(P,"A",{href:!0});var aY=i(fp);Nz=a(aY,"Optimizer"),aY.forEach(o),d1=s(P,"A",{id:!0}),i(d1).forEach(o),Lz=a(P,`
| `),gp=s(P,"A",{href:!0});var nY=i(gp);jz=a(nY,"Scheduler"),nY.forEach(o),c1=s(P,"A",{id:!0}),i(c1).forEach(o),Rz=a(P,`
| `),_p=s(P,"A",{href:!0});var sY=i(_p);Wz=a(sY,"fp32 Precision"),sY.forEach(o),p1=s(P,"A",{id:!0}),i(p1).forEach(o),Gz=a(P,`
| `),vp=s(P,"A",{href:!0});var iY=i(vp);Mz=a(iY,"Automatic Mixed Precision"),iY.forEach(o),m1=s(P,"A",{id:!0}),i(m1).forEach(o),Hz=a(P,`
| `),bp=s(P,"A",{href:!0});var lY=i(bp);Bz=a(lY,"Batch Size"),lY.forEach(o),h1=s(P,"A",{id:!0}),i(h1).forEach(o),Vz=a(P,`
| `),yp=s(P,"A",{href:!0});var dY=i(yp);Yz=a(dY,"Gradient Accumulation"),dY.forEach(o),u1=s(P,"A",{id:!0}),i(u1).forEach(o),Xz=a(P,`
| `),wp=s(P,"A",{href:!0});var cY=i(wp);Zz=a(cY,"Gradient Clipping"),cY.forEach(o),f1=s(P,"A",{id:!0}),i(f1).forEach(o),Jz=a(P,`
| `),Tp=s(P,"A",{href:!0});var pY=i(Tp);Kz=a(pY,"Getting The Model Weights Out"),pY.forEach(o),g1=s(P,"A",{id:!0}),i(g1).forEach(o),Qz=a(P,`
]`),P.forEach(o),this.h()},h(){m(u,"name","hf:doc:metadata"),m(u,"content",JSON.stringify(zY)),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.29.0/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.29.0/en/main_classes/trainer#transformers.Trainer"),m(ne,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Ee,"href","https://github.com/NVIDIA/apex"),m(Ee,"rel","nofollow"),m($e,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(Ad,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(qd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(Pd,"href","callback"),m(Dr,"id","transformers.Trainer"),m(Dr,"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(Dr,"href","#transformers.Trainer"),m(qo,"class","relative group"),m(Dd,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),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(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(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(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(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($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(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(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(Od,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),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(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(Nr,"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(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(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,"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(Wr,"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(Id,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(bs,"href","https://github.com/pytorch/pytorch/issues/16266"),m(bs,"rel","nofollow"),m(Fd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(Ud,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(F,"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(Hr,"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(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(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(zd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer.log_metrics"),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(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(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(Xr,"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(Zr,"id","transformers.Seq2SeqTrainer"),m(Zr,"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(Zr,"href","#transformers.Seq2SeqTrainer"),m(Lo,"class","relative group"),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(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(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(Kr,"id","transformers.TrainingArguments"),m(Kr,"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(Kr,"href","#transformers.TrainingArguments"),m(Mo,"class","relative group"),m(Nd,"href","/docs/transformers/v4.29.0/en/internal/trainer_utils#transformers.HfArgumentParser"),m(Ks,"href","https://docs.python.org/3/library/argparse#module-argparse"),m(Ks,"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(Qr,"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(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(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(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(Me,"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(ua,"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(fa,"id","transformers.Seq2SeqTrainingArguments"),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","#transformers.Seq2SeqTrainingArguments"),m(Xo,"class","relative group"),m(Ld,"href","/docs/transformers/v4.29.0/en/internal/trainer_utils#transformers.HfArgumentParser"),m(bi,"href","https://docs.python.org/3/library/argparse#module-argparse"),m(bi,"rel","nofollow"),m(ga,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_a,"id","checkpoints"),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","#checkpoints"),m(Ko,"class","relative group"),m(jd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(Rd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Wd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer.train"),m(Hd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Ta,"id","logging"),m(Ta,"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(Ta,"href","#logging"),m(Qo,"class","relative group"),m(Vd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(Yd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Jd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Kd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(Qd,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(xa,"id","randomness"),m(xa,"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(xa,"href","#randomness"),m(er,"class","relative group"),m(nc,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(qi,"href","https://pytorch.org/docs/stable/notes/randomness"),m(qi,"rel","nofollow"),m(ka,"id","specific-gpus-selection"),m(ka,"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(ka,"href","#specific-gpus-selection"),m(tr,"class","relative group"),m(Di,"href","https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html"),m(Di,"rel","nofollow"),m(Oi,"href","https://github.com/huggingface/accelerate"),m(Oi,"rel","nofollow"),m(Ci,"href","https://github.com/microsoft/DeepSpeed"),m(Ci,"rel","nofollow"),m(ic,"href","Deepspeed"),m(Ni,"href","https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html"),m(Ni,"rel","nofollow"),m(Mi,"start","2"),m(Oa,"id","trainer-integrations"),m(Oa,"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(Oa,"href","#trainer-integrations"),m(or,"class","relative group"),m(yc,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(Yi,"href","https://github.com/microsoft/DeepSpeed"),m(Yi,"rel","nofollow"),m(Xi,"href","https://pytorch.org/docs/stable/fsdp.html"),m(Xi,"rel","nofollow"),m(Zi,"href","https://github.com/facebookresearch/fairscale/"),m(Zi,"rel","nofollow"),m(Ji,"href","https://arxiv.org/abs/1910.02054"),m(Ji,"rel","nofollow"),m(wc,"href","#pytorch-fully-sharded-data-parallel"),m(Tc,"id","zero-install-notes"),m(Fa,"id","cuda-extension-installation-notes"),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","#cuda-extension-installation-notes"),m(rr,"class","relative group"),m(Qi,"href","https://github.com/facebookresearch/fairscale/issues"),m(Qi,"rel","nofollow"),m(el,"href","https://github.com/microsoft/DeepSpeed/issues"),m(el,"rel","nofollow"),m(Ua,"id","possible-problem-1"),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","#possible-problem-1"),m(ar,"class","relative group"),m(al,"href","https://www.google.com/search?q=ubuntu+cuda+10.2+install"),m(al,"rel","nofollow"),m(Na,"id","possible-problem-2"),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-2"),m(nr,"class","relative group"),m(ja,"id","possible-problem-3"),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","#possible-problem-3"),m(sr,"class","relative group"),m(Wa,"id","fairscale"),m(Wa,"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(Wa,"href","#fairscale"),m(ir,"class","relative group"),m(ml,"href","https://github.com/facebookresearch/fairscale/"),m(ml,"rel","nofollow"),m(Fc,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),m(hl,"href","https://arxiv.org/abs/1910.02054"),m(hl,"rel","nofollow"),m(_l,"href","https://github.com/facebookresearch/fairscale/#installation"),m(_l,"rel","nofollow"),m(Nc,"href","#zero-install-notes"),m($l,"href","https://github.com/facebookresearch/fairscale/issues"),m($l,"rel","nofollow"),m(Pl,"start","3"),m(Xa,"id","pytorch-fully-sharded-data-parallel"),m(Xa,"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(Xa,"href","#pytorch-fully-sharded-data-parallel"),m(pr,"class","relative group"),m(Cl,"href","https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/"),m(Cl,"rel","nofollow"),m(Ml,"href","https://github.com/huggingface/transformers/issues/21667"),m(Ml,"rel","nofollow"),m(Qa,"id","pytorchxla-fully-sharded-data-parallel"),m(Qa,"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(Qa,"href","#pytorchxla-fully-sharded-data-parallel"),m(fr,"class","relative group"),m(Bl,"href","https://pytorch.org/blog/scaling-pytorch-models-on-cloud-tpus-with-fsdp/"),m(Bl,"rel","nofollow"),m(Vl,"href","https://github.com/pytorch/xla/tree/master/torch_xla/distributed/fsdp"),m(Vl,"rel","nofollow"),m(Zl,"href","https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py"),m(Zl,"rel","nofollow"),m(on,"id","using-trainer-for-accelerated-pytorch-training-on-mac"),m(on,"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(on,"href","#using-trainer-for-accelerated-pytorch-training-on-mac"),m(gr,"class","relative group"),m(ed,"href","https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/"),m(ed,"rel","nofollow"),m(td,"href","https://pytorch.org/docs/stable/notes/mps.html"),m(td,"rel","nofollow"),m(od,"href","https://medium.com/towards-data-science/gpu-acceleration-comes-to-pytorch-on-m1-macs-195c399efcc1"),m(od,"rel","nofollow"),m(nd,"href","https://github.com/pytorch/pytorch/issues"),m(nd,"rel","nofollow"),m(ep,"href","./deepspeed#deepspeed-trainer-integration"),m(Yb,"id","deepspeed"),m(tp,"href","./deepspeed#deepspeed-installation"),m(Xb,"id","installation"),m(op,"href","./deepspeed#deepspeed-multi-gpu"),m(Zb,"id","deployment-with-multiple-gpus"),m(rp,"href","./deepspeed#deepspeed-one-gpu"),m(Jb,"id","deployment-with-one-gpu"),m(ap,"href","./deepspeed#deepspeed-notebook"),m(Kb,"id","deployment-in-notebooks"),m(np,"href","./deepspeed#deepspeed-config"),m(Qb,"id","configuration"),m(sp,"href","./deepspeed#deepspeed-config-passing"),m(e1,"id","passing-configuration"),m(ip,"href","./deepspeed#deepspeed-config-shared"),m(t1,"id","shared-configuration"),m(lp,"href","./deepspeed#deepspeed-zero"),m(o1,"id","zero"),m(dp,"href","./deepspeed#deepspeed-zero2-config"),m(r1,"id","zero-2-config"),m(cp,"href","./deepspeed#deepspeed-zero3-config"),m(a1,"id","zero-3-config"),m(pp,"href","./deepspeed#deepspeed-nvme"),m(n1,"id","nvme-support"),m(mp,"href","./deepspeed#deepspeed-zero2-zero3-performance"),m(s1,"id","zero-2-vs-zero-3-performance"),m(hp,"href","./deepspeed#deepspeed-zero2-example"),m(i1,"id","zero-2-example"),m(up,"href","./deepspeed#deepspeed-zero3-example"),m(l1,"id","zero-3-example"),m(fp,"href","./deepspeed#deepspeed-optimizer"),m(d1,"id","optimizer"),m(gp,"href","./deepspeed#deepspeed-scheduler"),m(c1,"id","scheduler"),m(_p,"href","./deepspeed#deepspeed-fp32"),m(p1,"id","fp32-precision"),m(vp,"href","./deepspeed#deepspeed-amp"),m(m1,"id","automatic-mixed-precision"),m(bp,"href","./deepspeed#deepspeed-bs"),m(h1,"id","batch-size"),m(yp,"href","./deepspeed#deepspeed-grad-acc"),m(u1,"id","gradient-accumulation"),m(wp,"href","./deepspeed#deepspeed-grad-clip"),m(f1,"id","gradient-clipping"),m(Tp,"href","./deepspeed#deepspeed-weight-extraction"),m(g1,"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,Fe,c),e(Fe,Cn),e(Fe,Ee),e(Ee,In),e(Fe,Fn),p(t,se,c),p(t,oe,c),e(oe,md),e(oe,$e),e($e,kr),e(oe,hd),p(t,Ao,c),p(t,W,c),e(W,re),e(re,Ar),e(Ar,ud),e(re,fd),e(W,gd),e(W,_d),e(_d,Lm),e(Lm,YT),e(_d,XT),e(W,ZT),e(W,vd),e(vd,jm),e(jm,JT),e(vd,KT),e(W,QT),e(W,bd),e(bd,Rm),e(Rm,eE),e(bd,tE),e(W,oE),e(W,wt),e(wt,Wm),e(Wm,rE),e(wt,aE),e(wt,Gm),e(Gm,nE),e(wt,sE),e(wt,Mm),e(Mm,iE),e(wt,lE),e(W,dE),e(W,yd),e(yd,Hm),e(Hm,cE),e(yd,pE),e(W,mE),e(W,wd),e(wd,Bm),e(Bm,hE),e(wd,uE),e(W,fE),e(W,Td),e(Td,Vm),e(Vm,gE),e(Td,_E),e(W,vE),e(W,Ed),e(Ed,Ym),e(Ym,bE),e(Ed,yE),e(W,wE),e(W,$d),e($d,Xm),e(Xm,TE),e($d,EE),e(W,$E),e(W,xd),e(xd,Zm),e(Zm,xE),e(xd,kE),e(W,AE),e(W,kd),e(kd,Jm),e(Jm,qE),e(kd,PE),p(t,z1,c),_(qr,t,c),p(t,N1,c),p(t,Pr,c),e(Pr,DE),e(Pr,Ad),e(Ad,SE),e(Pr,OE),p(t,L1,c),_(Un,t,c),p(t,j1,c),p(t,Tt,c),e(Tt,CE),e(Tt,qd),e(qd,IE),e(Tt,FE),e(Tt,Pd),e(Pd,UE),e(Tt,zE),p(t,R1,c),p(t,qo,c),e(qo,Dr),e(Dr,Km),_(zn,Km,null),e(qo,NE),e(qo,Qm),e(Qm,LE),p(t,W1,c),p(t,$,c),_(Nn,$,null),e($,jE),e($,eh),e(eh,RE),e($,WE),e($,th),e(th,GE),e($,ME),e($,xe),e(xe,Sr),e(Sr,oh),e(oh,HE),e(Sr,BE),e(Sr,Dd),e(Dd,VE),e(Sr,YE),e(xe,XE),e(xe,ie),e(ie,rh),e(rh,ZE),e(ie,JE),e(ie,ah),e(ah,KE),e(ie,QE),e(ie,nh),e(nh,e4),e(ie,t4),e(ie,sh),e(sh,o4),e(ie,r4),e(ie,ih),e(ih,a4),e(ie,n4),e(ie,lh),e(lh,s4),e(ie,i4),e(xe,l4),e(xe,Sd),e(Sd,dh),e(dh,d4),e(Sd,c4),e(xe,p4),e(xe,Ue),e(Ue,ch),e(ch,m4),e(Ue,h4),e(Ue,ph),e(ph,u4),e(Ue,f4),e(Ue,mh),e(mh,g4),e(Ue,_4),e(Ue,hh),e(hh,v4),e(Ue,b4),e(xe,y4),e(xe,ze),e(ze,uh),e(uh,w4),e(ze,T4),e(ze,fh),e(fh,E4),e(ze,$4),e(ze,gh),e(gh,x4),e(ze,k4),e(ze,_h),e(_h,A4),e(ze,q4),e($,P4),e($,Or),_(Ln,Or,null),e(Or,D4),e(Or,jn),e(jn,S4),e(jn,vh),e(vh,O4),e(jn,C4),e($,I4),e($,Cr),_(Rn,Cr,null),e(Cr,F4),e(Cr,Wn),e(Wn,U4),e(Wn,bh),e(bh,z4),e(Wn,N4),e($,L4),e($,Et),_(Gn,Et,null),e(Et,j4),e(Et,yh),e(yh,R4),e(Et,W4),e(Et,wh),e(wh,G4),e($,M4),e($,Ir),_(Mn,Ir,null),e(Ir,H4),e(Ir,Th),e(Th,B4),e($,V4),e($,Fr),_(Hn,Fr,null),e(Fr,Y4),e(Fr,Bn),e(Bn,X4),e(Bn,Eh),e(Eh,Z4),e(Bn,J4),e($,K4),e($,$t),_(Vn,$t,null),e($t,Q4),e($t,$h),e($h,e$),e($t,t$),e($t,Yn),e(Yn,o$),e(Yn,xh),e(xh,r$),e(Yn,a$),e($,n$),e($,xt),_(Xn,xt,null),e(xt,s$),e(xt,kh),e(kh,i$),e(xt,l$),e(xt,lt),e(lt,d$),e(lt,Ah),e(Ah,c$),e(lt,p$),e(lt,qh),e(qh,m$),e(lt,h$),e(lt,Ph),e(Ph,u$),e(lt,f$),e($,g$),e($,Ur),_(Zn,Ur,null),e(Ur,_$),e(Ur,Dh),e(Dh,v$),e($,b$),e($,Ne),_(Jn,Ne,null),e(Ne,y$),e(Ne,Sh),e(Sh,w$),e(Ne,T$),e(Ne,Kn),e(Kn,E$),e(Kn,Oh),e(Oh,$$),e(Kn,x$),e(Ne,k$),e(Ne,Ch),e(Ch,A$),e($,q$),e($,kt),_(Qn,kt,null),e(kt,P$),e(kt,Po),e(Po,D$),e(Po,Ih),e(Ih,S$),e(Po,O$),e(Po,Fh),e(Fh,C$),e(Po,I$),e(kt,F$),e(kt,Uh),e(Uh,U$),e($,z$),e($,zr),_(es,zr,null),e(zr,N$),e(zr,ts),e(ts,L$),e(ts,Od),e(Od,j$),e(ts,R$),e($,W$),e($,At),_(os,At,null),e(At,G$),e(At,rs),e(rs,M$),e(rs,zh),e(zh,H$),e(rs,B$),e(At,V$),e(At,Nh),e(Nh,Y$),e($,X$),e($,Nr),_(as,Nr,null),e(Nr,Z$),e(Nr,Lh),e(Lh,J$),e($,K$),e($,qt),_(ns,qt,null),e(qt,Q$),e(qt,ss),e(ss,e3),e(ss,jh),e(jh,t3),e(ss,o3),e(qt,r3),e(qt,Rh),e(Rh,a3),e($,n3),e($,Le),_(is,Le,null),e(Le,s3),e(Le,ls),e(ls,i3),e(ls,Wh),e(Wh,l3),e(ls,d3),e(Le,c3),e(Le,Do),e(Do,p3),e(Do,Gh),e(Gh,m3),e(Do,h3),e(Do,Mh),e(Mh,u3),e(Do,f3),e(Le,g3),e(Le,Hh),e(Hh,_3),e($,v3),e($,Pt),_(ds,Pt,null),e(Pt,b3),e(Pt,ke),e(ke,y3),e(ke,Bh),e(Bh,w3),e(ke,T3),e(ke,Vh),e(Vh,E3),e(ke,$3),e(ke,Yh),e(Yh,x3),e(ke,k3),e(ke,Xh),e(Xh,A3),e(ke,q3),e(Pt,P3),_(Lr,Pt,null),e($,D3),e($,jr),_(cs,jr,null),e(jr,S3),e(jr,ps),e(ps,O3),e(ps,Zh),e(Zh,C3),e(ps,I3),e($,F3),e($,Rr),_(ms,Rr,null),e(Rr,U3),e(Rr,Jh),e(Jh,z3),e($,N3),e($,Wr),_(hs,Wr,null),e(Wr,L3),e(Wr,us),e(us,j3),e(us,Kh),e(Kh,R3),e(us,W3),e($,G3),e($,Dt),_(fs,Dt,null),e(Dt,M3),e(Dt,gs),e(gs,H3),e(gs,Qh),e(Qh,B3),e(gs,V3),e(Dt,Y3),e(Dt,eu),e(eu,X3),e($,Z3),e($,F),_(_s,F,null),e(F,J3),e(F,tu),e(tu,K3),e(F,Q3),e(F,ou),e(ou,ex),e(F,tx),e(F,ru),e(ru,ox),e(F,rx),e(F,So),e(So,ax),e(So,au),e(au,nx),e(So,sx),e(So,nu),e(nu,ix),e(So,lx),e(F,dx),_(Gr,F,null),e(F,cx),e(F,su),e(su,iu),e(iu,px),e(F,mx),e(F,dt),e(dt,Ae),e(Ae,hx),e(Ae,lu),e(lu,ux),e(Ae,fx),e(Ae,du),e(du,gx),e(Ae,_x),e(Ae,cu),e(cu,vx),e(Ae,bx),e(Ae,pu),e(pu,yx),e(Ae,wx),e(dt,Tx),e(dt,Oo),e(Oo,Ex),e(Oo,mu),e(mu,$x),e(Oo,xx),e(Oo,hu),e(hu,kx),e(Oo,Ax),e(dt,qx),e(dt,Cd),e(Cd,uu),e(uu,Px),e(Cd,Dx),e(dt,Sx),e(dt,St),e(St,fu),e(fu,Ox),e(St,Cx),e(St,gu),e(gu,Ix),e(St,Fx),e(St,_u),e(_u,Ux),e(St,zx),e(F,Nx),e(F,vu),e(vu,Lx),e(F,jx),e(F,bu),e(bu,Rx),e(F,Wx),e(F,vs),e(vs,Gx),e(vs,yu),e(yu,Mx),e(vs,Hx),e(F,Bx),e(F,ct),e(ct,Vx),e(ct,wu),e(wu,Yx),e(ct,Xx),e(ct,Tu),e(Tu,Zx),e(ct,Jx),e(ct,Eu),e(Eu,Kx),e(ct,Qx),e(F,ek),e(F,he),e(he,tk),e(he,Id),e(Id,ok),e(he,rk),e(he,$u),e($u,ak),e(he,nk),e(he,xu),e(xu,sk),e(he,ik),e(he,ku),e(ku,lk),e(he,dk),e(he,Au),e(Au,ck),e(he,pk),e(F,mk),e(F,V),e(V,hk),e(V,qu),e(qu,uk),e(V,fk),e(V,Pu),e(Pu,gk),e(V,_k),e(V,Du),e(Du,vk),e(V,bk),e(V,Su),e(Su,yk),e(V,wk),e(V,bs),e(bs,Tk),e(V,Ek),e(V,Ou),e(Ou,$k),e(V,xk),e(V,Cu),e(Cu,kk),e(V,Ak),e(V,Iu),e(Iu,qk),e(V,Pk),e(V,Fu),e(Fu,Dk),e(V,Sk),e(V,Uu),e(Uu,Ok),e(V,Ck),e(F,Ik),e(F,qe),e(qe,Fk),e(qe,Fd),e(Fd,Uk),e(qe,zk),e(qe,zu),e(zu,Nk),e(qe,Lk),e(qe,Ud),e(Ud,jk),e(qe,Rk),e(qe,Nu),e(Nu,Wk),e(qe,Gk),e(F,Mk),e(F,Lu),e(Lu,Hk),e($,Bk),e($,Mr),_(ys,Mr,null),e(Mr,Vk),e(Mr,ju),e(ju,Yk),e($,Xk),e($,Hr),_(ws,Hr,null),e(Hr,Zk),e(Hr,Ts),e(Ts,Jk),e(Ts,Ru),e(Ru,Kk),e(Ts,Qk),e($,eA),e($,Ot),_(Es,Ot,null),e(Ot,tA),e(Ot,$s),e($s,oA),e($s,Wu),e(Wu,rA),e($s,aA),e(Ot,nA),e(Ot,xs),e(xs,sA),e(xs,Gu),e(Gu,iA),e(xs,lA),e($,dA),e($,le),_(ks,le,null),e(le,cA),e(le,Mu),e(Mu,pA),e(le,mA),e(le,As),e(As,hA),e(As,Hu),e(Hu,uA),e(As,fA),e(le,gA),_(Br,le,null),e(le,_A),e(le,qs),e(qs,vA),e(qs,Bu),e(Bu,bA),e(qs,yA),e(le,wA),e(le,Co),e(Co,Io),e(Io,TA),e(Io,Vu),e(Vu,EA),e(Io,$A),e(Io,Yu),e(Yu,xA),e(Io,kA),e(Co,AA),e(Co,Fo),e(Fo,qA),e(Fo,Xu),e(Xu,PA),e(Fo,DA),e(Fo,Zu),e(Zu,SA),e(Fo,OA),e(Co,CA),e(Co,Uo),e(Uo,IA),e(Uo,Ju),e(Ju,FA),e(Uo,UA),e(Uo,Ku),e(Ku,zA),e(Uo,NA),e($,LA),e($,Ct),_(Ps,Ct,null),e(Ct,jA),e(Ct,zo),e(zo,RA),e(zo,Qu),e(Qu,WA),e(zo,GA),e(zo,ef),e(ef,MA),e(zo,HA),e(Ct,BA),e(Ct,tf),e(tf,VA),e($,YA),e($,It),_(Ds,It,null),e(It,XA),e(It,No),e(No,ZA),e(No,of),e(of,JA),e(No,KA),e(No,rf),e(rf,QA),e(No,e9),e(It,t9),e(It,af),e(af,o9),e($,r9),e($,Vr),_(Ss,Vr,null),e(Vr,a9),e(Vr,pt),e(pt,n9),e(pt,nf),e(nf,s9),e(pt,i9),e(pt,sf),e(sf,l9),e(pt,d9),e(pt,lf),e(lf,c9),e(pt,p9),e($,m9),e($,Yr),_(Os,Yr,null),e(Yr,h9),e(Yr,Cs),e(Cs,u9),e(Cs,df),e(df,f9),e(Cs,g9),e($,_9),e($,je),_(Is,je,null),e(je,v9),e(je,Fs),e(Fs,b9),e(Fs,cf),e(cf,y9),e(Fs,w9),e(je,T9),e(je,pf),e(pf,E9),e(je,$9),e(je,Us),e(Us,x9),e(Us,zd),e(zd,k9),e(Us,A9),e($,q9),e($,Ft),_(zs,Ft,null),e(Ft,P9),e(Ft,Ns),e(Ns,D9),e(Ns,mf),e(mf,S9),e(Ns,O9),e(Ft,C9),e(Ft,hf),e(hf,I9),e($,F9),e($,Ut),_(Ls,Ut,null),e(Ut,U9),e(Ut,uf),e(uf,z9),e(Ut,N9),e(Ut,ff),e(ff,L9),e($,j9),e($,Xr),_(js,Xr,null),e(Xr,R9),e(Xr,gf),e(gf,W9),e($,G9),e($,zt),_(Rs,zt,null),e(zt,M9),e(zt,_f),e(_f,H9),e(zt,B9),e(zt,vf),e(vf,V9),p(t,G1,c),p(t,Lo,c),e(Lo,Zr),e(Zr,bf),_(Ws,bf,null),e(Lo,Y9),e(Lo,yf),e(yf,X9),p(t,M1,c),p(t,mt,c),_(Gs,mt,null),e(mt,Z9),e(mt,Re),_(Ms,Re,null),e(Re,J9),e(Re,wf),e(wf,K9),e(Re,Q9),e(Re,Hs),e(Hs,e5),e(Hs,Tf),e(Tf,t5),e(Hs,o5),e(Re,r5),e(Re,Ef),e(Ef,a5),e(mt,n5),e(mt,de),_(Bs,de,null),e(de,s5),e(de,$f),e($f,i5),e(de,l5),e(de,Vs),e(Vs,d5),e(Vs,xf),e(xf,c5),e(Vs,p5),e(de,m5),_(Jr,de,null),e(de,h5),e(de,Ys),e(Ys,u5),e(Ys,kf),e(kf,f5),e(Ys,g5),e(de,_5),e(de,jo),e(jo,Ro),e(Ro,v5),e(Ro,Af),e(Af,b5),e(Ro,y5),e(Ro,qf),e(qf,w5),e(Ro,T5),e(jo,E5),e(jo,Wo),e(Wo,$5),e(Wo,Pf),e(Pf,x5),e(Wo,k5),e(Wo,Df),e(Df,A5),e(Wo,q5),e(jo,P5),e(jo,Go),e(Go,D5),e(Go,Sf),e(Sf,S5),e(Go,O5),e(Go,Of),e(Of,C5),e(Go,I5),p(t,H1,c),p(t,Mo,c),e(Mo,Kr),e(Kr,Cf),_(Xs,Cf,null),e(Mo,F5),e(Mo,If),e(If,U5),p(t,B1,c),p(t,S,c),_(Zs,S,null),e(S,z5),e(S,Js),e(Js,N5),e(Js,Ff),e(Ff,L5),e(Js,j5),e(S,R5),e(S,Ho),e(Ho,W5),e(Ho,Nd),e(Nd,G5),e(Ho,M5),e(Ho,Ks),e(Ks,H5),e(Ho,B5),e(S,V5),e(S,fe),_(Qs,fe,null),e(fe,Y5),e(fe,Uf),e(Uf,X5),e(fe,Z5),e(fe,Bo),e(Bo,J5),e(Bo,zf),e(zf,K5),e(Bo,Q5),e(Bo,Nf),e(Nf,eq),e(Bo,tq),e(fe,oq),e(fe,Vo),e(Vo,rq),e(Vo,Lf),e(Lf,aq),e(Vo,nq),e(Vo,jf),e(jf,sq),e(Vo,iq),e(fe,lq),e(fe,ei),e(ei,dq),e(ei,Rf),e(Rf,cq),e(ei,pq),e(S,mq),e(S,Qr),_(ti,Qr,null),e(Qr,hq),e(Qr,Wf),e(Wf,uq),e(S,fq),e(S,Nt),_(oi,Nt,null),e(Nt,gq),e(Nt,Gf),e(Gf,_q),e(Nt,vq),e(Nt,Yo),e(Yo,bq),e(Yo,Mf),e(Mf,yq),e(Yo,wq),e(Yo,Hf),e(Hf,Tq),e(Yo,Eq),e(S,$q),e(S,Lt),_(ri,Lt,null),e(Lt,xq),e(Lt,Bf),e(Bf,kq),e(Lt,Aq),_(ea,Lt,null),e(S,qq),e(S,jt),_(ai,jt,null),e(jt,Pq),e(jt,Vf),e(Vf,Dq),e(jt,Sq),_(ta,jt,null),e(S,Oq),e(S,Rt),_(ni,Rt,null),e(Rt,Cq),e(Rt,Yf),e(Yf,Iq),e(Rt,Fq),_(oa,Rt,null),e(S,Uq),e(S,Wt),_(si,Wt,null),e(Wt,zq),e(Wt,Xf),e(Xf,Nq),e(Wt,Lq),_(ra,Wt,null),e(S,jq),e(S,Gt),_(ii,Gt,null),e(Gt,Rq),e(Gt,Zf),e(Zf,Wq),e(Gt,Gq),_(aa,Gt,null),e(S,Mq),e(S,We),_(li,We,null),e(We,Hq),e(We,Jf),e(Jf,Bq),e(We,Vq),_(na,We,null),e(We,Yq),_(sa,We,null),e(S,Xq),e(S,Mt),_(di,Mt,null),e(Mt,Zq),e(Mt,Kf),e(Kf,Jq),e(Mt,Kq),_(ia,Mt,null),e(S,Qq),e(S,Ge),_(ci,Ge,null),e(Ge,eP),e(Ge,Qf),e(Qf,tP),e(Ge,oP),_(la,Ge,null),e(Ge,rP),_(da,Ge,null),e(S,aP),e(S,Me),_(pi,Me,null),e(Me,nP),e(Me,eg),e(eg,sP),e(Me,iP),_(ca,Me,null),e(Me,lP),_(pa,Me,null),e(S,dP),e(S,ma),_(mi,ma,null),e(ma,cP),e(ma,hi),e(hi,pP),e(hi,tg),e(tg,mP),e(hi,hP),e(S,uP),e(S,ha),_(ui,ha,null),e(ha,fP),e(ha,og),e(og,gP),e(S,_P),e(S,ua),_(fi,ua,null),e(ua,vP),e(ua,rg),e(rg,bP),p(t,V1,c),p(t,Xo,c),e(Xo,fa),e(fa,ag),_(gi,ag,null),e(Xo,yP),e(Xo,ng),e(ng,wP),p(t,Y1,c),p(t,Pe,c),_(_i,Pe,null),e(Pe,TP),e(Pe,vi),e(vi,EP),e(vi,sg),e(sg,$P),e(vi,xP),e(Pe,kP),e(Pe,Zo),e(Zo,AP),e(Zo,Ld),e(Ld,qP),e(Zo,PP),e(Zo,bi),e(bi,DP),e(Zo,SP),e(Pe,OP),e(Pe,ga),_(yi,ga,null),e(ga,CP),e(ga,Jo),e(Jo,IP),e(Jo,ig),e(ig,FP),e(Jo,UP),e(Jo,lg),e(lg,zP),e(Jo,NP),p(t,X1,c),p(t,Ko,c),e(Ko,_a),e(_a,dg),_(wi,dg,null),e(Ko,LP),e(Ko,cg),e(cg,jP),p(t,Z1,c),p(t,ge,c),e(ge,RP),e(ge,jd),e(jd,WP),e(ge,GP),e(ge,pg),e(pg,MP),e(ge,HP),e(ge,Rd),e(Rd,BP),e(ge,VP),e(ge,mg),e(mg,YP),e(ge,XP),p(t,J1,c),p(t,va,c),e(va,ZP),e(va,Wd),e(Wd,JP),e(va,KP),p(t,K1,c),p(t,ba,c),e(ba,Gd),e(Gd,hg),e(hg,QP),e(Gd,e6),e(ba,t6),e(ba,Md),e(Md,ug),e(ug,o6),e(Md,r6),p(t,Q1,c),p(t,He,c),e(He,a6),e(He,fg),e(fg,n6),e(He,s6),e(He,gg),e(gg,i6),e(He,l6),e(He,Hd),e(Hd,d6),e(He,c6),p(t,ey,c),p(t,ya,c),e(ya,wa),e(wa,_g),e(_g,p6),e(wa,m6),e(wa,vg),e(vg,h6),e(wa,u6),e(ya,f6),e(ya,Bd),e(Bd,bg),e(bg,g6),e(Bd,_6),p(t,ty,c),p(t,Qo,c),e(Qo,Ta),e(Ta,yg),_(Ti,yg,null),e(Qo,v6),e(Qo,wg),e(wg,b6),p(t,oy,c),p(t,Be,c),e(Be,y6),e(Be,Vd),e(Vd,w6),e(Be,T6),e(Be,Tg),e(Tg,E6),e(Be,$6),e(Be,Eg),e(Eg,x6),e(Be,k6),p(t,ry,c),p(t,Ht,c),e(Ht,A6),e(Ht,$g),e($g,q6),e(Ht,P6),e(Ht,Yd),e(Yd,D6),e(Ht,S6),p(t,ay,c),p(t,Ea,c),e(Ea,Xd),e(Xd,xg),e(xg,O6),e(Xd,C6),e(Ea,I6),e(Ea,Zd),e(Zd,kg),e(kg,F6),e(Zd,U6),p(t,ny,c),p(t,Ve,c),e(Ve,z6),e(Ve,Jd),e(Jd,N6),e(Ve,L6),e(Ve,Ag),e(Ag,j6),e(Ve,R6),e(Ve,qg),e(qg,W6),e(Ve,G6),p(t,sy,c),p(t,ce,c),e(ce,M6),e(ce,Kd),e(Kd,H6),e(ce,B6),e(ce,Pg),e(Pg,V6),e(ce,Y6),e(ce,Dg),e(Dg,X6),e(ce,Z6),e(ce,Sg),e(Sg,J6),e(ce,K6),e(ce,Qd),e(Qd,Q6),e(ce,eD),p(t,iy,c),p(t,ec,c),e(ec,tD),p(t,ly,c),_(Ei,t,c),p(t,dy,c),p(t,tc,c),e(tc,oD),p(t,cy,c),_($i,t,c),p(t,py,c),p(t,oc,c),e(oc,rD),p(t,my,c),_(xi,t,c),p(t,hy,c),p(t,rc,c),e(rc,aD),p(t,uy,c),p(t,ac,c),e(ac,nD),p(t,fy,c),_(ki,t,c),p(t,gy,c),p(t,$a,c),e($a,sD),e($a,Og),e(Og,iD),e($a,lD),p(t,_y,c),p(t,er,c),e(er,xa),e(xa,Cg),_(Ai,Cg,null),e(er,dD),e(er,Ig),e(Ig,cD),p(t,vy,c),p(t,_e,c),e(_e,pD),e(_e,nc),e(nc,mD),e(_e,hD),e(_e,Fg),e(Fg,uD),e(_e,fD),e(_e,Ug),e(Ug,gD),e(_e,_D),e(_e,zg),e(zg,vD),e(_e,bD),p(t,by,c),p(t,Bt,c),e(Bt,yD),e(Bt,qi),e(qi,wD),e(Bt,TD),e(Bt,Ng),e(Ng,ED),e(Bt,$D),p(t,yy,c),p(t,tr,c),e(tr,ka),e(ka,Lg),_(Pi,Lg,null),e(tr,xD),e(tr,jg),e(jg,kD),p(t,wy,c),p(t,sc,c),e(sc,AD),p(t,Ty,c),p(t,Aa,c),e(Aa,qD),e(Aa,Di),e(Di,Rg),e(Rg,PD),e(Aa,DD),p(t,Ey,c),_(Si,t,c),p(t,$y,c),p(t,Vt,c),e(Vt,SD),e(Vt,Oi),e(Oi,Wg),e(Wg,OD),e(Vt,CD),e(Vt,Ci),e(Ci,Gg),e(Gg,ID),e(Vt,FD),p(t,xy,c),_(Ii,t,c),p(t,ky,c),_(Fi,t,c),p(t,Ay,c),p(t,qa,c),e(qa,UD),e(qa,ic),e(ic,zD),e(qa,ND),p(t,qy,c),p(t,lc,c),e(lc,LD),p(t,Py,c),p(t,dc,c),e(dc,jD),p(t,Dy,c),p(t,cc,c),e(cc,Mg),e(Mg,Hg),e(Hg,RD),p(t,Sy,c),p(t,Pa,c),e(Pa,WD),e(Pa,Bg),e(Bg,GD),e(Pa,MD),p(t,Oy,c),p(t,pc,c),e(pc,HD),p(t,Cy,c),_(Ui,t,c),p(t,Iy,c),p(t,Yt,c),e(Yt,BD),e(Yt,Vg),e(Vg,VD),e(Yt,YD),e(Yt,Yg),e(Yg,XD),e(Yt,ZD),p(t,Fy,c),p(t,mc,c),e(mc,JD),p(t,Uy,c),_(zi,t,c),p(t,zy,c),p(t,Xt,c),e(Xt,KD),e(Xt,Xg),e(Xg,QD),e(Xt,e8),e(Xt,Zg),e(Zg,t8),e(Xt,o8),p(t,Ny,c),p(t,Zt,c),e(Zt,r8),e(Zt,Jg),e(Jg,a8),e(Zt,n8),e(Zt,Ni),e(Ni,Kg),e(Kg,s8),e(Zt,i8),p(t,Ly,c),_(Li,t,c),p(t,jy,c),p(t,hc,c),e(hc,l8),p(t,Ry,c),_(ji,t,c),p(t,Wy,c),p(t,uc,c),e(uc,d8),p(t,Gy,c),_(Ri,t,c),p(t,My,c),p(t,fc,c),e(fc,c8),p(t,Hy,c),p(t,gc,c),e(gc,Qg),e(Qg,e_),e(e_,p8),p(t,By,c),p(t,Da,c),e(Da,m8),e(Da,t_),e(t_,h8),e(Da,u8),p(t,Vy,c),p(t,_c,c),e(_c,Wi),e(Wi,f8),e(Wi,o_),e(o_,g8),e(Wi,_8),p(t,Yy,c),_(Gi,t,c),p(t,Xy,c),p(t,Mi,c),e(Mi,r_),e(r_,v8),p(t,Zy,c),_(Hi,t,c),p(t,Jy,c),p(t,Jt,c),e(Jt,b8),e(Jt,a_),e(a_,y8),e(Jt,w8),e(Jt,n_),e(n_,T8),e(Jt,E8),p(t,Ky,c),p(t,vc,c),e(vc,$8),p(t,Qy,c),_(Bi,t,c),p(t,e2,c),p(t,bc,c),e(bc,x8),p(t,t2,c),p(t,Sa,c),e(Sa,k8),e(Sa,s_),e(s_,A8),e(Sa,q8),p(t,o2,c),p(t,or,c),e(or,Oa),e(Oa,i_),_(Vi,i_,null),e(or,P8),e(or,l_),e(l_,D8),p(t,r2,c),p(t,Ca,c),e(Ca,S8),e(Ca,yc),e(yc,O8),e(Ca,C8),p(t,a2,c),p(t,ve,c),e(ve,I8),e(ve,Yi),e(Yi,F8),e(ve,U8),e(ve,Xi),e(Xi,z8),e(ve,N8),e(ve,Zi),e(Zi,L8),e(ve,j8),e(ve,Ji),e(Ji,R8),e(ve,W8),p(t,n2,c),p(t,Ia,c),e(Ia,G8),e(Ia,wc),e(wc,M8),e(Ia,H8),p(t,s2,c),p(t,Tc,c),p(t,i2,c),p(t,rr,c),e(rr,Fa),e(Fa,d_),_(Ki,d_,null),e(rr,B8),e(rr,c_),e(c_,V8),p(t,l2,c),p(t,Ec,c),e(Ec,Y8),p(t,d2,c),p(t,Kt,c),e(Kt,X8),e(Kt,Qi),e(Qi,Z8),e(Kt,J8),e(Kt,el),e(el,K8),e(Kt,Q8),p(t,c2,c),p(t,$c,c),e($c,eS),p(t,p2,c),_(tl,t,c),p(t,m2,c),p(t,xc,c),e(xc,tS),p(t,h2,c),p(t,Qt,c),e(Qt,oS),e(Qt,p_),e(p_,rS),e(Qt,aS),e(Qt,m_),e(m_,nS),e(Qt,sS),p(t,u2,c),p(t,ar,c),e(ar,Ua),e(Ua,h_),_(ol,h_,null),e(ar,iS),e(ar,u_),e(u_,lS),p(t,f2,c),p(t,kc,c),e(kc,dS),p(t,g2,c),p(t,Ye,c),e(Ye,cS),e(Ye,f_),e(f_,pS),e(Ye,mS),e(Ye,g_),e(g_,hS),e(Ye,uS),e(Ye,__),e(__,fS),e(Ye,gS),p(t,_2,c),p(t,eo,c),e(eo,_S),e(eo,v_),e(v_,vS),e(eo,bS),e(eo,b_),e(b_,yS),e(eo,wS),p(t,v2,c),_(rl,t,c),p(t,b2,c),p(t,za,c),e(za,TS),e(za,al),e(al,ES),e(za,$S),p(t,y2,c),p(t,nr,c),e(nr,Na),e(Na,y_),_(nl,y_,null),e(nr,xS),e(nr,w_),e(w_,kS),p(t,w2,c),p(t,Ac,c),e(Ac,AS),p(t,T2,c),_(sl,t,c),p(t,E2,c),p(t,to,c),e(to,qS),e(to,T_),e(T_,PS),e(to,DS),e(to,E_),e(E_,SS),e(to,OS),p(t,$2,c),p(t,qc,c),e(qc,CS),p(t,x2,c),_(il,t,c),p(t,k2,c),p(t,Pc,c),e(Pc,IS),p(t,A2,c),p(t,La,c),e(La,FS),e(La,$_),e($_,US),e(La,zS),p(t,q2,c),p(t,ht,c),e(ht,x_),e(x_,NS),e(ht,LS),e(ht,k_),e(k_,jS),e(ht,RS),e(ht,A_),e(A_,WS),e(ht,GS),p(t,P2,c),p(t,Dc,c),e(Dc,MS),p(t,D2,c),_(ll,t,c),p(t,S2,c),p(t,Sc,c),e(Sc,HS),p(t,O2,c),p(t,Xe,c),e(Xe,BS),e(Xe,q_),e(q_,VS),e(Xe,YS),e(Xe,P_),e(P_,XS),e(Xe,ZS),e(Xe,D_),e(D_,JS),e(Xe,KS),p(t,C2,c),p(t,sr,c),e(sr,ja),e(ja,S_),_(dl,S_,null),e(sr,QS),e(sr,O_),e(O_,e7),p(t,I2,c),p(t,oo,c),e(oo,t7),e(oo,C_),e(C_,o7),e(oo,r7),e(oo,I_),e(I_,a7),e(oo,n7),p(t,F2,c),p(t,Oc,c),e(Oc,s7),p(t,U2,c),p(t,Cc,c),e(Cc,i7),p(t,z2,c),p(t,Ra,c),e(Ra,l7),e(Ra,F_),e(F_,d7),e(Ra,c7),p(t,N2,c),_(cl,t,c),p(t,L2,c),p(t,ee,c),e(ee,p7),e(ee,U_),e(U_,m7),e(ee,h7),e(ee,z_),e(z_,u7),e(ee,f7),e(ee,N_),e(N_,g7),e(ee,_7),e(ee,L_),e(L_,v7),e(ee,b7),e(ee,j_),e(j_,y7),e(ee,w7),e(ee,R_),e(R_,T7),e(ee,E7),p(t,j2,c),p(t,Ic,c),e(Ic,$7),p(t,R2,c),p(t,ir,c),e(ir,Wa),e(Wa,W_),_(pl,W_,null),e(ir,x7),e(ir,G_),e(G_,k7),p(t,W2,c),_(Ga,t,c),p(t,G2,c),p(t,Ze,c),e(Ze,A7),e(Ze,ml),e(ml,q7),e(Ze,P7),e(Ze,Fc),e(Fc,D7),e(Ze,S7),e(Ze,hl),e(hl,O7),e(Ze,C7),p(t,M2,c),p(t,Je,c),e(Je,M_),e(M_,I7),e(Je,F7),e(Je,H_),e(H_,U7),e(Je,z7),e(Je,B_),e(B_,N7),e(Je,L7),e(Je,V_),e(V_,j7),p(t,H2,c),p(t,Uc,c),e(Uc,R7),p(t,B2,c),p(t,ul,c),e(ul,Y_),e(Y_,W7),e(ul,G7),p(t,V2,c),p(t,zc,c),e(zc,M7),p(t,Y2,c),_(fl,t,c),p(t,X2,c),p(t,ro,c),e(ro,H7),e(ro,X_),e(X_,B7),e(ro,V7),e(ro,Z_),e(Z_,Y7),e(ro,X7),p(t,Z2,c),_(gl,t,c),p(t,J2,c),p(t,ao,c),e(ao,Z7),e(ao,J_),e(J_,J7),e(ao,K7),e(ao,_l),e(_l,Q7),e(ao,eO),p(t,K2,c),p(t,Ma,c),e(Ma,tO),e(Ma,Nc),e(Nc,oO),e(Ma,rO),p(t,Q2,c),p(t,Lc,c),e(Lc,aO),p(t,e0,c),p(t,vl,c),e(vl,K_),e(K_,nO),e(vl,sO),p(t,t0,c),_(bl,t,c),p(t,o0,c),p(t,jc,c),e(jc,iO),p(t,r0,c),_(yl,t,c),p(t,a0,c),p(t,wl,c),e(wl,Q_),e(Q_,lO),e(wl,dO),p(t,n0,c),_(Tl,t,c),p(t,s0,c),p(t,Rc,c),e(Rc,cO),p(t,i0,c),_(El,t,c),p(t,l0,c),p(t,Wc,c),e(Wc,pO),p(t,d0,c),p(t,Ha,c),e(Ha,mO),e(Ha,$l),e($l,hO),e(Ha,uO),p(t,c0,c),p(t,xl,c),e(xl,ev),e(ev,fO),e(xl,gO),p(t,p0,c),p(t,no,c),e(no,_O),e(no,tv),e(tv,vO),e(no,bO),e(no,ov),e(ov,yO),e(no,wO),p(t,m0,c),p(t,Ba,c),e(Ba,TO),e(Ba,rv),e(rv,EO),e(Ba,$O),p(t,h0,c),_(kl,t,c),p(t,u0,c),p(t,Gc,c),e(Gc,xO),p(t,f0,c),p(t,Ke,c),e(Ke,av),e(av,kO),e(Ke,AO),e(Ke,nv),e(nv,qO),e(Ke,PO),e(Ke,Al),e(Al,DO),e(Al,sv),e(sv,SO),e(Al,OO),e(Ke,CO),e(Ke,ql),e(ql,IO),e(ql,iv),e(iv,FO),e(ql,UO),p(t,g0,c),p(t,Pl,c),e(Pl,ut),e(ut,zO),e(ut,lv),e(lv,NO),e(ut,LO),e(ut,dv),e(dv,jO),e(ut,RO),e(ut,cv),e(cv,WO),e(ut,GO),p(t,_0,c),p(t,Va,c),e(Va,MO),e(Va,pv),e(pv,HO),e(Va,BO),p(t,v0,c),_(Dl,t,c),p(t,b0,c),p(t,lr,c),e(lr,mv),e(mv,VO),e(lr,YO),e(lr,hv),e(hv,XO),e(lr,ZO),p(t,y0,c),p(t,so,c),e(so,JO),e(so,uv),e(uv,KO),e(so,QO),e(so,fv),e(fv,eC),e(so,tC),p(t,w0,c),p(t,Mc,c),e(Mc,oC),p(t,T0,c),p(t,be,c),e(be,gv),e(gv,rC),e(be,aC),e(be,_v),e(_v,nC),e(be,sC),e(be,Sl),e(Sl,iC),e(Sl,vv),e(vv,lC),e(Sl,dC),e(be,cC),e(be,dr),e(dr,pC),e(dr,bv),e(bv,mC),e(dr,hC),e(dr,yv),e(yv,uC),e(dr,fC),e(be,gC),e(be,wv),e(wv,_C),p(t,E0,c),p(t,Hc,c),e(Hc,vC),p(t,$0,c),p(t,Ya,c),e(Ya,cr),e(cr,bC),e(cr,Tv),e(Tv,yC),e(cr,wC),e(cr,Ev),e(Ev,TC),e(cr,EC),e(Ya,$C),e(Ya,De),e(De,xC),e(De,$v),e($v,kC),e(De,AC),e(De,xv),e(xv,qC),e(De,PC),e(De,kv),e(kv,DC),e(De,SC),e(De,Av),e(Av,OC),e(De,CC),p(t,x0,c),p(t,pr,c),e(pr,Xa),e(Xa,qv),_(Ol,qv,null),e(pr,IC),e(pr,Pv),e(Pv,FC),p(t,k0,c),p(t,Za,c),e(Za,UC),e(Za,Cl),e(Cl,zC),e(Za,NC),p(t,A0,c),p(t,Il,c),e(Il,Dv),e(Dv,LC),e(Il,jC),p(t,q0,c),p(t,Fl,c),e(Fl,Sv),e(Sv,RC),e(Fl,WC),p(t,P0,c),p(t,pe,c),e(pe,Ov),e(Ov,Ul),e(Ul,GC),e(Ul,Cv),e(Cv,MC),e(Ul,HC),e(pe,BC),e(pe,zl),e(zl,Bc),e(Bc,Iv),e(Iv,VC),e(Bc,YC),e(zl,XC),e(zl,mr),e(mr,Nl),e(Nl,ZC),e(Nl,Fv),e(Fv,JC),e(Nl,KC),e(mr,QC),e(mr,Ll),e(Ll,eI),e(Ll,Uv),e(Uv,tI),e(Ll,oI),e(mr,rI),e(mr,jl),e(jl,aI),e(jl,zv),e(zv,nI),e(jl,sI),e(pe,iI),e(pe,Nv),e(Nv,hr),e(hr,lI),e(hr,Lv),e(Lv,dI),e(hr,cI),e(hr,jv),e(jv,pI),e(hr,mI),e(pe,hI),e(pe,Rv),e(Rv,ft),e(ft,uI),e(ft,Wv),e(Wv,fI),e(ft,gI),e(ft,Gv),e(Gv,_I),e(ft,vI),e(ft,Mv),e(Mv,bI),e(ft,yI),e(pe,wI),e(pe,Hv),e(Hv,ur),e(ur,TI),e(ur,Bv),e(Bv,EI),e(ur,$I),e(ur,Vv),e(Vv,xI),e(ur,kI),e(pe,AI),e(pe,Rl),e(Rl,gt),e(gt,qI),e(gt,Yv),e(Yv,PI),e(gt,DI),e(gt,Xv),e(Xv,SI),e(gt,OI),e(gt,Zv),e(Zv,CI),e(gt,II),e(Rl,FI),e(Rl,_t),e(_t,Vc),e(Vc,UI),e(Vc,Wl),e(Wl,Se),e(Se,zI),e(Se,Jv),e(Jv,NI),e(Se,LI),e(Se,Kv),e(Kv,jI),e(Se,RI),e(Se,Qv),e(Qv,WI),e(Se,GI),e(Se,eb),e(eb,MI),e(Se,HI),e(Wl,BI),e(Wl,Gl),e(Gl,VI),e(Gl,tb),e(tb,YI),e(Gl,XI),e(_t,ZI),e(_t,vt),e(vt,ob),e(ob,JI),e(vt,KI),e(vt,rb),e(rb,QI),e(vt,eF),e(vt,ab),e(ab,tF),e(vt,oF),e(vt,nb),e(nb,rF),e(_t,aF),e(_t,Ja),e(Ja,sb),e(sb,nF),e(Ja,sF),e(Ja,ib),e(ib,iF),e(Ja,lF),e(_t,dF),e(_t,Ka),e(Ka,lb),e(lb,cF),e(Ka,pF),e(Ka,db),e(db,mF),e(Ka,hF),p(t,D0,c),p(t,Yc,c),e(Yc,cb),e(cb,uF),p(t,S0,c),p(t,Xc,c),e(Xc,Qe),e(Qe,fF),e(Qe,pb),e(pb,gF),e(Qe,_F),e(Qe,mb),e(mb,vF),e(Qe,bF),e(Qe,yF),e(Qe,wF),e(Qe,Ml),e(Ml,TF),p(t,O0,c),p(t,fr,c),e(fr,Qa),e(Qa,hb),_(Hl,hb,null),e(fr,EF),e(fr,ub),e(ub,$F),p(t,C0,c),p(t,io,c),e(io,xF),e(io,Bl),e(Bl,kF),e(io,AF),e(io,Vl),e(Vl,qF),e(io,PF),p(t,I0,c),p(t,Yl,c),e(Yl,fb),e(fb,DF),e(Yl,SF),p(t,F0,c),p(t,Xl,c),e(Xl,gb),e(gb,OF),e(Xl,CF),p(t,U0,c),p(t,lo,c),e(lo,IF),e(lo,_b),e(_b,FF),e(lo,UF),e(lo,vb),e(vb,zF),e(lo,NF),p(t,z0,c),p(t,et,c),e(et,en),e(en,bb),e(bb,LF),e(en,jF),e(en,yb),e(yb,RF),e(en,WF),e(et,GF),e(et,tn),e(tn,wb),e(wb,MF),e(tn,HF),e(tn,Zl),e(Zl,BF),e(tn,VF),e(et,YF),e(et,tt),e(tt,Tb),e(Tb,XF),e(tt,ZF),e(tt,Eb),e(Eb,JF),e(tt,KF),e(tt,$b),e($b,QF),e(tt,eU),e(tt,xb),e(xb,tU),e(tt,oU),e(et,rU),e(et,Zc),e(Zc,aU),e(Zc,Jl),e(Jl,Oe),e(Oe,nU),e(Oe,kb),e(kb,sU),e(Oe,iU),e(Oe,Ab),e(Ab,lU),e(Oe,dU),e(Oe,qb),e(qb,cU),e(Oe,pU),e(Oe,Pb),e(Pb,mU),e(Oe,hU),e(Jl,uU),e(Jl,Kl),e(Kl,fU),e(Kl,Db),e(Db,gU),e(Kl,_U),p(t,N0,c),p(t,gr,c),e(gr,on),e(on,Sb),_(Ql,Sb,null),e(gr,vU),e(gr,Ob),e(Ob,bU),p(t,L0,c),p(t,ot,c),e(ot,yU),e(ot,Cb),e(Cb,wU),e(ot,TU),e(ot,ed),e(ed,EU),e(ot,$U),e(ot,td),e(td,xU),e(ot,kU),p(t,j0,c),_(rn,t,c),p(t,R0,c),p(t,Jc,c),e(Jc,Ib),e(Ib,AU),p(t,W0,c),p(t,co,c),e(co,Fb),e(Fb,qU),e(co,PU),e(co,Ub),e(Ub,DU),e(co,SU),e(co,zb),e(zb,OU),p(t,G0,c),p(t,_r,c),e(_r,Nb),e(Nb,CU),e(_r,IU),e(_r,od),e(od,FU),e(_r,UU),p(t,M0,c),p(t,vr,c),e(vr,Lb),e(Lb,zU),e(vr,NU),e(vr,jb),e(jb,LU),e(vr,jU),p(t,H0,c),_(rd,t,c),p(t,B0,c),p(t,Kc,c),e(Kc,Rb),e(Rb,RU),p(t,V0,c),p(t,an,c),e(an,ad),e(ad,WU),e(ad,Wb),e(Wb,GU),e(ad,MU),e(an,HU),e(an,Ce),e(Ce,BU),e(Ce,Gb),e(Gb,VU),e(Ce,YU),e(Ce,Mb),e(Mb,XU),e(Ce,ZU),e(Ce,Hb),e(Hb,JU),e(Ce,KU),e(Ce,Bb),e(Bb,QU),e(Ce,ez),p(t,Y0,c),p(t,po,c),e(po,tz),e(po,Vb),e(Vb,oz),e(po,rz),e(po,nd),e(nd,az),e(po,nz),p(t,X0,c),p(t,Qc,c),e(Qc,sz),p(t,Z0,c),p(t,q,c),e(q,iz),e(q,ep),e(ep,lz),e(q,Yb),e(q,dz),e(q,tp),e(tp,cz),e(q,Xb),e(q,pz),e(q,op),e(op,mz),e(q,Zb),e(q,hz),e(q,rp),e(rp,uz),e(q,Jb),e(q,fz),e(q,ap),e(ap,gz),e(q,Kb),e(q,_z),e(q,np),e(np,vz),e(q,Qb),e(q,bz),e(q,sp),e(sp,yz),e(q,e1),e(q,wz),e(q,ip),e(ip,Tz),e(q,t1),e(q,Ez),e(q,lp),e(lp,$z),e(q,o1),e(q,xz),e(q,dp),e(dp,kz),e(q,r1),e(q,Az),e(q,cp),e(cp,qz),e(q,a1),e(q,Pz),e(q,pp),e(pp,Dz),e(q,n1),e(q,Sz),e(q,mp),e(mp,Oz),e(q,s1),e(q,Cz),e(q,hp),e(hp,Iz),e(q,i1),e(q,Fz),e(q,up),e(up,Uz),e(q,l1),e(q,zz),e(q,fp),e(fp,Nz),e(q,d1),e(q,Lz),e(q,gp),e(gp,jz),e(q,c1),e(q,Rz),e(q,_p),e(_p,Wz),e(q,p1),e(q,Gz),e(q,vp),e(vp,Mz),e(q,m1),e(q,Hz),e(q,bp),e(bp,Bz),e(q,h1),e(q,Vz),e(q,yp),e(yp,Yz),e(q,u1),e(q,Xz),e(q,wp),e(wp,Zz),e(q,f1),e(q,Jz),e(q,Tp),e(Tp,Kz),e(q,g1),e(q,Qz),J0=!0},p(t,[c]){const sd={};c&2&&(sd.$$scope={dirty:c,ctx:t}),qr.$set(sd);const _1={};c&2&&(_1.$$scope={dirty:c,ctx:t}),Lr.$set(_1);const v1={};c&2&&(v1.$$scope={dirty:c,ctx:t}),Gr.$set(v1);const b1={};c&2&&(b1.$$scope={dirty:c,ctx:t}),Br.$set(b1);const br={};c&2&&(br.$$scope={dirty:c,ctx:t}),Jr.$set(br);const y1={};c&2&&(y1.$$scope={dirty:c,ctx:t}),ea.$set(y1);const w1={};c&2&&(w1.$$scope={dirty:c,ctx:t}),ta.$set(w1);const yr={};c&2&&(yr.$$scope={dirty:c,ctx:t}),oa.$set(yr);const T1={};c&2&&(T1.$$scope={dirty:c,ctx:t}),ra.$set(T1);const E1={};c&2&&(E1.$$scope={dirty:c,ctx:t}),aa.$set(E1);const id={};c&2&&(id.$$scope={dirty:c,ctx:t}),na.$set(id);const $1={};c&2&&($1.$$scope={dirty:c,ctx:t}),sa.$set($1);const ld={};c&2&&(ld.$$scope={dirty:c,ctx:t}),ia.$set(ld);const x1={};c&2&&(x1.$$scope={dirty:c,ctx:t}),la.$set(x1);const H={};c&2&&(H.$$scope={dirty:c,ctx:t}),da.$set(H);const Ep={};c&2&&(Ep.$$scope={dirty:c,ctx:t}),ca.$set(Ep);const k1={};c&2&&(k1.$$scope={dirty:c,ctx:t}),pa.$set(k1);const $p={};c&2&&($p.$$scope={dirty:c,ctx:t}),Ga.$set($p);const A1={};c&2&&(A1.$$scope={dirty:c,ctx:t}),rn.$set(A1)},i(t){J0||(v(h.$$.fragment,t),v(qr.$$.fragment,t),v(Un.$$.fragment,t),v(zn.$$.fragment,t),v(Nn.$$.fragment,t),v(Ln.$$.fragment,t),v(Rn.$$.fragment,t),v(Gn.$$.fragment,t),v(Mn.$$.fragment,t),v(Hn.$$.fragment,t),v(Vn.$$.fragment,t),v(Xn.$$.fragment,t),v(Zn.$$.fragment,t),v(Jn.$$.fragment,t),v(Qn.$$.fragment,t),v(es.$$.fragment,t),v(os.$$.fragment,t),v(as.$$.fragment,t),v(ns.$$.fragment,t),v(is.$$.fragment,t),v(ds.$$.fragment,t),v(Lr.$$.fragment,t),v(cs.$$.fragment,t),v(ms.$$.fragment,t),v(hs.$$.fragment,t),v(fs.$$.fragment,t),v(_s.$$.fragment,t),v(Gr.$$.fragment,t),v(ys.$$.fragment,t),v(ws.$$.fragment,t),v(Es.$$.fragment,t),v(ks.$$.fragment,t),v(Br.$$.fragment,t),v(Ps.$$.fragment,t),v(Ds.$$.fragment,t),v(Ss.$$.fragment,t),v(Os.$$.fragment,t),v(Is.$$.fragment,t),v(zs.$$.fragment,t),v(Ls.$$.fragment,t),v(js.$$.fragment,t),v(Rs.$$.fragment,t),v(Ws.$$.fragment,t),v(Gs.$$.fragment,t),v(Ms.$$.fragment,t),v(Bs.$$.fragment,t),v(Jr.$$.fragment,t),v(Xs.$$.fragment,t),v(Zs.$$.fragment,t),v(Qs.$$.fragment,t),v(ti.$$.fragment,t),v(oi.$$.fragment,t),v(ri.$$.fragment,t),v(ea.$$.fragment,t),v(ai.$$.fragment,t),v(ta.$$.fragment,t),v(ni.$$.fragment,t),v(oa.$$.fragment,t),v(si.$$.fragment,t),v(ra.$$.fragment,t),v(ii.$$.fragment,t),v(aa.$$.fragment,t),v(li.$$.fragment,t),v(na.$$.fragment,t),v(sa.$$.fragment,t),v(di.$$.fragment,t),v(ia.$$.fragment,t),v(ci.$$.fragment,t),v(la.$$.fragment,t),v(da.$$.fragment,t),v(pi.$$.fragment,t),v(ca.$$.fragment,t),v(pa.$$.fragment,t),v(mi.$$.fragment,t),v(ui.$$.fragment,t),v(fi.$$.fragment,t),v(gi.$$.fragment,t),v(_i.$$.fragment,t),v(yi.$$.fragment,t),v(wi.$$.fragment,t),v(Ti.$$.fragment,t),v(Ei.$$.fragment,t),v($i.$$.fragment,t),v(xi.$$.fragment,t),v(ki.$$.fragment,t),v(Ai.$$.fragment,t),v(Pi.$$.fragment,t),v(Si.$$.fragment,t),v(Ii.$$.fragment,t),v(Fi.$$.fragment,t),v(Ui.$$.fragment,t),v(zi.$$.fragment,t),v(Li.$$.fragment,t),v(ji.$$.fragment,t),v(Ri.$$.fragment,t),v(Gi.$$.fragment,t),v(Hi.$$.fragment,t),v(Bi.$$.fragment,t),v(Vi.$$.fragment,t),v(Ki.$$.fragment,t),v(tl.$$.fragment,t),v(ol.$$.fragment,t),v(rl.$$.fragment,t),v(nl.$$.fragment,t),v(sl.$$.fragment,t),v(il.$$.fragment,t),v(ll.$$.fragment,t),v(dl.$$.fragment,t),v(cl.$$.fragment,t),v(pl.$$.fragment,t),v(Ga.$$.fragment,t),v(fl.$$.fragment,t),v(gl.$$.fragment,t),v(bl.$$.fragment,t),v(yl.$$.fragment,t),v(Tl.$$.fragment,t),v(El.$$.fragment,t),v(kl.$$.fragment,t),v(Dl.$$.fragment,t),v(Ol.$$.fragment,t),v(Hl.$$.fragment,t),v(Ql.$$.fragment,t),v(rn.$$.fragment,t),v(rd.$$.fragment,t),J0=!0)},o(t){b(h.$$.fragment,t),b(qr.$$.fragment,t),b(Un.$$.fragment,t),b(zn.$$.fragment,t),b(Nn.$$.fragment,t),b(Ln.$$.fragment,t),b(Rn.$$.fragment,t),b(Gn.$$.fragment,t),b(Mn.$$.fragment,t),b(Hn.$$.fragment,t),b(Vn.$$.fragment,t),b(Xn.$$.fragment,t),b(Zn.$$.fragment,t),b(Jn.$$.fragment,t),b(Qn.$$.fragment,t),b(es.$$.fragment,t),b(os.$$.fragment,t),b(as.$$.fragment,t),b(ns.$$.fragment,t),b(is.$$.fragment,t),b(ds.$$.fragment,t),b(Lr.$$.fragment,t),b(cs.$$.fragment,t),b(ms.$$.fragment,t),b(hs.$$.fragment,t),b(fs.$$.fragment,t),b(_s.$$.fragment,t),b(Gr.$$.fragment,t),b(ys.$$.fragment,t),b(ws.$$.fragment,t),b(Es.$$.fragment,t),b(ks.$$.fragment,t),b(Br.$$.fragment,t),b(Ps.$$.fragment,t),b(Ds.$$.fragment,t),b(Ss.$$.fragment,t),b(Os.$$.fragment,t),b(Is.$$.fragment,t),b(zs.$$.fragment,t),b(Ls.$$.fragment,t),b(js.$$.fragment,t),b(Rs.$$.fragment,t),b(Ws.$$.fragment,t),b(Gs.$$.fragment,t),b(Ms.$$.fragment,t),b(Bs.$$.fragment,t),b(Jr.$$.fragment,t),b(Xs.$$.fragment,t),b(Zs.$$.fragment,t),b(Qs.$$.fragment,t),b(ti.$$.fragment,t),b(oi.$$.fragment,t),b(ri.$$.fragment,t),b(ea.$$.fragment,t),b(ai.$$.fragment,t),b(ta.$$.fragment,t),b(ni.$$.fragment,t),b(oa.$$.fragment,t),b(si.$$.fragment,t),b(ra.$$.fragment,t),b(ii.$$.fragment,t),b(aa.$$.fragment,t),b(li.$$.fragment,t),b(na.$$.fragment,t),b(sa.$$.fragment,t),b(di.$$.fragment,t),b(ia.$$.fragment,t),b(ci.$$.fragment,t),b(la.$$.fragment,t),b(da.$$.fragment,t),b(pi.$$.fragment,t),b(ca.$$.fragment,t),b(pa.$$.fragment,t),b(mi.$$.fragment,t),b(ui.$$.fragment,t),b(fi.$$.fragment,t),b(gi.$$.fragment,t),b(_i.$$.fragment,t),b(yi.$$.fragment,t),b(wi.$$.fragment,t),b(Ti.$$.fragment,t),b(Ei.$$.fragment,t),b($i.$$.fragment,t),b(xi.$$.fragment,t),b(ki.$$.fragment,t),b(Ai.$$.fragment,t),b(Pi.$$.fragment,t),b(Si.$$.fragment,t),b(Ii.$$.fragment,t),b(Fi.$$.fragment,t),b(Ui.$$.fragment,t),b(zi.$$.fragment,t),b(Li.$$.fragment,t),b(ji.$$.fragment,t),b(Ri.$$.fragment,t),b(Gi.$$.fragment,t),b(Hi.$$.fragment,t),b(Bi.$$.fragment,t),b(Vi.$$.fragment,t),b(Ki.$$.fragment,t),b(tl.$$.fragment,t),b(ol.$$.fragment,t),b(rl.$$.fragment,t),b(nl.$$.fragment,t),b(sl.$$.fragment,t),b(il.$$.fragment,t),b(ll.$$.fragment,t),b(dl.$$.fragment,t),b(cl.$$.fragment,t),b(pl.$$.fragment,t),b(Ga.$$.fragment,t),b(fl.$$.fragment,t),b(gl.$$.fragment,t),b(bl.$$.fragment,t),b(yl.$$.fragment,t),b(Tl.$$.fragment,t),b(El.$$.fragment,t),b(kl.$$.fragment,t),b(Dl.$$.fragment,t),b(Ol.$$.fragment,t),b(Hl.$$.fragment,t),b(Ql.$$.fragment,t),b(rn.$$.fragment,t),b(rd.$$.fragment,t),J0=!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(Fe),t&&o(se),t&&o(oe),t&&o(Ao),t&&o(W),t&&o(z1),y(qr,t),t&&o(N1),t&&o(Pr),t&&o(L1),y(Un,t),t&&o(j1),t&&o(Tt),t&&o(R1),t&&o(qo),y(zn),t&&o(W1),t&&o($),y(Nn),y(Ln),y(Rn),y(Gn),y(Mn),y(Hn),y(Vn),y(Xn),y(Zn),y(Jn),y(Qn),y(es),y(os),y(as),y(ns),y(is),y(ds),y(Lr),y(cs),y(ms),y(hs),y(fs),y(_s),y(Gr),y(ys),y(ws),y(Es),y(ks),y(Br),y(Ps),y(Ds),y(Ss),y(Os),y(Is),y(zs),y(Ls),y(js),y(Rs),t&&o(G1),t&&o(Lo),y(Ws),t&&o(M1),t&&o(mt),y(Gs),y(Ms),y(Bs),y(Jr),t&&o(H1),t&&o(Mo),y(Xs),t&&o(B1),t&&o(S),y(Zs),y(Qs),y(ti),y(oi),y(ri),y(ea),y(ai),y(ta),y(ni),y(oa),y(si),y(ra),y(ii),y(aa),y(li),y(na),y(sa),y(di),y(ia),y(ci),y(la),y(da),y(pi),y(ca),y(pa),y(mi),y(ui),y(fi),t&&o(V1),t&&o(Xo),y(gi),t&&o(Y1),t&&o(Pe),y(_i),y(yi),t&&o(X1),t&&o(Ko),y(wi),t&&o(Z1),t&&o(ge),t&&o(J1),t&&o(va),t&&o(K1),t&&o(ba),t&&o(Q1),t&&o(He),t&&o(ey),t&&o(ya),t&&o(ty),t&&o(Qo),y(Ti),t&&o(oy),t&&o(Be),t&&o(ry),t&&o(Ht),t&&o(ay),t&&o(Ea),t&&o(ny),t&&o(Ve),t&&o(sy),t&&o(ce),t&&o(iy),t&&o(ec),t&&o(ly),y(Ei,t),t&&o(dy),t&&o(tc),t&&o(cy),y($i,t),t&&o(py),t&&o(oc),t&&o(my),y(xi,t),t&&o(hy),t&&o(rc),t&&o(uy),t&&o(ac),t&&o(fy),y(ki,t),t&&o(gy),t&&o($a),t&&o(_y),t&&o(er),y(Ai),t&&o(vy),t&&o(_e),t&&o(by),t&&o(Bt),t&&o(yy),t&&o(tr),y(Pi),t&&o(wy),t&&o(sc),t&&o(Ty),t&&o(Aa),t&&o(Ey),y(Si,t),t&&o($y),t&&o(Vt),t&&o(xy),y(Ii,t),t&&o(ky),y(Fi,t),t&&o(Ay),t&&o(qa),t&&o(qy),t&&o(lc),t&&o(Py),t&&o(dc),t&&o(Dy),t&&o(cc),t&&o(Sy),t&&o(Pa),t&&o(Oy),t&&o(pc),t&&o(Cy),y(Ui,t),t&&o(Iy),t&&o(Yt),t&&o(Fy),t&&o(mc),t&&o(Uy),y(zi,t),t&&o(zy),t&&o(Xt),t&&o(Ny),t&&o(Zt),t&&o(Ly),y(Li,t),t&&o(jy),t&&o(hc),t&&o(Ry),y(ji,t),t&&o(Wy),t&&o(uc),t&&o(Gy),y(Ri,t),t&&o(My),t&&o(fc),t&&o(Hy),t&&o(gc),t&&o(By),t&&o(Da),t&&o(Vy),t&&o(_c),t&&o(Yy),y(Gi,t),t&&o(Xy),t&&o(Mi),t&&o(Zy),y(Hi,t),t&&o(Jy),t&&o(Jt),t&&o(Ky),t&&o(vc),t&&o(Qy),y(Bi,t),t&&o(e2),t&&o(bc),t&&o(t2),t&&o(Sa),t&&o(o2),t&&o(or),y(Vi),t&&o(r2),t&&o(Ca),t&&o(a2),t&&o(ve),t&&o(n2),t&&o(Ia),t&&o(s2),t&&o(Tc),t&&o(i2),t&&o(rr),y(Ki),t&&o(l2),t&&o(Ec),t&&o(d2),t&&o(Kt),t&&o(c2),t&&o($c),t&&o(p2),y(tl,t),t&&o(m2),t&&o(xc),t&&o(h2),t&&o(Qt),t&&o(u2),t&&o(ar),y(ol),t&&o(f2),t&&o(kc),t&&o(g2),t&&o(Ye),t&&o(_2),t&&o(eo),t&&o(v2),y(rl,t),t&&o(b2),t&&o(za),t&&o(y2),t&&o(nr),y(nl),t&&o(w2),t&&o(Ac),t&&o(T2),y(sl,t),t&&o(E2),t&&o(to),t&&o($2),t&&o(qc),t&&o(x2),y(il,t),t&&o(k2),t&&o(Pc),t&&o(A2),t&&o(La),t&&o(q2),t&&o(ht),t&&o(P2),t&&o(Dc),t&&o(D2),y(ll,t),t&&o(S2),t&&o(Sc),t&&o(O2),t&&o(Xe),t&&o(C2),t&&o(sr),y(dl),t&&o(I2),t&&o(oo),t&&o(F2),t&&o(Oc),t&&o(U2),t&&o(Cc),t&&o(z2),t&&o(Ra),t&&o(N2),y(cl,t),t&&o(L2),t&&o(ee),t&&o(j2),t&&o(Ic),t&&o(R2),t&&o(ir),y(pl),t&&o(W2),y(Ga,t),t&&o(G2),t&&o(Ze),t&&o(M2),t&&o(Je),t&&o(H2),t&&o(Uc),t&&o(B2),t&&o(ul),t&&o(V2),t&&o(zc),t&&o(Y2),y(fl,t),t&&o(X2),t&&o(ro),t&&o(Z2),y(gl,t),t&&o(J2),t&&o(ao),t&&o(K2),t&&o(Ma),t&&o(Q2),t&&o(Lc),t&&o(e0),t&&o(vl),t&&o(t0),y(bl,t),t&&o(o0),t&&o(jc),t&&o(r0),y(yl,t),t&&o(a0),t&&o(wl),t&&o(n0),y(Tl,t),t&&o(s0),t&&o(Rc),t&&o(i0),y(El,t),t&&o(l0),t&&o(Wc),t&&o(d0),t&&o(Ha),t&&o(c0),t&&o(xl),t&&o(p0),t&&o(no),t&&o(m0),t&&o(Ba),t&&o(h0),y(kl,t),t&&o(u0),t&&o(Gc),t&&o(f0),t&&o(Ke),t&&o(g0),t&&o(Pl),t&&o(_0),t&&o(Va),t&&o(v0),y(Dl,t),t&&o(b0),t&&o(lr),t&&o(y0),t&&o(so),t&&o(w0),t&&o(Mc),t&&o(T0),t&&o(be),t&&o(E0),t&&o(Hc),t&&o($0),t&&o(Ya),t&&o(x0),t&&o(pr),y(Ol),t&&o(k0),t&&o(Za),t&&o(A0),t&&o(Il),t&&o(q0),t&&o(Fl),t&&o(P0),t&&o(pe),t&&o(D0),t&&o(Yc),t&&o(S0),t&&o(Xc),t&&o(O0),t&&o(fr),y(Hl),t&&o(C0),t&&o(io),t&&o(I0),t&&o(Yl),t&&o(F0),t&&o(Xl),t&&o(U0),t&&o(lo),t&&o(z0),t&&o(et),t&&o(N0),t&&o(gr),y(Ql),t&&o(L0),t&&o(ot),t&&o(j0),y(rn,t),t&&o(R0),t&&o(Jc),t&&o(W0),t&&o(co),t&&o(G0),t&&o(_r),t&&o(M0),t&&o(vr),t&&o(H0),y(rd,t),t&&o(B0),t&&o(Kc),t&&o(V0),t&&o(an),t&&o(Y0),t&&o(po),t&&o(X0),t&&o(Qc),t&&o(Z0),t&&o(q)}}}const zY={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 NY(C){return gY(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class HY extends mY{constructor(u){super();hY(this,u,NY,UY,uY,{})}}export{HY as default,zY as metadata};
