import{S as iL,i as dL,s as cL,e as n,k as i,w as f,t as r,M as pL,c as s,d as o,m as d,a as l,x as g,h as a,b as m,G as e,g as p,y as _,q as b,o as v,B as y,v as mL,L as _o}from"../../chunks/vendor-hf-doc-builder.js";import{T as un}from"../../chunks/Tip-hf-doc-builder.js";import{D as S}from"../../chunks/Docstring-hf-doc-builder.js";import{C as U}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as oe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as go}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function hL(D){let u,k,T,w,$,h,E,C,z,j,R,G,ee,Q,Y,X,ue,H,L,W,ne,F,we,Te,se,gt,_t,ge,je,fn,Ee,gn,_n;return{c(){u=n("p"),k=r("The "),T=n("a"),w=r("Trainer"),$=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=i(),E=n("ul"),C=n("li"),z=r("your model always return tuples or subclasses of "),j=n("a"),R=r("ModelOutput"),G=r("."),ee=i(),Q=n("li"),Y=r("your model can compute the loss if a "),X=n("code"),ue=r("labels"),H=r(` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),L=i(),W=n("li"),ne=r("your model can accept multiple label arguments (use the "),F=n("code"),we=r("label_names"),Te=r(" in your "),se=n("a"),gt=r("TrainingArguments"),_t=r(" to indicate their name to the "),ge=n("a"),je=r("Trainer"),fn=r(") but none of them should be named "),Ee=n("code"),gn=r('"label"'),_n=r("."),this.h()},l(le){u=s(le,"P",{});var re=l(u);k=a(re,"The "),T=s(re,"A",{href:!0});var Fi=l(T);w=a(Fi,"Trainer"),Fi.forEach(o),$=a(re,` 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:`),re.forEach(o),h=d(le),E=s(le,"UL",{});var Ae=l(E);C=s(Ae,"LI",{});var hr=l(C);z=a(hr,"your model always return tuples or subclasses of "),j=s(hr,"A",{href:!0});var Ni=l(j);R=a(Ni,"ModelOutput"),Ni.forEach(o),G=a(hr,"."),hr.forEach(o),ee=d(Ae),Q=s(Ae,"LI",{});var bo=l(Q);Y=a(bo,"your model can compute the loss if a "),X=s(bo,"CODE",{});var O=l(X);ue=a(O,"labels"),O.forEach(o),H=a(bo,` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),bo.forEach(o),L=d(Ae),W=s(Ae,"LI",{});var ae=l(W);ne=a(ae,"your model can accept multiple label arguments (use the "),F=s(ae,"CODE",{});var ur=l(F);we=a(ur,"label_names"),ur.forEach(o),Te=a(ae," in your "),se=s(ae,"A",{href:!0});var zi=l(se);gt=a(zi,"TrainingArguments"),zi.forEach(o),_t=a(ae," to indicate their name to the "),ge=s(ae,"A",{href:!0});var Wi=l(ge);je=a(Wi,"Trainer"),Wi.forEach(o),fn=a(ae,") but none of them should be named "),Ee=s(ae,"CODE",{});var Oi=l(Ee);gn=a(Oi,'"label"'),Oi.forEach(o),_n=a(ae,"."),ae.forEach(o),Ae.forEach(o),this.h()},h(){m(T,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(j,"href","/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput"),m(se,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.TrainingArguments"),m(ge,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer")},m(le,re){p(le,u,re),e(u,k),e(u,T),e(T,w),e(u,$),p(le,h,re),p(le,E,re),e(E,C),e(C,z),e(C,j),e(j,R),e(C,G),e(E,ee),e(E,Q),e(Q,Y),e(Q,X),e(X,ue),e(Q,H),e(E,L),e(E,W),e(W,ne),e(W,F),e(F,we),e(W,Te),e(W,se),e(se,gt),e(W,_t),e(W,ge),e(ge,je),e(W,fn),e(W,Ee),e(Ee,gn),e(W,_n)},d(le){le&&o(u),le&&o(h),le&&o(E)}}}function uL(D){let u,k,T,w,$,h,E,C,z,j,R,G,ee,Q,Y,X,ue;return{c(){u=n("p"),k=r("To use this method, you need to have provided a "),T=n("code"),w=r("model_init"),$=r(" when initializing your "),h=n("a"),E=r("Trainer"),C=r(`: we need to
reinitialize the model at each new run. This is incompatible with the `),z=n("code"),j=r("optimizers"),R=r(` argument, so you need to
subclass `),G=n("a"),ee=r("Trainer"),Q=r(" and override the method "),Y=n("a"),X=r("create_optimizer_and_scheduler()"),ue=r(` for custom
optimizer/scheduler.`),this.h()},l(H){u=s(H,"P",{});var L=l(u);k=a(L,"To use this method, you need to have provided a "),T=s(L,"CODE",{});var W=l(T);w=a(W,"model_init"),W.forEach(o),$=a(L," when initializing your "),h=s(L,"A",{href:!0});var ne=l(h);E=a(ne,"Trainer"),ne.forEach(o),C=a(L,`: we need to
reinitialize the model at each new run. This is incompatible with the `),z=s(L,"CODE",{});var F=l(z);j=a(F,"optimizers"),F.forEach(o),R=a(L,` argument, so you need to
subclass `),G=s(L,"A",{href:!0});var we=l(G);ee=a(we,"Trainer"),we.forEach(o),Q=a(L," and override the method "),Y=s(L,"A",{href:!0});var Te=l(Y);X=a(Te,"create_optimizer_and_scheduler()"),Te.forEach(o),ue=a(L,` for custom
optimizer/scheduler.`),L.forEach(o),this.h()},h(){m(h,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(G,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(Y,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer.create_optimizer_and_scheduler")},m(H,L){p(H,u,L),e(u,k),e(u,T),e(T,w),e(u,$),e(u,h),e(h,E),e(u,C),e(u,z),e(z,j),e(u,R),e(u,G),e(G,ee),e(u,Q),e(u,Y),e(Y,X),e(u,ue)},d(H){H&&o(u)}}}function fL(D){let u,k,T,w,$;return w=new U({props:{code:"aW5pdF9tZW1fY3B1X2FsbG9jX2RlbHRhJTIwJTIwJTIwJTNEJTIwJTIwJTIwJTIwJTIwMTMwMU1CJTBBaW5pdF9tZW1fY3B1X3BlYWtlZF9kZWx0YSUyMCUyMCUzRCUyMCUyMCUyMCUyMCUyMCUyMDE1NE1CJTBBaW5pdF9tZW1fZ3B1X2FsbG9jX2RlbHRhJTIwJTIwJTIwJTNEJTIwJTIwJTIwJTIwJTIwJTIwMjMwTUIlMEFpbml0X21lbV9ncHVfcGVha2VkX2RlbHRhJTIwJTIwJTNEJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwME1CJTBBdHJhaW5fbWVtX2NwdV9hbGxvY19kZWx0YSUyMCUyMCUzRCUyMCUyMCUyMCUyMCUyMDEzNDVNQiUwQXRyYWluX21lbV9jcHVfcGVha2VkX2RlbHRhJTIwJTNEJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwME1CJTBBdHJhaW5fbWVtX2dwdV9hbGxvY19kZWx0YSUyMCUyMCUzRCUyMCUyMCUyMCUyMCUyMCUyMDY5M01CJTBBdHJhaW5fbWVtX2dwdV9wZWFrZWRfZGVsdGElMjAlM0QlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjA3TUI=",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"),k=r("Now when this method is run, you will see a report that will include: :"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=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,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function gL(D){let u,k;return{c(){u=n("p"),k=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=l(u);k=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,k)},d(T){T&&o(u)}}}function _L(D){let u,k;return{c(){u=n("p"),k=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=l(u);k=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,k)},d(T){T&&o(u)}}}function bL(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF9kYXRhbG9hZGVyKHRyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUyMGV2YWxfYmF0Y2hfc2l6ZSUzRDY0KSUwQWFyZ3MucGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXpl",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function vL(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF9ldmFsdWF0ZShzdHJhdGVneSUzRCUyMnN0ZXBzJTIyJTJDJTIwc3RlcHMlM0QxMDApJTBBYXJncy5ldmFsX3N0ZXBz",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function yL(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF9sb2dnaW5nKHN0cmF0ZWd5JTNEJTIyc3RlcHMlMjIlMkMlMjBzdGVwcyUzRDEwMCklMEFhcmdzLmxvZ2dpbmdfc3RlcHM=",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function wL(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF9scl9zY2hlZHVsZXIobmFtZSUzRCUyMmNvc2luZSUyMiUyQyUyMHdhcm11cF9yYXRpbyUzRDAuMDUpJTBBYXJncy53YXJtdXBfcmF0aW8=",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function TL(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF9vcHRpbWl6ZXIobmFtZSUzRCUyMmFkYW13X3RvcmNoJTIyJTJDJTIwYmV0YTElM0QwLjgpJTBBYXJncy5vcHRpbQ==",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function EL(D){let u,k,T,w,$,h,E,C,z,j,R,G,ee,Q,Y,X,ue,H,L,W;return{c(){u=n("p"),k=r("Calling this method will set "),T=n("code"),w=r("self.push_to_hub"),$=r(" to "),h=n("code"),E=r("True"),C=r(", which means the "),z=n("code"),j=r("output_dir"),R=r(` will begin a git
directory synced with the repo (determined by `),G=n("code"),ee=r("model_id"),Q=r(`) and the content will be pushed each time a save is
triggered (depending on`),Y=n("code"),X=r("self.save_strategy"),ue=r("). Calling "),H=n("a"),L=r("save_model()"),W=r(" will also trigger a push."),this.h()},l(ne){u=s(ne,"P",{});var F=l(u);k=a(F,"Calling this method will set "),T=s(F,"CODE",{});var we=l(T);w=a(we,"self.push_to_hub"),we.forEach(o),$=a(F," to "),h=s(F,"CODE",{});var Te=l(h);E=a(Te,"True"),Te.forEach(o),C=a(F,", which means the "),z=s(F,"CODE",{});var se=l(z);j=a(se,"output_dir"),se.forEach(o),R=a(F,` will begin a git
directory synced with the repo (determined by `),G=s(F,"CODE",{});var gt=l(G);ee=a(gt,"model_id"),gt.forEach(o),Q=a(F,`) and the content will be pushed each time a save is
triggered (depending on`),Y=s(F,"CODE",{});var _t=l(Y);X=a(_t,"self.save_strategy"),_t.forEach(o),ue=a(F,"). Calling "),H=s(F,"A",{href:!0});var ge=l(H);L=a(ge,"save_model()"),ge.forEach(o),W=a(F," will also trigger a push."),F.forEach(o),this.h()},h(){m(H,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer.save_model")},m(ne,F){p(ne,u,F),e(u,k),e(u,T),e(T,w),e(u,$),e(u,h),e(h,E),e(u,C),e(u,z),e(z,j),e(u,R),e(u,G),e(G,ee),e(u,Q),e(u,Y),e(Y,X),e(u,ue),e(u,H),e(H,L),e(u,W)},d(ne){ne&&o(u)}}}function AL(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF9wdXNoX3RvX2h1YiglMjJtZSUyRmF3ZXNvbWUtbW9kZWwlMjIpJTBBYXJncy5odWJfbW9kZWxfaWQ=",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function $L(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF9zYXZlKHN0cmF0ZWd5JTNEJTIyc3RlcHMlMjIlMkMlMjBzdGVwcyUzRDEwMCklMEFhcmdzLnNhdmVfc3RlcHM=",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function kL(D){let u,k,T,w,$,h,E,C;return{c(){u=n("p"),k=r("Calling this method will automatically set "),T=n("code"),w=r("self.do_predict"),$=r(" to "),h=n("code"),E=r("True"),C=r(".")},l(z){u=s(z,"P",{});var j=l(u);k=a(j,"Calling this method will automatically set "),T=s(j,"CODE",{});var R=l(T);w=a(R,"self.do_predict"),R.forEach(o),$=a(j," to "),h=s(j,"CODE",{});var G=l(h);E=a(G,"True"),G.forEach(o),C=a(j,"."),j.forEach(o)},m(z,j){p(z,u,j),e(u,k),e(u,T),e(T,w),e(u,$),e(u,h),e(h,E),e(u,C)},d(z){z&&o(u)}}}function xL(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF90ZXN0aW5nKGJhdGNoX3NpemUlM0QzMiklMEFhcmdzLnBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXpl",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function ML(D){let u,k,T,w,$,h,E,C;return{c(){u=n("p"),k=r("Calling this method will automatically set "),T=n("code"),w=r("self.do_train"),$=r(" to "),h=n("code"),E=r("True"),C=r(".")},l(z){u=s(z,"P",{});var j=l(u);k=a(j,"Calling this method will automatically set "),T=s(j,"CODE",{});var R=l(T);w=a(R,"self.do_train"),R.forEach(o),$=a(j," to "),h=s(j,"CODE",{});var G=l(h);E=a(G,"True"),G.forEach(o),C=a(j,"."),j.forEach(o)},m(z,j){p(z,u,j),e(u,k),e(u,T),e(T,w),e(u,$),e(u,h),e(h,E),e(u,C)},d(z){z&&o(u)}}}function IL(D){let u,k,T,w,$;return w=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUyMndvcmtpbmdfZGlyJTIyKSUwQWFyZ3MlMjAlM0QlMjBhcmdzLnNldF90cmFpbmluZyhsZWFybmluZ19yYXRlJTNEMWUtNCUyQyUyMGJhdGNoX3NpemUlM0QzMiklMEFhcmdzLmxlYXJuaW5nX3JhdGU=",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"),k=r("Example:"),T=i(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=l(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,k),p(h,T,E),_(w,h,E),$=!0},p:_o,i(h){$||(b(w.$$.fragment,h),$=!0)},o(h){v(w.$$.fragment,h),$=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function SL(D){let u,k,T,w,$;return{c(){u=n("p"),k=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"),$=r(" for more details."),this.h()},l(h){u=s(h,"P",{});var E=l(u);k=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 C=l(T);w=a(C,"https://github.com/pytorch/pytorch/issues/82707"),C.forEach(o),$=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,k),e(u,T),e(T,w),e(u,$)},d(h){h&&o(u)}}}function qL(D){let u,k,T,w,$,h,E,C,z,j,R,G,ee,Q,Y,X,ue,H,L,W,ne,F,we,Te,se,gt,_t,ge,je,fn,Ee,gn,_n,le,re,Fi,Ae,hr,Ni,bo,O,ae,ur,zi,Wi,Oi,Ri,Hp,o0,r0,a0,Li,Qp,n0,s0,l0,Bi,Kp,i0,d0,c0,bt,em,p0,m0,tm,h0,u0,om,f0,g0,_0,Gi,rm,b0,v0,y0,Zi,am,w0,T0,E0,Vi,nm,A0,$0,k0,Xi,sm,x0,M0,I0,Yi,lm,S0,q0,U0,Hi,im,D0,j0,P0,Qi,dm,J0,C0,Ev,fr,Av,gr,F0,Ki,N0,z0,$v,bn,kv,vt,W0,ed,O0,R0,td,L0,B0,xv,vo,_r,cm,vn,G0,pm,Z0,Mv,A,yn,V0,mm,X0,Y0,hm,H0,Q0,$e,br,um,K0,e2,od,t2,o2,r2,ie,fm,a2,n2,gm,s2,l2,_m,i2,d2,bm,c2,p2,vm,m2,h2,ym,u2,f2,g2,rd,wm,_2,b2,v2,Pe,Tm,y2,w2,Em,T2,E2,Am,A2,$2,$m,k2,x2,M2,Je,km,I2,S2,xm,q2,U2,Mm,D2,j2,Im,P2,J2,C2,vr,wn,F2,Tn,N2,Sm,z2,W2,O2,yr,En,R2,An,L2,qm,B2,G2,Z2,yt,$n,V2,Um,X2,Y2,Dm,H2,Q2,wr,kn,K2,jm,eE,tE,Tr,xn,oE,Mn,rE,Pm,aE,nE,sE,wt,In,lE,Jm,iE,dE,Sn,cE,Cm,pE,mE,hE,Tt,qn,uE,Fm,fE,gE,nt,_E,Nm,bE,vE,zm,yE,wE,Wm,TE,EE,AE,Er,Un,$E,Om,kE,xE,Ce,Dn,ME,Rm,IE,SE,jn,qE,Lm,UE,DE,jE,Bm,PE,JE,Et,Pn,CE,yo,FE,Gm,NE,zE,Zm,WE,OE,RE,Vm,LE,BE,Ar,Jn,GE,Cn,ZE,ad,VE,XE,YE,At,Fn,HE,Nn,QE,Xm,KE,e4,t4,Ym,o4,r4,$r,zn,a4,Hm,n4,s4,$t,Wn,l4,On,i4,Qm,d4,c4,p4,Km,m4,h4,Fe,Rn,u4,Ln,f4,eh,g4,_4,b4,wo,v4,th,y4,w4,oh,T4,E4,A4,rh,$4,k4,kt,Bn,x4,ke,M4,ah,I4,S4,nh,q4,U4,sh,D4,j4,lh,P4,J4,C4,kr,F4,xr,Gn,N4,Zn,z4,ih,W4,O4,R4,Mr,Vn,L4,dh,B4,G4,Ir,Xn,Z4,Yn,V4,ch,X4,Y4,H4,xt,Hn,Q4,Qn,K4,ph,eA,tA,oA,mh,rA,aA,P,Kn,nA,hh,sA,lA,uh,iA,dA,fh,cA,pA,To,mA,gh,hA,uA,_h,fA,gA,_A,Sr,bA,bh,vh,vA,yA,st,xe,wA,yh,TA,EA,wh,AA,$A,Th,kA,xA,Eh,MA,IA,SA,Eo,qA,Ah,UA,DA,$h,jA,PA,JA,nd,kh,CA,FA,NA,Mt,xh,zA,WA,Mh,OA,RA,Ih,LA,BA,GA,Sh,ZA,VA,qh,XA,YA,es,HA,Uh,QA,KA,e3,lt,t3,Dh,o3,r3,jh,a3,n3,Ph,s3,l3,i3,fe,d3,sd,c3,p3,Jh,m3,h3,Ch,u3,f3,Fh,g3,_3,Nh,b3,v3,y3,Z,w3,zh,T3,E3,Wh,A3,$3,Oh,k3,x3,Rh,M3,I3,ts,S3,q3,Lh,U3,D3,Bh,j3,P3,Gh,J3,C3,Zh,F3,N3,Vh,z3,W3,O3,Me,R3,ld,L3,B3,Xh,G3,Z3,id,V3,X3,Yh,Y3,H3,Q3,Hh,K3,e$,qr,os,t$,Qh,o$,r$,Ur,rs,a$,as,n$,Kh,s$,l$,i$,It,ns,d$,ss,c$,eu,p$,m$,h$,ls,u$,tu,f$,g$,_$,de,is,b$,ou,v$,y$,ds,w$,ru,T$,E$,A$,Dr,$$,cs,k$,au,x$,M$,I$,Ao,$o,S$,nu,q$,U$,su,D$,j$,P$,ko,J$,lu,C$,F$,iu,N$,z$,W$,xo,O$,du,R$,L$,cu,B$,G$,Z$,St,ps,V$,Mo,X$,pu,Y$,H$,mu,Q$,K$,ek,hu,tk,ok,qt,ms,rk,Io,ak,uu,nk,sk,fu,lk,ik,dk,gu,ck,pk,jr,hs,mk,it,hk,_u,uk,fk,bu,gk,_k,vu,bk,vk,yk,Pr,us,wk,fs,Tk,yu,Ek,Ak,$k,Ne,gs,kk,_s,xk,wu,Mk,Ik,Sk,Tu,qk,Uk,bs,Dk,dd,jk,Pk,Jk,Ut,vs,Ck,ys,Fk,Eu,Nk,zk,Wk,Au,Ok,Rk,Dt,ws,Lk,$u,Bk,Gk,ku,Zk,Vk,Jr,Ts,Xk,xu,Yk,Hk,jt,Es,Qk,Mu,Kk,ex,Iu,tx,Iv,So,Cr,Su,As,ox,qu,rx,Sv,dt,$s,ax,ze,ks,nx,Uu,sx,lx,xs,ix,Du,dx,cx,px,ju,mx,hx,ce,Ms,ux,Pu,fx,gx,Is,_x,Ju,bx,vx,yx,Fr,wx,Ss,Tx,Cu,Ex,Ax,$x,qo,Uo,kx,Fu,xx,Mx,Nu,Ix,Sx,qx,Do,Ux,zu,Dx,jx,Wu,Px,Jx,Cx,jo,Fx,Ou,Nx,zx,Ru,Wx,Ox,qv,Po,Nr,Lu,qs,Rx,Bu,Lx,Uv,q,Us,Bx,Ds,Gx,Gu,Zx,Vx,Xx,Jo,Yx,cd,Hx,Qx,js,Kx,eM,tM,_e,Ps,oM,Zu,rM,aM,Co,nM,Vu,sM,lM,Xu,iM,dM,cM,Fo,pM,Yu,mM,hM,Hu,uM,fM,gM,Js,_M,Qu,bM,vM,yM,zr,Cs,wM,Ku,TM,EM,Pt,Fs,AM,ef,$M,kM,No,xM,tf,MM,IM,of,SM,qM,UM,Jt,Ns,DM,rf,jM,PM,Wr,JM,Ct,zs,CM,af,FM,NM,Or,zM,Ft,Ws,WM,nf,OM,RM,Rr,LM,Nt,Os,BM,sf,GM,ZM,Lr,VM,zt,Rs,XM,lf,YM,HM,Br,QM,We,Ls,KM,df,e5,t5,Gr,o5,Zr,r5,Wt,Bs,a5,cf,n5,s5,Vr,l5,Oe,Gs,i5,pf,d5,c5,Xr,p5,Yr,m5,Re,Zs,h5,mf,u5,f5,Hr,g5,Qr,_5,Kr,Vs,b5,Xs,v5,hf,y5,w5,T5,ea,Ys,E5,uf,A5,$5,ta,Hs,k5,ff,x5,Dv,zo,oa,gf,Qs,M5,_f,I5,jv,Ie,Ks,S5,el,q5,bf,U5,D5,j5,Wo,P5,pd,J5,C5,tl,F5,N5,z5,ra,ol,W5,Oo,O5,vf,R5,L5,yf,B5,G5,Pv,Ro,aa,wf,rl,Z5,Tf,V5,Jv,be,X5,md,Y5,H5,Ef,Q5,K5,hd,eI,tI,Af,oI,rI,Cv,na,aI,ud,nI,sI,Fv,sa,fd,$f,lI,iI,dI,gd,kf,cI,pI,Nv,Le,mI,xf,hI,uI,Mf,fI,gI,_d,_I,bI,zv,la,ia,If,vI,yI,Sf,wI,TI,EI,bd,qf,AI,$I,Wv,Lo,da,Uf,al,kI,Df,xI,Ov,Be,MI,vd,II,SI,jf,qI,UI,Pf,DI,jI,Rv,Ot,PI,Jf,JI,CI,yd,FI,NI,Lv,ca,wd,Cf,zI,WI,OI,Td,Ff,RI,LI,Bv,Ge,BI,Ed,GI,ZI,Nf,VI,XI,zf,YI,HI,Gv,pe,QI,Ad,KI,e9,Wf,t9,o9,Of,r9,a9,Rf,n9,s9,$d,l9,i9,Zv,kd,d9,Vv,nl,Xv,xd,c9,Yv,sl,Hv,Md,p9,Qv,ll,Kv,Id,m9,ey,Sd,h9,ty,il,oy,pa,u9,Lf,f9,g9,ry,Bo,ma,Bf,dl,_9,Gf,b9,ay,ve,v9,qd,y9,w9,Zf,T9,E9,Vf,A9,$9,Xf,k9,x9,ny,Rt,M9,cl,I9,S9,Yf,q9,U9,sy,Go,ha,Hf,pl,D9,Qf,j9,ly,Ud,P9,iy,ua,J9,ml,Kf,C9,F9,dy,hl,cy,Lt,N9,ul,eg,z9,W9,fl,tg,O9,R9,py,gl,my,_l,hy,fa,L9,Dd,B9,G9,uy,jd,Z9,fy,Pd,V9,gy,Jd,og,rg,X9,_y,ga,Y9,ag,H9,Q9,by,Cd,K9,vy,bl,yy,Bt,eS,ng,tS,oS,sg,rS,aS,wy,Fd,nS,Ty,vl,Ey,Gt,sS,lg,lS,iS,ig,dS,cS,Ay,Zt,pS,dg,mS,hS,yl,cg,uS,fS,$y,wl,ky,Nd,gS,xy,Tl,My,zd,_S,Iy,El,Sy,Wd,bS,qy,Od,pg,mg,vS,Uy,_a,yS,hg,wS,TS,Dy,Rd,Al,ES,ug,AS,$S,jy,$l,Py,kl,fg,kS,Jy,xl,Cy,Vt,xS,gg,MS,IS,_g,SS,qS,Fy,Ld,US,Ny,Ml,zy,Bd,DS,Wy,ba,jS,bg,PS,JS,Oy,Zo,va,vg,Il,CS,yg,FS,Ry,ya,NS,Gd,zS,WS,Ly,Ze,OS,Sl,RS,LS,ql,BS,GS,Ul,ZS,VS,By,wa,XS,Zd,YS,HS,Gy,Vd,Zy,Vo,Ta,wg,Dl,QS,Tg,KS,Vy,Xd,eq,Xy,Ea,tq,jl,oq,rq,Yy,Yd,aq,Hy,Pl,Qy,Hd,nq,Ky,Xt,sq,Eg,lq,iq,Ag,dq,cq,e1,Xo,Aa,$g,Jl,pq,kg,mq,t1,Qd,hq,o1,Ve,uq,xg,fq,gq,Mg,_q,bq,Ig,vq,yq,r1,Yt,wq,Sg,Tq,Eq,qg,Aq,$q,a1,Cl,n1,$a,kq,Fl,xq,Mq,s1,Yo,ka,Ug,Nl,Iq,Dg,Sq,l1,Kd,qq,i1,zl,d1,Ht,Uq,jg,Dq,jq,Pg,Pq,Jq,c1,ec,Cq,p1,Wl,m1,tc,Fq,h1,xa,Nq,Jg,zq,Wq,u1,ct,Cg,Oq,Rq,Fg,Lq,Bq,Ng,Gq,Zq,f1,oc,Vq,g1,Ol,_1,rc,Xq,b1,Xe,Yq,zg,Hq,Qq,Wg,Kq,eU,Og,tU,oU,v1,Ho,Ma,Rg,Rl,rU,Lg,aU,y1,Qt,nU,Bg,sU,lU,Gg,iU,dU,w1,ac,cU,T1,nc,pU,E1,Ia,mU,Zg,hU,uU,A1,Ll,$1,te,fU,Vg,gU,_U,Xg,bU,vU,Yg,yU,wU,Hg,TU,EU,Qg,AU,$U,Kg,kU,xU,k1,sc,MU,x1,Qo,Sa,e_,Bl,IU,t_,SU,M1,qa,qU,Gl,UU,DU,I1,Zl,o_,jU,PU,S1,Vl,r_,JU,CU,q1,me,a_,Xl,FU,n_,NU,zU,WU,Yl,lc,s_,OU,RU,LU,Ko,Hl,BU,l_,GU,ZU,VU,Ql,XU,i_,YU,HU,QU,Kl,KU,d_,eD,tD,oD,c_,er,rD,p_,aD,nD,m_,sD,lD,iD,h_,pt,dD,u_,cD,pD,f_,mD,hD,g_,uD,fD,gD,__,tr,_D,b_,bD,vD,v_,yD,wD,TD,ei,mt,ED,y_,AD,$D,w_,kD,xD,T_,MD,ID,SD,ht,ic,qD,ti,Se,UD,E_,DD,jD,A_,PD,JD,$_,CD,FD,k_,ND,zD,WD,oi,OD,x_,RD,LD,BD,ut,M_,GD,ZD,I_,VD,XD,S_,YD,HD,q_,QD,KD,Ua,U_,ej,tj,D_,oj,rj,aj,Da,j_,nj,sj,P_,lj,ij,U1,dc,J_,dj,D1,cc,Ye,cj,C_,pj,mj,F_,hj,uj,fj,gj,ri,_j,j1,or,ja,N_,ai,bj,z_,vj,P1,Kt,yj,ni,wj,Tj,si,Ej,Aj,J1,li,W_,$j,kj,C1,ii,O_,xj,Mj,F1,eo,Ij,R_,Sj,qj,L_,Uj,Dj,N1,He,Pa,B_,jj,Pj,G_,Jj,Cj,Fj,Ja,Z_,Nj,zj,di,Wj,Oj,Rj,Qe,V_,Lj,Bj,X_,Gj,Zj,Y_,Vj,Xj,H_,Yj,Hj,Qj,pc,Kj,ci,qe,eP,Q_,tP,oP,K_,rP,aP,eb,nP,sP,tb,lP,iP,dP,pi,cP,ob,pP,mP,z1,rr,Ca,rb,mi,hP,ab,uP,W1,Ke,fP,nb,gP,_P,hi,bP,vP,ui,yP,wP,O1,Fa,R1,mc,sb,TP,L1,to,lb,EP,AP,ib,$P,kP,db,xP,B1,ar,cb,MP,IP,fi,SP,qP,G1,ft,pb,UP,DP,mb,jP,PP,hb,JP,CP,Z1,gi,V1,hc,ub,FP,X1,Na,_i,NP,fb,zP,WP,OP,Ue,RP,gb,LP,BP,_b,GP,ZP,bb,VP,XP,vb,YP,HP,Y1,oo,QP,yb,KP,e6,bi,t6,o6,H1,nr,za,wb,vi,r6,Tb,a6,Q1,uc,n6,K1,Wa,Eb,s6,l6,Ab,i6,ew,fc,d6,tw,ro,$b,ao,c6,kb,p6,m6,xb,h6,u6,Mb,f6,g6,K,yi,_6,Ib,b6,v6,y6,wi,w6,Sb,T6,E6,Ti,A6,qb,$6,k6,Ei,x6,Ub,M6,I6,Ai,S6,Db,sr,q6,jb,U6,D6,Pb,j6,P6,ow,$i,rw,ki,xi,J6,Jb,C6,F6,aw,Mi,nw,Oa,N6,Ii,z6,W6,sw,gc,O6,lw,M,R6,_c,L6,Cb,B6,bc,G6,Fb,Z6,vc,V6,Nb,X6,yc,Y6,zb,H6,wc,Q6,Wb,K6,Tc,eJ,Ob,tJ,Ec,oJ,Rb,rJ,Ac,aJ,Lb,nJ,$c,sJ,Bb,lJ,kc,iJ,Gb,dJ,xc,cJ,Zb,pJ,Mc,mJ,Vb,hJ,Ic,uJ,Xb,fJ,Sc,gJ,Yb,_J,qc,bJ,Hb,vJ,Uc,yJ,Qb,wJ,Dc,TJ,Kb,EJ,jc,AJ,ev,$J,Pc,kJ,tv,xJ,Jc,MJ,ov,IJ,Cc,SJ,rv,qJ,Fc,UJ,av,DJ,Nc,jJ,nv,PJ,iw;return h=new oe({}),fr=new un({props:{warning:!0,$$slots:{default:[hL]},$$scope:{ctx:D}}}),bn=new U({props:{code:"ZnJvbSUyMHRvcmNoJTIwaW1wb3J0JTIwbm4lMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwVHJhaW5lciUwQSUwQSUwQWNsYXNzJTIwQ3VzdG9tVHJhaW5lcihUcmFpbmVyKSUzQSUwQSUyMCUyMCUyMCUyMGRlZiUyMGNvbXB1dGVfbG9zcyhzZWxmJTJDJTIwbW9kZWwlMkMlMjBpbnB1dHMlMkMlMjByZXR1cm5fb3V0cHV0cyUzREZhbHNlKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVscyUyMCUzRCUyMGlucHV0cy5nZXQoJTIybGFiZWxzJTIyKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMGZvcndhcmQlMjBwYXNzJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG91dHB1dHMuZ2V0KCUyMmxvZ2l0cyUyMiklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBjb21wdXRlJTIwY3VzdG9tJTIwbG9zcyUyMChzdXBwb3NlJTIwb25lJTIwaGFzJTIwMyUyMGxhYmVscyUyMHdpdGglMjBkaWZmZXJlbnQlMjB3ZWlnaHRzKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxvc3NfZmN0JTIwJTNEJTIwbm4uQ3Jvc3NFbnRyb3B5TG9zcyh3ZWlnaHQlM0R0b3JjaC50ZW5zb3IoJTVCMS4wJTJDJTIwMi4wJTJDJTIwMy4wJTVEJTJDJTIwZGV2aWNlJTNEbW9kZWwuZGV2aWNlKSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwbG9zc19mY3QobG9naXRzLnZpZXcoLTElMkMlMjBzZWxmLm1vZGVsLmNvbmZpZy5udW1fbGFiZWxzKSUyQyUyMGxhYmVscy52aWV3KC0xKSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAobG9zcyUyQyUyMG91dHB1dHMpJTIwaWYlMjByZXR1cm5fb3V0cHV0cyUyMGVsc2UlMjBsb3Nz",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>], device=model.device))
        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`}}),vn=new oe({}),yn=new S({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.31.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.31.0/en/main_classes/trainer#transformers.Trainer">Trainer</a> is optimized to work with the <a href="/docs/transformers/v4.31.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.31.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.31.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.31.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.31.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.13.1/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.13.1/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.31.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.31.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.31.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.31.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.31.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.31.0/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> on your model
and a scheduler given by <a href="/docs/transformers/v4.31.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.31.0/src/transformers/trainer.py#L225"}}),wn=new S({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.31.0/src/transformers/trainer.py#L702"}}),En=new S({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.31.0/src/transformers/trainer.py#L2612"}}),$n=new S({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.31.0/src/transformers/trainer.py#L2669"}}),kn=new S({props:{name:"compute_loss_context_manager",anchor:"transformers.Trainer.compute_loss_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer.py#L2606"}}),xn=new S({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.31.0/src/transformers/trainer.py#L3430"}}),In=new S({props:{name:"create_optimizer",anchor:"transformers.Trainer.create_optimizer",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer.py#L960"}}),qn=new S({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.31.0/src/transformers/trainer.py#L944"}}),Un=new S({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.31.0/src/transformers/trainer.py#L1139"}}),Dn=new S({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.13.1/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.31.0/src/transformers/trainer.py#L2897",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>
`}}),Pn=new S({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.31.0/src/transformers/trainer.py#L3030"}}),Jn=new S({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.31.0/src/transformers/trainer.py#L3365",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Fn=new S({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.13.1/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.31.0/src/transformers/trainer.py#L878"}}),zn=new S({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.31.0/src/transformers/trainer.py#L1016"}}),Wn=new S({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.13.1/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.31.0/src/transformers/trainer.py#L912"}}),Rn=new S({props:{name:"get_train_dataloader",anchor:"transformers.Trainer.get_train_dataloader",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer.py#L823"}}),Bn=new S({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.31.0/src/transformers/trainer.py#L2480",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>
`}}),kr=new un({props:{warning:!0,$$slots:{default:[uL]},$$scope:{ctx:D}}}),Gn=new S({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.31.0/src/transformers/trainer.py#L3383"}}),Vn=new S({props:{name:"is_local_process_zero",anchor:"transformers.Trainer.is_local_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer.py#L2701"}}),Xn=new S({props:{name:"is_world_process_zero",anchor:"transformers.Trainer.is_world_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer.py#L2708"}}),Hn=new S({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.31.0/src/transformers/trainer.py#L2555"}}),Kn=new S({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.31.0/src/transformers/trainer_pt_utils.py#L898"}}),Sr=new go({props:{anchor:"transformers.Trainer.log_metrics.example",$$slots:{default:[fL]},$$scope:{ctx:D}}}),os=new S({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.31.0/src/transformers/trainer_pt_utils.py#L872",returnDescription:`
<p>The reformatted metrics</p>
`,returnType:`
<p>metrics (<code>Dict[str, float]</code>)</p>
`}}),rs=new S({props:{name:"num_examples",anchor:"transformers.Trainer.num_examples",parameters:[{name:"dataloader",val:": DataLoader"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer.py#L1157"}}),ns=new S({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.31.0/src/transformers/trainer.py#L713",returnDescription:`
<p>The callback removed, if found.</p>
`,returnType:`
<p><code>~transformer.TrainerCallback</code></p>
`}}),is=new S({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.31.0/src/transformers/trainer.py#L2968"}}),Dr=new un({props:{$$slots:{default:[gL]},$$scope:{ctx:D}}}),ps=new S({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.31.0/src/transformers/trainer.py#L3593"}}),ms=new S({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.31.0/src/transformers/trainer.py#L3260",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>
`}}),hs=new S({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.`,name:"blocking"},{anchor:"transformers.Trainer.push_to_hub.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments passed along to <a href="/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer.create_model_card">create_model_card()</a>.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer.py#L3533",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>
`}}),us=new S({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.31.0/src/transformers/trainer.py#L729"}}),gs=new S({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.31.0/src/transformers/trainer_pt_utils.py#L988"}}),vs=new S({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.31.0/src/transformers/trainer.py#L2720"}}),ws=new S({props:{name:"save_state",anchor:"transformers.Trainer.save_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer_pt_utils.py#L1026"}}),Ts=new S({props:{name:"train",anchor:"transformers.Trainer.train",parameters:[{name:"resume_from_checkpoint",val:": typing.Union[bool, str, 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.31.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.31.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.`,name:"ignore_keys_for_eval"},{anchor:"transformers.Trainer.train.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments used to hide deprecated arguments`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/trainer.py#L1460"}}),Es=new S({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.31.0/src/transformers/trainer.py#L2628",returnDescription:`
<p>The tensor with training loss on this batch.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),As=new oe({}),$s=new S({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.31.0/src/transformers/trainer_seq2seq.py#L41"}}),ks=new S({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.13.1/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.31.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>
`}}),Ms=new S({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.13.1/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.31.0/src/transformers/trainer_seq2seq.py#L161"}}),Fr=new un({props:{$$slots:{default:[_L]},$$scope:{ctx:D}}}),qs=new oe({}),Us=new S({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:": typing.Union[str, typing.List[transformers.debug_utils.DebugOption]] = ''"},{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:"ddp_broadcast_buffers",val:": typing.Optional[bool] = 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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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>. When <code>load_best_model_at_end</code> is enabled, the &#x201C;best&#x201D; checkpoint according to
<code>metric_for_best_model</code> will always be retained in addition to the most recent ones. For example, for
<code>save_total_limit=5</code> and <code>load_best_model_at_end</code>, the four last checkpoints will always be retained
alongside the best model. When <code>save_total_limit=1</code> and <code>load_best_model_at_end</code>, it is possible that two
checkpoints are saved: the last one and the best one (if they are different).`,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. When this option is
enabled, the best checkpoint will always be saved. See
<a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.save_total_limit" rel="nofollow"><code>save_total_limit</code></a>
for more.</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_post&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.ddp_broadcast_buffers",description:`<strong>ddp_broadcast_buffers</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>broadcast_buffers</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_broadcast_buffers"},{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.31.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.31.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.31.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.31.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.31.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.31.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.31.0/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.31.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;
This argument is deprecated.<code>mps</code> device will be used if it is available similar to <code>cuda</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.31.0/src/transformers/training_args.py#L156"}}),Ps=new S({props:{name:"get_process_log_level",anchor:"transformers.TrainingArguments.get_process_log_level",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/training_args.py#L1902"}}),Cs=new S({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.31.0/src/transformers/training_args.py#L1991"}}),Fs=new S({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.31.0/src/transformers/training_args.py#L1940"}}),Ns=new S({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.31.0/src/transformers/training_args.py#L2497"}}),Wr=new go({props:{anchor:"transformers.TrainingArguments.set_dataloader.example",$$slots:{default:[bL]},$$scope:{ctx:D}}}),zs=new S({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.31.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.31.0/src/transformers/training_args.py#L2112"}}),Or=new go({props:{anchor:"transformers.TrainingArguments.set_evaluate.example",$$slots:{default:[vL]},$$scope:{ctx:D}}}),Ws=new S({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.31.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.31.0/src/transformers/training_args.py#L2262"}}),Rr=new go({props:{anchor:"transformers.TrainingArguments.set_logging.example",$$slots:{default:[yL]},$$scope:{ctx:D}}}),Os=new S({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.31.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.31.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.31.0/src/transformers/training_args.py#L2452"}}),Lr=new go({props:{anchor:"transformers.TrainingArguments.set_lr_scheduler.example",$$slots:{default:[wL]},$$scope:{ctx:D}}}),Rs=new S({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.31.0/src/transformers/training_args.py#L2401"}}),Br=new go({props:{anchor:"transformers.TrainingArguments.set_optimizer.example",$$slots:{default:[TL]},$$scope:{ctx:D}}}),Ls=new S({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.31.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.31.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.31.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.31.0/src/transformers/training_args.py#L2336"}}),Gr=new un({props:{$$slots:{default:[EL]},$$scope:{ctx:D}}}),Zr=new go({props:{anchor:"transformers.TrainingArguments.set_push_to_hub.example",$$slots:{default:[AL]},$$scope:{ctx:D}}}),Bs=new S({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.31.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.31.0/src/transformers/training_args.py#L2213"}}),Vr=new go({props:{anchor:"transformers.TrainingArguments.set_save.example",$$slots:{default:[$L]},$$scope:{ctx:D}}}),Gs=new S({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.31.0/src/transformers/training_args.py#L2173"}}),Xr=new un({props:{$$slots:{default:[kL]},$$scope:{ctx:D}}}),Yr=new go({props:{anchor:"transformers.TrainingArguments.set_testing.example",$$slots:{default:[xL]},$$scope:{ctx:D}}}),Zs=new S({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.31.0/src/transformers/training_args.py#L2037"}}),Hr=new un({props:{$$slots:{default:[ML]},$$scope:{ctx:D}}}),Qr=new go({props:{anchor:"transformers.TrainingArguments.set_training.example",$$slots:{default:[IL]},$$scope:{ctx:D}}}),Vs=new S({props:{name:"to_dict",anchor:"transformers.TrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/training_args.py#L2000"}}),Ys=new S({props:{name:"to_json_string",anchor:"transformers.TrainingArguments.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/training_args.py#L2017"}}),Hs=new S({props:{name:"to_sanitized_dict",anchor:"transformers.TrainingArguments.to_sanitized_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/training_args.py#L2023"}}),Qs=new oe({}),Ks=new S({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:": typing.Union[str, typing.List[transformers.debug_utils.DebugOption]] = ''"},{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:"ddp_broadcast_buffers",val:": typing.Optional[bool] = 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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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.31.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>. When <code>load_best_model_at_end</code> is enabled, the &#x201C;best&#x201D; checkpoint according to
<code>metric_for_best_model</code> will always be retained in addition to the most recent ones. For example, for
<code>save_total_limit=5</code> and <code>load_best_model_at_end</code>, the four last checkpoints will always be retained
alongside the best model. When <code>save_total_limit=1</code> and <code>load_best_model_at_end</code>, it is possible that two
checkpoints are saved: the last one and the best one (if they are different).`,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. When this option is
enabled, the best checkpoint will always be saved. See
<a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.save_total_limit" rel="nofollow"><code>save_total_limit</code></a>
for more.</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_post&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.ddp_broadcast_buffers",description:`<strong>ddp_broadcast_buffers</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>broadcast_buffers</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_broadcast_buffers"},{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.31.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.31.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.31.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.31.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.31.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.31.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.31.0/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.31.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;
This argument is deprecated.<code>mps</code> device will be used if it is available similar to <code>cuda</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.31.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a>, <em>optional</em>) &#x2014;
Allows to load a <a href="/docs/transformers/v4.31.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.31.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.31.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a> object.</li>
</ul>`,name:"generation_config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/training_args_seq2seq.py#L30"}}),ol=new S({props:{name:"to_dict",anchor:"transformers.Seq2SeqTrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/training_args_seq2seq.py#L87"}}),rl=new oe({}),al=new oe({}),nl=new U({props:{code:"JTVCLi4uJTVEJTBBbG9nZ2VyJTIwJTNEJTIwbG9nZ2luZy5nZXRMb2dnZXIoX19uYW1lX18pJTBBJTBBJTIzJTIwU2V0dXAlMjBsb2dnaW5nJTBBbG9nZ2luZy5iYXNpY0NvbmZpZyglMEElMjAlMjAlMjAlMjBmb3JtYXQlM0QlMjIlMjUoYXNjdGltZSlzJTIwLSUyMCUyNShsZXZlbG5hbWUpcyUyMC0lMjAlMjUobmFtZSlzJTIwLSUyMCUyNShtZXNzYWdlKXMlMjIlMkMlMEElMjAlMjAlMjAlMjBkYXRlZm10JTNEJTIyJTI1bSUyRiUyNWQlMkYlMjVZJTIwJTI1SCUzQSUyNU0lM0ElMjVTJTIyJTJDJTBBJTIwJTIwJTIwJTIwaGFuZGxlcnMlM0QlNUJsb2dnaW5nLlN0cmVhbUhhbmRsZXIoc3lzLnN0ZG91dCklNUQlMkMlMEEpJTBBJTBBJTIzJTIwc2V0JTIwdGhlJTIwbWFpbiUyMGNvZGUlMjBhbmQlMjB0aGUlMjBtb2R1bGVzJTIwaXQlMjB1c2VzJTIwdG8lMjB0aGUlMjBzYW1lJTIwbG9nLWxldmVsJTIwYWNjb3JkaW5nJTIwdG8lMjB0aGUlMjBub2RlJTBBbG9nX2xldmVsJTIwJTNEJTIwdHJhaW5pbmdfYXJncy5nZXRfcHJvY2Vzc19sb2dfbGV2ZWwoKSUwQWxvZ2dlci5zZXRMZXZlbChsb2dfbGV2ZWwpJTBBZGF0YXNldHMudXRpbHMubG9nZ2luZy5zZXRfdmVyYm9zaXR5KGxvZ19sZXZlbCklMEF0cmFuc2Zvcm1lcnMudXRpbHMubG9nZ2luZy5zZXRfdmVyYm9zaXR5KGxvZ19sZXZlbCklMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciguLi4p",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(...)`}}),sl=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9y",highlighted:"my_app.py ... --log_level warning --log_level_replica error"}}),ll=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9yJTIwLS1sb2dfb25fZWFjaF9ub2RlJTIwMA==",highlighted:"my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0"}}),il=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjBlcnJvciUyMC0tbG9nX2xldmVsX3JlcGxpY2ElMjBlcnJvciUyMC0tbG9nX29uX2VhY2hfbm9kZSUyMDA=",highlighted:"my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0"}}),dl=new oe({}),pl=new oe({}),hl=new U({props:{code:"cHl0aG9uJTIwLW0lMjB0b3JjaC5kaXN0cmlidXRlZC5sYXVuY2glMjAtLW5wcm9jX3Blcl9ub2RlJTNEMiUyMCUyMHRyYWluZXItcHJvZ3JhbS5weSUyMC4uLg==",highlighted:"python -m torch.distributed.launch --nproc_per_node=2  trainer-program.py ..."}}),gl=new U({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbnVtX3Byb2Nlc3NlcyUyMDIlMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"accelerate launch --num_processes 2 trainer-program.py ..."}}),_l=new U({props:{code:"ZGVlcHNwZWVkJTIwLS1udW1fZ3B1cyUyMDIlMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"deepspeed --num_gpus 2 trainer-program.py ..."}}),bl=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QwJTJDMiUyMHB5dGhvbiUyMC1tJTIwdG9yY2guZGlzdHJpYnV0ZWQubGF1bmNoJTIwdHJhaW5lci1wcm9ncmFtLnB5JTIwLi4u",highlighted:"CUDA_VISIBLE_DEVICES=0,2 python -m torch.distributed.launch trainer-program.py ..."}}),vl=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QyJTJDMCUyMHB5dGhvbiUyMC1tJTIwdG9yY2guZGlzdHJpYnV0ZWQubGF1bmNoJTIwdHJhaW5lci1wcm9ncmFtLnB5JTIwLi4u",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python -m torch.distributed.launch trainer-program.py ..."}}),wl=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QyJTJDMCUyMHB5dGhvbiUyMHRyYWluZXItcHJvZ3JhbS5weSUyMC4uLg==",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ..."}}),Tl=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QlMjBweXRob24lMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"CUDA_VISIBLE_DEVICES= python trainer-program.py ..."}}),El=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9WSVNJQkxFX0RFVklDRVMlM0QwJTJDMiUwQXB5dGhvbiUyMC1tJTIwdG9yY2guZGlzdHJpYnV0ZWQubGF1bmNoJTIwdHJhaW5lci1wcm9ncmFtLnB5JTIwLi4u",highlighted:`<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=0,2
python -m torch.distributed.launch trainer-program.py ...`}}),$l=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9ERVZJQ0VfT1JERVIlM0RQQ0lfQlVTX0lE",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=PCI_BUS_ID'}}),xl=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9ERVZJQ0VfT1JERVIlM0RGQVNURVNUX0ZJUlNU",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=FASTEST_FIRST'}}),Ml=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9WSVNJQkxFX0RFVklDRVMlM0QxJTJDMA==",highlighted:'<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=1,0'}}),Il=new oe({}),Dl=new oe({}),Pl=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRlZXBzcGVlZA==",highlighted:"pip install deepspeed"}}),Jl=new oe({}),Cl=new U({props:{code:"d2hpY2glMjBudmNj",highlighted:'<span class="hljs-built_in">which</span> nvcc'}}),Nl=new oe({}),zl=new U({props:{code:"JTJGdXNyJTJGbG9jYWwlMkZjdWRhLTEwLjIlMEElMkZ1c3IlMkZsb2NhbCUyRmN1ZGEtMTEuMA==",highlighted:`/usr/local/cuda-10.2
/usr/local/cuda-11.0`}}),Wl=new U({props:{code:"ZWNobyUyMCUyNFBBVEglMEFlY2hvJTIwJTI0TERfTElCUkFSWV9QQVRI",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>`}}),Ol=new U({props:{code:"ZXhwb3J0JTIwUEFUSCUzRCUyRnVzciUyRmxvY2FsJTJGY3VkYS0xMC4yJTJGYmluJTNBJTI0UEFUSCUwQWV4cG9ydCUyMExEX0xJQlJBUllfUEFUSCUzRCUyRnVzciUyRmxvY2FsJTJGY3VkYS0xMC4yJTJGbGliNjQlM0ElMjRMRF9MSUJSQVJZX1BBVEg=",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>`}}),Rl=new oe({}),Ll=new U({props:{code:"c3VkbyUyMGxuJTIwLXMlMjAlMkZ1c3IlMkZiaW4lMkZnY2MtNyUyMCUyMCUyRnVzciUyRmxvY2FsJTJGY3VkYS0xMC4yJTJGYmluJTJGZ2NjJTBBc3VkbyUyMGxuJTIwLXMlMjAlMkZ1c3IlMkZiaW4lMkZnJTJCJTJCLTclMjAlMjAlMkZ1c3IlMkZsb2NhbCUyRmN1ZGEtMTAuMiUyRmJpbiUyRmclMkIlMkI=",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++`}}),Bl=new oe({}),ai=new oe({}),mi=new oe({}),Fa=new un({props:{warning:!1,$$slots:{default:[SL]},$$scope:{ctx:D}}}),gi=new U({props:{code:"ZXhwb3J0JTIwVEFTS19OQU1FJTNEbXJwYyUwQSUwQXB5dGhvbiUyMGV4YW1wbGVzJTJGcHl0b3JjaCUyRnRleHQtY2xhc3NpZmljYXRpb24lMkZydW5fZ2x1ZS5weSUyMCU1QyUwQSUyMCUyMC0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwYmVydC1iYXNlLWNhc2VkJTIwJTVDJTBBJTIwJTIwLS10YXNrX25hbWUlMjAlMjRUQVNLX05BTUUlMjAlNUMlMEElMjAlMjAtLWRvX3RyYWluJTIwJTVDJTBBJTIwJTIwLS1kb19ldmFsJTIwJTVDJTBBJTIwJTIwLS1tYXhfc2VxX2xlbmd0aCUyMDEyOCUyMCU1QyUwQSUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwMzIlMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlMjAyZS01JTIwJTVDJTBBJTIwJTIwLS1udW1fdHJhaW5fZXBvY2hzJTIwMyUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUyMCUyRnRtcCUyRiUyNFRBU0tfTkFNRSUyRiUyMCU1QyUwQSUyMCUyMC0tb3ZlcndyaXRlX291dHB1dF9kaXI=",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>/ \\
  --overwrite_output_dir`}}),vi=new oe({}),wi=new U({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMEFkaXN0cmlidXRlZF90eXBlJTNBJTIwTVVMVElfR1BVJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTBBZG93bmNhc3RfYmYxNiUzQSUyMCdubyclMEFncHVfaWRzJTNBJTIwYWxsJTBBbWFjaGluZV9yYW5rJTNBJTIwMCUyMCUyM2NoYW5nZSUyMHJhbmslMjBhcyUyMHBlciUyMHRoZSUyMG5vZGUlMEFtYWluX3Byb2Nlc3NfaXAlM0ElMjAxOTIuMTY4LjIwLjElMEFtYWluX3Byb2Nlc3NfcG9ydCUzQSUyMDk4OTglMEFtYWluX3RyYWluaW5nX2Z1bmN0aW9uJTNBJTIwbWFpbiUwQW1peGVkX3ByZWNpc2lvbiUzQSUyMGZwMTYlMEFudW1fbWFjaGluZXMlM0ElMjAyJTBBbnVtX3Byb2Nlc3NlcyUzQSUyMDglMEFyZHp2X2JhY2tlbmQlM0ElMjBzdGF0aWMlMEFzYW1lX25ldHdvcmslM0ElMjB0cnVlJTBBdHB1X2VudiUzQSUyMCU1QiU1RCUwQXRwdV91c2VfY2x1c3RlciUzQSUyMGZhbHNlJTBBdHB1X3VzZV9zdWRvJTNBJTIwZmFsc2UlMEF1c2VfY3B1JTNBJTIwZmFsc2U=",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>                                                                                             
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">MULTI_GPU</span>                                                                                                    
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&#x27;no&#x27;</span>
<span class="hljs-attr">gpu_ids:</span> <span class="hljs-string">all</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span> <span class="hljs-comment">#change rank as per the node</span>
<span class="hljs-attr">main_process_ip:</span> <span class="hljs-number">192.168</span><span class="hljs-number">.20</span><span class="hljs-number">.1</span>
<span class="hljs-attr">main_process_port:</span> <span class="hljs-number">9898</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">mixed_precision:</span> <span class="hljs-string">fp16</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">8</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`}}),Ti=new U({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMEFkaXN0cmlidXRlZF90eXBlJTNBJTIwRlNEUCUwQWRvd25jYXN0X2JmMTYlM0ElMjAnbm8nJTBBZnNkcF9jb25maWclM0ElMEElMjAlMjBmc2RwX2F1dG9fd3JhcF9wb2xpY3klM0ElMjBUUkFOU0ZPUk1FUl9CQVNFRF9XUkFQJTBBJTIwJTIwZnNkcF9iYWNrd2FyZF9wcmVmZXRjaF9wb2xpY3klM0ElMjBCQUNLV0FSRF9QUkUlMEElMjAlMjBmc2RwX2ZvcndhcmRfcHJlZmV0Y2glM0ElMjB0cnVlJTBBJTIwJTIwZnNkcF9vZmZsb2FkX3BhcmFtcyUzQSUyMGZhbHNlJTBBJTIwJTIwZnNkcF9zaGFyZGluZ19zdHJhdGVneSUzQSUyMDElMEElMjAlMjBmc2RwX3N0YXRlX2RpY3RfdHlwZSUzQSUyMEZVTExfU1RBVEVfRElDVCUwQSUyMCUyMGZzZHBfc3luY19tb2R1bGVfc3RhdGVzJTNBJTIwdHJ1ZSUwQSUyMCUyMGZzZHBfdHJhbnNmb3JtZXJfbGF5ZXJfY2xzX3RvX3dyYXAlM0ElMjBCZXJ0TGF5ZXIlMEElMjAlMjBmc2RwX3VzZV9vcmlnX3BhcmFtcyUzQSUyMHRydWUlMEFtYWNoaW5lX3JhbmslM0ElMjAwJTBBbWFpbl90cmFpbmluZ19mdW5jdGlvbiUzQSUyMG1haW4lMEFtaXhlZF9wcmVjaXNpb24lM0ElMjBiZjE2JTBBbnVtX21hY2hpbmVzJTNBJTIwMSUwQW51bV9wcm9jZXNzZXMlM0ElMjAyJTBBcmR6dl9iYWNrZW5kJTNBJTIwc3RhdGljJTBBc2FtZV9uZXR3b3JrJTNBJTIwdHJ1ZSUwQXRwdV9lbnYlM0ElMjAlNUIlNUQlMEF0cHVfdXNlX2NsdXN0ZXIlM0ElMjBmYWxzZSUwQXRwdV91c2Vfc3VkbyUzQSUyMGZhbHNlJTBBdXNlX2NwdSUzQSUyMGZhbHNl",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">FSDP</span>
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&#x27;no&#x27;</span>
<span class="hljs-attr">fsdp_config:</span>
  <span class="hljs-attr">fsdp_auto_wrap_policy:</span> <span class="hljs-string">TRANSFORMER_BASED_WRAP</span>
  <span class="hljs-attr">fsdp_backward_prefetch_policy:</span> <span class="hljs-string">BACKWARD_PRE</span>
  <span class="hljs-attr">fsdp_forward_prefetch:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">fsdp_offload_params:</span> <span class="hljs-literal">false</span>
  <span class="hljs-attr">fsdp_sharding_strategy:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">fsdp_state_dict_type:</span> <span class="hljs-string">FULL_STATE_DICT</span>
  <span class="hljs-attr">fsdp_sync_module_states:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">fsdp_transformer_layer_cls_to_wrap:</span> <span class="hljs-string">BertLayer</span>
  <span class="hljs-attr">fsdp_use_orig_params:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">mixed_precision:</span> <span class="hljs-string">bf16</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`}}),Ei=new U({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMEFkZWVwc3BlZWRfY29uZmlnJTNBJTBBJTIwJTIwZGVlcHNwZWVkX2NvbmZpZ19maWxlJTNBJTIwJTJGaG9tZSUyRnVzZXIlMkZjb25maWdzJTJGZHNfemVybzNfY29uZmlnLmpzb24lMEElMjAlMjB6ZXJvM19pbml0X2ZsYWclM0ElMjB0cnVlJTBBZGlzdHJpYnV0ZWRfdHlwZSUzQSUyMERFRVBTUEVFRCUwQWRvd25jYXN0X2JmMTYlM0ElMjAnbm8nJTBBbWFjaGluZV9yYW5rJTNBJTIwMCUwQW1haW5fdHJhaW5pbmdfZnVuY3Rpb24lM0ElMjBtYWluJTBBbnVtX21hY2hpbmVzJTNBJTIwMSUwQW51bV9wcm9jZXNzZXMlM0ElMjA0JTBBcmR6dl9iYWNrZW5kJTNBJTIwc3RhdGljJTBBc2FtZV9uZXR3b3JrJTNBJTIwdHJ1ZSUwQXRwdV9lbnYlM0ElMjAlNUIlNUQlMEF0cHVfdXNlX2NsdXN0ZXIlM0ElMjBmYWxzZSUwQXRwdV91c2Vfc3VkbyUzQSUyMGZhbHNlJTBBdXNlX2NwdSUzQSUyMGZhbHNl",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>
<span class="hljs-attr">deepspeed_config:</span>
  <span class="hljs-attr">deepspeed_config_file:</span> <span class="hljs-string">/home/user/configs/ds_zero3_config.json</span>
  <span class="hljs-attr">zero3_init_flag:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">DEEPSPEED</span>
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&#x27;no&#x27;</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">4</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`}}),Ai=new U({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMEFkZWVwc3BlZWRfY29uZmlnJTNBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTBBJTIwJTIwZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNBJTIwMSUwQSUyMCUyMGdyYWRpZW50X2NsaXBwaW5nJTNBJTIwMC43JTBBJTIwJTIwb2ZmbG9hZF9vcHRpbWl6ZXJfZGV2aWNlJTNBJTIwY3B1JTBBJTIwJTIwb2ZmbG9hZF9wYXJhbV9kZXZpY2UlM0ElMjBjcHUlMEElMjAlMjB6ZXJvM19pbml0X2ZsYWclM0ElMjB0cnVlJTBBJTIwJTIwemVyb19zdGFnZSUzQSUyMDIlMEFkaXN0cmlidXRlZF90eXBlJTNBJTIwREVFUFNQRUVEJTBBZG93bmNhc3RfYmYxNiUzQSUyMCdubyclMEFtYWNoaW5lX3JhbmslM0ElMjAwJTBBbWFpbl90cmFpbmluZ19mdW5jdGlvbiUzQSUyMG1haW4lMEFtaXhlZF9wcmVjaXNpb24lM0ElMjBiZjE2JTBBbnVtX21hY2hpbmVzJTNBJTIwMSUwQW51bV9wcm9jZXNzZXMlM0ElMjA0JTBBcmR6dl9iYWNrZW5kJTNBJTIwc3RhdGljJTBBc2FtZV9uZXR3b3JrJTNBJTIwdHJ1ZSUwQXRwdV9lbnYlM0ElMjAlNUIlNUQlMEF0cHVfdXNlX2NsdXN0ZXIlM0ElMjBmYWxzZSUwQXRwdV91c2Vfc3VkbyUzQSUyMGZhbHNlJTBBdXNlX2NwdSUzQSUyMGZhbHNl",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>                                                                                             
<span class="hljs-attr">deepspeed_config:</span>                                                                                                              
  <span class="hljs-attr">gradient_accumulation_steps:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">gradient_clipping:</span> <span class="hljs-number">0.7</span>
  <span class="hljs-attr">offload_optimizer_device:</span> <span class="hljs-string">cpu</span>
  <span class="hljs-attr">offload_param_device:</span> <span class="hljs-string">cpu</span>
  <span class="hljs-attr">zero3_init_flag:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">zero_stage:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">DEEPSPEED</span>
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&#x27;no&#x27;</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">mixed_precision:</span> <span class="hljs-string">bf16</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">4</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`}}),$i=new U({props:{code:"Y2QlMjB0cmFuc2Zvcm1lcnMlMEElMEFhY2NlbGVyYXRlJTIwbGF1bmNoJTIwJTVDJTBBLiUyRmV4YW1wbGVzJTJGcHl0b3JjaCUyRnRleHQtY2xhc3NpZmljYXRpb24lMkZydW5fZ2x1ZS5weSUyMCU1QyUwQS0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwYmVydC1iYXNlLWNhc2VkJTIwJTVDJTBBLS10YXNrX25hbWUlMjAlMjRUQVNLX05BTUUlMjAlNUMlMEEtLWRvX3RyYWluJTIwJTVDJTBBLS1kb19ldmFsJTIwJTVDJTBBLS1tYXhfc2VxX2xlbmd0aCUyMDEyOCUyMCU1QyUwQS0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwMTYlMjAlNUMlMEEtLWxlYXJuaW5nX3JhdGUlMjA1ZS01JTIwJTVDJTBBLS1udW1fdHJhaW5fZXBvY2hzJTIwMyUyMCU1QyUwQS0tb3V0cHV0X2RpciUyMCUyRnRtcCUyRiUyNFRBU0tfTkFNRSUyRiUyMCU1QyUwQS0tb3ZlcndyaXRlX291dHB1dF9kaXI=",highlighted:`<span class="hljs-built_in">cd</span> transformers

accelerate launch \\
./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 16 \\
--learning_rate 5e-5 \\
--num_train_epochs 3 \\
--output_dir /tmp/<span class="hljs-variable">$TASK_NAME</span>/ \\
--overwrite_output_dir`}}),Mi=new U({props:{code:"Y2QlMjB0cmFuc2Zvcm1lcnMlMEElMEFhY2NlbGVyYXRlJTIwbGF1bmNoJTIwLS1udW1fcHJvY2Vzc2VzJTNEMiUyMCU1QyUwQS0tdXNlX2ZzZHAlMjAlNUMlMEEtLW1peGVkX3ByZWNpc2lvbiUzRGJmMTYlMjAlNUMlMEEtLWZzZHBfYXV0b193cmFwX3BvbGljeSUzRFRSQU5TRk9STUVSX0JBU0VEX1dSQVAlMjAlMjAlNUMlMEEtLWZzZHBfdHJhbnNmb3JtZXJfbGF5ZXJfY2xzX3RvX3dyYXAlM0QlMjJCZXJ0TGF5ZXIlMjIlMjAlNUMlMEEtLWZzZHBfc2hhcmRpbmdfc3RyYXRlZ3klM0QxJTIwJTVDJTBBLS1mc2RwX3N0YXRlX2RpY3RfdHlwZSUzREZVTExfU1RBVEVfRElDVCUyMCU1QyUwQS4lMkZleGFtcGxlcyUyRnB5dG9yY2glMkZ0ZXh0LWNsYXNzaWZpY2F0aW9uJTJGcnVuX2dsdWUucHklMEEtLW1vZGVsX25hbWVfb3JfcGF0aCUyMGJlcnQtYmFzZS1jYXNlZCUyMCU1QyUwQS0tdGFza19uYW1lJTIwJTI0VEFTS19OQU1FJTIwJTVDJTBBLS1kb190cmFpbiUyMCU1QyUwQS0tZG9fZXZhbCUyMCU1QyUwQS0tbWF4X3NlcV9sZW5ndGglMjAxMjglMjAlNUMlMEEtLXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUyMDE2JTIwJTVDJTBBLS1sZWFybmluZ19yYXRlJTIwNWUtNSUyMCU1QyUwQS0tbnVtX3RyYWluX2Vwb2NocyUyMDMlMjAlNUMlMEEtLW91dHB1dF9kaXIlMjAlMkZ0bXAlMkYlMjRUQVNLX05BTUUlMkYlMjAlNUMlMEEtLW92ZXJ3cml0ZV9vdXRwdXRfZGly",highlighted:`<span class="hljs-built_in">cd</span> transformers

accelerate launch --num_processes=2 \\
--use_fsdp \\
--mixed_precision=bf16 \\
--fsdp_auto_wrap_policy=TRANSFORMER_BASED_WRAP  \\
--fsdp_transformer_layer_cls_to_wrap=<span class="hljs-string">&quot;BertLayer&quot;</span> \\
--fsdp_sharding_strategy=1 \\
--fsdp_state_dict_type=FULL_STATE_DICT \\
./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 16 \\
--learning_rate 5e-5 \\
--num_train_epochs 3 \\
--output_dir /tmp/<span class="hljs-variable">$TASK_NAME</span>/ \\
--overwrite_output_dir`}}),{c(){u=n("meta"),k=i(),T=n("h1"),w=n("a"),$=n("span"),f(h.$$.fragment),E=i(),C=n("span"),z=r("Trainer"),j=i(),R=n("p"),G=r("The "),ee=n("a"),Q=r("Trainer"),Y=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"),ue=r("example scripts"),H=r("."),L=i(),W=n("p"),ne=r("Before instantiating your "),F=n("a"),we=r("Trainer"),Te=r(", create a "),se=n("a"),gt=r("TrainingArguments"),_t=r(" to access all the points of customization during training."),ge=i(),je=n("p"),fn=r("The API supports distributed training on multiple GPUs/TPUs, mixed precision through "),Ee=n("a"),gn=r("NVIDIA Apex"),_n=r(" and Native AMP for PyTorch."),le=i(),re=n("p"),Fi=r("The "),Ae=n("a"),hr=r("Trainer"),Ni=r(" contains the basic training loop which supports the above features. To inject custom behavior you can subclass them and override the following methods:"),bo=i(),O=n("ul"),ae=n("li"),ur=n("strong"),zi=r("get_train_dataloader"),Wi=r(" \u2014 Creates the training DataLoader."),Oi=i(),Ri=n("li"),Hp=n("strong"),o0=r("get_eval_dataloader"),r0=r(" \u2014 Creates the evaluation DataLoader."),a0=i(),Li=n("li"),Qp=n("strong"),n0=r("get_test_dataloader"),s0=r(" \u2014 Creates the test DataLoader."),l0=i(),Bi=n("li"),Kp=n("strong"),i0=r("log"),d0=r(" \u2014 Logs information on the various objects watching training."),c0=i(),bt=n("li"),em=n("strong"),p0=r("create_optimizer_and_scheduler"),m0=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 `),tm=n("code"),h0=r("create_optimizer"),u0=r(" and "),om=n("code"),f0=r("create_scheduler"),g0=r(` methods
separately.`),_0=i(),Gi=n("li"),rm=n("strong"),b0=r("create_optimizer"),v0=r(" \u2014 Sets up the optimizer if it wasn\u2019t passed at init."),y0=i(),Zi=n("li"),am=n("strong"),w0=r("create_scheduler"),T0=r(" \u2014 Sets up the learning rate scheduler if it wasn\u2019t passed at init."),E0=i(),Vi=n("li"),nm=n("strong"),A0=r("compute_loss"),$0=r(" - Computes the loss on a batch of training inputs."),k0=i(),Xi=n("li"),sm=n("strong"),x0=r("training_step"),M0=r(" \u2014 Performs a training step."),I0=i(),Yi=n("li"),lm=n("strong"),S0=r("prediction_step"),q0=r(" \u2014 Performs an evaluation/test step."),U0=i(),Hi=n("li"),im=n("strong"),D0=r("evaluate"),j0=r(" \u2014 Runs an evaluation loop and returns metrics."),P0=i(),Qi=n("li"),dm=n("strong"),J0=r("predict"),C0=r(" \u2014 Returns predictions (with metrics if labels are available) on a test set."),Ev=i(),f(fr.$$.fragment),Av=i(),gr=n("p"),F0=r("Here is an example of how to customize "),Ki=n("a"),N0=r("Trainer"),z0=r(" to use a weighted loss (useful when you have an unbalanced training set):"),$v=i(),f(bn.$$.fragment),kv=i(),vt=n("p"),W0=r("Another way to customize the training loop behavior for the PyTorch "),ed=n("a"),O0=r("Trainer"),R0=r(" is to use "),td=n("a"),L0=r("callbacks"),B0=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)."),xv=i(),vo=n("h2"),_r=n("a"),cm=n("span"),f(vn.$$.fragment),G0=i(),pm=n("span"),Z0=r("Trainer"),Mv=i(),A=n("div"),f(yn.$$.fragment),V0=i(),mm=n("p"),X0=r("Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for \u{1F917} Transformers."),Y0=i(),hm=n("p"),H0=r("Important attributes:"),Q0=i(),$e=n("ul"),br=n("li"),um=n("strong"),K0=r("model"),e2=r(" \u2014 Always points to the core model. If using a transformers model, it will be a "),od=n("a"),t2=r("PreTrainedModel"),o2=r(`
subclass.`),r2=i(),ie=n("li"),fm=n("strong"),a2=r("model_wrapped"),n2=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 `),gm=n("code"),s2=r("DeepSpeed"),l2=r(`,
the inner model is wrapped in `),_m=n("code"),i2=r("DeepSpeed"),d2=r(" and then again in "),bm=n("code"),c2=r("torch.nn.DistributedDataParallel"),p2=r(`. If the inner
model hasn\u2019t been wrapped, then `),vm=n("code"),m2=r("self.model_wrapped"),h2=r(" is the same as "),ym=n("code"),u2=r("self.model"),f2=r("."),g2=i(),rd=n("li"),wm=n("strong"),_2=r("is_model_parallel"),b2=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).`),v2=i(),Pe=n("li"),Tm=n("strong"),y2=r("place_model_on_device"),w2=r(` \u2014 Whether or not to automatically place the model on the device - it will be set
to `),Em=n("code"),T2=r("False"),E2=r(` if model parallel or deepspeed is used, or if the default
`),Am=n("code"),A2=r("TrainingArguments.place_model_on_device"),$2=r(" is overridden to return "),$m=n("code"),k2=r("False"),x2=r(" ."),M2=i(),Je=n("li"),km=n("strong"),I2=r("is_in_train"),S2=r(" \u2014 Whether or not a model is currently running "),xm=n("code"),q2=r("train"),U2=r(" (e.g. when "),Mm=n("code"),D2=r("evaluate"),j2=r(` is called while
in `),Im=n("code"),P2=r("train"),J2=r(")"),C2=i(),vr=n("div"),f(wn.$$.fragment),F2=i(),Tn=n("p"),N2=r("Add a callback to the current list of "),Sm=n("code"),z2=r("~transformer.TrainerCallback"),W2=r("."),O2=i(),yr=n("div"),f(En.$$.fragment),R2=i(),An=n("p"),L2=r("A helper wrapper that creates an appropriate context manager for "),qm=n("code"),B2=r("autocast"),G2=r(` while feeding it the desired
arguments, depending on the situation.`),Z2=i(),yt=n("div"),f($n.$$.fragment),V2=i(),Um=n("p"),X2=r("How the loss is computed by Trainer. By default, all models return the loss in the first element."),Y2=i(),Dm=n("p"),H2=r("Subclass and override for custom behavior."),Q2=i(),wr=n("div"),f(kn.$$.fragment),K2=i(),jm=n("p"),eE=r("A helper wrapper to group together context managers."),tE=i(),Tr=n("div"),f(xn.$$.fragment),oE=i(),Mn=n("p"),rE=r("Creates a draft of a model card using the information available to the "),Pm=n("code"),aE=r("Trainer"),nE=r("."),sE=i(),wt=n("div"),f(In.$$.fragment),lE=i(),Jm=n("p"),iE=r("Setup the optimizer."),dE=i(),Sn=n("p"),cE=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 `),Cm=n("code"),pE=r("optimizers"),mE=r(", or subclass and override this method in a subclass."),hE=i(),Tt=n("div"),f(qn.$$.fragment),uE=i(),Fm=n("p"),fE=r("Setup the optimizer and the learning rate scheduler."),gE=i(),nt=n("p"),_E=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 `),Nm=n("code"),bE=r("optimizers"),vE=r(", or subclass and override this method (or "),zm=n("code"),yE=r("create_optimizer"),wE=r(` and/or
`),Wm=n("code"),TE=r("create_scheduler"),EE=r(") in a subclass."),AE=i(),Er=n("div"),f(Un.$$.fragment),$E=i(),Om=n("p"),kE=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.`),xE=i(),Ce=n("div"),f(Dn.$$.fragment),ME=i(),Rm=n("p"),IE=r("Run evaluation and returns metrics."),SE=i(),jn=n("p"),qE=r(`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Lm=n("code"),UE=r("compute_metrics"),DE=r(" argument)."),jE=i(),Bm=n("p"),PE=r("You can also subclass and override this method to inject custom behavior."),JE=i(),Et=n("div"),f(Pn.$$.fragment),CE=i(),yo=n("p"),FE=r("Prediction/evaluation loop, shared by "),Gm=n("code"),NE=r("Trainer.evaluate()"),zE=r(" and "),Zm=n("code"),WE=r("Trainer.predict()"),OE=r("."),RE=i(),Vm=n("p"),LE=r("Works both with or without labels."),BE=i(),Ar=n("div"),f(Jn.$$.fragment),GE=i(),Cn=n("p"),ZE=r("For models that inherit from "),ad=n("a"),VE=r("PreTrainedModel"),XE=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.`),YE=i(),At=n("div"),f(Fn.$$.fragment),HE=i(),Nn=n("p"),QE=r("Returns the evaluation "),Xm=n("code"),KE=r("~torch.utils.data.DataLoader"),e4=r("."),t4=i(),Ym=n("p"),o4=r("Subclass and override this method if you want to inject some custom behavior."),r4=i(),$r=n("div"),f(zn.$$.fragment),a4=i(),Hm=n("p"),n4=r("Returns the optimizer class and optimizer parameters based on the training arguments."),s4=i(),$t=n("div"),f(Wn.$$.fragment),l4=i(),On=n("p"),i4=r("Returns the test "),Qm=n("code"),d4=r("~torch.utils.data.DataLoader"),c4=r("."),p4=i(),Km=n("p"),m4=r("Subclass and override this method if you want to inject some custom behavior."),h4=i(),Fe=n("div"),f(Rn.$$.fragment),u4=i(),Ln=n("p"),f4=r("Returns the training "),eh=n("code"),g4=r("~torch.utils.data.DataLoader"),_4=r("."),b4=i(),wo=n("p"),v4=r("Will use no sampler if "),th=n("code"),y4=r("train_dataset"),w4=r(" does not implement "),oh=n("code"),T4=r("__len__"),E4=r(`, a random sampler (adapted to distributed
training if necessary) otherwise.`),A4=i(),rh=n("p"),$4=r("Subclass and override this method if you want to inject some custom behavior."),k4=i(),kt=n("div"),f(Bn.$$.fragment),x4=i(),ke=n("p"),M4=r("Launch an hyperparameter search using "),ah=n("code"),I4=r("optuna"),S4=r(" or "),nh=n("code"),q4=r("Ray Tune"),U4=r(" or "),sh=n("code"),D4=r("SigOpt"),j4=r(`. The optimized quantity is determined
by `),lh=n("code"),P4=r("compute_objective"),J4=r(`, which defaults to a function returning the evaluation loss when no metric is provided,
the sum of all metrics otherwise.`),C4=i(),f(kr.$$.fragment),F4=i(),xr=n("div"),f(Gn.$$.fragment),N4=i(),Zn=n("p"),z4=r("Initializes a git repo in "),ih=n("code"),W4=r("self.args.hub_model_id"),O4=r("."),R4=i(),Mr=n("div"),f(Vn.$$.fragment),L4=i(),dh=n("p"),B4=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.`),G4=i(),Ir=n("div"),f(Xn.$$.fragment),Z4=i(),Yn=n("p"),V4=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 `),ch=n("code"),X4=r("True"),Y4=r(" for one process)."),H4=i(),xt=n("div"),f(Hn.$$.fragment),Q4=i(),Qn=n("p"),K4=r("Log "),ph=n("code"),eA=r("logs"),tA=r(" on the various objects watching training."),oA=i(),mh=n("p"),rA=r("Subclass and override this method to inject custom behavior."),aA=i(),P=n("div"),f(Kn.$$.fragment),nA=i(),hh=n("p"),sA=r("Log metrics in a specially formatted way"),lA=i(),uh=n("p"),iA=r("Under distributed environment this is done only for a process with rank 0."),dA=i(),fh=n("p"),cA=r("Notes on memory reports:"),pA=i(),To=n("p"),mA=r("In order to get memory usage report you need to install "),gh=n("code"),hA=r("psutil"),uA=r(". You can do that with "),_h=n("code"),fA=r("pip install psutil"),gA=r("."),_A=i(),f(Sr.$$.fragment),bA=i(),bh=n("p"),vh=n("strong"),vA=r("Understanding the reports:"),yA=i(),st=n("ul"),xe=n("li"),wA=r("the first segment, e.g., "),yh=n("code"),TA=r("train__"),EA=r(", tells you which stage the metrics are for. Reports starting with "),wh=n("code"),AA=r("init_"),$A=r(`
will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the
`),Th=n("code"),kA=r("__init__"),xA=r(" will be reported along with the "),Eh=n("code"),MA=r("eval_"),IA=r(" metrics."),SA=i(),Eo=n("li"),qA=r("the third segment, is either "),Ah=n("code"),UA=r("cpu"),DA=r(" or "),$h=n("code"),jA=r("gpu"),PA=r(`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),JA=i(),nd=n("li"),kh=n("code"),CA=r("*_alloc_delta"),FA=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.`),NA=i(),Mt=n("li"),xh=n("code"),zA=r("*_peaked_delta"),WA=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 `),Mh=n("code"),OA=r("alloc_delta"),RA=r(` +
`),Ih=n("code"),LA=r("peaked_delta"),BA=r(" and you know how much memory was needed to complete that stage."),GA=i(),Sh=n("p"),ZA=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.`),VA=i(),qh=n("p"),XA=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.`),YA=i(),es=n("p"),HA=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 `),Uh=n("code"),QA=r("tracemalloc"),KA=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.`),e3=i(),lt=n("p"),t3=r("The GPU allocated and peak memory reporting is done with "),Dh=n("code"),o3=r("torch.cuda.memory_allocated()"),r3=r(` and
`),jh=n("code"),a3=r("torch.cuda.max_memory_allocated()"),n3=r(`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),Ph=n("code"),s3=r("torch.cuda"),l3=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.`),i3=i(),fe=n("p"),d3=r("Note that this tracker doesn\u2019t account for memory allocations outside of "),sd=n("a"),c3=r("Trainer"),p3=r("\u2019s "),Jh=n("code"),m3=r("__init__"),h3=r(", "),Ch=n("code"),u3=r("train"),f3=r(`,
`),Fh=n("code"),g3=r("evaluate"),_3=r(" and "),Nh=n("code"),b3=r("predict"),v3=r(" calls."),y3=i(),Z=n("p"),w3=r("Because "),zh=n("code"),T3=r("evaluation"),E3=r(" calls may happen during "),Wh=n("code"),A3=r("train"),$3=r(`, we can\u2019t handle nested invocations because
`),Oh=n("code"),k3=r("torch.cuda.max_memory_allocated"),x3=r(" is a single counter, so if it gets reset by a nested eval call, "),Rh=n("code"),M3=r("train"),I3=r(`\u2019s tracker
will report incorrect info. If this `),ts=n("a"),S3=r("pytorch issue"),q3=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
`),Lh=n("code"),U3=r("train"),D3=r(", "),Bh=n("code"),j3=r("evaluate"),P3=r(" and "),Gh=n("code"),J3=r("predict"),C3=r(" methods. Which means that if "),Zh=n("code"),F3=r("eval"),N3=r(" is called during "),Vh=n("code"),z3=r("train"),W3=r(`, it\u2019s the latter
that will account for its memory usage and that of the former.`),O3=i(),Me=n("p"),R3=r("This also means that if any other tool that is used along the "),ld=n("a"),L3=r("Trainer"),B3=r(` calls
`),Xh=n("code"),G3=r("torch.cuda.reset_peak_memory_stats"),Z3=r(", the gpu peak memory stats could be invalid. And the "),id=n("a"),V3=r("Trainer"),X3=r(` will disrupt
the normal behavior of any such tools that rely on calling `),Yh=n("code"),Y3=r("torch.cuda.reset_peak_memory_stats"),H3=r(" themselves."),Q3=i(),Hh=n("p"),K3=r("For best performance you may want to consider turning the memory profiling off for production runs."),e$=i(),qr=n("div"),f(os.$$.fragment),t$=i(),Qh=n("p"),o$=r("Reformat Trainer metrics values to a human-readable format"),r$=i(),Ur=n("div"),f(rs.$$.fragment),a$=i(),as=n("p"),n$=r("Helper to get number of samples in a "),Kh=n("code"),s$=r("~torch.utils.data.DataLoader"),l$=r(` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),i$=i(),It=n("div"),f(ns.$$.fragment),d$=i(),ss=n("p"),c$=r("Remove a callback from the current list of "),eu=n("code"),p$=r("~transformer.TrainerCallback"),m$=r(" and returns it."),h$=i(),ls=n("p"),u$=r("If the callback is not found, returns "),tu=n("code"),f$=r("None"),g$=r(" (and no error is raised)."),_$=i(),de=n("div"),f(is.$$.fragment),b$=i(),ou=n("p"),v$=r("Run prediction and returns predictions and potential metrics."),y$=i(),ds=n("p"),w$=r(`Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method
will also return metrics, like in `),ru=n("code"),T$=r("evaluate()"),E$=r("."),A$=i(),f(Dr.$$.fragment),$$=i(),cs=n("p"),k$=r("Returns: "),au=n("em"),x$=r("NamedTuple"),M$=r(" A namedtuple with the following keys:"),I$=i(),Ao=n("ul"),$o=n("li"),S$=r("predictions ("),nu=n("code"),q$=r("np.ndarray"),U$=r("): The predictions on "),su=n("code"),D$=r("test_dataset"),j$=r("."),P$=i(),ko=n("li"),J$=r("label_ids ("),lu=n("code"),C$=r("np.ndarray"),F$=r(", "),iu=n("em"),N$=r("optional"),z$=r("): The labels (if the dataset contained some)."),W$=i(),xo=n("li"),O$=r("metrics ("),du=n("code"),R$=r("Dict[str, float]"),L$=r(", "),cu=n("em"),B$=r("optional"),G$=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),Z$=i(),St=n("div"),f(ps.$$.fragment),V$=i(),Mo=n("p"),X$=r("Prediction/evaluation loop, shared by "),pu=n("code"),Y$=r("Trainer.evaluate()"),H$=r(" and "),mu=n("code"),Q$=r("Trainer.predict()"),K$=r("."),ek=i(),hu=n("p"),tk=r("Works both with or without labels."),ok=i(),qt=n("div"),f(ms.$$.fragment),rk=i(),Io=n("p"),ak=r("Perform an evaluation step on "),uu=n("code"),nk=r("model"),sk=r(" using "),fu=n("code"),lk=r("inputs"),ik=r("."),dk=i(),gu=n("p"),ck=r("Subclass and override to inject custom behavior."),pk=i(),jr=n("div"),f(hs.$$.fragment),mk=i(),it=n("p"),hk=r("Upload "),_u=n("em"),uk=r("self.model"),fk=r(" and "),bu=n("em"),gk=r("self.tokenizer"),_k=r(" to the \u{1F917} model hub on the repo "),vu=n("em"),bk=r("self.args.hub_model_id"),vk=r("."),yk=i(),Pr=n("div"),f(us.$$.fragment),wk=i(),fs=n("p"),Tk=r("Remove a callback from the current list of "),yu=n("code"),Ek=r("~transformer.TrainerCallback"),Ak=r("."),$k=i(),Ne=n("div"),f(gs.$$.fragment),kk=i(),_s=n("p"),xk=r("Save metrics into a json file for that split, e.g. "),wu=n("code"),Mk=r("train_results.json"),Ik=r("."),Sk=i(),Tu=n("p"),qk=r("Under distributed environment this is done only for a process with rank 0."),Uk=i(),bs=n("p"),Dk=r("To understand the metrics please read the docstring of "),dd=n("a"),jk=r("log_metrics()"),Pk=r(`. The only difference is that raw
unformatted numbers are saved in the current method.`),Jk=i(),Ut=n("div"),f(vs.$$.fragment),Ck=i(),ys=n("p"),Fk=r("Will save the model, so you can reload it using "),Eu=n("code"),Nk=r("from_pretrained()"),zk=r("."),Wk=i(),Au=n("p"),Ok=r("Will only save from the main process."),Rk=i(),Dt=n("div"),f(ws.$$.fragment),Lk=i(),$u=n("p"),Bk=r("Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),Gk=i(),ku=n("p"),Zk=r("Under distributed environment this is done only for a process with rank 0."),Vk=i(),Jr=n("div"),f(Ts.$$.fragment),Xk=i(),xu=n("p"),Yk=r("Main training entry point."),Hk=i(),jt=n("div"),f(Es.$$.fragment),Qk=i(),Mu=n("p"),Kk=r("Perform a training step on a batch of inputs."),ex=i(),Iu=n("p"),tx=r("Subclass and override to inject custom behavior."),Iv=i(),So=n("h2"),Cr=n("a"),Su=n("span"),f(As.$$.fragment),ox=i(),qu=n("span"),rx=r("Seq2SeqTrainer"),Sv=i(),dt=n("div"),f($s.$$.fragment),ax=i(),ze=n("div"),f(ks.$$.fragment),nx=i(),Uu=n("p"),sx=r("Run evaluation and returns metrics."),lx=i(),xs=n("p"),ix=r(`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Du=n("code"),dx=r("compute_metrics"),cx=r(" argument)."),px=i(),ju=n("p"),mx=r("You can also subclass and override this method to inject custom behavior."),hx=i(),ce=n("div"),f(Ms.$$.fragment),ux=i(),Pu=n("p"),fx=r("Run prediction and returns predictions and potential metrics."),gx=i(),Is=n("p"),_x=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 `),Ju=n("code"),bx=r("evaluate()"),vx=r("."),yx=i(),f(Fr.$$.fragment),wx=i(),Ss=n("p"),Tx=r("Returns: "),Cu=n("em"),Ex=r("NamedTuple"),Ax=r(" A namedtuple with the following keys:"),$x=i(),qo=n("ul"),Uo=n("li"),kx=r("predictions ("),Fu=n("code"),xx=r("np.ndarray"),Mx=r("): The predictions on "),Nu=n("code"),Ix=r("test_dataset"),Sx=r("."),qx=i(),Do=n("li"),Ux=r("label_ids ("),zu=n("code"),Dx=r("np.ndarray"),jx=r(", "),Wu=n("em"),Px=r("optional"),Jx=r("): The labels (if the dataset contained some)."),Cx=i(),jo=n("li"),Fx=r("metrics ("),Ou=n("code"),Nx=r("Dict[str, float]"),zx=r(", "),Ru=n("em"),Wx=r("optional"),Ox=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),qv=i(),Po=n("h2"),Nr=n("a"),Lu=n("span"),f(qs.$$.fragment),Rx=i(),Bu=n("span"),Lx=r("TrainingArguments"),Uv=i(),q=n("div"),f(Us.$$.fragment),Bx=i(),Ds=n("p"),Gx=r("TrainingArguments is the subset of the arguments we use in our example scripts "),Gu=n("strong"),Zx=r(`which relate to the training loop
itself`),Vx=r("."),Xx=i(),Jo=n("p"),Yx=r("Using "),cd=n("a"),Hx=r("HfArgumentParser"),Qx=r(` we can turn this class into
`),js=n("a"),Kx=r("argparse"),eM=r(` arguments that can be specified on the
command line.`),tM=i(),_e=n("div"),f(Ps.$$.fragment),oM=i(),Zu=n("p"),rM=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.`),aM=i(),Co=n("p"),nM=r("For the main process the log level defaults to the logging level set ("),Vu=n("code"),sM=r("logging.WARNING"),lM=r(` if you didn\u2019t do
anything) unless overridden by `),Xu=n("code"),iM=r("log_level"),dM=r(" argument."),cM=i(),Fo=n("p"),pM=r("For the replica processes the log level defaults to "),Yu=n("code"),mM=r("logging.WARNING"),hM=r(" unless overridden by "),Hu=n("code"),uM=r("log_level_replica"),fM=r(`
argument.`),gM=i(),Js=n("p"),_M=r("The choice between the main and replica process settings is made according to the return value of "),Qu=n("code"),bM=r("should_log"),vM=r("."),yM=i(),zr=n("div"),f(Cs.$$.fragment),wM=i(),Ku=n("p"),TM=r("Get number of steps used for a linear warmup."),EM=i(),Pt=n("div"),f(Fs.$$.fragment),AM=i(),ef=n("p"),$M=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.`),kM=i(),No=n("p"),xM=r("One such use is for "),tf=n("code"),MM=r("datasets"),IM=r("\u2019s "),of=n("code"),SM=r("map"),qM=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.`),UM=i(),Jt=n("div"),f(Ns.$$.fragment),DM=i(),rf=n("p"),jM=r("A method that regroups all arguments linked to the dataloaders creation."),PM=i(),f(Wr.$$.fragment),JM=i(),Ct=n("div"),f(zs.$$.fragment),CM=i(),af=n("p"),FM=r("A method that regroups all arguments linked to the evaluation."),NM=i(),f(Or.$$.fragment),zM=i(),Ft=n("div"),f(Ws.$$.fragment),WM=i(),nf=n("p"),OM=r("A method that regroups all arguments linked to the evaluation."),RM=i(),f(Rr.$$.fragment),LM=i(),Nt=n("div"),f(Os.$$.fragment),BM=i(),sf=n("p"),GM=r("A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters."),ZM=i(),f(Lr.$$.fragment),VM=i(),zt=n("div"),f(Rs.$$.fragment),XM=i(),lf=n("p"),YM=r("A method that regroups all arguments linked to the optimizer and its hyperparameters."),HM=i(),f(Br.$$.fragment),QM=i(),We=n("div"),f(Ls.$$.fragment),KM=i(),df=n("p"),e5=r("A method that regroups all arguments linked to synchronizing checkpoints with the Hub."),t5=i(),f(Gr.$$.fragment),o5=i(),f(Zr.$$.fragment),r5=i(),Wt=n("div"),f(Bs.$$.fragment),a5=i(),cf=n("p"),n5=r("A method that regroups all arguments linked to the evaluation."),s5=i(),f(Vr.$$.fragment),l5=i(),Oe=n("div"),f(Gs.$$.fragment),i5=i(),pf=n("p"),d5=r("A method that regroups all basic arguments linked to testing on a held-out dataset."),c5=i(),f(Xr.$$.fragment),p5=i(),f(Yr.$$.fragment),m5=i(),Re=n("div"),f(Zs.$$.fragment),h5=i(),mf=n("p"),u5=r("A method that regroups all basic arguments linked to the training."),f5=i(),f(Hr.$$.fragment),g5=i(),f(Qr.$$.fragment),_5=i(),Kr=n("div"),f(Vs.$$.fragment),b5=i(),Xs=n("p"),v5=r("Serializes this instance while replace "),hf=n("code"),y5=r("Enum"),w5=r(` by their values (for JSON serialization support). It obfuscates
the token values by removing their value.`),T5=i(),ea=n("div"),f(Ys.$$.fragment),E5=i(),uf=n("p"),A5=r("Serializes this instance to a JSON string."),$5=i(),ta=n("div"),f(Hs.$$.fragment),k5=i(),ff=n("p"),x5=r("Sanitized serialization to use with TensorBoard\u2019s hparams"),Dv=i(),zo=n("h2"),oa=n("a"),gf=n("span"),f(Qs.$$.fragment),M5=i(),_f=n("span"),I5=r("Seq2SeqTrainingArguments"),jv=i(),Ie=n("div"),f(Ks.$$.fragment),S5=i(),el=n("p"),q5=r("TrainingArguments is the subset of the arguments we use in our example scripts "),bf=n("strong"),U5=r(`which relate to the training loop
itself`),D5=r("."),j5=i(),Wo=n("p"),P5=r("Using "),pd=n("a"),J5=r("HfArgumentParser"),C5=r(` we can turn this class into
`),tl=n("a"),F5=r("argparse"),N5=r(` arguments that can be specified on the
command line.`),z5=i(),ra=n("div"),f(ol.$$.fragment),W5=i(),Oo=n("p"),O5=r("Serializes this instance while replace "),vf=n("code"),R5=r("Enum"),L5=r(" by their values and "),yf=n("code"),B5=r("GenerationConfig"),G5=r(` by dictionaries (for JSON
serialization support). It obfuscates the token values by removing their value.`),Pv=i(),Ro=n("h2"),aa=n("a"),wf=n("span"),f(rl.$$.fragment),Z5=i(),Tf=n("span"),V5=r("Checkpoints"),Jv=i(),be=n("p"),X5=r("By default, "),md=n("a"),Y5=r("Trainer"),H5=r(" will save all checkpoints in the "),Ef=n("code"),Q5=r("output_dir"),K5=r(` you set in the
`),hd=n("a"),eI=r("TrainingArguments"),tI=r(" you are using. Those will go in subfolder named "),Af=n("code"),oI=r("checkpoint-xxx"),rI=r(` with xxx
being the step at which the training was at.`),Cv=i(),na=n("p"),aI=r("Resuming training from a checkpoint can be done when calling "),ud=n("a"),nI=r("Trainer.train()"),sI=r(" with either:"),Fv=i(),sa=n("ul"),fd=n("li"),$f=n("code"),lI=r("resume_from_checkpoint=True"),iI=r(" which will resume training from the latest checkpoint"),dI=i(),gd=n("li"),kf=n("code"),cI=r("resume_from_checkpoint=checkpoint_dir"),pI=r(` which will resume training from the specific checkpoint in the directory
passed.`),Nv=i(),Le=n("p"),mI=r("In addition, you can easily save your checkpoints on the Model Hub when using "),xf=n("code"),hI=r("push_to_hub=True"),uI=r(`. By default, all
the models saved in intermediate checkpoints are saved in different commits, but not the optimizer state. You can adapt
the `),Mf=n("code"),fI=r("hub-strategy"),gI=r(" value of your "),_d=n("a"),_I=r("TrainingArguments"),bI=r(" to either:"),zv=i(),la=n("ul"),ia=n("li"),If=n("code"),vI=r('"checkpoint"'),yI=r(`: the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to
resume training easily with `),Sf=n("code"),wI=r('trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")'),TI=r("."),EI=i(),bd=n("li"),qf=n("code"),AI=r('"all_checkpoints"'),$I=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)`),Wv=i(),Lo=n("h2"),da=n("a"),Uf=n("span"),f(al.$$.fragment),kI=i(),Df=n("span"),xI=r("Logging"),Ov=i(),Be=n("p"),MI=r("By default "),vd=n("a"),II=r("Trainer"),SI=r(" will use "),jf=n("code"),qI=r("logging.INFO"),UI=r(" for the main process and "),Pf=n("code"),DI=r("logging.WARNING"),jI=r(" for the replicas if any."),Rv=i(),Ot=n("p"),PI=r("These defaults can be overridden to use any of the 5 "),Jf=n("code"),JI=r("logging"),CI=r(" levels with "),yd=n("a"),FI=r("TrainingArguments"),NI=r(`\u2019s
arguments:`),Lv=i(),ca=n("ul"),wd=n("li"),Cf=n("code"),zI=r("log_level"),WI=r(" - for the main process"),OI=i(),Td=n("li"),Ff=n("code"),RI=r("log_level_replica"),LI=r(" - for the replicas"),Bv=i(),Ge=n("p"),BI=r("Further, if "),Ed=n("a"),GI=r("TrainingArguments"),ZI=r("\u2019s "),Nf=n("code"),VI=r("log_on_each_node"),XI=r(" is set to "),zf=n("code"),YI=r("False"),HI=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.`),Gv=i(),pe=n("p"),QI=r("Note that "),Ad=n("a"),KI=r("Trainer"),e9=r(" is going to set "),Wf=n("code"),t9=r("transformers"),o9=r(`\u2019s log level separately for each node in its
`),Of=n("code"),r9=r("Trainer.__init__()"),a9=r(`. So you may want to set this sooner (see the next example) if you tap into other
`),Rf=n("code"),n9=r("transformers"),s9=r(" functionality before creating the "),$d=n("a"),l9=r("Trainer"),i9=r(" object."),Zv=i(),kd=n("p"),d9=r("Here is an example of how this can be used in an application:"),Vv=i(),f(nl.$$.fragment),Xv=i(),xd=n("p"),c9=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:`),Yv=i(),f(sl.$$.fragment),Hv=i(),Md=n("p"),p9=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:`),Qv=i(),f(ll.$$.fragment),Kv=i(),Id=n("p"),m9=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.`),ey=i(),Sd=n("p"),h9=r("If you need your application to be as quiet as possible you could do:"),ty=i(),f(il.$$.fragment),oy=i(),pa=n("p"),u9=r("(add "),Lf=n("code"),f9=r("--log_on_each_node 0"),g9=r(" if on multi-node environment)"),ry=i(),Bo=n("h2"),ma=n("a"),Bf=n("span"),f(dl.$$.fragment),_9=i(),Gf=n("span"),b9=r("Randomness"),ay=i(),ve=n("p"),v9=r("When resuming from a checkpoint generated by "),qd=n("a"),y9=r("Trainer"),w9=r(` all efforts are made to restore the
`),Zf=n("em"),T9=r("python"),E9=r(", "),Vf=n("em"),A9=r("numpy"),$9=r(" and "),Xf=n("em"),k9=r("pytorch"),x9=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.`),ny=i(),Rt=n("p"),M9=r(`However, due to various default non-deterministic pytorch settings this might not fully work. If you want full
determinism please refer to `),cl=n("a"),I9=r("Controlling sources of randomness"),S9=r(`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),Yf=n("code"),q9=r("torch.backends.cudnn.deterministic"),U9=r(`) may slow things down, therefore this
can\u2019t be done by default, but you can enable those yourself if needed.`),sy=i(),Go=n("h2"),ha=n("a"),Hf=n("span"),f(pl.$$.fragment),D9=i(),Qf=n("span"),j9=r("Specific GPUs Selection"),ly=i(),Ud=n("p"),P9=r("Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),iy=i(),ua=n("p"),J9=r("When using "),ml=n("a"),Kf=n("code"),C9=r("DistributedDataParallel"),F9=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:"),dy=i(),f(hl.$$.fragment),cy=i(),Lt=n("p"),N9=r("if you have either "),ul=n("a"),eg=n("code"),z9=r("accelerate"),W9=r(" or "),fl=n("a"),tg=n("code"),O9=r("deepspeed"),R9=r(" installed you can also accomplish the same by using one of:"),py=i(),f(gl.$$.fragment),my=i(),f(_l.$$.fragment),hy=i(),fa=n("p"),L9=r("You don\u2019t need to use the Accelerate or "),Dd=n("a"),B9=r("the Deepspeed integration"),G9=r(" features to use these launchers."),uy=i(),jd=n("p"),Z9=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."),fy=i(),Pd=n("p"),V9=r("The following environment variables help you control which GPUs to use and their order."),gy=i(),Jd=n("p"),og=n("strong"),rg=n("code"),X9=r("CUDA_VISIBLE_DEVICES"),_y=i(),ga=n("p"),Y9=r("If you have multiple GPUs and you\u2019d like to use only 1 or a few of those GPUs, set the environment variable "),ag=n("code"),H9=r("CUDA_VISIBLE_DEVICES"),Q9=r(" to a list of the GPUs to be used."),by=i(),Cd=n("p"),K9=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:"),vy=i(),f(bl.$$.fragment),yy=i(),Bt=n("p"),eS=r("So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),ng=n("code"),tS=r("cuda:0"),oS=r(" and "),sg=n("code"),rS=r("cuda:1"),aS=r(" correspondingly."),wy=i(),Fd=n("p"),nS=r("You can even change their order:"),Ty=i(),f(vl.$$.fragment),Ey=i(),Gt=n("p"),sS=r("Here your physical GPUs 0 and 2 are mapped to "),lg=n("code"),lS=r("cuda:1"),iS=r(" and "),ig=n("code"),dS=r("cuda:0"),cS=r(" correspondingly."),Ay=i(),Zt=n("p"),pS=r("The above examples were all for "),dg=n("code"),mS=r("DistributedDataParallel"),hS=r(" use pattern, but the same method works for "),yl=n("a"),cg=n("code"),uS=r("DataParallel"),fS=r(" as well:"),$y=i(),f(wl.$$.fragment),ky=i(),Nd=n("p"),gS=r("To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),xy=i(),f(Tl.$$.fragment),My=i(),zd=n("p"),_S=r("As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),Iy=i(),f(El.$$.fragment),Sy=i(),Wd=n("p"),bS=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."),qy=i(),Od=n("p"),pg=n("strong"),mg=n("code"),vS=r("CUDA_DEVICE_ORDER"),Uy=i(),_a=n("p"),yS=r("There is an additional environment variable "),hg=n("code"),wS=r("CUDA_DEVICE_ORDER"),TS=r(" that controls how the physical devices are ordered. The two choices are:"),Dy=i(),Rd=n("ol"),Al=n("li"),ES=r("ordered by PCIe bus IDs (matches "),ug=n("code"),AS=r("nvidia-smi"),$S=r("\u2019s order) - this is the default."),jy=i(),f($l.$$.fragment),Py=i(),kl=n("ol"),fg=n("li"),kS=r("ordered by GPU compute capabilities"),Jy=i(),f(xl.$$.fragment),Cy=i(),Vt=n("p"),xS=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 "),gg=n("code"),MS=r("CUDA_DEVICE_ORDER=FASTEST_FIRST"),IS=r(" will always put the newer faster card first. It\u2019ll be somewhat confusing though since "),_g=n("code"),SS=r("nvidia-smi"),qS=r(" will still report them in the PCIe order."),Fy=i(),Ld=n("p"),US=r("The other solution to swapping the order is to use:"),Ny=i(),f(Ml.$$.fragment),zy=i(),Bd=n("p"),DS=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."),Wy=i(),ba=n("p"),jS=r("Also if you do set this environment variable it\u2019s the best to set it in your "),bg=n("code"),PS=r("~/.bashrc"),JS=r(" file or some other startup config file and forget about it."),Oy=i(),Zo=n("h2"),va=n("a"),vg=n("span"),f(Il.$$.fragment),CS=i(),yg=n("span"),FS=r("Trainer Integrations"),Ry=i(),ya=n("p"),NS=r("The "),Gd=n("a"),zS=r("Trainer"),WS=r(` has been extended to support libraries that may dramatically improve your training
time and fit much bigger models.`),Ly=i(),Ze=n("p"),OS=r("Currently it supports third party solutions, "),Sl=n("a"),RS=r("DeepSpeed"),LS=r(" and "),ql=n("a"),BS=r("PyTorch FSDP"),GS=r(", which implement parts of the paper "),Ul=n("a"),ZS=r(`ZeRO: Memory Optimizations
Toward Training Trillion Parameter Models, by Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, Yuxiong He`),VS=r("."),By=i(),wa=n("p"),XS=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 "),Zd=n("a"),YS=r("PyTorch FSDP integration"),HS=r(")"),Gy=i(),Vd=n("a"),Zy=i(),Vo=n("h3"),Ta=n("a"),wg=n("span"),f(Dl.$$.fragment),QS=i(),Tg=n("span"),KS=r("CUDA Extension Installation Notes"),Vy=i(),Xd=n("p"),eq=r("As of this writing, Deepspeed require compilation of CUDA C++ code, before it can be used."),Xy=i(),Ea=n("p"),tq=r("While all installation issues should be dealt with through the corresponding GitHub Issues of "),jl=n("a"),oq=r("Deepspeed"),rq=r(`, there are a few common issues that one may encounter while building
any PyTorch extension that needs to build CUDA extensions.`),Yy=i(),Yd=n("p"),aq=r("Therefore, if you encounter a CUDA-related build issue while doing the following:"),Hy=i(),f(Pl.$$.fragment),Qy=i(),Hd=n("p"),nq=r("please, read the following notes first."),Ky=i(),Xt=n("p"),sq=r("In these notes we give examples for what to do when "),Eg=n("code"),lq=r("pytorch"),iq=r(" has been built with CUDA "),Ag=n("code"),dq=r("10.2"),cq=r(`. If your situation is
different remember to adjust the version number to the one you are after.`),e1=i(),Xo=n("h4"),Aa=n("a"),$g=n("span"),f(Jl.$$.fragment),pq=i(),kg=n("span"),mq=r("Possible problem #1"),t1=i(),Qd=n("p"),hq=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.`),o1=i(),Ve=n("p"),uq=r("For example, if you installed "),xg=n("code"),fq=r("pytorch"),gq=r(" with "),Mg=n("code"),_q=r("cudatoolkit==10.2"),bq=r(` in the Python environment, you also need to have
CUDA `),Ig=n("code"),vq=r("10.2"),yq=r(" installed system-wide."),r1=i(),Yt=n("p"),wq=r("The exact location may vary from system to system, but "),Sg=n("code"),Tq=r("/usr/local/cuda-10.2"),Eq=r(` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),qg=n("code"),Aq=r("PATH"),$q=r(` environment variable, one can find the
installation location by doing:`),a1=i(),f(Cl.$$.fragment),n1=i(),$a=n("p"),kq=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: `),Fl=n("a"),xq=r("ubuntu cuda 10.2 install"),Mq=r("."),s1=i(),Yo=n("h4"),ka=n("a"),Ug=n("span"),f(Nl.$$.fragment),Iq=i(),Dg=n("span"),Sq=r("Possible problem #2"),l1=i(),Kd=n("p"),qq=r(`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),i1=i(),f(zl.$$.fragment),d1=i(),Ht=n("p"),Uq=r("Now, in this situation you need to make sure that your "),jg=n("code"),Dq=r("PATH"),jq=r(" and "),Pg=n("code"),Pq=r("LD_LIBRARY_PATH"),Jq=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.`),c1=i(),ec=n("p"),Cq=r("First, you may look at their contents:"),p1=i(),f(Wl.$$.fragment),m1=i(),tc=n("p"),Fq=r("so you get an idea of what is inside."),h1=i(),xa=n("p"),Nq=r("It\u2019s possible that "),Jg=n("code"),zq=r("LD_LIBRARY_PATH"),Wq=r(" is empty."),u1=i(),ct=n("p"),Cg=n("code"),Oq=r("PATH"),Rq=r(" lists the locations of where executables can be found and "),Fg=n("code"),Lq=r("LD_LIBRARY_PATH"),Bq=r(` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),Ng=n("code"),Gq=r(":"),Zq=r(` is used to separate multiple
entries.`),f1=i(),oc=n("p"),Vq=r(`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),g1=i(),f(Ol.$$.fragment),_1=i(),rc=n("p"),Xq=r("Note that we aren\u2019t overwriting the existing values, but prepending instead."),b1=i(),Xe=n("p"),Yq=r(`Of course, adjust the version number, the full path if need be. Check that the directories you assign actually do
exist. `),zg=n("code"),Hq=r("lib64"),Qq=r(" sub-directory is where the various CUDA "),Wg=n("code"),Kq=r(".so"),eU=r(" objects, like "),Og=n("code"),tU=r("libcudart.so"),oU=r(` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),v1=i(),Ho=n("h4"),Ma=n("a"),Rg=n("span"),f(Rl.$$.fragment),rU=i(),Lg=n("span"),aU=r("Possible problem #3"),y1=i(),Qt=n("p"),nU=r("Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),Bg=n("code"),sU=r("gcc-9"),lU=r(` but it wants
`),Gg=n("code"),iU=r("gcc-7"),dU=r("."),w1=i(),ac=n("p"),cU=r("There are various ways to go about it."),T1=i(),nc=n("p"),pU=r("If you can install the latest CUDA toolkit it typically should support the newer compiler."),E1=i(),Ia=n("p"),mU=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 `),Zg=n("code"),hU=r("gcc-7"),uU=r(` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),A1=i(),f(Ll.$$.fragment),$1=i(),te=n("p"),fU=r("Here, we are making a symlink to "),Vg=n("code"),gU=r("gcc-7"),_U=r(" from "),Xg=n("code"),bU=r("/usr/local/cuda-10.2/bin/gcc"),vU=r(` and since
`),Yg=n("code"),yU=r("/usr/local/cuda-10.2/bin/"),wU=r(" should be in the "),Hg=n("code"),TU=r("PATH"),EU=r(` environment variable (see the previous problem\u2019s solution), it
should find `),Qg=n("code"),AU=r("gcc-7"),$U=r(" (and "),Kg=n("code"),kU=r("g++7"),xU=r(") and then the build will succeed."),k1=i(),sc=n("p"),MU=r("As always make sure to edit the paths in the example to match your situation."),x1=i(),Qo=n("h3"),Sa=n("a"),e_=n("span"),f(Bl.$$.fragment),IU=i(),t_=n("span"),SU=r("PyTorch Fully Sharded Data parallel"),M1=i(),qa=n("p"),qU=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 `),Gl=n("a"),UU=r("Fully Sharded Data Parallel blog"),DU=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.`),I1=i(),Zl=n("p"),o_=n("strong"),jU=r("Required PyTorch version for FSDP support"),PU=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.`),S1=i(),Vl=n("p"),r_=n("strong"),JU=r("Usage"),CU=r(":"),q1=i(),me=n("ul"),a_=n("li"),Xl=n("p"),FU=r(`Make sure you have added the distributed launcher
`),n_=n("code"),NU=r("-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),zU=r(" if you haven\u2019t been using it already."),WU=i(),Yl=n("li"),lc=n("p"),s_=n("strong"),OU=r("Sharding Strategy"),RU=r(":"),LU=i(),Ko=n("ul"),Hl=n("li"),BU=r(`FULL_SHARD : Shards optimizer states + gradients + model parameters across data parallel workers/GPUs.
For this, add `),l_=n("code"),GU=r("--fsdp full_shard"),ZU=r(" to the command line arguments."),VU=i(),Ql=n("li"),XU=r(`SHARD_GRAD_OP : Shards optimizer states + gradients across data parallel workers/GPUs.
For this, add `),i_=n("code"),YU=r("--fsdp shard_grad_op"),HU=r(" to the command line arguments."),QU=i(),Kl=n("li"),KU=r("NO_SHARD : No sharding. For this, add "),d_=n("code"),eD=r("--fsdp no_shard"),tD=r(" to the command line arguments."),oD=i(),c_=n("li"),er=n("p"),rD=r(`To offload the parameters and gradients to the CPU,
add `),p_=n("code"),aD=r('--fsdp "full_shard offload"'),nD=r(" or "),m_=n("code"),sD=r('--fsdp "shard_grad_op offload"'),lD=r(" to the command line arguments."),iD=i(),h_=n("li"),pt=n("p"),dD=r("To automatically recursively wrap layers with FSDP using "),u_=n("code"),cD=r("default_auto_wrap_policy"),pD=r(`,
add `),f_=n("code"),mD=r('--fsdp "full_shard auto_wrap"'),hD=r(" or "),g_=n("code"),uD=r('--fsdp "shard_grad_op auto_wrap"'),fD=r(" to the command line arguments."),gD=i(),__=n("li"),tr=n("p"),_D=r(`To enable both CPU offloading and auto wrapping,
add `),b_=n("code"),bD=r('--fsdp "full_shard offload auto_wrap"'),vD=r(" or "),v_=n("code"),yD=r('--fsdp "shard_grad_op offload auto_wrap"'),wD=r(" to the command line arguments."),TD=i(),ei=n("li"),mt=n("p"),ED=r("Remaining FSDP config is passed via "),y_=n("code"),AD=r("--fsdp_config <path_to_fsdp_config.json>"),$D=r(`. It is either a location of
FSDP json config file (e.g., `),w_=n("code"),kD=r("fsdp_config.json"),xD=r(") or an already loaded json file as "),T_=n("code"),MD=r("dict"),ID=r("."),SD=i(),ht=n("ul"),ic=n("li"),qD=r("If auto wrapping is enabled, you can either use transformer based auto wrap policy or size based auto wrap policy."),ti=n("ul"),Se=n("li"),UD=r("For transformer based auto wrap policy, please specify "),E_=n("code"),DD=r("fsdp_transformer_layer_cls_to_wrap"),jD=r(` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),A_=n("code"),PD=r("BertLayer"),JD=r(", "),$_=n("code"),CD=r("GPTJBlock"),FD=r(", "),k_=n("code"),ND=r("T5Block"),zD=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.`),WD=i(),oi=n("li"),OD=r("For size based auto wrap policy, please add "),x_=n("code"),RD=r("fsdp_min_num_params"),LD=r(` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),BD=i(),ut=n("li"),M_=n("code"),GD=r("fsdp_backward_prefetch"),ZD=r(` can be specified in the config file. It controls when to prefetch next set of parameters.
`),I_=n("code"),VD=r("backward_pre"),XD=r(" and "),S_=n("code"),YD=r("backward_pos"),HD=r(` are available options.
For more information refer `),q_=n("code"),QD=r("torch.distributed.fsdp.fully_sharded_data_parallel.BackwardPrefetch"),KD=i(),Ua=n("li"),U_=n("code"),ej=r("fsdp_forward_prefetch"),tj=r(` can be specified in the config file. It controls when to prefetch next set of parameters.
If `),D_=n("code"),oj=r('"True"'),rj=r(", FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass."),aj=i(),Da=n("li"),j_=n("code"),nj=r("limit_all_gathers"),sj=r(` can be specified in the config file.
If `),P_=n("code"),lj=r('"True"'),ij=r(", FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers."),U1=i(),dc=n("p"),J_=n("strong"),dj=r("Few caveats to be aware of"),D1=i(),cc=n("ul"),Ye=n("li"),cj=r("it is incompatible with "),C_=n("code"),pj=r("generate"),mj=r(", thus is incompatible with "),F_=n("code"),hj=r("--predict_with_generate"),uj=r(`
in all seq2seq/clm scripts (translation/summarization/clm etc.).`),fj=n("br"),gj=r(`
Please refer issue `),ri=n("a"),_j=r("#21667"),j1=i(),or=n("h3"),ja=n("a"),N_=n("span"),f(ai.$$.fragment),bj=i(),z_=n("span"),vj=r("PyTorch/XLA Fully Sharded Data parallel"),P1=i(),Kt=n("p"),yj=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 `),ni=n("a"),wj=r("Scaling PyTorch models on Cloud TPUs with FSDP"),Tj=r(" and "),si=n("a"),Ej=r("PyTorch/XLA implementation of FSDP"),Aj=r(`
All you need to do is enable it through the config.`),J1=i(),li=n("p"),W_=n("strong"),$j=r("Required PyTorch/XLA version for FSDP support"),kj=r(": >=2.0"),C1=i(),ii=n("p"),O_=n("strong"),xj=r("Usage"),Mj=r(":"),F1=i(),eo=n("p"),Ij=r("Pass "),R_=n("code"),Sj=r('--fsdp "full shard"'),qj=r(" along with following changes to be made in "),L_=n("code"),Uj=r("--fsdp_config <path_to_fsdp_config.json>"),Dj=r(":"),N1=i(),He=n("ul"),Pa=n("li"),B_=n("code"),jj=r("xla"),Pj=r(" should be set to "),G_=n("code"),Jj=r("True"),Cj=r(" to enable PyTorch/XLA FSDP."),Fj=i(),Ja=n("li"),Z_=n("code"),Nj=r("xla_fsdp_settings"),zj=r(` The value is a dictionary which stores the XLA FSDP wrapping parameters.
For a complete list of options, please see `),di=n("a"),Wj=r("here"),Oj=r("."),Rj=i(),Qe=n("li"),V_=n("code"),Lj=r("xla_fsdp_grad_ckpt"),Bj=r(". When "),X_=n("code"),Gj=r("True"),Zj=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
`),Y_=n("code"),Vj=r("fsdp_min_num_params"),Xj=r(" or "),H_=n("code"),Yj=r("fsdp_transformer_layer_cls_to_wrap"),Hj=r("."),Qj=i(),pc=n("li"),Kj=r("You can either use transformer based auto wrap policy or size based auto wrap policy."),ci=n("ul"),qe=n("li"),eP=r("For transformer based auto wrap policy, please specify "),Q_=n("code"),tP=r("fsdp_transformer_layer_cls_to_wrap"),oP=r(` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),K_=n("code"),rP=r("BertLayer"),aP=r(", "),eb=n("code"),nP=r("GPTJBlock"),sP=r(", "),tb=n("code"),lP=r("T5Block"),iP=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.`),dP=i(),pi=n("li"),cP=r("For size based auto wrap policy, please add "),ob=n("code"),pP=r("fsdp_min_num_params"),mP=r(` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),z1=i(),rr=n("h3"),Ca=n("a"),rb=n("span"),f(mi.$$.fragment),hP=i(),ab=n("span"),uP=r("Using Trainer for accelerated PyTorch Training on Mac"),W1=i(),Ke=n("p"),fP=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 `),nb=n("code"),gP=r('"mps"'),_P=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 `),hi=n("a"),bP=r("Introducing Accelerated PyTorch Training on Mac"),vP=r(`
and `),ui=n("a"),yP=r("MPS BACKEND"),wP=r("."),O1=i(),f(Fa.$$.fragment),R1=i(),mc=n("p"),sb=n("strong"),TP=r("Benefits of Training and Inference using Apple Silicon Chips"),L1=i(),to=n("ol"),lb=n("li"),EP=r("Enables users to train larger networks or batch sizes locally"),AP=i(),ib=n("li"),$P=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.`),kP=i(),db=n("li"),xP=r("Reduces costs associated with cloud-based development or the need for additional local GPUs."),B1=i(),ar=n("p"),cb=n("strong"),MP=r("Pre-requisites"),IP=r(`: To install torch with mps support,
please follow this nice medium article `),fi=n("a"),SP=r("GPU-Acceleration Comes to PyTorch on M1 Macs"),qP=r("."),G1=i(),ft=n("p"),pb=n("strong"),UP=r("Usage"),DP=r(`:
`),mb=n("code"),jP=r("mps"),PP=r(" device will be used by default if available similar to the way "),hb=n("code"),JP=r("cuda"),CP=r(` device is used.
Therefore, no action from user is required.
For example, you can run the official Glue text classififcation task (from the root folder) using Apple Silicon GPU with below command:`),Z1=i(),f(gi.$$.fragment),V1=i(),hc=n("p"),ub=n("strong"),FP=r("A few caveats to be aware of"),X1=i(),Na=n("ol"),_i=n("li"),NP=r(`Some PyTorch operations have not been implemented in mps and will throw an error.
One way to get around that is to set the environment variable `),fb=n("code"),zP=r("PYTORCH_ENABLE_MPS_FALLBACK=1"),WP=r(`,
which will fallback to CPU for these operations. It still throws a UserWarning however.`),OP=i(),Ue=n("li"),RP=r("Distributed setups "),gb=n("code"),LP=r("gloo"),BP=r(" and "),_b=n("code"),GP=r("nccl"),ZP=r(" are not working with "),bb=n("code"),VP=r("mps"),XP=r(` device.
This means that currently only single GPU of `),vb=n("code"),YP=r("mps"),HP=r(" device type can be used."),Y1=i(),oo=n("p"),QP=r("Finally, please, remember that, \u{1F917} "),yb=n("code"),KP=r("Trainer"),e6=r(` only integrates MPS backend, therefore if you
have any problems or questions with regards to MPS backend usage, please,
file an issue with `),bi=n("a"),t6=r("PyTorch GitHub"),o6=r("."),H1=i(),nr=n("h2"),za=n("a"),wb=n("span"),f(vi.$$.fragment),r6=i(),Tb=n("span"),a6=r("Using Accelerate Launcher with Trainer"),Q1=i(),uc=n("p"),n6=r("Accelerate now powers Trainer. In terms of what users should expect:"),K1=i(),Wa=n("ul"),Eb=n("li"),s6=r("They can keep using the Trainer ingterations such as FSDP, DeepSpeed vis trainer arguments without any changes on their part."),l6=i(),Ab=n("li"),i6=r("They can now use Accelerate Launcher with Trainer (recommended)."),ew=i(),fc=n("p"),d6=r("Steps to use Accelerate Launcher with Trainer:"),tw=i(),ro=n("ol"),$b=n("li"),ao=n("p"),c6=r("Make sure \u{1F917} Accelerate is installed, you can\u2019t use the "),kb=n("code"),p6=r("Trainer"),m6=r(" without it anyway. If not "),xb=n("code"),h6=r("pip install accelerate"),u6=r(". You may also need to update your version of Accelerate: "),Mb=n("code"),f6=r("pip install accelerate --upgrade"),g6=i(),K=n("li"),yi=n("p"),_6=r("Run "),Ib=n("code"),b6=r("accelerate config"),v6=r(` and fill the questionnaire. Below are example accelerate configs:
a. DDP Multi-node Multi-GPU config:`),y6=i(),f(wi.$$.fragment),w6=i(),Sb=n("p"),T6=r("b. FSDP config:"),E6=i(),f(Ti.$$.fragment),A6=i(),qb=n("p"),$6=r("c. DeepSpeed config pointing to a file:"),k6=i(),f(Ei.$$.fragment),x6=i(),Ub=n("p"),M6=r("d. DeepSpeed config using accelerate plugin:"),I6=i(),f(Ai.$$.fragment),S6=i(),Db=n("li"),sr=n("p"),q6=r(`Run the Trainer script with args other than the ones handled above by accelerate config or launcher args.
Below is an example to run `),jb=n("code"),U6=r("run_glue.py"),D6=r(" using "),Pb=n("code"),j6=r("accelerate launcher"),P6=r(" with FSDP config from above."),ow=i(),f($i.$$.fragment),rw=i(),ki=n("ol"),xi=n("li"),J6=r("You can also directly use the cmd args for "),Jb=n("code"),C6=r("accelerate launch"),F6=r(". Above example would map to:"),aw=i(),f(Mi.$$.fragment),nw=i(),Oa=n("p"),N6=r("For more information, please refer the \u{1F917} Accelerate CLI guide: "),Ii=n("a"),z6=r("Launching your \u{1F917} Accelerate scripts"),W6=r("."),sw=i(),gc=n("p"),O6=r("Sections that were moved:"),lw=i(),M=n("p"),R6=r("[ "),_c=n("a"),L6=r("DeepSpeed"),Cb=n("a"),B6=r(`
| `),bc=n("a"),G6=r("Installation"),Fb=n("a"),Z6=r(`
| `),vc=n("a"),V6=r("Deployment with multiple GPUs"),Nb=n("a"),X6=r(`
| `),yc=n("a"),Y6=r("Deployment with one GPU"),zb=n("a"),H6=r(`
| `),wc=n("a"),Q6=r("Deployment in Notebooks"),Wb=n("a"),K6=r(`
| `),Tc=n("a"),eJ=r("Configuration"),Ob=n("a"),tJ=r(`
| `),Ec=n("a"),oJ=r("Passing Configuration"),Rb=n("a"),rJ=r(`
| `),Ac=n("a"),aJ=r("Shared Configuration"),Lb=n("a"),nJ=r(`
| `),$c=n("a"),sJ=r("ZeRO"),Bb=n("a"),lJ=r(`
| `),kc=n("a"),iJ=r("ZeRO-2 Config"),Gb=n("a"),dJ=r(`
| `),xc=n("a"),cJ=r("ZeRO-3 Config"),Zb=n("a"),pJ=r(`
| `),Mc=n("a"),mJ=r("NVMe Support"),Vb=n("a"),hJ=r(`
| `),Ic=n("a"),uJ=r("ZeRO-2 vs ZeRO-3 Performance"),Xb=n("a"),fJ=r(`
| `),Sc=n("a"),gJ=r("ZeRO-2 Example"),Yb=n("a"),_J=r(`
| `),qc=n("a"),bJ=r("ZeRO-3 Example"),Hb=n("a"),vJ=r(`
| `),Uc=n("a"),yJ=r("Optimizer"),Qb=n("a"),wJ=r(`
| `),Dc=n("a"),TJ=r("Scheduler"),Kb=n("a"),EJ=r(`
| `),jc=n("a"),AJ=r("fp32 Precision"),ev=n("a"),$J=r(`
| `),Pc=n("a"),kJ=r("Automatic Mixed Precision"),tv=n("a"),xJ=r(`
| `),Jc=n("a"),MJ=r("Batch Size"),ov=n("a"),IJ=r(`
| `),Cc=n("a"),SJ=r("Gradient Accumulation"),rv=n("a"),qJ=r(`
| `),Fc=n("a"),UJ=r("Gradient Clipping"),av=n("a"),DJ=r(`
| `),Nc=n("a"),jJ=r("Getting The Model Weights Out"),nv=n("a"),PJ=r(`
]`),this.h()},l(t){const c=pL('[data-svelte="svelte-1phssyn"]',document.head);u=s(c,"META",{name:!0,content:!0}),c.forEach(o),k=d(t),T=s(t,"H1",{class:!0});var Si=l(T);w=s(Si,"A",{id:!0,class:!0,href:!0});var sv=l(w);$=s(sv,"SPAN",{});var lv=l($);g(h.$$.fragment,lv),lv.forEach(o),sv.forEach(o),E=d(Si),C=s(Si,"SPAN",{});var iv=l(C);z=a(iv,"Trainer"),iv.forEach(o),Si.forEach(o),j=d(t),R=s(t,"P",{});var lr=l(R);G=a(lr,"The "),ee=s(lr,"A",{href:!0});var dv=l(ee);Q=a(dv,"Trainer"),dv.forEach(o),Y=a(lr," class provides an API for feature-complete training in PyTorch for most standard use cases. It\u2019s used in most of the "),X=s(lr,"A",{href:!0,rel:!0});var cv=l(X);ue=a(cv,"example scripts"),cv.forEach(o),H=a(lr,"."),lr.forEach(o),L=d(t),W=s(t,"P",{});var ir=l(W);ne=a(ir,"Before instantiating your "),F=s(ir,"A",{href:!0});var pv=l(F);we=a(pv,"Trainer"),pv.forEach(o),Te=a(ir,", create a "),se=s(ir,"A",{href:!0});var mv=l(se);gt=a(mv,"TrainingArguments"),mv.forEach(o),_t=a(ir," to access all the points of customization during training."),ir.forEach(o),ge=d(t),je=s(t,"P",{});var qi=l(je);fn=a(qi,"The API supports distributed training on multiple GPUs/TPUs, mixed precision through "),Ee=s(qi,"A",{href:!0,rel:!0});var hv=l(Ee);gn=a(hv,"NVIDIA Apex"),hv.forEach(o),_n=a(qi," and Native AMP for PyTorch."),qi.forEach(o),le=d(t),re=s(t,"P",{});var Ui=l(re);Fi=a(Ui,"The "),Ae=s(Ui,"A",{href:!0});var uv=l(Ae);hr=a(uv,"Trainer"),uv.forEach(o),Ni=a(Ui," contains the basic training loop which supports the above features. To inject custom behavior you can subclass them and override the following methods:"),Ui.forEach(o),bo=d(t),O=s(t,"UL",{});var B=l(O);ae=s(B,"LI",{});var zc=l(ae);ur=s(zc,"STRONG",{});var fv=l(ur);zi=a(fv,"get_train_dataloader"),fv.forEach(o),Wi=a(zc," \u2014 Creates the training DataLoader."),zc.forEach(o),Oi=d(B),Ri=s(B,"LI",{});var Wc=l(Ri);Hp=s(Wc,"STRONG",{});var n8=l(Hp);o0=a(n8,"get_eval_dataloader"),n8.forEach(o),r0=a(Wc," \u2014 Creates the evaluation DataLoader."),Wc.forEach(o),a0=d(B),Li=s(B,"LI",{});var JJ=l(Li);Qp=s(JJ,"STRONG",{});var s8=l(Qp);n0=a(s8,"get_test_dataloader"),s8.forEach(o),s0=a(JJ," \u2014 Creates the test DataLoader."),JJ.forEach(o),l0=d(B),Bi=s(B,"LI",{});var CJ=l(Bi);Kp=s(CJ,"STRONG",{});var l8=l(Kp);i0=a(l8,"log"),l8.forEach(o),d0=a(CJ," \u2014 Logs information on the various objects watching training."),CJ.forEach(o),c0=d(B),bt=s(B,"LI",{});var Di=l(bt);em=s(Di,"STRONG",{});var i8=l(em);p0=a(i8,"create_optimizer_and_scheduler"),i8.forEach(o),m0=a(Di,` \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 `),tm=s(Di,"CODE",{});var d8=l(tm);h0=a(d8,"create_optimizer"),d8.forEach(o),u0=a(Di," and "),om=s(Di,"CODE",{});var c8=l(om);f0=a(c8,"create_scheduler"),c8.forEach(o),g0=a(Di,` methods
separately.`),Di.forEach(o),_0=d(B),Gi=s(B,"LI",{});var FJ=l(Gi);rm=s(FJ,"STRONG",{});var p8=l(rm);b0=a(p8,"create_optimizer"),p8.forEach(o),v0=a(FJ," \u2014 Sets up the optimizer if it wasn\u2019t passed at init."),FJ.forEach(o),y0=d(B),Zi=s(B,"LI",{});var NJ=l(Zi);am=s(NJ,"STRONG",{});var m8=l(am);w0=a(m8,"create_scheduler"),m8.forEach(o),T0=a(NJ," \u2014 Sets up the learning rate scheduler if it wasn\u2019t passed at init."),NJ.forEach(o),E0=d(B),Vi=s(B,"LI",{});var zJ=l(Vi);nm=s(zJ,"STRONG",{});var h8=l(nm);A0=a(h8,"compute_loss"),h8.forEach(o),$0=a(zJ," - Computes the loss on a batch of training inputs."),zJ.forEach(o),k0=d(B),Xi=s(B,"LI",{});var WJ=l(Xi);sm=s(WJ,"STRONG",{});var u8=l(sm);x0=a(u8,"training_step"),u8.forEach(o),M0=a(WJ," \u2014 Performs a training step."),WJ.forEach(o),I0=d(B),Yi=s(B,"LI",{});var OJ=l(Yi);lm=s(OJ,"STRONG",{});var f8=l(lm);S0=a(f8,"prediction_step"),f8.forEach(o),q0=a(OJ," \u2014 Performs an evaluation/test step."),OJ.forEach(o),U0=d(B),Hi=s(B,"LI",{});var RJ=l(Hi);im=s(RJ,"STRONG",{});var g8=l(im);D0=a(g8,"evaluate"),g8.forEach(o),j0=a(RJ," \u2014 Runs an evaluation loop and returns metrics."),RJ.forEach(o),P0=d(B),Qi=s(B,"LI",{});var LJ=l(Qi);dm=s(LJ,"STRONG",{});var _8=l(dm);J0=a(_8,"predict"),_8.forEach(o),C0=a(LJ," \u2014 Returns predictions (with metrics if labels are available) on a test set."),LJ.forEach(o),B.forEach(o),Ev=d(t),g(fr.$$.fragment,t),Av=d(t),gr=s(t,"P",{});var dw=l(gr);F0=a(dw,"Here is an example of how to customize "),Ki=s(dw,"A",{href:!0});var b8=l(Ki);N0=a(b8,"Trainer"),b8.forEach(o),z0=a(dw," to use a weighted loss (useful when you have an unbalanced training set):"),dw.forEach(o),$v=d(t),g(bn.$$.fragment,t),kv=d(t),vt=s(t,"P",{});var Oc=l(vt);W0=a(Oc,"Another way to customize the training loop behavior for the PyTorch "),ed=s(Oc,"A",{href:!0});var v8=l(ed);O0=a(v8,"Trainer"),v8.forEach(o),R0=a(Oc," is to use "),td=s(Oc,"A",{href:!0});var y8=l(td);L0=a(y8,"callbacks"),y8.forEach(o),B0=a(Oc," that can inspect the training loop state (for progress reporting, logging on TensorBoard or other ML platforms\u2026) and take decisions (like early stopping)."),Oc.forEach(o),xv=d(t),vo=s(t,"H2",{class:!0});var cw=l(vo);_r=s(cw,"A",{id:!0,class:!0,href:!0});var w8=l(_r);cm=s(w8,"SPAN",{});var T8=l(cm);g(vn.$$.fragment,T8),T8.forEach(o),w8.forEach(o),G0=d(cw),pm=s(cw,"SPAN",{});var E8=l(pm);Z0=a(E8,"Trainer"),E8.forEach(o),cw.forEach(o),Mv=d(t),A=s(t,"DIV",{class:!0});var x=l(A);g(yn.$$.fragment,x),V0=d(x),mm=s(x,"P",{});var A8=l(mm);X0=a(A8,"Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for \u{1F917} Transformers."),A8.forEach(o),Y0=d(x),hm=s(x,"P",{});var $8=l(hm);H0=a($8,"Important attributes:"),$8.forEach(o),Q0=d(x),$e=s(x,"UL",{});var no=l($e);br=s(no,"LI",{});var gv=l(br);um=s(gv,"STRONG",{});var k8=l(um);K0=a(k8,"model"),k8.forEach(o),e2=a(gv," \u2014 Always points to the core model. If using a transformers model, it will be a "),od=s(gv,"A",{href:!0});var x8=l(od);t2=a(x8,"PreTrainedModel"),x8.forEach(o),o2=a(gv,`
subclass.`),gv.forEach(o),r2=d(no),ie=s(no,"LI",{});var De=l(ie);fm=s(De,"STRONG",{});var M8=l(fm);a2=a(M8,"model_wrapped"),M8.forEach(o),n2=a(De,` \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 `),gm=s(De,"CODE",{});var I8=l(gm);s2=a(I8,"DeepSpeed"),I8.forEach(o),l2=a(De,`,
the inner model is wrapped in `),_m=s(De,"CODE",{});var S8=l(_m);i2=a(S8,"DeepSpeed"),S8.forEach(o),d2=a(De," and then again in "),bm=s(De,"CODE",{});var q8=l(bm);c2=a(q8,"torch.nn.DistributedDataParallel"),q8.forEach(o),p2=a(De,`. If the inner
model hasn\u2019t been wrapped, then `),vm=s(De,"CODE",{});var U8=l(vm);m2=a(U8,"self.model_wrapped"),U8.forEach(o),h2=a(De," is the same as "),ym=s(De,"CODE",{});var D8=l(ym);u2=a(D8,"self.model"),D8.forEach(o),f2=a(De,"."),De.forEach(o),g2=d(no),rd=s(no,"LI",{});var BJ=l(rd);wm=s(BJ,"STRONG",{});var j8=l(wm);_2=a(j8,"is_model_parallel"),j8.forEach(o),b2=a(BJ,` \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).`),BJ.forEach(o),v2=d(no),Pe=s(no,"LI",{});var dr=l(Pe);Tm=s(dr,"STRONG",{});var P8=l(Tm);y2=a(P8,"place_model_on_device"),P8.forEach(o),w2=a(dr,` \u2014 Whether or not to automatically place the model on the device - it will be set
to `),Em=s(dr,"CODE",{});var J8=l(Em);T2=a(J8,"False"),J8.forEach(o),E2=a(dr,` if model parallel or deepspeed is used, or if the default
`),Am=s(dr,"CODE",{});var C8=l(Am);A2=a(C8,"TrainingArguments.place_model_on_device"),C8.forEach(o),$2=a(dr," is overridden to return "),$m=s(dr,"CODE",{});var F8=l($m);k2=a(F8,"False"),F8.forEach(o),x2=a(dr," ."),dr.forEach(o),M2=d(no),Je=s(no,"LI",{});var cr=l(Je);km=s(cr,"STRONG",{});var N8=l(km);I2=a(N8,"is_in_train"),N8.forEach(o),S2=a(cr," \u2014 Whether or not a model is currently running "),xm=s(cr,"CODE",{});var z8=l(xm);q2=a(z8,"train"),z8.forEach(o),U2=a(cr," (e.g. when "),Mm=s(cr,"CODE",{});var W8=l(Mm);D2=a(W8,"evaluate"),W8.forEach(o),j2=a(cr,` is called while
in `),Im=s(cr,"CODE",{});var O8=l(Im);P2=a(O8,"train"),O8.forEach(o),J2=a(cr,")"),cr.forEach(o),no.forEach(o),C2=d(x),vr=s(x,"DIV",{class:!0});var pw=l(vr);g(wn.$$.fragment,pw),F2=d(pw),Tn=s(pw,"P",{});var mw=l(Tn);N2=a(mw,"Add a callback to the current list of "),Sm=s(mw,"CODE",{});var R8=l(Sm);z2=a(R8,"~transformer.TrainerCallback"),R8.forEach(o),W2=a(mw,"."),mw.forEach(o),pw.forEach(o),O2=d(x),yr=s(x,"DIV",{class:!0});var hw=l(yr);g(En.$$.fragment,hw),R2=d(hw),An=s(hw,"P",{});var uw=l(An);L2=a(uw,"A helper wrapper that creates an appropriate context manager for "),qm=s(uw,"CODE",{});var L8=l(qm);B2=a(L8,"autocast"),L8.forEach(o),G2=a(uw,` while feeding it the desired
arguments, depending on the situation.`),uw.forEach(o),hw.forEach(o),Z2=d(x),yt=s(x,"DIV",{class:!0});var Rc=l(yt);g($n.$$.fragment,Rc),V2=d(Rc),Um=s(Rc,"P",{});var B8=l(Um);X2=a(B8,"How the loss is computed by Trainer. By default, all models return the loss in the first element."),B8.forEach(o),Y2=d(Rc),Dm=s(Rc,"P",{});var G8=l(Dm);H2=a(G8,"Subclass and override for custom behavior."),G8.forEach(o),Rc.forEach(o),Q2=d(x),wr=s(x,"DIV",{class:!0});var fw=l(wr);g(kn.$$.fragment,fw),K2=d(fw),jm=s(fw,"P",{});var Z8=l(jm);eE=a(Z8,"A helper wrapper to group together context managers."),Z8.forEach(o),fw.forEach(o),tE=d(x),Tr=s(x,"DIV",{class:!0});var gw=l(Tr);g(xn.$$.fragment,gw),oE=d(gw),Mn=s(gw,"P",{});var _w=l(Mn);rE=a(_w,"Creates a draft of a model card using the information available to the "),Pm=s(_w,"CODE",{});var V8=l(Pm);aE=a(V8,"Trainer"),V8.forEach(o),nE=a(_w,"."),_w.forEach(o),gw.forEach(o),sE=d(x),wt=s(x,"DIV",{class:!0});var Lc=l(wt);g(In.$$.fragment,Lc),lE=d(Lc),Jm=s(Lc,"P",{});var X8=l(Jm);iE=a(X8,"Setup the optimizer."),X8.forEach(o),dE=d(Lc),Sn=s(Lc,"P",{});var bw=l(Sn);cE=a(bw,`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 `),Cm=s(bw,"CODE",{});var Y8=l(Cm);pE=a(Y8,"optimizers"),Y8.forEach(o),mE=a(bw,", or subclass and override this method in a subclass."),bw.forEach(o),Lc.forEach(o),hE=d(x),Tt=s(x,"DIV",{class:!0});var Bc=l(Tt);g(qn.$$.fragment,Bc),uE=d(Bc),Fm=s(Bc,"P",{});var H8=l(Fm);fE=a(H8,"Setup the optimizer and the learning rate scheduler."),H8.forEach(o),gE=d(Bc),nt=s(Bc,"P",{});var Ra=l(nt);_E=a(Ra,`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 `),Nm=s(Ra,"CODE",{});var Q8=l(Nm);bE=a(Q8,"optimizers"),Q8.forEach(o),vE=a(Ra,", or subclass and override this method (or "),zm=s(Ra,"CODE",{});var K8=l(zm);yE=a(K8,"create_optimizer"),K8.forEach(o),wE=a(Ra,` and/or
`),Wm=s(Ra,"CODE",{});var eC=l(Wm);TE=a(eC,"create_scheduler"),eC.forEach(o),EE=a(Ra,") in a subclass."),Ra.forEach(o),Bc.forEach(o),AE=d(x),Er=s(x,"DIV",{class:!0});var vw=l(Er);g(Un.$$.fragment,vw),$E=d(vw),Om=s(vw,"P",{});var tC=l(Om);kE=a(tC,`Setup the scheduler. The optimizer of the trainer must have been set up either before this method is called or
passed as an argument.`),tC.forEach(o),vw.forEach(o),xE=d(x),Ce=s(x,"DIV",{class:!0});var La=l(Ce);g(Dn.$$.fragment,La),ME=d(La),Rm=s(La,"P",{});var oC=l(Rm);IE=a(oC,"Run evaluation and returns metrics."),oC.forEach(o),SE=d(La),jn=s(La,"P",{});var yw=l(jn);qE=a(yw,`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Lm=s(yw,"CODE",{});var rC=l(Lm);UE=a(rC,"compute_metrics"),rC.forEach(o),DE=a(yw," argument)."),yw.forEach(o),jE=d(La),Bm=s(La,"P",{});var aC=l(Bm);PE=a(aC,"You can also subclass and override this method to inject custom behavior."),aC.forEach(o),La.forEach(o),JE=d(x),Et=s(x,"DIV",{class:!0});var Gc=l(Et);g(Pn.$$.fragment,Gc),CE=d(Gc),yo=s(Gc,"P",{});var Zc=l(yo);FE=a(Zc,"Prediction/evaluation loop, shared by "),Gm=s(Zc,"CODE",{});var nC=l(Gm);NE=a(nC,"Trainer.evaluate()"),nC.forEach(o),zE=a(Zc," and "),Zm=s(Zc,"CODE",{});var sC=l(Zm);WE=a(sC,"Trainer.predict()"),sC.forEach(o),OE=a(Zc,"."),Zc.forEach(o),RE=d(Gc),Vm=s(Gc,"P",{});var lC=l(Vm);LE=a(lC,"Works both with or without labels."),lC.forEach(o),Gc.forEach(o),BE=d(x),Ar=s(x,"DIV",{class:!0});var ww=l(Ar);g(Jn.$$.fragment,ww),GE=d(ww),Cn=s(ww,"P",{});var Tw=l(Cn);ZE=a(Tw,"For models that inherit from "),ad=s(Tw,"A",{href:!0});var iC=l(ad);VE=a(iC,"PreTrainedModel"),iC.forEach(o),XE=a(Tw,`, 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.`),Tw.forEach(o),ww.forEach(o),YE=d(x),At=s(x,"DIV",{class:!0});var Vc=l(At);g(Fn.$$.fragment,Vc),HE=d(Vc),Nn=s(Vc,"P",{});var Ew=l(Nn);QE=a(Ew,"Returns the evaluation "),Xm=s(Ew,"CODE",{});var dC=l(Xm);KE=a(dC,"~torch.utils.data.DataLoader"),dC.forEach(o),e4=a(Ew,"."),Ew.forEach(o),t4=d(Vc),Ym=s(Vc,"P",{});var cC=l(Ym);o4=a(cC,"Subclass and override this method if you want to inject some custom behavior."),cC.forEach(o),Vc.forEach(o),r4=d(x),$r=s(x,"DIV",{class:!0});var Aw=l($r);g(zn.$$.fragment,Aw),a4=d(Aw),Hm=s(Aw,"P",{});var pC=l(Hm);n4=a(pC,"Returns the optimizer class and optimizer parameters based on the training arguments."),pC.forEach(o),Aw.forEach(o),s4=d(x),$t=s(x,"DIV",{class:!0});var Xc=l($t);g(Wn.$$.fragment,Xc),l4=d(Xc),On=s(Xc,"P",{});var $w=l(On);i4=a($w,"Returns the test "),Qm=s($w,"CODE",{});var mC=l(Qm);d4=a(mC,"~torch.utils.data.DataLoader"),mC.forEach(o),c4=a($w,"."),$w.forEach(o),p4=d(Xc),Km=s(Xc,"P",{});var hC=l(Km);m4=a(hC,"Subclass and override this method if you want to inject some custom behavior."),hC.forEach(o),Xc.forEach(o),h4=d(x),Fe=s(x,"DIV",{class:!0});var Ba=l(Fe);g(Rn.$$.fragment,Ba),u4=d(Ba),Ln=s(Ba,"P",{});var kw=l(Ln);f4=a(kw,"Returns the training "),eh=s(kw,"CODE",{});var uC=l(eh);g4=a(uC,"~torch.utils.data.DataLoader"),uC.forEach(o),_4=a(kw,"."),kw.forEach(o),b4=d(Ba),wo=s(Ba,"P",{});var Yc=l(wo);v4=a(Yc,"Will use no sampler if "),th=s(Yc,"CODE",{});var fC=l(th);y4=a(fC,"train_dataset"),fC.forEach(o),w4=a(Yc," does not implement "),oh=s(Yc,"CODE",{});var gC=l(oh);T4=a(gC,"__len__"),gC.forEach(o),E4=a(Yc,`, a random sampler (adapted to distributed
training if necessary) otherwise.`),Yc.forEach(o),A4=d(Ba),rh=s(Ba,"P",{});var _C=l(rh);$4=a(_C,"Subclass and override this method if you want to inject some custom behavior."),_C.forEach(o),Ba.forEach(o),k4=d(x),kt=s(x,"DIV",{class:!0});var Hc=l(kt);g(Bn.$$.fragment,Hc),x4=d(Hc),ke=s(Hc,"P",{});var so=l(ke);M4=a(so,"Launch an hyperparameter search using "),ah=s(so,"CODE",{});var bC=l(ah);I4=a(bC,"optuna"),bC.forEach(o),S4=a(so," or "),nh=s(so,"CODE",{});var vC=l(nh);q4=a(vC,"Ray Tune"),vC.forEach(o),U4=a(so," or "),sh=s(so,"CODE",{});var yC=l(sh);D4=a(yC,"SigOpt"),yC.forEach(o),j4=a(so,`. The optimized quantity is determined
by `),lh=s(so,"CODE",{});var wC=l(lh);P4=a(wC,"compute_objective"),wC.forEach(o),J4=a(so,`, which defaults to a function returning the evaluation loss when no metric is provided,
the sum of all metrics otherwise.`),so.forEach(o),C4=d(Hc),g(kr.$$.fragment,Hc),Hc.forEach(o),F4=d(x),xr=s(x,"DIV",{class:!0});var xw=l(xr);g(Gn.$$.fragment,xw),N4=d(xw),Zn=s(xw,"P",{});var Mw=l(Zn);z4=a(Mw,"Initializes a git repo in "),ih=s(Mw,"CODE",{});var TC=l(ih);W4=a(TC,"self.args.hub_model_id"),TC.forEach(o),O4=a(Mw,"."),Mw.forEach(o),xw.forEach(o),R4=d(x),Mr=s(x,"DIV",{class:!0});var Iw=l(Mr);g(Vn.$$.fragment,Iw),L4=d(Iw),dh=s(Iw,"P",{});var EC=l(dh);B4=a(EC,`Whether or not this process is the local (e.g., on one machine if training in a distributed fashion on several
machines) main process.`),EC.forEach(o),Iw.forEach(o),G4=d(x),Ir=s(x,"DIV",{class:!0});var Sw=l(Ir);g(Xn.$$.fragment,Sw),Z4=d(Sw),Yn=s(Sw,"P",{});var qw=l(Yn);V4=a(qw,`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 `),ch=s(qw,"CODE",{});var AC=l(ch);X4=a(AC,"True"),AC.forEach(o),Y4=a(qw," for one process)."),qw.forEach(o),Sw.forEach(o),H4=d(x),xt=s(x,"DIV",{class:!0});var Qc=l(xt);g(Hn.$$.fragment,Qc),Q4=d(Qc),Qn=s(Qc,"P",{});var Uw=l(Qn);K4=a(Uw,"Log "),ph=s(Uw,"CODE",{});var $C=l(ph);eA=a($C,"logs"),$C.forEach(o),tA=a(Uw," on the various objects watching training."),Uw.forEach(o),oA=d(Qc),mh=s(Qc,"P",{});var kC=l(mh);rA=a(kC,"Subclass and override this method to inject custom behavior."),kC.forEach(o),Qc.forEach(o),aA=d(x),P=s(x,"DIV",{class:!0});var N=l(P);g(Kn.$$.fragment,N),nA=d(N),hh=s(N,"P",{});var xC=l(hh);sA=a(xC,"Log metrics in a specially formatted way"),xC.forEach(o),lA=d(N),uh=s(N,"P",{});var MC=l(uh);iA=a(MC,"Under distributed environment this is done only for a process with rank 0."),MC.forEach(o),dA=d(N),fh=s(N,"P",{});var IC=l(fh);cA=a(IC,"Notes on memory reports:"),IC.forEach(o),pA=d(N),To=s(N,"P",{});var Kc=l(To);mA=a(Kc,"In order to get memory usage report you need to install "),gh=s(Kc,"CODE",{});var SC=l(gh);hA=a(SC,"psutil"),SC.forEach(o),uA=a(Kc,". You can do that with "),_h=s(Kc,"CODE",{});var qC=l(_h);fA=a(qC,"pip install psutil"),qC.forEach(o),gA=a(Kc,"."),Kc.forEach(o),_A=d(N),g(Sr.$$.fragment,N),bA=d(N),bh=s(N,"P",{});var UC=l(bh);vh=s(UC,"STRONG",{});var DC=l(vh);vA=a(DC,"Understanding the reports:"),DC.forEach(o),UC.forEach(o),yA=d(N),st=s(N,"UL",{});var Ga=l(st);xe=s(Ga,"LI",{});var lo=l(xe);wA=a(lo,"the first segment, e.g., "),yh=s(lo,"CODE",{});var jC=l(yh);TA=a(jC,"train__"),jC.forEach(o),EA=a(lo,", tells you which stage the metrics are for. Reports starting with "),wh=s(lo,"CODE",{});var PC=l(wh);AA=a(PC,"init_"),PC.forEach(o),$A=a(lo,`
will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the
`),Th=s(lo,"CODE",{});var JC=l(Th);kA=a(JC,"__init__"),JC.forEach(o),xA=a(lo," will be reported along with the "),Eh=s(lo,"CODE",{});var CC=l(Eh);MA=a(CC,"eval_"),CC.forEach(o),IA=a(lo," metrics."),lo.forEach(o),SA=d(Ga),Eo=s(Ga,"LI",{});var ep=l(Eo);qA=a(ep,"the third segment, is either "),Ah=s(ep,"CODE",{});var FC=l(Ah);UA=a(FC,"cpu"),FC.forEach(o),DA=a(ep," or "),$h=s(ep,"CODE",{});var NC=l($h);jA=a(NC,"gpu"),NC.forEach(o),PA=a(ep,`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),ep.forEach(o),JA=d(Ga),nd=s(Ga,"LI",{});var GJ=l(nd);kh=s(GJ,"CODE",{});var zC=l(kh);CA=a(zC,"*_alloc_delta"),zC.forEach(o),FA=a(GJ,` - 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.`),GJ.forEach(o),NA=d(Ga),Mt=s(Ga,"LI",{});var ji=l(Mt);xh=s(ji,"CODE",{});var WC=l(xh);zA=a(WC,"*_peaked_delta"),WC.forEach(o),WA=a(ji,` - 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 `),Mh=s(ji,"CODE",{});var OC=l(Mh);OA=a(OC,"alloc_delta"),OC.forEach(o),RA=a(ji,` +
`),Ih=s(ji,"CODE",{});var RC=l(Ih);LA=a(RC,"peaked_delta"),RC.forEach(o),BA=a(ji," and you know how much memory was needed to complete that stage."),ji.forEach(o),Ga.forEach(o),GA=d(N),Sh=s(N,"P",{});var LC=l(Sh);ZA=a(LC,`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.`),LC.forEach(o),VA=d(N),qh=s(N,"P",{});var BC=l(qh);XA=a(BC,`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.`),BC.forEach(o),YA=d(N),es=s(N,"P",{});var Dw=l(es);HA=a(Dw,`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 `),Uh=s(Dw,"CODE",{});var GC=l(Uh);QA=a(GC,"tracemalloc"),GC.forEach(o),KA=a(Dw,` 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.`),Dw.forEach(o),e3=d(N),lt=s(N,"P",{});var Za=l(lt);t3=a(Za,"The GPU allocated and peak memory reporting is done with "),Dh=s(Za,"CODE",{});var ZC=l(Dh);o3=a(ZC,"torch.cuda.memory_allocated()"),ZC.forEach(o),r3=a(Za,` and
`),jh=s(Za,"CODE",{});var VC=l(jh);a3=a(VC,"torch.cuda.max_memory_allocated()"),VC.forEach(o),n3=a(Za,`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),Ph=s(Za,"CODE",{});var XC=l(Ph);s3=a(XC,"torch.cuda"),XC.forEach(o),l3=a(Za,` 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.`),Za.forEach(o),i3=d(N),fe=s(N,"P",{});var et=l(fe);d3=a(et,"Note that this tracker doesn\u2019t account for memory allocations outside of "),sd=s(et,"A",{href:!0});var YC=l(sd);c3=a(YC,"Trainer"),YC.forEach(o),p3=a(et,"\u2019s "),Jh=s(et,"CODE",{});var HC=l(Jh);m3=a(HC,"__init__"),HC.forEach(o),h3=a(et,", "),Ch=s(et,"CODE",{});var QC=l(Ch);u3=a(QC,"train"),QC.forEach(o),f3=a(et,`,
`),Fh=s(et,"CODE",{});var KC=l(Fh);g3=a(KC,"evaluate"),KC.forEach(o),_3=a(et," and "),Nh=s(et,"CODE",{});var e7=l(Nh);b3=a(e7,"predict"),e7.forEach(o),v3=a(et," calls."),et.forEach(o),y3=d(N),Z=s(N,"P",{});var V=l(Z);w3=a(V,"Because "),zh=s(V,"CODE",{});var t7=l(zh);T3=a(t7,"evaluation"),t7.forEach(o),E3=a(V," calls may happen during "),Wh=s(V,"CODE",{});var o7=l(Wh);A3=a(o7,"train"),o7.forEach(o),$3=a(V,`, we can\u2019t handle nested invocations because
`),Oh=s(V,"CODE",{});var r7=l(Oh);k3=a(r7,"torch.cuda.max_memory_allocated"),r7.forEach(o),x3=a(V," is a single counter, so if it gets reset by a nested eval call, "),Rh=s(V,"CODE",{});var a7=l(Rh);M3=a(a7,"train"),a7.forEach(o),I3=a(V,`\u2019s tracker
will report incorrect info. If this `),ts=s(V,"A",{href:!0,rel:!0});var n7=l(ts);S3=a(n7,"pytorch issue"),n7.forEach(o),q3=a(V,` gets resolved
it will be possible to change this class to be re-entrant. Until then we will only track the outer level of
`),Lh=s(V,"CODE",{});var s7=l(Lh);U3=a(s7,"train"),s7.forEach(o),D3=a(V,", "),Bh=s(V,"CODE",{});var l7=l(Bh);j3=a(l7,"evaluate"),l7.forEach(o),P3=a(V," and "),Gh=s(V,"CODE",{});var i7=l(Gh);J3=a(i7,"predict"),i7.forEach(o),C3=a(V," methods. Which means that if "),Zh=s(V,"CODE",{});var d7=l(Zh);F3=a(d7,"eval"),d7.forEach(o),N3=a(V," is called during "),Vh=s(V,"CODE",{});var c7=l(Vh);z3=a(c7,"train"),c7.forEach(o),W3=a(V,`, it\u2019s the latter
that will account for its memory usage and that of the former.`),V.forEach(o),O3=d(N),Me=s(N,"P",{});var io=l(Me);R3=a(io,"This also means that if any other tool that is used along the "),ld=s(io,"A",{href:!0});var p7=l(ld);L3=a(p7,"Trainer"),p7.forEach(o),B3=a(io,` calls
`),Xh=s(io,"CODE",{});var m7=l(Xh);G3=a(m7,"torch.cuda.reset_peak_memory_stats"),m7.forEach(o),Z3=a(io,", the gpu peak memory stats could be invalid. And the "),id=s(io,"A",{href:!0});var h7=l(id);V3=a(h7,"Trainer"),h7.forEach(o),X3=a(io,` will disrupt
the normal behavior of any such tools that rely on calling `),Yh=s(io,"CODE",{});var u7=l(Yh);Y3=a(u7,"torch.cuda.reset_peak_memory_stats"),u7.forEach(o),H3=a(io," themselves."),io.forEach(o),Q3=d(N),Hh=s(N,"P",{});var f7=l(Hh);K3=a(f7,"For best performance you may want to consider turning the memory profiling off for production runs."),f7.forEach(o),N.forEach(o),e$=d(x),qr=s(x,"DIV",{class:!0});var jw=l(qr);g(os.$$.fragment,jw),t$=d(jw),Qh=s(jw,"P",{});var g7=l(Qh);o$=a(g7,"Reformat Trainer metrics values to a human-readable format"),g7.forEach(o),jw.forEach(o),r$=d(x),Ur=s(x,"DIV",{class:!0});var Pw=l(Ur);g(rs.$$.fragment,Pw),a$=d(Pw),as=s(Pw,"P",{});var Jw=l(as);n$=a(Jw,"Helper to get number of samples in a "),Kh=s(Jw,"CODE",{});var _7=l(Kh);s$=a(_7,"~torch.utils.data.DataLoader"),_7.forEach(o),l$=a(Jw,` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),Jw.forEach(o),Pw.forEach(o),i$=d(x),It=s(x,"DIV",{class:!0});var tp=l(It);g(ns.$$.fragment,tp),d$=d(tp),ss=s(tp,"P",{});var Cw=l(ss);c$=a(Cw,"Remove a callback from the current list of "),eu=s(Cw,"CODE",{});var b7=l(eu);p$=a(b7,"~transformer.TrainerCallback"),b7.forEach(o),m$=a(Cw," and returns it."),Cw.forEach(o),h$=d(tp),ls=s(tp,"P",{});var Fw=l(ls);u$=a(Fw,"If the callback is not found, returns "),tu=s(Fw,"CODE",{});var v7=l(tu);f$=a(v7,"None"),v7.forEach(o),g$=a(Fw," (and no error is raised)."),Fw.forEach(o),tp.forEach(o),_$=d(x),de=s(x,"DIV",{class:!0});var tt=l(de);g(is.$$.fragment,tt),b$=d(tt),ou=s(tt,"P",{});var y7=l(ou);v$=a(y7,"Run prediction and returns predictions and potential metrics."),y7.forEach(o),y$=d(tt),ds=s(tt,"P",{});var Nw=l(ds);w$=a(Nw,`Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method
will also return metrics, like in `),ru=s(Nw,"CODE",{});var w7=l(ru);T$=a(w7,"evaluate()"),w7.forEach(o),E$=a(Nw,"."),Nw.forEach(o),A$=d(tt),g(Dr.$$.fragment,tt),$$=d(tt),cs=s(tt,"P",{});var zw=l(cs);k$=a(zw,"Returns: "),au=s(zw,"EM",{});var T7=l(au);x$=a(T7,"NamedTuple"),T7.forEach(o),M$=a(zw," A namedtuple with the following keys:"),zw.forEach(o),I$=d(tt),Ao=s(tt,"UL",{});var op=l(Ao);$o=s(op,"LI",{});var rp=l($o);S$=a(rp,"predictions ("),nu=s(rp,"CODE",{});var E7=l(nu);q$=a(E7,"np.ndarray"),E7.forEach(o),U$=a(rp,"): The predictions on "),su=s(rp,"CODE",{});var A7=l(su);D$=a(A7,"test_dataset"),A7.forEach(o),j$=a(rp,"."),rp.forEach(o),P$=d(op),ko=s(op,"LI",{});var ap=l(ko);J$=a(ap,"label_ids ("),lu=s(ap,"CODE",{});var $7=l(lu);C$=a($7,"np.ndarray"),$7.forEach(o),F$=a(ap,", "),iu=s(ap,"EM",{});var k7=l(iu);N$=a(k7,"optional"),k7.forEach(o),z$=a(ap,"): The labels (if the dataset contained some)."),ap.forEach(o),W$=d(op),xo=s(op,"LI",{});var np=l(xo);O$=a(np,"metrics ("),du=s(np,"CODE",{});var x7=l(du);R$=a(x7,"Dict[str, float]"),x7.forEach(o),L$=a(np,", "),cu=s(np,"EM",{});var M7=l(cu);B$=a(M7,"optional"),M7.forEach(o),G$=a(np,`): The potential dictionary of metrics (if the dataset contained
labels).`),np.forEach(o),op.forEach(o),tt.forEach(o),Z$=d(x),St=s(x,"DIV",{class:!0});var sp=l(St);g(ps.$$.fragment,sp),V$=d(sp),Mo=s(sp,"P",{});var lp=l(Mo);X$=a(lp,"Prediction/evaluation loop, shared by "),pu=s(lp,"CODE",{});var I7=l(pu);Y$=a(I7,"Trainer.evaluate()"),I7.forEach(o),H$=a(lp," and "),mu=s(lp,"CODE",{});var S7=l(mu);Q$=a(S7,"Trainer.predict()"),S7.forEach(o),K$=a(lp,"."),lp.forEach(o),ek=d(sp),hu=s(sp,"P",{});var q7=l(hu);tk=a(q7,"Works both with or without labels."),q7.forEach(o),sp.forEach(o),ok=d(x),qt=s(x,"DIV",{class:!0});var ip=l(qt);g(ms.$$.fragment,ip),rk=d(ip),Io=s(ip,"P",{});var dp=l(Io);ak=a(dp,"Perform an evaluation step on "),uu=s(dp,"CODE",{});var U7=l(uu);nk=a(U7,"model"),U7.forEach(o),sk=a(dp," using "),fu=s(dp,"CODE",{});var D7=l(fu);lk=a(D7,"inputs"),D7.forEach(o),ik=a(dp,"."),dp.forEach(o),dk=d(ip),gu=s(ip,"P",{});var j7=l(gu);ck=a(j7,"Subclass and override to inject custom behavior."),j7.forEach(o),ip.forEach(o),pk=d(x),jr=s(x,"DIV",{class:!0});var Ww=l(jr);g(hs.$$.fragment,Ww),mk=d(Ww),it=s(Ww,"P",{});var Va=l(it);hk=a(Va,"Upload "),_u=s(Va,"EM",{});var P7=l(_u);uk=a(P7,"self.model"),P7.forEach(o),fk=a(Va," and "),bu=s(Va,"EM",{});var J7=l(bu);gk=a(J7,"self.tokenizer"),J7.forEach(o),_k=a(Va," to the \u{1F917} model hub on the repo "),vu=s(Va,"EM",{});var C7=l(vu);bk=a(C7,"self.args.hub_model_id"),C7.forEach(o),vk=a(Va,"."),Va.forEach(o),Ww.forEach(o),yk=d(x),Pr=s(x,"DIV",{class:!0});var Ow=l(Pr);g(us.$$.fragment,Ow),wk=d(Ow),fs=s(Ow,"P",{});var Rw=l(fs);Tk=a(Rw,"Remove a callback from the current list of "),yu=s(Rw,"CODE",{});var F7=l(yu);Ek=a(F7,"~transformer.TrainerCallback"),F7.forEach(o),Ak=a(Rw,"."),Rw.forEach(o),Ow.forEach(o),$k=d(x),Ne=s(x,"DIV",{class:!0});var Xa=l(Ne);g(gs.$$.fragment,Xa),kk=d(Xa),_s=s(Xa,"P",{});var Lw=l(_s);xk=a(Lw,"Save metrics into a json file for that split, e.g. "),wu=s(Lw,"CODE",{});var N7=l(wu);Mk=a(N7,"train_results.json"),N7.forEach(o),Ik=a(Lw,"."),Lw.forEach(o),Sk=d(Xa),Tu=s(Xa,"P",{});var z7=l(Tu);qk=a(z7,"Under distributed environment this is done only for a process with rank 0."),z7.forEach(o),Uk=d(Xa),bs=s(Xa,"P",{});var Bw=l(bs);Dk=a(Bw,"To understand the metrics please read the docstring of "),dd=s(Bw,"A",{href:!0});var W7=l(dd);jk=a(W7,"log_metrics()"),W7.forEach(o),Pk=a(Bw,`. The only difference is that raw
unformatted numbers are saved in the current method.`),Bw.forEach(o),Xa.forEach(o),Jk=d(x),Ut=s(x,"DIV",{class:!0});var cp=l(Ut);g(vs.$$.fragment,cp),Ck=d(cp),ys=s(cp,"P",{});var Gw=l(ys);Fk=a(Gw,"Will save the model, so you can reload it using "),Eu=s(Gw,"CODE",{});var O7=l(Eu);Nk=a(O7,"from_pretrained()"),O7.forEach(o),zk=a(Gw,"."),Gw.forEach(o),Wk=d(cp),Au=s(cp,"P",{});var R7=l(Au);Ok=a(R7,"Will only save from the main process."),R7.forEach(o),cp.forEach(o),Rk=d(x),Dt=s(x,"DIV",{class:!0});var pp=l(Dt);g(ws.$$.fragment,pp),Lk=d(pp),$u=s(pp,"P",{});var L7=l($u);Bk=a(L7,"Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),L7.forEach(o),Gk=d(pp),ku=s(pp,"P",{});var B7=l(ku);Zk=a(B7,"Under distributed environment this is done only for a process with rank 0."),B7.forEach(o),pp.forEach(o),Vk=d(x),Jr=s(x,"DIV",{class:!0});var Zw=l(Jr);g(Ts.$$.fragment,Zw),Xk=d(Zw),xu=s(Zw,"P",{});var G7=l(xu);Yk=a(G7,"Main training entry point."),G7.forEach(o),Zw.forEach(o),Hk=d(x),jt=s(x,"DIV",{class:!0});var mp=l(jt);g(Es.$$.fragment,mp),Qk=d(mp),Mu=s(mp,"P",{});var Z7=l(Mu);Kk=a(Z7,"Perform a training step on a batch of inputs."),Z7.forEach(o),ex=d(mp),Iu=s(mp,"P",{});var V7=l(Iu);tx=a(V7,"Subclass and override to inject custom behavior."),V7.forEach(o),mp.forEach(o),x.forEach(o),Iv=d(t),So=s(t,"H2",{class:!0});var Vw=l(So);Cr=s(Vw,"A",{id:!0,class:!0,href:!0});var X7=l(Cr);Su=s(X7,"SPAN",{});var Y7=l(Su);g(As.$$.fragment,Y7),Y7.forEach(o),X7.forEach(o),ox=d(Vw),qu=s(Vw,"SPAN",{});var H7=l(qu);rx=a(H7,"Seq2SeqTrainer"),H7.forEach(o),Vw.forEach(o),Sv=d(t),dt=s(t,"DIV",{class:!0});var hp=l(dt);g($s.$$.fragment,hp),ax=d(hp),ze=s(hp,"DIV",{class:!0});var Ya=l(ze);g(ks.$$.fragment,Ya),nx=d(Ya),Uu=s(Ya,"P",{});var Q7=l(Uu);sx=a(Q7,"Run evaluation and returns metrics."),Q7.forEach(o),lx=d(Ya),xs=s(Ya,"P",{});var Xw=l(xs);ix=a(Xw,`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Du=s(Xw,"CODE",{});var K7=l(Du);dx=a(K7,"compute_metrics"),K7.forEach(o),cx=a(Xw," argument)."),Xw.forEach(o),px=d(Ya),ju=s(Ya,"P",{});var eF=l(ju);mx=a(eF,"You can also subclass and override this method to inject custom behavior."),eF.forEach(o),Ya.forEach(o),hx=d(hp),ce=s(hp,"DIV",{class:!0});var ot=l(ce);g(Ms.$$.fragment,ot),ux=d(ot),Pu=s(ot,"P",{});var tF=l(Pu);fx=a(tF,"Run prediction and returns predictions and potential metrics."),tF.forEach(o),gx=d(ot),Is=s(ot,"P",{});var Yw=l(Is);_x=a(Yw,`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 `),Ju=s(Yw,"CODE",{});var oF=l(Ju);bx=a(oF,"evaluate()"),oF.forEach(o),vx=a(Yw,"."),Yw.forEach(o),yx=d(ot),g(Fr.$$.fragment,ot),wx=d(ot),Ss=s(ot,"P",{});var Hw=l(Ss);Tx=a(Hw,"Returns: "),Cu=s(Hw,"EM",{});var rF=l(Cu);Ex=a(rF,"NamedTuple"),rF.forEach(o),Ax=a(Hw," A namedtuple with the following keys:"),Hw.forEach(o),$x=d(ot),qo=s(ot,"UL",{});var up=l(qo);Uo=s(up,"LI",{});var fp=l(Uo);kx=a(fp,"predictions ("),Fu=s(fp,"CODE",{});var aF=l(Fu);xx=a(aF,"np.ndarray"),aF.forEach(o),Mx=a(fp,"): The predictions on "),Nu=s(fp,"CODE",{});var nF=l(Nu);Ix=a(nF,"test_dataset"),nF.forEach(o),Sx=a(fp,"."),fp.forEach(o),qx=d(up),Do=s(up,"LI",{});var gp=l(Do);Ux=a(gp,"label_ids ("),zu=s(gp,"CODE",{});var sF=l(zu);Dx=a(sF,"np.ndarray"),sF.forEach(o),jx=a(gp,", "),Wu=s(gp,"EM",{});var lF=l(Wu);Px=a(lF,"optional"),lF.forEach(o),Jx=a(gp,"): The labels (if the dataset contained some)."),gp.forEach(o),Cx=d(up),jo=s(up,"LI",{});var _p=l(jo);Fx=a(_p,"metrics ("),Ou=s(_p,"CODE",{});var iF=l(Ou);Nx=a(iF,"Dict[str, float]"),iF.forEach(o),zx=a(_p,", "),Ru=s(_p,"EM",{});var dF=l(Ru);Wx=a(dF,"optional"),dF.forEach(o),Ox=a(_p,`): The potential dictionary of metrics (if the dataset contained
labels).`),_p.forEach(o),up.forEach(o),ot.forEach(o),hp.forEach(o),qv=d(t),Po=s(t,"H2",{class:!0});var Qw=l(Po);Nr=s(Qw,"A",{id:!0,class:!0,href:!0});var cF=l(Nr);Lu=s(cF,"SPAN",{});var pF=l(Lu);g(qs.$$.fragment,pF),pF.forEach(o),cF.forEach(o),Rx=d(Qw),Bu=s(Qw,"SPAN",{});var mF=l(Bu);Lx=a(mF,"TrainingArguments"),mF.forEach(o),Qw.forEach(o),Uv=d(t),q=s(t,"DIV",{class:!0});var J=l(q);g(Us.$$.fragment,J),Bx=d(J),Ds=s(J,"P",{});var Kw=l(Ds);Gx=a(Kw,"TrainingArguments is the subset of the arguments we use in our example scripts "),Gu=s(Kw,"STRONG",{});var hF=l(Gu);Zx=a(hF,`which relate to the training loop
itself`),hF.forEach(o),Vx=a(Kw,"."),Kw.forEach(o),Xx=d(J),Jo=s(J,"P",{});var bp=l(Jo);Yx=a(bp,"Using "),cd=s(bp,"A",{href:!0});var uF=l(cd);Hx=a(uF,"HfArgumentParser"),uF.forEach(o),Qx=a(bp,` we can turn this class into
`),js=s(bp,"A",{href:!0,rel:!0});var fF=l(js);Kx=a(fF,"argparse"),fF.forEach(o),eM=a(bp,` arguments that can be specified on the
command line.`),bp.forEach(o),tM=d(J),_e=s(J,"DIV",{class:!0});var co=l(_e);g(Ps.$$.fragment,co),oM=d(co),Zu=s(co,"P",{});var gF=l(Zu);rM=a(gF,`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.`),gF.forEach(o),aM=d(co),Co=s(co,"P",{});var vp=l(Co);nM=a(vp,"For the main process the log level defaults to the logging level set ("),Vu=s(vp,"CODE",{});var _F=l(Vu);sM=a(_F,"logging.WARNING"),_F.forEach(o),lM=a(vp,` if you didn\u2019t do
anything) unless overridden by `),Xu=s(vp,"CODE",{});var bF=l(Xu);iM=a(bF,"log_level"),bF.forEach(o),dM=a(vp," argument."),vp.forEach(o),cM=d(co),Fo=s(co,"P",{});var yp=l(Fo);pM=a(yp,"For the replica processes the log level defaults to "),Yu=s(yp,"CODE",{});var vF=l(Yu);mM=a(vF,"logging.WARNING"),vF.forEach(o),hM=a(yp," unless overridden by "),Hu=s(yp,"CODE",{});var yF=l(Hu);uM=a(yF,"log_level_replica"),yF.forEach(o),fM=a(yp,`
argument.`),yp.forEach(o),gM=d(co),Js=s(co,"P",{});var eT=l(Js);_M=a(eT,"The choice between the main and replica process settings is made according to the return value of "),Qu=s(eT,"CODE",{});var wF=l(Qu);bM=a(wF,"should_log"),wF.forEach(o),vM=a(eT,"."),eT.forEach(o),co.forEach(o),yM=d(J),zr=s(J,"DIV",{class:!0});var tT=l(zr);g(Cs.$$.fragment,tT),wM=d(tT),Ku=s(tT,"P",{});var TF=l(Ku);TM=a(TF,"Get number of steps used for a linear warmup."),TF.forEach(o),tT.forEach(o),EM=d(J),Pt=s(J,"DIV",{class:!0});var wp=l(Pt);g(Fs.$$.fragment,wp),AM=d(wp),ef=s(wp,"P",{});var EF=l(ef);$M=a(EF,`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.`),EF.forEach(o),kM=d(wp),No=s(wp,"P",{});var Tp=l(No);xM=a(Tp,"One such use is for "),tf=s(Tp,"CODE",{});var AF=l(tf);MM=a(AF,"datasets"),AF.forEach(o),IM=a(Tp,"\u2019s "),of=s(Tp,"CODE",{});var $F=l(of);SM=a($F,"map"),$F.forEach(o),qM=a(Tp,` 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.`),Tp.forEach(o),wp.forEach(o),UM=d(J),Jt=s(J,"DIV",{class:!0});var Ep=l(Jt);g(Ns.$$.fragment,Ep),DM=d(Ep),rf=s(Ep,"P",{});var kF=l(rf);jM=a(kF,"A method that regroups all arguments linked to the dataloaders creation."),kF.forEach(o),PM=d(Ep),g(Wr.$$.fragment,Ep),Ep.forEach(o),JM=d(J),Ct=s(J,"DIV",{class:!0});var Ap=l(Ct);g(zs.$$.fragment,Ap),CM=d(Ap),af=s(Ap,"P",{});var xF=l(af);FM=a(xF,"A method that regroups all arguments linked to the evaluation."),xF.forEach(o),NM=d(Ap),g(Or.$$.fragment,Ap),Ap.forEach(o),zM=d(J),Ft=s(J,"DIV",{class:!0});var $p=l(Ft);g(Ws.$$.fragment,$p),WM=d($p),nf=s($p,"P",{});var MF=l(nf);OM=a(MF,"A method that regroups all arguments linked to the evaluation."),MF.forEach(o),RM=d($p),g(Rr.$$.fragment,$p),$p.forEach(o),LM=d(J),Nt=s(J,"DIV",{class:!0});var kp=l(Nt);g(Os.$$.fragment,kp),BM=d(kp),sf=s(kp,"P",{});var IF=l(sf);GM=a(IF,"A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters."),IF.forEach(o),ZM=d(kp),g(Lr.$$.fragment,kp),kp.forEach(o),VM=d(J),zt=s(J,"DIV",{class:!0});var xp=l(zt);g(Rs.$$.fragment,xp),XM=d(xp),lf=s(xp,"P",{});var SF=l(lf);YM=a(SF,"A method that regroups all arguments linked to the optimizer and its hyperparameters."),SF.forEach(o),HM=d(xp),g(Br.$$.fragment,xp),xp.forEach(o),QM=d(J),We=s(J,"DIV",{class:!0});var Ha=l(We);g(Ls.$$.fragment,Ha),KM=d(Ha),df=s(Ha,"P",{});var qF=l(df);e5=a(qF,"A method that regroups all arguments linked to synchronizing checkpoints with the Hub."),qF.forEach(o),t5=d(Ha),g(Gr.$$.fragment,Ha),o5=d(Ha),g(Zr.$$.fragment,Ha),Ha.forEach(o),r5=d(J),Wt=s(J,"DIV",{class:!0});var Mp=l(Wt);g(Bs.$$.fragment,Mp),a5=d(Mp),cf=s(Mp,"P",{});var UF=l(cf);n5=a(UF,"A method that regroups all arguments linked to the evaluation."),UF.forEach(o),s5=d(Mp),g(Vr.$$.fragment,Mp),Mp.forEach(o),l5=d(J),Oe=s(J,"DIV",{class:!0});var Qa=l(Oe);g(Gs.$$.fragment,Qa),i5=d(Qa),pf=s(Qa,"P",{});var DF=l(pf);d5=a(DF,"A method that regroups all basic arguments linked to testing on a held-out dataset."),DF.forEach(o),c5=d(Qa),g(Xr.$$.fragment,Qa),p5=d(Qa),g(Yr.$$.fragment,Qa),Qa.forEach(o),m5=d(J),Re=s(J,"DIV",{class:!0});var Ka=l(Re);g(Zs.$$.fragment,Ka),h5=d(Ka),mf=s(Ka,"P",{});var jF=l(mf);u5=a(jF,"A method that regroups all basic arguments linked to the training."),jF.forEach(o),f5=d(Ka),g(Hr.$$.fragment,Ka),g5=d(Ka),g(Qr.$$.fragment,Ka),Ka.forEach(o),_5=d(J),Kr=s(J,"DIV",{class:!0});var oT=l(Kr);g(Vs.$$.fragment,oT),b5=d(oT),Xs=s(oT,"P",{});var rT=l(Xs);v5=a(rT,"Serializes this instance while replace "),hf=s(rT,"CODE",{});var PF=l(hf);y5=a(PF,"Enum"),PF.forEach(o),w5=a(rT,` by their values (for JSON serialization support). It obfuscates
the token values by removing their value.`),rT.forEach(o),oT.forEach(o),T5=d(J),ea=s(J,"DIV",{class:!0});var aT=l(ea);g(Ys.$$.fragment,aT),E5=d(aT),uf=s(aT,"P",{});var JF=l(uf);A5=a(JF,"Serializes this instance to a JSON string."),JF.forEach(o),aT.forEach(o),$5=d(J),ta=s(J,"DIV",{class:!0});var nT=l(ta);g(Hs.$$.fragment,nT),k5=d(nT),ff=s(nT,"P",{});var CF=l(ff);x5=a(CF,"Sanitized serialization to use with TensorBoard\u2019s hparams"),CF.forEach(o),nT.forEach(o),J.forEach(o),Dv=d(t),zo=s(t,"H2",{class:!0});var sT=l(zo);oa=s(sT,"A",{id:!0,class:!0,href:!0});var FF=l(oa);gf=s(FF,"SPAN",{});var NF=l(gf);g(Qs.$$.fragment,NF),NF.forEach(o),FF.forEach(o),M5=d(sT),_f=s(sT,"SPAN",{});var zF=l(_f);I5=a(zF,"Seq2SeqTrainingArguments"),zF.forEach(o),sT.forEach(o),jv=d(t),Ie=s(t,"DIV",{class:!0});var en=l(Ie);g(Ks.$$.fragment,en),S5=d(en),el=s(en,"P",{});var lT=l(el);q5=a(lT,"TrainingArguments is the subset of the arguments we use in our example scripts "),bf=s(lT,"STRONG",{});var WF=l(bf);U5=a(WF,`which relate to the training loop
itself`),WF.forEach(o),D5=a(lT,"."),lT.forEach(o),j5=d(en),Wo=s(en,"P",{});var Ip=l(Wo);P5=a(Ip,"Using "),pd=s(Ip,"A",{href:!0});var OF=l(pd);J5=a(OF,"HfArgumentParser"),OF.forEach(o),C5=a(Ip,` we can turn this class into
`),tl=s(Ip,"A",{href:!0,rel:!0});var RF=l(tl);F5=a(RF,"argparse"),RF.forEach(o),N5=a(Ip,` arguments that can be specified on the
command line.`),Ip.forEach(o),z5=d(en),ra=s(en,"DIV",{class:!0});var iT=l(ra);g(ol.$$.fragment,iT),W5=d(iT),Oo=s(iT,"P",{});var Sp=l(Oo);O5=a(Sp,"Serializes this instance while replace "),vf=s(Sp,"CODE",{});var LF=l(vf);R5=a(LF,"Enum"),LF.forEach(o),L5=a(Sp," by their values and "),yf=s(Sp,"CODE",{});var BF=l(yf);B5=a(BF,"GenerationConfig"),BF.forEach(o),G5=a(Sp,` by dictionaries (for JSON
serialization support). It obfuscates the token values by removing their value.`),Sp.forEach(o),iT.forEach(o),en.forEach(o),Pv=d(t),Ro=s(t,"H2",{class:!0});var dT=l(Ro);aa=s(dT,"A",{id:!0,class:!0,href:!0});var GF=l(aa);wf=s(GF,"SPAN",{});var ZF=l(wf);g(rl.$$.fragment,ZF),ZF.forEach(o),GF.forEach(o),Z5=d(dT),Tf=s(dT,"SPAN",{});var VF=l(Tf);V5=a(VF,"Checkpoints"),VF.forEach(o),dT.forEach(o),Jv=d(t),be=s(t,"P",{});var po=l(be);X5=a(po,"By default, "),md=s(po,"A",{href:!0});var XF=l(md);Y5=a(XF,"Trainer"),XF.forEach(o),H5=a(po," will save all checkpoints in the "),Ef=s(po,"CODE",{});var YF=l(Ef);Q5=a(YF,"output_dir"),YF.forEach(o),K5=a(po,` you set in the
`),hd=s(po,"A",{href:!0});var HF=l(hd);eI=a(HF,"TrainingArguments"),HF.forEach(o),tI=a(po," you are using. Those will go in subfolder named "),Af=s(po,"CODE",{});var QF=l(Af);oI=a(QF,"checkpoint-xxx"),QF.forEach(o),rI=a(po,` with xxx
being the step at which the training was at.`),po.forEach(o),Cv=d(t),na=s(t,"P",{});var cT=l(na);aI=a(cT,"Resuming training from a checkpoint can be done when calling "),ud=s(cT,"A",{href:!0});var KF=l(ud);nI=a(KF,"Trainer.train()"),KF.forEach(o),sI=a(cT," with either:"),cT.forEach(o),Fv=d(t),sa=s(t,"UL",{});var pT=l(sa);fd=s(pT,"LI",{});var ZJ=l(fd);$f=s(ZJ,"CODE",{});var eN=l($f);lI=a(eN,"resume_from_checkpoint=True"),eN.forEach(o),iI=a(ZJ," which will resume training from the latest checkpoint"),ZJ.forEach(o),dI=d(pT),gd=s(pT,"LI",{});var VJ=l(gd);kf=s(VJ,"CODE",{});var tN=l(kf);cI=a(tN,"resume_from_checkpoint=checkpoint_dir"),tN.forEach(o),pI=a(VJ,` which will resume training from the specific checkpoint in the directory
passed.`),VJ.forEach(o),pT.forEach(o),Nv=d(t),Le=s(t,"P",{});var tn=l(Le);mI=a(tn,"In addition, you can easily save your checkpoints on the Model Hub when using "),xf=s(tn,"CODE",{});var oN=l(xf);hI=a(oN,"push_to_hub=True"),oN.forEach(o),uI=a(tn,`. By default, all
the models saved in intermediate checkpoints are saved in different commits, but not the optimizer state. You can adapt
the `),Mf=s(tn,"CODE",{});var rN=l(Mf);fI=a(rN,"hub-strategy"),rN.forEach(o),gI=a(tn," value of your "),_d=s(tn,"A",{href:!0});var aN=l(_d);_I=a(aN,"TrainingArguments"),aN.forEach(o),bI=a(tn," to either:"),tn.forEach(o),zv=d(t),la=s(t,"UL",{});var mT=l(la);ia=s(mT,"LI",{});var _v=l(ia);If=s(_v,"CODE",{});var nN=l(If);vI=a(nN,'"checkpoint"'),nN.forEach(o),yI=a(_v,`: the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to
resume training easily with `),Sf=s(_v,"CODE",{});var sN=l(Sf);wI=a(sN,'trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")'),sN.forEach(o),TI=a(_v,"."),_v.forEach(o),EI=d(mT),bd=s(mT,"LI",{});var XJ=l(bd);qf=s(XJ,"CODE",{});var lN=l(qf);AI=a(lN,'"all_checkpoints"'),lN.forEach(o),$I=a(XJ,`: all checkpoints are pushed like they appear in the output folder (so you will get one
checkpoint folder per folder in your final repository)`),XJ.forEach(o),mT.forEach(o),Wv=d(t),Lo=s(t,"H2",{class:!0});var hT=l(Lo);da=s(hT,"A",{id:!0,class:!0,href:!0});var iN=l(da);Uf=s(iN,"SPAN",{});var dN=l(Uf);g(al.$$.fragment,dN),dN.forEach(o),iN.forEach(o),kI=d(hT),Df=s(hT,"SPAN",{});var cN=l(Df);xI=a(cN,"Logging"),cN.forEach(o),hT.forEach(o),Ov=d(t),Be=s(t,"P",{});var on=l(Be);MI=a(on,"By default "),vd=s(on,"A",{href:!0});var pN=l(vd);II=a(pN,"Trainer"),pN.forEach(o),SI=a(on," will use "),jf=s(on,"CODE",{});var mN=l(jf);qI=a(mN,"logging.INFO"),mN.forEach(o),UI=a(on," for the main process and "),Pf=s(on,"CODE",{});var hN=l(Pf);DI=a(hN,"logging.WARNING"),hN.forEach(o),jI=a(on," for the replicas if any."),on.forEach(o),Rv=d(t),Ot=s(t,"P",{});var qp=l(Ot);PI=a(qp,"These defaults can be overridden to use any of the 5 "),Jf=s(qp,"CODE",{});var uN=l(Jf);JI=a(uN,"logging"),uN.forEach(o),CI=a(qp," levels with "),yd=s(qp,"A",{href:!0});var fN=l(yd);FI=a(fN,"TrainingArguments"),fN.forEach(o),NI=a(qp,`\u2019s
arguments:`),qp.forEach(o),Lv=d(t),ca=s(t,"UL",{});var uT=l(ca);wd=s(uT,"LI",{});var YJ=l(wd);Cf=s(YJ,"CODE",{});var gN=l(Cf);zI=a(gN,"log_level"),gN.forEach(o),WI=a(YJ," - for the main process"),YJ.forEach(o),OI=d(uT),Td=s(uT,"LI",{});var HJ=l(Td);Ff=s(HJ,"CODE",{});var _N=l(Ff);RI=a(_N,"log_level_replica"),_N.forEach(o),LI=a(HJ," - for the replicas"),HJ.forEach(o),uT.forEach(o),Bv=d(t),Ge=s(t,"P",{});var rn=l(Ge);BI=a(rn,"Further, if "),Ed=s(rn,"A",{href:!0});var bN=l(Ed);GI=a(bN,"TrainingArguments"),bN.forEach(o),ZI=a(rn,"\u2019s "),Nf=s(rn,"CODE",{});var vN=l(Nf);VI=a(vN,"log_on_each_node"),vN.forEach(o),XI=a(rn," is set to "),zf=s(rn,"CODE",{});var yN=l(zf);YI=a(yN,"False"),yN.forEach(o),HI=a(rn,` 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.`),rn.forEach(o),Gv=d(t),pe=s(t,"P",{});var rt=l(pe);QI=a(rt,"Note that "),Ad=s(rt,"A",{href:!0});var wN=l(Ad);KI=a(wN,"Trainer"),wN.forEach(o),e9=a(rt," is going to set "),Wf=s(rt,"CODE",{});var TN=l(Wf);t9=a(TN,"transformers"),TN.forEach(o),o9=a(rt,`\u2019s log level separately for each node in its
`),Of=s(rt,"CODE",{});var EN=l(Of);r9=a(EN,"Trainer.__init__()"),EN.forEach(o),a9=a(rt,`. So you may want to set this sooner (see the next example) if you tap into other
`),Rf=s(rt,"CODE",{});var AN=l(Rf);n9=a(AN,"transformers"),AN.forEach(o),s9=a(rt," functionality before creating the "),$d=s(rt,"A",{href:!0});var $N=l($d);l9=a($N,"Trainer"),$N.forEach(o),i9=a(rt," object."),rt.forEach(o),Zv=d(t),kd=s(t,"P",{});var kN=l(kd);d9=a(kN,"Here is an example of how this can be used in an application:"),kN.forEach(o),Vv=d(t),g(nl.$$.fragment,t),Xv=d(t),xd=s(t,"P",{});var xN=l(xd);c9=a(xN,`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:`),xN.forEach(o),Yv=d(t),g(sl.$$.fragment,t),Hv=d(t),Md=s(t,"P",{});var MN=l(Md);p9=a(MN,`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:`),MN.forEach(o),Qv=d(t),g(ll.$$.fragment,t),Kv=d(t),Id=s(t,"P",{});var IN=l(Id);m9=a(IN,`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.`),IN.forEach(o),ey=d(t),Sd=s(t,"P",{});var SN=l(Sd);h9=a(SN,"If you need your application to be as quiet as possible you could do:"),SN.forEach(o),ty=d(t),g(il.$$.fragment,t),oy=d(t),pa=s(t,"P",{});var fT=l(pa);u9=a(fT,"(add "),Lf=s(fT,"CODE",{});var qN=l(Lf);f9=a(qN,"--log_on_each_node 0"),qN.forEach(o),g9=a(fT," if on multi-node environment)"),fT.forEach(o),ry=d(t),Bo=s(t,"H2",{class:!0});var gT=l(Bo);ma=s(gT,"A",{id:!0,class:!0,href:!0});var UN=l(ma);Bf=s(UN,"SPAN",{});var DN=l(Bf);g(dl.$$.fragment,DN),DN.forEach(o),UN.forEach(o),_9=d(gT),Gf=s(gT,"SPAN",{});var jN=l(Gf);b9=a(jN,"Randomness"),jN.forEach(o),gT.forEach(o),ay=d(t),ve=s(t,"P",{});var mo=l(ve);v9=a(mo,"When resuming from a checkpoint generated by "),qd=s(mo,"A",{href:!0});var PN=l(qd);y9=a(PN,"Trainer"),PN.forEach(o),w9=a(mo,` all efforts are made to restore the
`),Zf=s(mo,"EM",{});var JN=l(Zf);T9=a(JN,"python"),JN.forEach(o),E9=a(mo,", "),Vf=s(mo,"EM",{});var CN=l(Vf);A9=a(CN,"numpy"),CN.forEach(o),$9=a(mo," and "),Xf=s(mo,"EM",{});var FN=l(Xf);k9=a(FN,"pytorch"),FN.forEach(o),x9=a(mo,` 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.`),mo.forEach(o),ny=d(t),Rt=s(t,"P",{});var Up=l(Rt);M9=a(Up,`However, due to various default non-deterministic pytorch settings this might not fully work. If you want full
determinism please refer to `),cl=s(Up,"A",{href:!0,rel:!0});var NN=l(cl);I9=a(NN,"Controlling sources of randomness"),NN.forEach(o),S9=a(Up,`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),Yf=s(Up,"CODE",{});var zN=l(Yf);q9=a(zN,"torch.backends.cudnn.deterministic"),zN.forEach(o),U9=a(Up,`) may slow things down, therefore this
can\u2019t be done by default, but you can enable those yourself if needed.`),Up.forEach(o),sy=d(t),Go=s(t,"H2",{class:!0});var _T=l(Go);ha=s(_T,"A",{id:!0,class:!0,href:!0});var WN=l(ha);Hf=s(WN,"SPAN",{});var ON=l(Hf);g(pl.$$.fragment,ON),ON.forEach(o),WN.forEach(o),D9=d(_T),Qf=s(_T,"SPAN",{});var RN=l(Qf);j9=a(RN,"Specific GPUs Selection"),RN.forEach(o),_T.forEach(o),ly=d(t),Ud=s(t,"P",{});var LN=l(Ud);P9=a(LN,"Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),LN.forEach(o),iy=d(t),ua=s(t,"P",{});var bT=l(ua);J9=a(bT,"When using "),ml=s(bT,"A",{href:!0,rel:!0});var BN=l(ml);Kf=s(BN,"CODE",{});var GN=l(Kf);C9=a(GN,"DistributedDataParallel"),GN.forEach(o),BN.forEach(o),F9=a(bT," 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:"),bT.forEach(o),dy=d(t),g(hl.$$.fragment,t),cy=d(t),Lt=s(t,"P",{});var Dp=l(Lt);N9=a(Dp,"if you have either "),ul=s(Dp,"A",{href:!0,rel:!0});var ZN=l(ul);eg=s(ZN,"CODE",{});var VN=l(eg);z9=a(VN,"accelerate"),VN.forEach(o),ZN.forEach(o),W9=a(Dp," or "),fl=s(Dp,"A",{href:!0,rel:!0});var XN=l(fl);tg=s(XN,"CODE",{});var YN=l(tg);O9=a(YN,"deepspeed"),YN.forEach(o),XN.forEach(o),R9=a(Dp," installed you can also accomplish the same by using one of:"),Dp.forEach(o),py=d(t),g(gl.$$.fragment,t),my=d(t),g(_l.$$.fragment,t),hy=d(t),fa=s(t,"P",{});var vT=l(fa);L9=a(vT,"You don\u2019t need to use the Accelerate or "),Dd=s(vT,"A",{href:!0});var HN=l(Dd);B9=a(HN,"the Deepspeed integration"),HN.forEach(o),G9=a(vT," features to use these launchers."),vT.forEach(o),uy=d(t),jd=s(t,"P",{});var QN=l(jd);Z9=a(QN,"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."),QN.forEach(o),fy=d(t),Pd=s(t,"P",{});var KN=l(Pd);V9=a(KN,"The following environment variables help you control which GPUs to use and their order."),KN.forEach(o),gy=d(t),Jd=s(t,"P",{});var ez=l(Jd);og=s(ez,"STRONG",{});var tz=l(og);rg=s(tz,"CODE",{});var oz=l(rg);X9=a(oz,"CUDA_VISIBLE_DEVICES"),oz.forEach(o),tz.forEach(o),ez.forEach(o),_y=d(t),ga=s(t,"P",{});var yT=l(ga);Y9=a(yT,"If you have multiple GPUs and you\u2019d like to use only 1 or a few of those GPUs, set the environment variable "),ag=s(yT,"CODE",{});var rz=l(ag);H9=a(rz,"CUDA_VISIBLE_DEVICES"),rz.forEach(o),Q9=a(yT," to a list of the GPUs to be used."),yT.forEach(o),by=d(t),Cd=s(t,"P",{});var az=l(Cd);K9=a(az,"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:"),az.forEach(o),vy=d(t),g(bl.$$.fragment,t),yy=d(t),Bt=s(t,"P",{});var jp=l(Bt);eS=a(jp,"So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),ng=s(jp,"CODE",{});var nz=l(ng);tS=a(nz,"cuda:0"),nz.forEach(o),oS=a(jp," and "),sg=s(jp,"CODE",{});var sz=l(sg);rS=a(sz,"cuda:1"),sz.forEach(o),aS=a(jp," correspondingly."),jp.forEach(o),wy=d(t),Fd=s(t,"P",{});var lz=l(Fd);nS=a(lz,"You can even change their order:"),lz.forEach(o),Ty=d(t),g(vl.$$.fragment,t),Ey=d(t),Gt=s(t,"P",{});var Pp=l(Gt);sS=a(Pp,"Here your physical GPUs 0 and 2 are mapped to "),lg=s(Pp,"CODE",{});var iz=l(lg);lS=a(iz,"cuda:1"),iz.forEach(o),iS=a(Pp," and "),ig=s(Pp,"CODE",{});var dz=l(ig);dS=a(dz,"cuda:0"),dz.forEach(o),cS=a(Pp," correspondingly."),Pp.forEach(o),Ay=d(t),Zt=s(t,"P",{});var Jp=l(Zt);pS=a(Jp,"The above examples were all for "),dg=s(Jp,"CODE",{});var cz=l(dg);mS=a(cz,"DistributedDataParallel"),cz.forEach(o),hS=a(Jp," use pattern, but the same method works for "),yl=s(Jp,"A",{href:!0,rel:!0});var pz=l(yl);cg=s(pz,"CODE",{});var mz=l(cg);uS=a(mz,"DataParallel"),mz.forEach(o),pz.forEach(o),fS=a(Jp," as well:"),Jp.forEach(o),$y=d(t),g(wl.$$.fragment,t),ky=d(t),Nd=s(t,"P",{});var hz=l(Nd);gS=a(hz,"To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),hz.forEach(o),xy=d(t),g(Tl.$$.fragment,t),My=d(t),zd=s(t,"P",{});var uz=l(zd);_S=a(uz,"As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),uz.forEach(o),Iy=d(t),g(El.$$.fragment,t),Sy=d(t),Wd=s(t,"P",{});var fz=l(Wd);bS=a(fz,"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."),fz.forEach(o),qy=d(t),Od=s(t,"P",{});var gz=l(Od);pg=s(gz,"STRONG",{});var _z=l(pg);mg=s(_z,"CODE",{});var bz=l(mg);vS=a(bz,"CUDA_DEVICE_ORDER"),bz.forEach(o),_z.forEach(o),gz.forEach(o),Uy=d(t),_a=s(t,"P",{});var wT=l(_a);yS=a(wT,"There is an additional environment variable "),hg=s(wT,"CODE",{});var vz=l(hg);wS=a(vz,"CUDA_DEVICE_ORDER"),vz.forEach(o),TS=a(wT," that controls how the physical devices are ordered. The two choices are:"),wT.forEach(o),Dy=d(t),Rd=s(t,"OL",{});var yz=l(Rd);Al=s(yz,"LI",{});var TT=l(Al);ES=a(TT,"ordered by PCIe bus IDs (matches "),ug=s(TT,"CODE",{});var wz=l(ug);AS=a(wz,"nvidia-smi"),wz.forEach(o),$S=a(TT,"\u2019s order) - this is the default."),TT.forEach(o),yz.forEach(o),jy=d(t),g($l.$$.fragment,t),Py=d(t),kl=s(t,"OL",{start:!0});var Tz=l(kl);fg=s(Tz,"LI",{});var Ez=l(fg);kS=a(Ez,"ordered by GPU compute capabilities"),Ez.forEach(o),Tz.forEach(o),Jy=d(t),g(xl.$$.fragment,t),Cy=d(t),Vt=s(t,"P",{});var Cp=l(Vt);xS=a(Cp,"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 "),gg=s(Cp,"CODE",{});var Az=l(gg);MS=a(Az,"CUDA_DEVICE_ORDER=FASTEST_FIRST"),Az.forEach(o),IS=a(Cp," will always put the newer faster card first. It\u2019ll be somewhat confusing though since "),_g=s(Cp,"CODE",{});var $z=l(_g);SS=a($z,"nvidia-smi"),$z.forEach(o),qS=a(Cp," will still report them in the PCIe order."),Cp.forEach(o),Fy=d(t),Ld=s(t,"P",{});var kz=l(Ld);US=a(kz,"The other solution to swapping the order is to use:"),kz.forEach(o),Ny=d(t),g(Ml.$$.fragment,t),zy=d(t),Bd=s(t,"P",{});var xz=l(Bd);DS=a(xz,"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."),xz.forEach(o),Wy=d(t),ba=s(t,"P",{});var ET=l(ba);jS=a(ET,"Also if you do set this environment variable it\u2019s the best to set it in your "),bg=s(ET,"CODE",{});var Mz=l(bg);PS=a(Mz,"~/.bashrc"),Mz.forEach(o),JS=a(ET," file or some other startup config file and forget about it."),ET.forEach(o),Oy=d(t),Zo=s(t,"H2",{class:!0});var AT=l(Zo);va=s(AT,"A",{id:!0,class:!0,href:!0});var Iz=l(va);vg=s(Iz,"SPAN",{});var Sz=l(vg);g(Il.$$.fragment,Sz),Sz.forEach(o),Iz.forEach(o),CS=d(AT),yg=s(AT,"SPAN",{});var qz=l(yg);FS=a(qz,"Trainer Integrations"),qz.forEach(o),AT.forEach(o),Ry=d(t),ya=s(t,"P",{});var $T=l(ya);NS=a($T,"The "),Gd=s($T,"A",{href:!0});var Uz=l(Gd);zS=a(Uz,"Trainer"),Uz.forEach(o),WS=a($T,` has been extended to support libraries that may dramatically improve your training
time and fit much bigger models.`),$T.forEach(o),Ly=d(t),Ze=s(t,"P",{});var an=l(Ze);OS=a(an,"Currently it supports third party solutions, "),Sl=s(an,"A",{href:!0,rel:!0});var Dz=l(Sl);RS=a(Dz,"DeepSpeed"),Dz.forEach(o),LS=a(an," and "),ql=s(an,"A",{href:!0,rel:!0});var jz=l(ql);BS=a(jz,"PyTorch FSDP"),jz.forEach(o),GS=a(an,", which implement parts of the paper "),Ul=s(an,"A",{href:!0,rel:!0});var Pz=l(Ul);ZS=a(Pz,`ZeRO: Memory Optimizations
Toward Training Trillion Parameter Models, by Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, Yuxiong He`),Pz.forEach(o),VS=a(an,"."),an.forEach(o),By=d(t),wa=s(t,"P",{});var kT=l(wa);XS=a(kT,"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 "),Zd=s(kT,"A",{href:!0});var Jz=l(Zd);YS=a(Jz,"PyTorch FSDP integration"),Jz.forEach(o),HS=a(kT,")"),kT.forEach(o),Gy=d(t),Vd=s(t,"A",{id:!0}),l(Vd).forEach(o),Zy=d(t),Vo=s(t,"H3",{class:!0});var xT=l(Vo);Ta=s(xT,"A",{id:!0,class:!0,href:!0});var Cz=l(Ta);wg=s(Cz,"SPAN",{});var Fz=l(wg);g(Dl.$$.fragment,Fz),Fz.forEach(o),Cz.forEach(o),QS=d(xT),Tg=s(xT,"SPAN",{});var Nz=l(Tg);KS=a(Nz,"CUDA Extension Installation Notes"),Nz.forEach(o),xT.forEach(o),Vy=d(t),Xd=s(t,"P",{});var zz=l(Xd);eq=a(zz,"As of this writing, Deepspeed require compilation of CUDA C++ code, before it can be used."),zz.forEach(o),Xy=d(t),Ea=s(t,"P",{});var MT=l(Ea);tq=a(MT,"While all installation issues should be dealt with through the corresponding GitHub Issues of "),jl=s(MT,"A",{href:!0,rel:!0});var Wz=l(jl);oq=a(Wz,"Deepspeed"),Wz.forEach(o),rq=a(MT,`, there are a few common issues that one may encounter while building
any PyTorch extension that needs to build CUDA extensions.`),MT.forEach(o),Yy=d(t),Yd=s(t,"P",{});var Oz=l(Yd);aq=a(Oz,"Therefore, if you encounter a CUDA-related build issue while doing the following:"),Oz.forEach(o),Hy=d(t),g(Pl.$$.fragment,t),Qy=d(t),Hd=s(t,"P",{});var Rz=l(Hd);nq=a(Rz,"please, read the following notes first."),Rz.forEach(o),Ky=d(t),Xt=s(t,"P",{});var Fp=l(Xt);sq=a(Fp,"In these notes we give examples for what to do when "),Eg=s(Fp,"CODE",{});var Lz=l(Eg);lq=a(Lz,"pytorch"),Lz.forEach(o),iq=a(Fp," has been built with CUDA "),Ag=s(Fp,"CODE",{});var Bz=l(Ag);dq=a(Bz,"10.2"),Bz.forEach(o),cq=a(Fp,`. If your situation is
different remember to adjust the version number to the one you are after.`),Fp.forEach(o),e1=d(t),Xo=s(t,"H4",{class:!0});var IT=l(Xo);Aa=s(IT,"A",{id:!0,class:!0,href:!0});var Gz=l(Aa);$g=s(Gz,"SPAN",{});var Zz=l($g);g(Jl.$$.fragment,Zz),Zz.forEach(o),Gz.forEach(o),pq=d(IT),kg=s(IT,"SPAN",{});var Vz=l(kg);mq=a(Vz,"Possible problem #1"),Vz.forEach(o),IT.forEach(o),t1=d(t),Qd=s(t,"P",{});var Xz=l(Qd);hq=a(Xz,`While, Pytorch comes with its own CUDA toolkit, to build these two projects you must have an identical version of CUDA
installed system-wide.`),Xz.forEach(o),o1=d(t),Ve=s(t,"P",{});var nn=l(Ve);uq=a(nn,"For example, if you installed "),xg=s(nn,"CODE",{});var Yz=l(xg);fq=a(Yz,"pytorch"),Yz.forEach(o),gq=a(nn," with "),Mg=s(nn,"CODE",{});var Hz=l(Mg);_q=a(Hz,"cudatoolkit==10.2"),Hz.forEach(o),bq=a(nn,` in the Python environment, you also need to have
CUDA `),Ig=s(nn,"CODE",{});var Qz=l(Ig);vq=a(Qz,"10.2"),Qz.forEach(o),yq=a(nn," installed system-wide."),nn.forEach(o),r1=d(t),Yt=s(t,"P",{});var Np=l(Yt);wq=a(Np,"The exact location may vary from system to system, but "),Sg=s(Np,"CODE",{});var Kz=l(Sg);Tq=a(Kz,"/usr/local/cuda-10.2"),Kz.forEach(o),Eq=a(Np,` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),qg=s(Np,"CODE",{});var eW=l(qg);Aq=a(eW,"PATH"),eW.forEach(o),$q=a(Np,` environment variable, one can find the
installation location by doing:`),Np.forEach(o),a1=d(t),g(Cl.$$.fragment,t),n1=d(t),$a=s(t,"P",{});var ST=l($a);kq=a(ST,`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: `),Fl=s(ST,"A",{href:!0,rel:!0});var tW=l(Fl);xq=a(tW,"ubuntu cuda 10.2 install"),tW.forEach(o),Mq=a(ST,"."),ST.forEach(o),s1=d(t),Yo=s(t,"H4",{class:!0});var qT=l(Yo);ka=s(qT,"A",{id:!0,class:!0,href:!0});var oW=l(ka);Ug=s(oW,"SPAN",{});var rW=l(Ug);g(Nl.$$.fragment,rW),rW.forEach(o),oW.forEach(o),Iq=d(qT),Dg=s(qT,"SPAN",{});var aW=l(Dg);Sq=a(aW,"Possible problem #2"),aW.forEach(o),qT.forEach(o),l1=d(t),Kd=s(t,"P",{});var nW=l(Kd);qq=a(nW,`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),nW.forEach(o),i1=d(t),g(zl.$$.fragment,t),d1=d(t),Ht=s(t,"P",{});var zp=l(Ht);Uq=a(zp,"Now, in this situation you need to make sure that your "),jg=s(zp,"CODE",{});var sW=l(jg);Dq=a(sW,"PATH"),sW.forEach(o),jq=a(zp," and "),Pg=s(zp,"CODE",{});var lW=l(Pg);Pq=a(lW,"LD_LIBRARY_PATH"),lW.forEach(o),Jq=a(zp,` 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.`),zp.forEach(o),c1=d(t),ec=s(t,"P",{});var iW=l(ec);Cq=a(iW,"First, you may look at their contents:"),iW.forEach(o),p1=d(t),g(Wl.$$.fragment,t),m1=d(t),tc=s(t,"P",{});var dW=l(tc);Fq=a(dW,"so you get an idea of what is inside."),dW.forEach(o),h1=d(t),xa=s(t,"P",{});var UT=l(xa);Nq=a(UT,"It\u2019s possible that "),Jg=s(UT,"CODE",{});var cW=l(Jg);zq=a(cW,"LD_LIBRARY_PATH"),cW.forEach(o),Wq=a(UT," is empty."),UT.forEach(o),u1=d(t),ct=s(t,"P",{});var Pi=l(ct);Cg=s(Pi,"CODE",{});var pW=l(Cg);Oq=a(pW,"PATH"),pW.forEach(o),Rq=a(Pi," lists the locations of where executables can be found and "),Fg=s(Pi,"CODE",{});var mW=l(Fg);Lq=a(mW,"LD_LIBRARY_PATH"),mW.forEach(o),Bq=a(Pi,` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),Ng=s(Pi,"CODE",{});var hW=l(Ng);Gq=a(hW,":"),hW.forEach(o),Zq=a(Pi,` is used to separate multiple
entries.`),Pi.forEach(o),f1=d(t),oc=s(t,"P",{});var uW=l(oc);Vq=a(uW,`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),uW.forEach(o),g1=d(t),g(Ol.$$.fragment,t),_1=d(t),rc=s(t,"P",{});var fW=l(rc);Xq=a(fW,"Note that we aren\u2019t overwriting the existing values, but prepending instead."),fW.forEach(o),b1=d(t),Xe=s(t,"P",{});var sn=l(Xe);Yq=a(sn,`Of course, adjust the version number, the full path if need be. Check that the directories you assign actually do
exist. `),zg=s(sn,"CODE",{});var gW=l(zg);Hq=a(gW,"lib64"),gW.forEach(o),Qq=a(sn," sub-directory is where the various CUDA "),Wg=s(sn,"CODE",{});var _W=l(Wg);Kq=a(_W,".so"),_W.forEach(o),eU=a(sn," objects, like "),Og=s(sn,"CODE",{});var bW=l(Og);tU=a(bW,"libcudart.so"),bW.forEach(o),oU=a(sn,` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),sn.forEach(o),v1=d(t),Ho=s(t,"H4",{class:!0});var DT=l(Ho);Ma=s(DT,"A",{id:!0,class:!0,href:!0});var vW=l(Ma);Rg=s(vW,"SPAN",{});var yW=l(Rg);g(Rl.$$.fragment,yW),yW.forEach(o),vW.forEach(o),rU=d(DT),Lg=s(DT,"SPAN",{});var wW=l(Lg);aU=a(wW,"Possible problem #3"),wW.forEach(o),DT.forEach(o),y1=d(t),Qt=s(t,"P",{});var Wp=l(Qt);nU=a(Wp,"Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),Bg=s(Wp,"CODE",{});var TW=l(Bg);sU=a(TW,"gcc-9"),TW.forEach(o),lU=a(Wp,` but it wants
`),Gg=s(Wp,"CODE",{});var EW=l(Gg);iU=a(EW,"gcc-7"),EW.forEach(o),dU=a(Wp,"."),Wp.forEach(o),w1=d(t),ac=s(t,"P",{});var AW=l(ac);cU=a(AW,"There are various ways to go about it."),AW.forEach(o),T1=d(t),nc=s(t,"P",{});var $W=l(nc);pU=a($W,"If you can install the latest CUDA toolkit it typically should support the newer compiler."),$W.forEach(o),E1=d(t),Ia=s(t,"P",{});var jT=l(Ia);mU=a(jT,`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 `),Zg=s(jT,"CODE",{});var kW=l(Zg);hU=a(kW,"gcc-7"),kW.forEach(o),uU=a(jT,` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),jT.forEach(o),A1=d(t),g(Ll.$$.fragment,t),$1=d(t),te=s(t,"P",{});var ye=l(te);fU=a(ye,"Here, we are making a symlink to "),Vg=s(ye,"CODE",{});var xW=l(Vg);gU=a(xW,"gcc-7"),xW.forEach(o),_U=a(ye," from "),Xg=s(ye,"CODE",{});var MW=l(Xg);bU=a(MW,"/usr/local/cuda-10.2/bin/gcc"),MW.forEach(o),vU=a(ye,` and since
`),Yg=s(ye,"CODE",{});var IW=l(Yg);yU=a(IW,"/usr/local/cuda-10.2/bin/"),IW.forEach(o),wU=a(ye," should be in the "),Hg=s(ye,"CODE",{});var SW=l(Hg);TU=a(SW,"PATH"),SW.forEach(o),EU=a(ye,` environment variable (see the previous problem\u2019s solution), it
should find `),Qg=s(ye,"CODE",{});var qW=l(Qg);AU=a(qW,"gcc-7"),qW.forEach(o),$U=a(ye," (and "),Kg=s(ye,"CODE",{});var UW=l(Kg);kU=a(UW,"g++7"),UW.forEach(o),xU=a(ye,") and then the build will succeed."),ye.forEach(o),k1=d(t),sc=s(t,"P",{});var DW=l(sc);MU=a(DW,"As always make sure to edit the paths in the example to match your situation."),DW.forEach(o),x1=d(t),Qo=s(t,"H3",{class:!0});var PT=l(Qo);Sa=s(PT,"A",{id:!0,class:!0,href:!0});var jW=l(Sa);e_=s(jW,"SPAN",{});var PW=l(e_);g(Bl.$$.fragment,PW),PW.forEach(o),jW.forEach(o),IU=d(PT),t_=s(PT,"SPAN",{});var JW=l(t_);SU=a(JW,"PyTorch Fully Sharded Data parallel"),JW.forEach(o),PT.forEach(o),M1=d(t),qa=s(t,"P",{});var JT=l(qa);qU=a(JT,`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 `),Gl=s(JT,"A",{href:!0,rel:!0});var CW=l(Gl);UU=a(CW,"Fully Sharded Data Parallel blog"),CW.forEach(o),DU=a(JT,`.
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.`),JT.forEach(o),I1=d(t),Zl=s(t,"P",{});var QJ=l(Zl);o_=s(QJ,"STRONG",{});var FW=l(o_);jU=a(FW,"Required PyTorch version for FSDP support"),FW.forEach(o),PU=a(QJ,`: 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.`),QJ.forEach(o),S1=d(t),Vl=s(t,"P",{});var KJ=l(Vl);r_=s(KJ,"STRONG",{});var NW=l(r_);JU=a(NW,"Usage"),NW.forEach(o),CU=a(KJ,":"),KJ.forEach(o),q1=d(t),me=s(t,"UL",{});var at=l(me);a_=s(at,"LI",{});var zW=l(a_);Xl=s(zW,"P",{});var CT=l(Xl);FU=a(CT,`Make sure you have added the distributed launcher
`),n_=s(CT,"CODE",{});var WW=l(n_);NU=a(WW,"-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),WW.forEach(o),zU=a(CT," if you haven\u2019t been using it already."),CT.forEach(o),zW.forEach(o),WU=d(at),Yl=s(at,"LI",{});var FT=l(Yl);lc=s(FT,"P",{});var e8=l(lc);s_=s(e8,"STRONG",{});var OW=l(s_);OU=a(OW,"Sharding Strategy"),OW.forEach(o),RU=a(e8,":"),e8.forEach(o),LU=d(FT),Ko=s(FT,"UL",{});var Op=l(Ko);Hl=s(Op,"LI",{});var NT=l(Hl);BU=a(NT,`FULL_SHARD : Shards optimizer states + gradients + model parameters across data parallel workers/GPUs.
For this, add `),l_=s(NT,"CODE",{});var RW=l(l_);GU=a(RW,"--fsdp full_shard"),RW.forEach(o),ZU=a(NT," to the command line arguments."),NT.forEach(o),VU=d(Op),Ql=s(Op,"LI",{});var zT=l(Ql);XU=a(zT,`SHARD_GRAD_OP : Shards optimizer states + gradients across data parallel workers/GPUs.
For this, add `),i_=s(zT,"CODE",{});var LW=l(i_);YU=a(LW,"--fsdp shard_grad_op"),LW.forEach(o),HU=a(zT," to the command line arguments."),zT.forEach(o),QU=d(Op),Kl=s(Op,"LI",{});var WT=l(Kl);KU=a(WT,"NO_SHARD : No sharding. For this, add "),d_=s(WT,"CODE",{});var BW=l(d_);eD=a(BW,"--fsdp no_shard"),BW.forEach(o),tD=a(WT," to the command line arguments."),WT.forEach(o),Op.forEach(o),FT.forEach(o),oD=d(at),c_=s(at,"LI",{});var GW=l(c_);er=s(GW,"P",{});var Rp=l(er);rD=a(Rp,`To offload the parameters and gradients to the CPU,
add `),p_=s(Rp,"CODE",{});var ZW=l(p_);aD=a(ZW,'--fsdp "full_shard offload"'),ZW.forEach(o),nD=a(Rp," or "),m_=s(Rp,"CODE",{});var VW=l(m_);sD=a(VW,'--fsdp "shard_grad_op offload"'),VW.forEach(o),lD=a(Rp," to the command line arguments."),Rp.forEach(o),GW.forEach(o),iD=d(at),h_=s(at,"LI",{});var XW=l(h_);pt=s(XW,"P",{});var ln=l(pt);dD=a(ln,"To automatically recursively wrap layers with FSDP using "),u_=s(ln,"CODE",{});var YW=l(u_);cD=a(YW,"default_auto_wrap_policy"),YW.forEach(o),pD=a(ln,`,
add `),f_=s(ln,"CODE",{});var HW=l(f_);mD=a(HW,'--fsdp "full_shard auto_wrap"'),HW.forEach(o),hD=a(ln," or "),g_=s(ln,"CODE",{});var QW=l(g_);uD=a(QW,'--fsdp "shard_grad_op auto_wrap"'),QW.forEach(o),fD=a(ln," to the command line arguments."),ln.forEach(o),XW.forEach(o),gD=d(at),__=s(at,"LI",{});var KW=l(__);tr=s(KW,"P",{});var Lp=l(tr);_D=a(Lp,`To enable both CPU offloading and auto wrapping,
add `),b_=s(Lp,"CODE",{});var eO=l(b_);bD=a(eO,'--fsdp "full_shard offload auto_wrap"'),eO.forEach(o),vD=a(Lp," or "),v_=s(Lp,"CODE",{});var tO=l(v_);yD=a(tO,'--fsdp "shard_grad_op offload auto_wrap"'),tO.forEach(o),wD=a(Lp," to the command line arguments."),Lp.forEach(o),KW.forEach(o),TD=d(at),ei=s(at,"LI",{});var OT=l(ei);mt=s(OT,"P",{});var dn=l(mt);ED=a(dn,"Remaining FSDP config is passed via "),y_=s(dn,"CODE",{});var oO=l(y_);AD=a(oO,"--fsdp_config <path_to_fsdp_config.json>"),oO.forEach(o),$D=a(dn,`. It is either a location of
FSDP json config file (e.g., `),w_=s(dn,"CODE",{});var rO=l(w_);kD=a(rO,"fsdp_config.json"),rO.forEach(o),xD=a(dn,") or an already loaded json file as "),T_=s(dn,"CODE",{});var aO=l(T_);MD=a(aO,"dict"),aO.forEach(o),ID=a(dn,"."),dn.forEach(o),SD=d(OT),ht=s(OT,"UL",{});var cn=l(ht);ic=s(cn,"LI",{});var t8=l(ic);qD=a(t8,"If auto wrapping is enabled, you can either use transformer based auto wrap policy or size based auto wrap policy."),ti=s(t8,"UL",{});var RT=l(ti);Se=s(RT,"LI",{});var ho=l(Se);UD=a(ho,"For transformer based auto wrap policy, please specify "),E_=s(ho,"CODE",{});var nO=l(E_);DD=a(nO,"fsdp_transformer_layer_cls_to_wrap"),nO.forEach(o),jD=a(ho,` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),A_=s(ho,"CODE",{});var sO=l(A_);PD=a(sO,"BertLayer"),sO.forEach(o),JD=a(ho,", "),$_=s(ho,"CODE",{});var lO=l($_);CD=a(lO,"GPTJBlock"),lO.forEach(o),FD=a(ho,", "),k_=s(ho,"CODE",{});var iO=l(k_);ND=a(iO,"T5Block"),iO.forEach(o),zD=a(ho,` \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.`),ho.forEach(o),WD=d(RT),oi=s(RT,"LI",{});var LT=l(oi);OD=a(LT,"For size based auto wrap policy, please add "),x_=s(LT,"CODE",{});var dO=l(x_);RD=a(dO,"fsdp_min_num_params"),dO.forEach(o),LD=a(LT,` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),LT.forEach(o),RT.forEach(o),t8.forEach(o),BD=d(cn),ut=s(cn,"LI",{});var pn=l(ut);M_=s(pn,"CODE",{});var cO=l(M_);GD=a(cO,"fsdp_backward_prefetch"),cO.forEach(o),ZD=a(pn,` can be specified in the config file. It controls when to prefetch next set of parameters.
`),I_=s(pn,"CODE",{});var pO=l(I_);VD=a(pO,"backward_pre"),pO.forEach(o),XD=a(pn," and "),S_=s(pn,"CODE",{});var mO=l(S_);YD=a(mO,"backward_pos"),mO.forEach(o),HD=a(pn,` are available options.
For more information refer `),q_=s(pn,"CODE",{});var hO=l(q_);QD=a(hO,"torch.distributed.fsdp.fully_sharded_data_parallel.BackwardPrefetch"),hO.forEach(o),pn.forEach(o),KD=d(cn),Ua=s(cn,"LI",{});var bv=l(Ua);U_=s(bv,"CODE",{});var uO=l(U_);ej=a(uO,"fsdp_forward_prefetch"),uO.forEach(o),tj=a(bv,` can be specified in the config file. It controls when to prefetch next set of parameters.
If `),D_=s(bv,"CODE",{});var fO=l(D_);oj=a(fO,'"True"'),fO.forEach(o),rj=a(bv,", FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass."),bv.forEach(o),aj=d(cn),Da=s(cn,"LI",{});var vv=l(Da);j_=s(vv,"CODE",{});var gO=l(j_);nj=a(gO,"limit_all_gathers"),gO.forEach(o),sj=a(vv,` can be specified in the config file.
If `),P_=s(vv,"CODE",{});var _O=l(P_);lj=a(_O,'"True"'),_O.forEach(o),ij=a(vv,", FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers."),vv.forEach(o),cn.forEach(o),OT.forEach(o),at.forEach(o),U1=d(t),dc=s(t,"P",{});var bO=l(dc);J_=s(bO,"STRONG",{});var vO=l(J_);dj=a(vO,"Few caveats to be aware of"),vO.forEach(o),bO.forEach(o),D1=d(t),cc=s(t,"UL",{});var yO=l(cc);Ye=s(yO,"LI",{});var pr=l(Ye);cj=a(pr,"it is incompatible with "),C_=s(pr,"CODE",{});var wO=l(C_);pj=a(wO,"generate"),wO.forEach(o),mj=a(pr,", thus is incompatible with "),F_=s(pr,"CODE",{});var TO=l(F_);hj=a(TO,"--predict_with_generate"),TO.forEach(o),uj=a(pr,`
in all seq2seq/clm scripts (translation/summarization/clm etc.).`),fj=s(pr,"BR",{}),gj=a(pr,`
Please refer issue `),ri=s(pr,"A",{href:!0,rel:!0});var EO=l(ri);_j=a(EO,"#21667"),EO.forEach(o),pr.forEach(o),yO.forEach(o),j1=d(t),or=s(t,"H3",{class:!0});var BT=l(or);ja=s(BT,"A",{id:!0,class:!0,href:!0});var AO=l(ja);N_=s(AO,"SPAN",{});var $O=l(N_);g(ai.$$.fragment,$O),$O.forEach(o),AO.forEach(o),bj=d(BT),z_=s(BT,"SPAN",{});var kO=l(z_);vj=a(kO,"PyTorch/XLA Fully Sharded Data parallel"),kO.forEach(o),BT.forEach(o),P1=d(t),Kt=s(t,"P",{});var Bp=l(Kt);yj=a(Bp,`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 `),ni=s(Bp,"A",{href:!0,rel:!0});var xO=l(ni);wj=a(xO,"Scaling PyTorch models on Cloud TPUs with FSDP"),xO.forEach(o),Tj=a(Bp," and "),si=s(Bp,"A",{href:!0,rel:!0});var MO=l(si);Ej=a(MO,"PyTorch/XLA implementation of FSDP"),MO.forEach(o),Aj=a(Bp,`
All you need to do is enable it through the config.`),Bp.forEach(o),J1=d(t),li=s(t,"P",{});var o8=l(li);W_=s(o8,"STRONG",{});var IO=l(W_);$j=a(IO,"Required PyTorch/XLA version for FSDP support"),IO.forEach(o),kj=a(o8,": >=2.0"),o8.forEach(o),C1=d(t),ii=s(t,"P",{});var r8=l(ii);O_=s(r8,"STRONG",{});var SO=l(O_);xj=a(SO,"Usage"),SO.forEach(o),Mj=a(r8,":"),r8.forEach(o),F1=d(t),eo=s(t,"P",{});var Gp=l(eo);Ij=a(Gp,"Pass "),R_=s(Gp,"CODE",{});var qO=l(R_);Sj=a(qO,'--fsdp "full shard"'),qO.forEach(o),qj=a(Gp," along with following changes to be made in "),L_=s(Gp,"CODE",{});var UO=l(L_);Uj=a(UO,"--fsdp_config <path_to_fsdp_config.json>"),UO.forEach(o),Dj=a(Gp,":"),Gp.forEach(o),N1=d(t),He=s(t,"UL",{});var mn=l(He);Pa=s(mn,"LI",{});var yv=l(Pa);B_=s(yv,"CODE",{});var DO=l(B_);jj=a(DO,"xla"),DO.forEach(o),Pj=a(yv," should be set to "),G_=s(yv,"CODE",{});var jO=l(G_);Jj=a(jO,"True"),jO.forEach(o),Cj=a(yv," to enable PyTorch/XLA FSDP."),yv.forEach(o),Fj=d(mn),Ja=s(mn,"LI",{});var wv=l(Ja);Z_=s(wv,"CODE",{});var PO=l(Z_);Nj=a(PO,"xla_fsdp_settings"),PO.forEach(o),zj=a(wv,` The value is a dictionary which stores the XLA FSDP wrapping parameters.
For a complete list of options, please see `),di=s(wv,"A",{href:!0,rel:!0});var JO=l(di);Wj=a(JO,"here"),JO.forEach(o),Oj=a(wv,"."),wv.forEach(o),Rj=d(mn),Qe=s(mn,"LI",{});var mr=l(Qe);V_=s(mr,"CODE",{});var CO=l(V_);Lj=a(CO,"xla_fsdp_grad_ckpt"),CO.forEach(o),Bj=a(mr,". When "),X_=s(mr,"CODE",{});var FO=l(X_);Gj=a(FO,"True"),FO.forEach(o),Zj=a(mr,`, 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
`),Y_=s(mr,"CODE",{});var NO=l(Y_);Vj=a(NO,"fsdp_min_num_params"),NO.forEach(o),Xj=a(mr," or "),H_=s(mr,"CODE",{});var zO=l(H_);Yj=a(zO,"fsdp_transformer_layer_cls_to_wrap"),zO.forEach(o),Hj=a(mr,"."),mr.forEach(o),Qj=d(mn),pc=s(mn,"LI",{});var a8=l(pc);Kj=a(a8,"You can either use transformer based auto wrap policy or size based auto wrap policy."),ci=s(a8,"UL",{});var GT=l(ci);qe=s(GT,"LI",{});var uo=l(qe);eP=a(uo,"For transformer based auto wrap policy, please specify "),Q_=s(uo,"CODE",{});var WO=l(Q_);tP=a(WO,"fsdp_transformer_layer_cls_to_wrap"),WO.forEach(o),oP=a(uo,` in the config file.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),K_=s(uo,"CODE",{});var OO=l(K_);rP=a(OO,"BertLayer"),OO.forEach(o),aP=a(uo,", "),eb=s(uo,"CODE",{});var RO=l(eb);nP=a(RO,"GPTJBlock"),RO.forEach(o),sP=a(uo,", "),tb=s(uo,"CODE",{});var LO=l(tb);lP=a(LO,"T5Block"),LO.forEach(o),iP=a(uo,` \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.`),uo.forEach(o),dP=d(GT),pi=s(GT,"LI",{});var ZT=l(pi);cP=a(ZT,"For size based auto wrap policy, please add "),ob=s(ZT,"CODE",{});var BO=l(ob);pP=a(BO,"fsdp_min_num_params"),BO.forEach(o),mP=a(ZT,` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),ZT.forEach(o),GT.forEach(o),a8.forEach(o),mn.forEach(o),z1=d(t),rr=s(t,"H3",{class:!0});var VT=l(rr);Ca=s(VT,"A",{id:!0,class:!0,href:!0});var GO=l(Ca);rb=s(GO,"SPAN",{});var ZO=l(rb);g(mi.$$.fragment,ZO),ZO.forEach(o),GO.forEach(o),hP=d(VT),ab=s(VT,"SPAN",{});var VO=l(ab);uP=a(VO,"Using Trainer for accelerated PyTorch Training on Mac"),VO.forEach(o),VT.forEach(o),W1=d(t),Ke=s(t,"P",{});var hn=l(Ke);fP=a(hn,`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 `),nb=s(hn,"CODE",{});var XO=l(nb);gP=a(XO,'"mps"'),XO.forEach(o),_P=a(hn,` 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 `),hi=s(hn,"A",{href:!0,rel:!0});var YO=l(hi);bP=a(YO,"Introducing Accelerated PyTorch Training on Mac"),YO.forEach(o),vP=a(hn,`
and `),ui=s(hn,"A",{href:!0,rel:!0});var HO=l(ui);yP=a(HO,"MPS BACKEND"),HO.forEach(o),wP=a(hn,"."),hn.forEach(o),O1=d(t),g(Fa.$$.fragment,t),R1=d(t),mc=s(t,"P",{});var QO=l(mc);sb=s(QO,"STRONG",{});var KO=l(sb);TP=a(KO,"Benefits of Training and Inference using Apple Silicon Chips"),KO.forEach(o),QO.forEach(o),L1=d(t),to=s(t,"OL",{});var Zp=l(to);lb=s(Zp,"LI",{});var eR=l(lb);EP=a(eR,"Enables users to train larger networks or batch sizes locally"),eR.forEach(o),AP=d(Zp),ib=s(Zp,"LI",{});var tR=l(ib);$P=a(tR,`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.`),tR.forEach(o),kP=d(Zp),db=s(Zp,"LI",{});var oR=l(db);xP=a(oR,"Reduces costs associated with cloud-based development or the need for additional local GPUs."),oR.forEach(o),Zp.forEach(o),B1=d(t),ar=s(t,"P",{});var Tv=l(ar);cb=s(Tv,"STRONG",{});var rR=l(cb);MP=a(rR,"Pre-requisites"),rR.forEach(o),IP=a(Tv,`: To install torch with mps support,
please follow this nice medium article `),fi=s(Tv,"A",{href:!0,rel:!0});var aR=l(fi);SP=a(aR,"GPU-Acceleration Comes to PyTorch on M1 Macs"),aR.forEach(o),qP=a(Tv,"."),Tv.forEach(o),G1=d(t),ft=s(t,"P",{});var Ji=l(ft);pb=s(Ji,"STRONG",{});var nR=l(pb);UP=a(nR,"Usage"),nR.forEach(o),DP=a(Ji,`:
`),mb=s(Ji,"CODE",{});var sR=l(mb);jP=a(sR,"mps"),sR.forEach(o),PP=a(Ji," device will be used by default if available similar to the way "),hb=s(Ji,"CODE",{});var lR=l(hb);JP=a(lR,"cuda"),lR.forEach(o),CP=a(Ji,` device is used.
Therefore, no action from user is required.
For example, you can run the official Glue text classififcation task (from the root folder) using Apple Silicon GPU with below command:`),Ji.forEach(o),Z1=d(t),g(gi.$$.fragment,t),V1=d(t),hc=s(t,"P",{});var iR=l(hc);ub=s(iR,"STRONG",{});var dR=l(ub);FP=a(dR,"A few caveats to be aware of"),dR.forEach(o),iR.forEach(o),X1=d(t),Na=s(t,"OL",{});var XT=l(Na);_i=s(XT,"LI",{});var YT=l(_i);NP=a(YT,`Some PyTorch operations have not been implemented in mps and will throw an error.
One way to get around that is to set the environment variable `),fb=s(YT,"CODE",{});var cR=l(fb);zP=a(cR,"PYTORCH_ENABLE_MPS_FALLBACK=1"),cR.forEach(o),WP=a(YT,`,
which will fallback to CPU for these operations. It still throws a UserWarning however.`),YT.forEach(o),OP=d(XT),Ue=s(XT,"LI",{});var fo=l(Ue);RP=a(fo,"Distributed setups "),gb=s(fo,"CODE",{});var pR=l(gb);LP=a(pR,"gloo"),pR.forEach(o),BP=a(fo," and "),_b=s(fo,"CODE",{});var mR=l(_b);GP=a(mR,"nccl"),mR.forEach(o),ZP=a(fo," are not working with "),bb=s(fo,"CODE",{});var hR=l(bb);VP=a(hR,"mps"),hR.forEach(o),XP=a(fo,` device.
This means that currently only single GPU of `),vb=s(fo,"CODE",{});var uR=l(vb);YP=a(uR,"mps"),uR.forEach(o),HP=a(fo," device type can be used."),fo.forEach(o),XT.forEach(o),Y1=d(t),oo=s(t,"P",{});var Vp=l(oo);QP=a(Vp,"Finally, please, remember that, \u{1F917} "),yb=s(Vp,"CODE",{});var fR=l(yb);KP=a(fR,"Trainer"),fR.forEach(o),e6=a(Vp,` only integrates MPS backend, therefore if you
have any problems or questions with regards to MPS backend usage, please,
file an issue with `),bi=s(Vp,"A",{href:!0,rel:!0});var gR=l(bi);t6=a(gR,"PyTorch GitHub"),gR.forEach(o),o6=a(Vp,"."),Vp.forEach(o),H1=d(t),nr=s(t,"H2",{class:!0});var HT=l(nr);za=s(HT,"A",{id:!0,class:!0,href:!0});var _R=l(za);wb=s(_R,"SPAN",{});var bR=l(wb);g(vi.$$.fragment,bR),bR.forEach(o),_R.forEach(o),r6=d(HT),Tb=s(HT,"SPAN",{});var vR=l(Tb);a6=a(vR,"Using Accelerate Launcher with Trainer"),vR.forEach(o),HT.forEach(o),Q1=d(t),uc=s(t,"P",{});var yR=l(uc);n6=a(yR,"Accelerate now powers Trainer. In terms of what users should expect:"),yR.forEach(o),K1=d(t),Wa=s(t,"UL",{});var QT=l(Wa);Eb=s(QT,"LI",{});var wR=l(Eb);s6=a(wR,"They can keep using the Trainer ingterations such as FSDP, DeepSpeed vis trainer arguments without any changes on their part."),wR.forEach(o),l6=d(QT),Ab=s(QT,"LI",{});var TR=l(Ab);i6=a(TR,"They can now use Accelerate Launcher with Trainer (recommended)."),TR.forEach(o),QT.forEach(o),ew=d(t),fc=s(t,"P",{});var ER=l(fc);d6=a(ER,"Steps to use Accelerate Launcher with Trainer:"),ER.forEach(o),tw=d(t),ro=s(t,"OL",{});var Xp=l(ro);$b=s(Xp,"LI",{});var AR=l($b);ao=s(AR,"P",{});var Ci=l(ao);c6=a(Ci,"Make sure \u{1F917} Accelerate is installed, you can\u2019t use the "),kb=s(Ci,"CODE",{});var $R=l(kb);p6=a($R,"Trainer"),$R.forEach(o),m6=a(Ci," without it anyway. If not "),xb=s(Ci,"CODE",{});var kR=l(xb);h6=a(kR,"pip install accelerate"),kR.forEach(o),u6=a(Ci,". You may also need to update your version of Accelerate: "),Mb=s(Ci,"CODE",{});var xR=l(Mb);f6=a(xR,"pip install accelerate --upgrade"),xR.forEach(o),Ci.forEach(o),AR.forEach(o),g6=d(Xp),K=s(Xp,"LI",{});var he=l(K);yi=s(he,"P",{});var KT=l(yi);_6=a(KT,"Run "),Ib=s(KT,"CODE",{});var MR=l(Ib);b6=a(MR,"accelerate config"),MR.forEach(o),v6=a(KT,` and fill the questionnaire. Below are example accelerate configs:
a. DDP Multi-node Multi-GPU config:`),KT.forEach(o),y6=d(he),g(wi.$$.fragment,he),w6=d(he),Sb=s(he,"P",{});var IR=l(Sb);T6=a(IR,"b. FSDP config:"),IR.forEach(o),E6=d(he),g(Ti.$$.fragment,he),A6=d(he),qb=s(he,"P",{});var SR=l(qb);$6=a(SR,"c. DeepSpeed config pointing to a file:"),SR.forEach(o),k6=d(he),g(Ei.$$.fragment,he),x6=d(he),Ub=s(he,"P",{});var qR=l(Ub);M6=a(qR,"d. DeepSpeed config using accelerate plugin:"),qR.forEach(o),I6=d(he),g(Ai.$$.fragment,he),he.forEach(o),S6=d(Xp),Db=s(Xp,"LI",{});var UR=l(Db);sr=s(UR,"P",{});var Yp=l(sr);q6=a(Yp,`Run the Trainer script with args other than the ones handled above by accelerate config or launcher args.
Below is an example to run `),jb=s(Yp,"CODE",{});var DR=l(jb);U6=a(DR,"run_glue.py"),DR.forEach(o),D6=a(Yp," using "),Pb=s(Yp,"CODE",{});var jR=l(Pb);j6=a(jR,"accelerate launcher"),jR.forEach(o),P6=a(Yp," with FSDP config from above."),Yp.forEach(o),UR.forEach(o),Xp.forEach(o),ow=d(t),g($i.$$.fragment,t),rw=d(t),ki=s(t,"OL",{start:!0});var PR=l(ki);xi=s(PR,"LI",{});var e0=l(xi);J6=a(e0,"You can also directly use the cmd args for "),Jb=s(e0,"CODE",{});var JR=l(Jb);C6=a(JR,"accelerate launch"),JR.forEach(o),F6=a(e0,". Above example would map to:"),e0.forEach(o),PR.forEach(o),aw=d(t),g(Mi.$$.fragment,t),nw=d(t),Oa=s(t,"P",{});var t0=l(Oa);N6=a(t0,"For more information, please refer the \u{1F917} Accelerate CLI guide: "),Ii=s(t0,"A",{href:!0,rel:!0});var CR=l(Ii);z6=a(CR,"Launching your \u{1F917} Accelerate scripts"),CR.forEach(o),W6=a(t0,"."),t0.forEach(o),sw=d(t),gc=s(t,"P",{});var FR=l(gc);O6=a(FR,"Sections that were moved:"),FR.forEach(o),lw=d(t),M=s(t,"P",{});var I=l(M);R6=a(I,"[ "),_c=s(I,"A",{href:!0});var NR=l(_c);L6=a(NR,"DeepSpeed"),NR.forEach(o),Cb=s(I,"A",{id:!0}),l(Cb).forEach(o),B6=a(I,`
| `),bc=s(I,"A",{href:!0});var zR=l(bc);G6=a(zR,"Installation"),zR.forEach(o),Fb=s(I,"A",{id:!0}),l(Fb).forEach(o),Z6=a(I,`
| `),vc=s(I,"A",{href:!0});var WR=l(vc);V6=a(WR,"Deployment with multiple GPUs"),WR.forEach(o),Nb=s(I,"A",{id:!0}),l(Nb).forEach(o),X6=a(I,`
| `),yc=s(I,"A",{href:!0});var OR=l(yc);Y6=a(OR,"Deployment with one GPU"),OR.forEach(o),zb=s(I,"A",{id:!0}),l(zb).forEach(o),H6=a(I,`
| `),wc=s(I,"A",{href:!0});var RR=l(wc);Q6=a(RR,"Deployment in Notebooks"),RR.forEach(o),Wb=s(I,"A",{id:!0}),l(Wb).forEach(o),K6=a(I,`
| `),Tc=s(I,"A",{href:!0});var LR=l(Tc);eJ=a(LR,"Configuration"),LR.forEach(o),Ob=s(I,"A",{id:!0}),l(Ob).forEach(o),tJ=a(I,`
| `),Ec=s(I,"A",{href:!0});var BR=l(Ec);oJ=a(BR,"Passing Configuration"),BR.forEach(o),Rb=s(I,"A",{id:!0}),l(Rb).forEach(o),rJ=a(I,`
| `),Ac=s(I,"A",{href:!0});var GR=l(Ac);aJ=a(GR,"Shared Configuration"),GR.forEach(o),Lb=s(I,"A",{id:!0}),l(Lb).forEach(o),nJ=a(I,`
| `),$c=s(I,"A",{href:!0});var ZR=l($c);sJ=a(ZR,"ZeRO"),ZR.forEach(o),Bb=s(I,"A",{id:!0}),l(Bb).forEach(o),lJ=a(I,`
| `),kc=s(I,"A",{href:!0});var VR=l(kc);iJ=a(VR,"ZeRO-2 Config"),VR.forEach(o),Gb=s(I,"A",{id:!0}),l(Gb).forEach(o),dJ=a(I,`
| `),xc=s(I,"A",{href:!0});var XR=l(xc);cJ=a(XR,"ZeRO-3 Config"),XR.forEach(o),Zb=s(I,"A",{id:!0}),l(Zb).forEach(o),pJ=a(I,`
| `),Mc=s(I,"A",{href:!0});var YR=l(Mc);mJ=a(YR,"NVMe Support"),YR.forEach(o),Vb=s(I,"A",{id:!0}),l(Vb).forEach(o),hJ=a(I,`
| `),Ic=s(I,"A",{href:!0});var HR=l(Ic);uJ=a(HR,"ZeRO-2 vs ZeRO-3 Performance"),HR.forEach(o),Xb=s(I,"A",{id:!0}),l(Xb).forEach(o),fJ=a(I,`
| `),Sc=s(I,"A",{href:!0});var QR=l(Sc);gJ=a(QR,"ZeRO-2 Example"),QR.forEach(o),Yb=s(I,"A",{id:!0}),l(Yb).forEach(o),_J=a(I,`
| `),qc=s(I,"A",{href:!0});var KR=l(qc);bJ=a(KR,"ZeRO-3 Example"),KR.forEach(o),Hb=s(I,"A",{id:!0}),l(Hb).forEach(o),vJ=a(I,`
| `),Uc=s(I,"A",{href:!0});var eL=l(Uc);yJ=a(eL,"Optimizer"),eL.forEach(o),Qb=s(I,"A",{id:!0}),l(Qb).forEach(o),wJ=a(I,`
| `),Dc=s(I,"A",{href:!0});var tL=l(Dc);TJ=a(tL,"Scheduler"),tL.forEach(o),Kb=s(I,"A",{id:!0}),l(Kb).forEach(o),EJ=a(I,`
| `),jc=s(I,"A",{href:!0});var oL=l(jc);AJ=a(oL,"fp32 Precision"),oL.forEach(o),ev=s(I,"A",{id:!0}),l(ev).forEach(o),$J=a(I,`
| `),Pc=s(I,"A",{href:!0});var rL=l(Pc);kJ=a(rL,"Automatic Mixed Precision"),rL.forEach(o),tv=s(I,"A",{id:!0}),l(tv).forEach(o),xJ=a(I,`
| `),Jc=s(I,"A",{href:!0});var aL=l(Jc);MJ=a(aL,"Batch Size"),aL.forEach(o),ov=s(I,"A",{id:!0}),l(ov).forEach(o),IJ=a(I,`
| `),Cc=s(I,"A",{href:!0});var nL=l(Cc);SJ=a(nL,"Gradient Accumulation"),nL.forEach(o),rv=s(I,"A",{id:!0}),l(rv).forEach(o),qJ=a(I,`
| `),Fc=s(I,"A",{href:!0});var sL=l(Fc);UJ=a(sL,"Gradient Clipping"),sL.forEach(o),av=s(I,"A",{id:!0}),l(av).forEach(o),DJ=a(I,`
| `),Nc=s(I,"A",{href:!0});var lL=l(Nc);jJ=a(lL,"Getting The Model Weights Out"),lL.forEach(o),nv=s(I,"A",{id:!0}),l(nv).forEach(o),PJ=a(I,`
]`),I.forEach(o),this.h()},h(){m(u,"name","hf:doc:metadata"),m(u,"content",JSON.stringify(UL)),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(ee,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(X,"href","https://github.com/huggingface/transformers/tree/main/examples"),m(X,"rel","nofollow"),m(F,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(se,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Ee,"href","https://github.com/NVIDIA/apex"),m(Ee,"rel","nofollow"),m(Ae,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(Ki,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(ed,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(td,"href","callback"),m(_r,"id","transformers.Trainer"),m(_r,"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(_r,"href","#transformers.Trainer"),m(vo,"class","relative group"),m(od,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),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(yt,"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(Tr,"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(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Er,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ce,"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(ad,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),m(Ar,"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($r,"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(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(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(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(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(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(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(sd,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(ts,"href","https://github.com/pytorch/pytorch/issues/16266"),m(ts,"rel","nofollow"),m(ld,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(id,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(P,"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(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(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(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(St,"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(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(Pr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(dd,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer.log_metrics"),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(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(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(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(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(A,"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,"id","transformers.Seq2SeqTrainer"),m(Cr,"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(Cr,"href","#transformers.Seq2SeqTrainer"),m(So,"class","relative group"),m(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ce,"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(Nr,"id","transformers.TrainingArguments"),m(Nr,"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(Nr,"href","#transformers.TrainingArguments"),m(Po,"class","relative group"),m(cd,"href","/docs/transformers/v4.31.0/en/internal/trainer_utils#transformers.HfArgumentParser"),m(js,"href","https://docs.python.org/3/library/argparse#module-argparse"),m(js,"rel","nofollow"),m(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(zr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(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(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(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(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(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(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(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(Oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Kr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ea,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ta,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(oa,"id","transformers.Seq2SeqTrainingArguments"),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","#transformers.Seq2SeqTrainingArguments"),m(zo,"class","relative group"),m(pd,"href","/docs/transformers/v4.31.0/en/internal/trainer_utils#transformers.HfArgumentParser"),m(tl,"href","https://docs.python.org/3/library/argparse#module-argparse"),m(tl,"rel","nofollow"),m(ra,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(aa,"id","checkpoints"),m(aa,"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(aa,"href","#checkpoints"),m(Ro,"class","relative group"),m(md,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(hd,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.TrainingArguments"),m(ud,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer.train"),m(_d,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.TrainingArguments"),m(da,"id","logging"),m(da,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(da,"href","#logging"),m(Lo,"class","relative group"),m(vd,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(yd,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Ed,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Ad,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m($d,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(ma,"id","randomness"),m(ma,"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(ma,"href","#randomness"),m(Bo,"class","relative group"),m(qd,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(cl,"href","https://pytorch.org/docs/stable/notes/randomness"),m(cl,"rel","nofollow"),m(ha,"id","specific-gpus-selection"),m(ha,"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(ha,"href","#specific-gpus-selection"),m(Go,"class","relative group"),m(ml,"href","https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html"),m(ml,"rel","nofollow"),m(ul,"href","https://github.com/huggingface/accelerate"),m(ul,"rel","nofollow"),m(fl,"href","https://github.com/microsoft/DeepSpeed"),m(fl,"rel","nofollow"),m(Dd,"href","Deepspeed"),m(yl,"href","https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html"),m(yl,"rel","nofollow"),m(kl,"start","2"),m(va,"id","trainer-integrations"),m(va,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(va,"href","#trainer-integrations"),m(Zo,"class","relative group"),m(Gd,"href","/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.Trainer"),m(Sl,"href","https://github.com/microsoft/DeepSpeed"),m(Sl,"rel","nofollow"),m(ql,"href","https://pytorch.org/docs/stable/fsdp.html"),m(ql,"rel","nofollow"),m(Ul,"href","https://arxiv.org/abs/1910.02054"),m(Ul,"rel","nofollow"),m(Zd,"href","#pytorch-fully-sharded-data-parallel"),m(Vd,"id","zero-install-notes"),m(Ta,"id","cuda-extension-installation-notes"),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","#cuda-extension-installation-notes"),m(Vo,"class","relative group"),m(jl,"href","https://github.com/microsoft/DeepSpeed/issues"),m(jl,"rel","nofollow"),m(Aa,"id","possible-problem-1"),m(Aa,"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(Aa,"href","#possible-problem-1"),m(Xo,"class","relative group"),m(Fl,"href","https://www.google.com/search?q=ubuntu+cuda+10.2+install"),m(Fl,"rel","nofollow"),m(ka,"id","possible-problem-2"),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","#possible-problem-2"),m(Yo,"class","relative group"),m(Ma,"id","possible-problem-3"),m(Ma,"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(Ma,"href","#possible-problem-3"),m(Ho,"class","relative group"),m(Sa,"id","pytorch-fully-sharded-data-parallel"),m(Sa,"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(Sa,"href","#pytorch-fully-sharded-data-parallel"),m(Qo,"class","relative group"),m(Gl,"href","https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/"),m(Gl,"rel","nofollow"),m(ri,"href","https://github.com/huggingface/transformers/issues/21667"),m(ri,"rel","nofollow"),m(ja,"id","pytorchxla-fully-sharded-data-parallel"),m(ja,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(ja,"href","#pytorchxla-fully-sharded-data-parallel"),m(or,"class","relative group"),m(ni,"href","https://pytorch.org/blog/scaling-pytorch-models-on-cloud-tpus-with-fsdp/"),m(ni,"rel","nofollow"),m(si,"href","https://github.com/pytorch/xla/tree/master/torch_xla/distributed/fsdp"),m(si,"rel","nofollow"),m(di,"href","https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py"),m(di,"rel","nofollow"),m(Ca,"id","using-trainer-for-accelerated-pytorch-training-on-mac"),m(Ca,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ca,"href","#using-trainer-for-accelerated-pytorch-training-on-mac"),m(rr,"class","relative group"),m(hi,"href","https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/"),m(hi,"rel","nofollow"),m(ui,"href","https://pytorch.org/docs/stable/notes/mps.html"),m(ui,"rel","nofollow"),m(fi,"href","https://medium.com/towards-data-science/gpu-acceleration-comes-to-pytorch-on-m1-macs-195c399efcc1"),m(fi,"rel","nofollow"),m(bi,"href","https://github.com/pytorch/pytorch/issues"),m(bi,"rel","nofollow"),m(za,"id","using-accelerate-launcher-with-trainer"),m(za,"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(za,"href","#using-accelerate-launcher-with-trainer"),m(nr,"class","relative group"),m(ki,"start","4"),m(Ii,"href","https://huggingface.co/docs/accelerate/basic_tutorials/launch"),m(Ii,"rel","nofollow"),m(_c,"href","./deepspeed#deepspeed-trainer-integration"),m(Cb,"id","deepspeed"),m(bc,"href","./deepspeed#deepspeed-installation"),m(Fb,"id","installation"),m(vc,"href","./deepspeed#deepspeed-multi-gpu"),m(Nb,"id","deployment-with-multiple-gpus"),m(yc,"href","./deepspeed#deepspeed-one-gpu"),m(zb,"id","deployment-with-one-gpu"),m(wc,"href","./deepspeed#deepspeed-notebook"),m(Wb,"id","deployment-in-notebooks"),m(Tc,"href","./deepspeed#deepspeed-config"),m(Ob,"id","configuration"),m(Ec,"href","./deepspeed#deepspeed-config-passing"),m(Rb,"id","passing-configuration"),m(Ac,"href","./deepspeed#deepspeed-config-shared"),m(Lb,"id","shared-configuration"),m($c,"href","./deepspeed#deepspeed-zero"),m(Bb,"id","zero"),m(kc,"href","./deepspeed#deepspeed-zero2-config"),m(Gb,"id","zero-2-config"),m(xc,"href","./deepspeed#deepspeed-zero3-config"),m(Zb,"id","zero-3-config"),m(Mc,"href","./deepspeed#deepspeed-nvme"),m(Vb,"id","nvme-support"),m(Ic,"href","./deepspeed#deepspeed-zero2-zero3-performance"),m(Xb,"id","zero-2-vs-zero-3-performance"),m(Sc,"href","./deepspeed#deepspeed-zero2-example"),m(Yb,"id","zero-2-example"),m(qc,"href","./deepspeed#deepspeed-zero3-example"),m(Hb,"id","zero-3-example"),m(Uc,"href","./deepspeed#deepspeed-optimizer"),m(Qb,"id","optimizer"),m(Dc,"href","./deepspeed#deepspeed-scheduler"),m(Kb,"id","scheduler"),m(jc,"href","./deepspeed#deepspeed-fp32"),m(ev,"id","fp32-precision"),m(Pc,"href","./deepspeed#deepspeed-amp"),m(tv,"id","automatic-mixed-precision"),m(Jc,"href","./deepspeed#deepspeed-bs"),m(ov,"id","batch-size"),m(Cc,"href","./deepspeed#deepspeed-grad-acc"),m(rv,"id","gradient-accumulation"),m(Fc,"href","./deepspeed#deepspeed-grad-clip"),m(av,"id","gradient-clipping"),m(Nc,"href","./deepspeed#deepspeed-weight-extraction"),m(nv,"id","getting-the-model-weights-out")},m(t,c){e(document.head,u),p(t,k,c),p(t,T,c),e(T,w),e(w,$),_(h,$,null),e(T,E),e(T,C),e(C,z),p(t,j,c),p(t,R,c),e(R,G),e(R,ee),e(ee,Q),e(R,Y),e(R,X),e(X,ue),e(R,H),p(t,L,c),p(t,W,c),e(W,ne),e(W,F),e(F,we),e(W,Te),e(W,se),e(se,gt),e(W,_t),p(t,ge,c),p(t,je,c),e(je,fn),e(je,Ee),e(Ee,gn),e(je,_n),p(t,le,c),p(t,re,c),e(re,Fi),e(re,Ae),e(Ae,hr),e(re,Ni),p(t,bo,c),p(t,O,c),e(O,ae),e(ae,ur),e(ur,zi),e(ae,Wi),e(O,Oi),e(O,Ri),e(Ri,Hp),e(Hp,o0),e(Ri,r0),e(O,a0),e(O,Li),e(Li,Qp),e(Qp,n0),e(Li,s0),e(O,l0),e(O,Bi),e(Bi,Kp),e(Kp,i0),e(Bi,d0),e(O,c0),e(O,bt),e(bt,em),e(em,p0),e(bt,m0),e(bt,tm),e(tm,h0),e(bt,u0),e(bt,om),e(om,f0),e(bt,g0),e(O,_0),e(O,Gi),e(Gi,rm),e(rm,b0),e(Gi,v0),e(O,y0),e(O,Zi),e(Zi,am),e(am,w0),e(Zi,T0),e(O,E0),e(O,Vi),e(Vi,nm),e(nm,A0),e(Vi,$0),e(O,k0),e(O,Xi),e(Xi,sm),e(sm,x0),e(Xi,M0),e(O,I0),e(O,Yi),e(Yi,lm),e(lm,S0),e(Yi,q0),e(O,U0),e(O,Hi),e(Hi,im),e(im,D0),e(Hi,j0),e(O,P0),e(O,Qi),e(Qi,dm),e(dm,J0),e(Qi,C0),p(t,Ev,c),_(fr,t,c),p(t,Av,c),p(t,gr,c),e(gr,F0),e(gr,Ki),e(Ki,N0),e(gr,z0),p(t,$v,c),_(bn,t,c),p(t,kv,c),p(t,vt,c),e(vt,W0),e(vt,ed),e(ed,O0),e(vt,R0),e(vt,td),e(td,L0),e(vt,B0),p(t,xv,c),p(t,vo,c),e(vo,_r),e(_r,cm),_(vn,cm,null),e(vo,G0),e(vo,pm),e(pm,Z0),p(t,Mv,c),p(t,A,c),_(yn,A,null),e(A,V0),e(A,mm),e(mm,X0),e(A,Y0),e(A,hm),e(hm,H0),e(A,Q0),e(A,$e),e($e,br),e(br,um),e(um,K0),e(br,e2),e(br,od),e(od,t2),e(br,o2),e($e,r2),e($e,ie),e(ie,fm),e(fm,a2),e(ie,n2),e(ie,gm),e(gm,s2),e(ie,l2),e(ie,_m),e(_m,i2),e(ie,d2),e(ie,bm),e(bm,c2),e(ie,p2),e(ie,vm),e(vm,m2),e(ie,h2),e(ie,ym),e(ym,u2),e(ie,f2),e($e,g2),e($e,rd),e(rd,wm),e(wm,_2),e(rd,b2),e($e,v2),e($e,Pe),e(Pe,Tm),e(Tm,y2),e(Pe,w2),e(Pe,Em),e(Em,T2),e(Pe,E2),e(Pe,Am),e(Am,A2),e(Pe,$2),e(Pe,$m),e($m,k2),e(Pe,x2),e($e,M2),e($e,Je),e(Je,km),e(km,I2),e(Je,S2),e(Je,xm),e(xm,q2),e(Je,U2),e(Je,Mm),e(Mm,D2),e(Je,j2),e(Je,Im),e(Im,P2),e(Je,J2),e(A,C2),e(A,vr),_(wn,vr,null),e(vr,F2),e(vr,Tn),e(Tn,N2),e(Tn,Sm),e(Sm,z2),e(Tn,W2),e(A,O2),e(A,yr),_(En,yr,null),e(yr,R2),e(yr,An),e(An,L2),e(An,qm),e(qm,B2),e(An,G2),e(A,Z2),e(A,yt),_($n,yt,null),e(yt,V2),e(yt,Um),e(Um,X2),e(yt,Y2),e(yt,Dm),e(Dm,H2),e(A,Q2),e(A,wr),_(kn,wr,null),e(wr,K2),e(wr,jm),e(jm,eE),e(A,tE),e(A,Tr),_(xn,Tr,null),e(Tr,oE),e(Tr,Mn),e(Mn,rE),e(Mn,Pm),e(Pm,aE),e(Mn,nE),e(A,sE),e(A,wt),_(In,wt,null),e(wt,lE),e(wt,Jm),e(Jm,iE),e(wt,dE),e(wt,Sn),e(Sn,cE),e(Sn,Cm),e(Cm,pE),e(Sn,mE),e(A,hE),e(A,Tt),_(qn,Tt,null),e(Tt,uE),e(Tt,Fm),e(Fm,fE),e(Tt,gE),e(Tt,nt),e(nt,_E),e(nt,Nm),e(Nm,bE),e(nt,vE),e(nt,zm),e(zm,yE),e(nt,wE),e(nt,Wm),e(Wm,TE),e(nt,EE),e(A,AE),e(A,Er),_(Un,Er,null),e(Er,$E),e(Er,Om),e(Om,kE),e(A,xE),e(A,Ce),_(Dn,Ce,null),e(Ce,ME),e(Ce,Rm),e(Rm,IE),e(Ce,SE),e(Ce,jn),e(jn,qE),e(jn,Lm),e(Lm,UE),e(jn,DE),e(Ce,jE),e(Ce,Bm),e(Bm,PE),e(A,JE),e(A,Et),_(Pn,Et,null),e(Et,CE),e(Et,yo),e(yo,FE),e(yo,Gm),e(Gm,NE),e(yo,zE),e(yo,Zm),e(Zm,WE),e(yo,OE),e(Et,RE),e(Et,Vm),e(Vm,LE),e(A,BE),e(A,Ar),_(Jn,Ar,null),e(Ar,GE),e(Ar,Cn),e(Cn,ZE),e(Cn,ad),e(ad,VE),e(Cn,XE),e(A,YE),e(A,At),_(Fn,At,null),e(At,HE),e(At,Nn),e(Nn,QE),e(Nn,Xm),e(Xm,KE),e(Nn,e4),e(At,t4),e(At,Ym),e(Ym,o4),e(A,r4),e(A,$r),_(zn,$r,null),e($r,a4),e($r,Hm),e(Hm,n4),e(A,s4),e(A,$t),_(Wn,$t,null),e($t,l4),e($t,On),e(On,i4),e(On,Qm),e(Qm,d4),e(On,c4),e($t,p4),e($t,Km),e(Km,m4),e(A,h4),e(A,Fe),_(Rn,Fe,null),e(Fe,u4),e(Fe,Ln),e(Ln,f4),e(Ln,eh),e(eh,g4),e(Ln,_4),e(Fe,b4),e(Fe,wo),e(wo,v4),e(wo,th),e(th,y4),e(wo,w4),e(wo,oh),e(oh,T4),e(wo,E4),e(Fe,A4),e(Fe,rh),e(rh,$4),e(A,k4),e(A,kt),_(Bn,kt,null),e(kt,x4),e(kt,ke),e(ke,M4),e(ke,ah),e(ah,I4),e(ke,S4),e(ke,nh),e(nh,q4),e(ke,U4),e(ke,sh),e(sh,D4),e(ke,j4),e(ke,lh),e(lh,P4),e(ke,J4),e(kt,C4),_(kr,kt,null),e(A,F4),e(A,xr),_(Gn,xr,null),e(xr,N4),e(xr,Zn),e(Zn,z4),e(Zn,ih),e(ih,W4),e(Zn,O4),e(A,R4),e(A,Mr),_(Vn,Mr,null),e(Mr,L4),e(Mr,dh),e(dh,B4),e(A,G4),e(A,Ir),_(Xn,Ir,null),e(Ir,Z4),e(Ir,Yn),e(Yn,V4),e(Yn,ch),e(ch,X4),e(Yn,Y4),e(A,H4),e(A,xt),_(Hn,xt,null),e(xt,Q4),e(xt,Qn),e(Qn,K4),e(Qn,ph),e(ph,eA),e(Qn,tA),e(xt,oA),e(xt,mh),e(mh,rA),e(A,aA),e(A,P),_(Kn,P,null),e(P,nA),e(P,hh),e(hh,sA),e(P,lA),e(P,uh),e(uh,iA),e(P,dA),e(P,fh),e(fh,cA),e(P,pA),e(P,To),e(To,mA),e(To,gh),e(gh,hA),e(To,uA),e(To,_h),e(_h,fA),e(To,gA),e(P,_A),_(Sr,P,null),e(P,bA),e(P,bh),e(bh,vh),e(vh,vA),e(P,yA),e(P,st),e(st,xe),e(xe,wA),e(xe,yh),e(yh,TA),e(xe,EA),e(xe,wh),e(wh,AA),e(xe,$A),e(xe,Th),e(Th,kA),e(xe,xA),e(xe,Eh),e(Eh,MA),e(xe,IA),e(st,SA),e(st,Eo),e(Eo,qA),e(Eo,Ah),e(Ah,UA),e(Eo,DA),e(Eo,$h),e($h,jA),e(Eo,PA),e(st,JA),e(st,nd),e(nd,kh),e(kh,CA),e(nd,FA),e(st,NA),e(st,Mt),e(Mt,xh),e(xh,zA),e(Mt,WA),e(Mt,Mh),e(Mh,OA),e(Mt,RA),e(Mt,Ih),e(Ih,LA),e(Mt,BA),e(P,GA),e(P,Sh),e(Sh,ZA),e(P,VA),e(P,qh),e(qh,XA),e(P,YA),e(P,es),e(es,HA),e(es,Uh),e(Uh,QA),e(es,KA),e(P,e3),e(P,lt),e(lt,t3),e(lt,Dh),e(Dh,o3),e(lt,r3),e(lt,jh),e(jh,a3),e(lt,n3),e(lt,Ph),e(Ph,s3),e(lt,l3),e(P,i3),e(P,fe),e(fe,d3),e(fe,sd),e(sd,c3),e(fe,p3),e(fe,Jh),e(Jh,m3),e(fe,h3),e(fe,Ch),e(Ch,u3),e(fe,f3),e(fe,Fh),e(Fh,g3),e(fe,_3),e(fe,Nh),e(Nh,b3),e(fe,v3),e(P,y3),e(P,Z),e(Z,w3),e(Z,zh),e(zh,T3),e(Z,E3),e(Z,Wh),e(Wh,A3),e(Z,$3),e(Z,Oh),e(Oh,k3),e(Z,x3),e(Z,Rh),e(Rh,M3),e(Z,I3),e(Z,ts),e(ts,S3),e(Z,q3),e(Z,Lh),e(Lh,U3),e(Z,D3),e(Z,Bh),e(Bh,j3),e(Z,P3),e(Z,Gh),e(Gh,J3),e(Z,C3),e(Z,Zh),e(Zh,F3),e(Z,N3),e(Z,Vh),e(Vh,z3),e(Z,W3),e(P,O3),e(P,Me),e(Me,R3),e(Me,ld),e(ld,L3),e(Me,B3),e(Me,Xh),e(Xh,G3),e(Me,Z3),e(Me,id),e(id,V3),e(Me,X3),e(Me,Yh),e(Yh,Y3),e(Me,H3),e(P,Q3),e(P,Hh),e(Hh,K3),e(A,e$),e(A,qr),_(os,qr,null),e(qr,t$),e(qr,Qh),e(Qh,o$),e(A,r$),e(A,Ur),_(rs,Ur,null),e(Ur,a$),e(Ur,as),e(as,n$),e(as,Kh),e(Kh,s$),e(as,l$),e(A,i$),e(A,It),_(ns,It,null),e(It,d$),e(It,ss),e(ss,c$),e(ss,eu),e(eu,p$),e(ss,m$),e(It,h$),e(It,ls),e(ls,u$),e(ls,tu),e(tu,f$),e(ls,g$),e(A,_$),e(A,de),_(is,de,null),e(de,b$),e(de,ou),e(ou,v$),e(de,y$),e(de,ds),e(ds,w$),e(ds,ru),e(ru,T$),e(ds,E$),e(de,A$),_(Dr,de,null),e(de,$$),e(de,cs),e(cs,k$),e(cs,au),e(au,x$),e(cs,M$),e(de,I$),e(de,Ao),e(Ao,$o),e($o,S$),e($o,nu),e(nu,q$),e($o,U$),e($o,su),e(su,D$),e($o,j$),e(Ao,P$),e(Ao,ko),e(ko,J$),e(ko,lu),e(lu,C$),e(ko,F$),e(ko,iu),e(iu,N$),e(ko,z$),e(Ao,W$),e(Ao,xo),e(xo,O$),e(xo,du),e(du,R$),e(xo,L$),e(xo,cu),e(cu,B$),e(xo,G$),e(A,Z$),e(A,St),_(ps,St,null),e(St,V$),e(St,Mo),e(Mo,X$),e(Mo,pu),e(pu,Y$),e(Mo,H$),e(Mo,mu),e(mu,Q$),e(Mo,K$),e(St,ek),e(St,hu),e(hu,tk),e(A,ok),e(A,qt),_(ms,qt,null),e(qt,rk),e(qt,Io),e(Io,ak),e(Io,uu),e(uu,nk),e(Io,sk),e(Io,fu),e(fu,lk),e(Io,ik),e(qt,dk),e(qt,gu),e(gu,ck),e(A,pk),e(A,jr),_(hs,jr,null),e(jr,mk),e(jr,it),e(it,hk),e(it,_u),e(_u,uk),e(it,fk),e(it,bu),e(bu,gk),e(it,_k),e(it,vu),e(vu,bk),e(it,vk),e(A,yk),e(A,Pr),_(us,Pr,null),e(Pr,wk),e(Pr,fs),e(fs,Tk),e(fs,yu),e(yu,Ek),e(fs,Ak),e(A,$k),e(A,Ne),_(gs,Ne,null),e(Ne,kk),e(Ne,_s),e(_s,xk),e(_s,wu),e(wu,Mk),e(_s,Ik),e(Ne,Sk),e(Ne,Tu),e(Tu,qk),e(Ne,Uk),e(Ne,bs),e(bs,Dk),e(bs,dd),e(dd,jk),e(bs,Pk),e(A,Jk),e(A,Ut),_(vs,Ut,null),e(Ut,Ck),e(Ut,ys),e(ys,Fk),e(ys,Eu),e(Eu,Nk),e(ys,zk),e(Ut,Wk),e(Ut,Au),e(Au,Ok),e(A,Rk),e(A,Dt),_(ws,Dt,null),e(Dt,Lk),e(Dt,$u),e($u,Bk),e(Dt,Gk),e(Dt,ku),e(ku,Zk),e(A,Vk),e(A,Jr),_(Ts,Jr,null),e(Jr,Xk),e(Jr,xu),e(xu,Yk),e(A,Hk),e(A,jt),_(Es,jt,null),e(jt,Qk),e(jt,Mu),e(Mu,Kk),e(jt,ex),e(jt,Iu),e(Iu,tx),p(t,Iv,c),p(t,So,c),e(So,Cr),e(Cr,Su),_(As,Su,null),e(So,ox),e(So,qu),e(qu,rx),p(t,Sv,c),p(t,dt,c),_($s,dt,null),e(dt,ax),e(dt,ze),_(ks,ze,null),e(ze,nx),e(ze,Uu),e(Uu,sx),e(ze,lx),e(ze,xs),e(xs,ix),e(xs,Du),e(Du,dx),e(xs,cx),e(ze,px),e(ze,ju),e(ju,mx),e(dt,hx),e(dt,ce),_(Ms,ce,null),e(ce,ux),e(ce,Pu),e(Pu,fx),e(ce,gx),e(ce,Is),e(Is,_x),e(Is,Ju),e(Ju,bx),e(Is,vx),e(ce,yx),_(Fr,ce,null),e(ce,wx),e(ce,Ss),e(Ss,Tx),e(Ss,Cu),e(Cu,Ex),e(Ss,Ax),e(ce,$x),e(ce,qo),e(qo,Uo),e(Uo,kx),e(Uo,Fu),e(Fu,xx),e(Uo,Mx),e(Uo,Nu),e(Nu,Ix),e(Uo,Sx),e(qo,qx),e(qo,Do),e(Do,Ux),e(Do,zu),e(zu,Dx),e(Do,jx),e(Do,Wu),e(Wu,Px),e(Do,Jx),e(qo,Cx),e(qo,jo),e(jo,Fx),e(jo,Ou),e(Ou,Nx),e(jo,zx),e(jo,Ru),e(Ru,Wx),e(jo,Ox),p(t,qv,c),p(t,Po,c),e(Po,Nr),e(Nr,Lu),_(qs,Lu,null),e(Po,Rx),e(Po,Bu),e(Bu,Lx),p(t,Uv,c),p(t,q,c),_(Us,q,null),e(q,Bx),e(q,Ds),e(Ds,Gx),e(Ds,Gu),e(Gu,Zx),e(Ds,Vx),e(q,Xx),e(q,Jo),e(Jo,Yx),e(Jo,cd),e(cd,Hx),e(Jo,Qx),e(Jo,js),e(js,Kx),e(Jo,eM),e(q,tM),e(q,_e),_(Ps,_e,null),e(_e,oM),e(_e,Zu),e(Zu,rM),e(_e,aM),e(_e,Co),e(Co,nM),e(Co,Vu),e(Vu,sM),e(Co,lM),e(Co,Xu),e(Xu,iM),e(Co,dM),e(_e,cM),e(_e,Fo),e(Fo,pM),e(Fo,Yu),e(Yu,mM),e(Fo,hM),e(Fo,Hu),e(Hu,uM),e(Fo,fM),e(_e,gM),e(_e,Js),e(Js,_M),e(Js,Qu),e(Qu,bM),e(Js,vM),e(q,yM),e(q,zr),_(Cs,zr,null),e(zr,wM),e(zr,Ku),e(Ku,TM),e(q,EM),e(q,Pt),_(Fs,Pt,null),e(Pt,AM),e(Pt,ef),e(ef,$M),e(Pt,kM),e(Pt,No),e(No,xM),e(No,tf),e(tf,MM),e(No,IM),e(No,of),e(of,SM),e(No,qM),e(q,UM),e(q,Jt),_(Ns,Jt,null),e(Jt,DM),e(Jt,rf),e(rf,jM),e(Jt,PM),_(Wr,Jt,null),e(q,JM),e(q,Ct),_(zs,Ct,null),e(Ct,CM),e(Ct,af),e(af,FM),e(Ct,NM),_(Or,Ct,null),e(q,zM),e(q,Ft),_(Ws,Ft,null),e(Ft,WM),e(Ft,nf),e(nf,OM),e(Ft,RM),_(Rr,Ft,null),e(q,LM),e(q,Nt),_(Os,Nt,null),e(Nt,BM),e(Nt,sf),e(sf,GM),e(Nt,ZM),_(Lr,Nt,null),e(q,VM),e(q,zt),_(Rs,zt,null),e(zt,XM),e(zt,lf),e(lf,YM),e(zt,HM),_(Br,zt,null),e(q,QM),e(q,We),_(Ls,We,null),e(We,KM),e(We,df),e(df,e5),e(We,t5),_(Gr,We,null),e(We,o5),_(Zr,We,null),e(q,r5),e(q,Wt),_(Bs,Wt,null),e(Wt,a5),e(Wt,cf),e(cf,n5),e(Wt,s5),_(Vr,Wt,null),e(q,l5),e(q,Oe),_(Gs,Oe,null),e(Oe,i5),e(Oe,pf),e(pf,d5),e(Oe,c5),_(Xr,Oe,null),e(Oe,p5),_(Yr,Oe,null),e(q,m5),e(q,Re),_(Zs,Re,null),e(Re,h5),e(Re,mf),e(mf,u5),e(Re,f5),_(Hr,Re,null),e(Re,g5),_(Qr,Re,null),e(q,_5),e(q,Kr),_(Vs,Kr,null),e(Kr,b5),e(Kr,Xs),e(Xs,v5),e(Xs,hf),e(hf,y5),e(Xs,w5),e(q,T5),e(q,ea),_(Ys,ea,null),e(ea,E5),e(ea,uf),e(uf,A5),e(q,$5),e(q,ta),_(Hs,ta,null),e(ta,k5),e(ta,ff),e(ff,x5),p(t,Dv,c),p(t,zo,c),e(zo,oa),e(oa,gf),_(Qs,gf,null),e(zo,M5),e(zo,_f),e(_f,I5),p(t,jv,c),p(t,Ie,c),_(Ks,Ie,null),e(Ie,S5),e(Ie,el),e(el,q5),e(el,bf),e(bf,U5),e(el,D5),e(Ie,j5),e(Ie,Wo),e(Wo,P5),e(Wo,pd),e(pd,J5),e(Wo,C5),e(Wo,tl),e(tl,F5),e(Wo,N5),e(Ie,z5),e(Ie,ra),_(ol,ra,null),e(ra,W5),e(ra,Oo),e(Oo,O5),e(Oo,vf),e(vf,R5),e(Oo,L5),e(Oo,yf),e(yf,B5),e(Oo,G5),p(t,Pv,c),p(t,Ro,c),e(Ro,aa),e(aa,wf),_(rl,wf,null),e(Ro,Z5),e(Ro,Tf),e(Tf,V5),p(t,Jv,c),p(t,be,c),e(be,X5),e(be,md),e(md,Y5),e(be,H5),e(be,Ef),e(Ef,Q5),e(be,K5),e(be,hd),e(hd,eI),e(be,tI),e(be,Af),e(Af,oI),e(be,rI),p(t,Cv,c),p(t,na,c),e(na,aI),e(na,ud),e(ud,nI),e(na,sI),p(t,Fv,c),p(t,sa,c),e(sa,fd),e(fd,$f),e($f,lI),e(fd,iI),e(sa,dI),e(sa,gd),e(gd,kf),e(kf,cI),e(gd,pI),p(t,Nv,c),p(t,Le,c),e(Le,mI),e(Le,xf),e(xf,hI),e(Le,uI),e(Le,Mf),e(Mf,fI),e(Le,gI),e(Le,_d),e(_d,_I),e(Le,bI),p(t,zv,c),p(t,la,c),e(la,ia),e(ia,If),e(If,vI),e(ia,yI),e(ia,Sf),e(Sf,wI),e(ia,TI),e(la,EI),e(la,bd),e(bd,qf),e(qf,AI),e(bd,$I),p(t,Wv,c),p(t,Lo,c),e(Lo,da),e(da,Uf),_(al,Uf,null),e(Lo,kI),e(Lo,Df),e(Df,xI),p(t,Ov,c),p(t,Be,c),e(Be,MI),e(Be,vd),e(vd,II),e(Be,SI),e(Be,jf),e(jf,qI),e(Be,UI),e(Be,Pf),e(Pf,DI),e(Be,jI),p(t,Rv,c),p(t,Ot,c),e(Ot,PI),e(Ot,Jf),e(Jf,JI),e(Ot,CI),e(Ot,yd),e(yd,FI),e(Ot,NI),p(t,Lv,c),p(t,ca,c),e(ca,wd),e(wd,Cf),e(Cf,zI),e(wd,WI),e(ca,OI),e(ca,Td),e(Td,Ff),e(Ff,RI),e(Td,LI),p(t,Bv,c),p(t,Ge,c),e(Ge,BI),e(Ge,Ed),e(Ed,GI),e(Ge,ZI),e(Ge,Nf),e(Nf,VI),e(Ge,XI),e(Ge,zf),e(zf,YI),e(Ge,HI),p(t,Gv,c),p(t,pe,c),e(pe,QI),e(pe,Ad),e(Ad,KI),e(pe,e9),e(pe,Wf),e(Wf,t9),e(pe,o9),e(pe,Of),e(Of,r9),e(pe,a9),e(pe,Rf),e(Rf,n9),e(pe,s9),e(pe,$d),e($d,l9),e(pe,i9),p(t,Zv,c),p(t,kd,c),e(kd,d9),p(t,Vv,c),_(nl,t,c),p(t,Xv,c),p(t,xd,c),e(xd,c9),p(t,Yv,c),_(sl,t,c),p(t,Hv,c),p(t,Md,c),e(Md,p9),p(t,Qv,c),_(ll,t,c),p(t,Kv,c),p(t,Id,c),e(Id,m9),p(t,ey,c),p(t,Sd,c),e(Sd,h9),p(t,ty,c),_(il,t,c),p(t,oy,c),p(t,pa,c),e(pa,u9),e(pa,Lf),e(Lf,f9),e(pa,g9),p(t,ry,c),p(t,Bo,c),e(Bo,ma),e(ma,Bf),_(dl,Bf,null),e(Bo,_9),e(Bo,Gf),e(Gf,b9),p(t,ay,c),p(t,ve,c),e(ve,v9),e(ve,qd),e(qd,y9),e(ve,w9),e(ve,Zf),e(Zf,T9),e(ve,E9),e(ve,Vf),e(Vf,A9),e(ve,$9),e(ve,Xf),e(Xf,k9),e(ve,x9),p(t,ny,c),p(t,Rt,c),e(Rt,M9),e(Rt,cl),e(cl,I9),e(Rt,S9),e(Rt,Yf),e(Yf,q9),e(Rt,U9),p(t,sy,c),p(t,Go,c),e(Go,ha),e(ha,Hf),_(pl,Hf,null),e(Go,D9),e(Go,Qf),e(Qf,j9),p(t,ly,c),p(t,Ud,c),e(Ud,P9),p(t,iy,c),p(t,ua,c),e(ua,J9),e(ua,ml),e(ml,Kf),e(Kf,C9),e(ua,F9),p(t,dy,c),_(hl,t,c),p(t,cy,c),p(t,Lt,c),e(Lt,N9),e(Lt,ul),e(ul,eg),e(eg,z9),e(Lt,W9),e(Lt,fl),e(fl,tg),e(tg,O9),e(Lt,R9),p(t,py,c),_(gl,t,c),p(t,my,c),_(_l,t,c),p(t,hy,c),p(t,fa,c),e(fa,L9),e(fa,Dd),e(Dd,B9),e(fa,G9),p(t,uy,c),p(t,jd,c),e(jd,Z9),p(t,fy,c),p(t,Pd,c),e(Pd,V9),p(t,gy,c),p(t,Jd,c),e(Jd,og),e(og,rg),e(rg,X9),p(t,_y,c),p(t,ga,c),e(ga,Y9),e(ga,ag),e(ag,H9),e(ga,Q9),p(t,by,c),p(t,Cd,c),e(Cd,K9),p(t,vy,c),_(bl,t,c),p(t,yy,c),p(t,Bt,c),e(Bt,eS),e(Bt,ng),e(ng,tS),e(Bt,oS),e(Bt,sg),e(sg,rS),e(Bt,aS),p(t,wy,c),p(t,Fd,c),e(Fd,nS),p(t,Ty,c),_(vl,t,c),p(t,Ey,c),p(t,Gt,c),e(Gt,sS),e(Gt,lg),e(lg,lS),e(Gt,iS),e(Gt,ig),e(ig,dS),e(Gt,cS),p(t,Ay,c),p(t,Zt,c),e(Zt,pS),e(Zt,dg),e(dg,mS),e(Zt,hS),e(Zt,yl),e(yl,cg),e(cg,uS),e(Zt,fS),p(t,$y,c),_(wl,t,c),p(t,ky,c),p(t,Nd,c),e(Nd,gS),p(t,xy,c),_(Tl,t,c),p(t,My,c),p(t,zd,c),e(zd,_S),p(t,Iy,c),_(El,t,c),p(t,Sy,c),p(t,Wd,c),e(Wd,bS),p(t,qy,c),p(t,Od,c),e(Od,pg),e(pg,mg),e(mg,vS),p(t,Uy,c),p(t,_a,c),e(_a,yS),e(_a,hg),e(hg,wS),e(_a,TS),p(t,Dy,c),p(t,Rd,c),e(Rd,Al),e(Al,ES),e(Al,ug),e(ug,AS),e(Al,$S),p(t,jy,c),_($l,t,c),p(t,Py,c),p(t,kl,c),e(kl,fg),e(fg,kS),p(t,Jy,c),_(xl,t,c),p(t,Cy,c),p(t,Vt,c),e(Vt,xS),e(Vt,gg),e(gg,MS),e(Vt,IS),e(Vt,_g),e(_g,SS),e(Vt,qS),p(t,Fy,c),p(t,Ld,c),e(Ld,US),p(t,Ny,c),_(Ml,t,c),p(t,zy,c),p(t,Bd,c),e(Bd,DS),p(t,Wy,c),p(t,ba,c),e(ba,jS),e(ba,bg),e(bg,PS),e(ba,JS),p(t,Oy,c),p(t,Zo,c),e(Zo,va),e(va,vg),_(Il,vg,null),e(Zo,CS),e(Zo,yg),e(yg,FS),p(t,Ry,c),p(t,ya,c),e(ya,NS),e(ya,Gd),e(Gd,zS),e(ya,WS),p(t,Ly,c),p(t,Ze,c),e(Ze,OS),e(Ze,Sl),e(Sl,RS),e(Ze,LS),e(Ze,ql),e(ql,BS),e(Ze,GS),e(Ze,Ul),e(Ul,ZS),e(Ze,VS),p(t,By,c),p(t,wa,c),e(wa,XS),e(wa,Zd),e(Zd,YS),e(wa,HS),p(t,Gy,c),p(t,Vd,c),p(t,Zy,c),p(t,Vo,c),e(Vo,Ta),e(Ta,wg),_(Dl,wg,null),e(Vo,QS),e(Vo,Tg),e(Tg,KS),p(t,Vy,c),p(t,Xd,c),e(Xd,eq),p(t,Xy,c),p(t,Ea,c),e(Ea,tq),e(Ea,jl),e(jl,oq),e(Ea,rq),p(t,Yy,c),p(t,Yd,c),e(Yd,aq),p(t,Hy,c),_(Pl,t,c),p(t,Qy,c),p(t,Hd,c),e(Hd,nq),p(t,Ky,c),p(t,Xt,c),e(Xt,sq),e(Xt,Eg),e(Eg,lq),e(Xt,iq),e(Xt,Ag),e(Ag,dq),e(Xt,cq),p(t,e1,c),p(t,Xo,c),e(Xo,Aa),e(Aa,$g),_(Jl,$g,null),e(Xo,pq),e(Xo,kg),e(kg,mq),p(t,t1,c),p(t,Qd,c),e(Qd,hq),p(t,o1,c),p(t,Ve,c),e(Ve,uq),e(Ve,xg),e(xg,fq),e(Ve,gq),e(Ve,Mg),e(Mg,_q),e(Ve,bq),e(Ve,Ig),e(Ig,vq),e(Ve,yq),p(t,r1,c),p(t,Yt,c),e(Yt,wq),e(Yt,Sg),e(Sg,Tq),e(Yt,Eq),e(Yt,qg),e(qg,Aq),e(Yt,$q),p(t,a1,c),_(Cl,t,c),p(t,n1,c),p(t,$a,c),e($a,kq),e($a,Fl),e(Fl,xq),e($a,Mq),p(t,s1,c),p(t,Yo,c),e(Yo,ka),e(ka,Ug),_(Nl,Ug,null),e(Yo,Iq),e(Yo,Dg),e(Dg,Sq),p(t,l1,c),p(t,Kd,c),e(Kd,qq),p(t,i1,c),_(zl,t,c),p(t,d1,c),p(t,Ht,c),e(Ht,Uq),e(Ht,jg),e(jg,Dq),e(Ht,jq),e(Ht,Pg),e(Pg,Pq),e(Ht,Jq),p(t,c1,c),p(t,ec,c),e(ec,Cq),p(t,p1,c),_(Wl,t,c),p(t,m1,c),p(t,tc,c),e(tc,Fq),p(t,h1,c),p(t,xa,c),e(xa,Nq),e(xa,Jg),e(Jg,zq),e(xa,Wq),p(t,u1,c),p(t,ct,c),e(ct,Cg),e(Cg,Oq),e(ct,Rq),e(ct,Fg),e(Fg,Lq),e(ct,Bq),e(ct,Ng),e(Ng,Gq),e(ct,Zq),p(t,f1,c),p(t,oc,c),e(oc,Vq),p(t,g1,c),_(Ol,t,c),p(t,_1,c),p(t,rc,c),e(rc,Xq),p(t,b1,c),p(t,Xe,c),e(Xe,Yq),e(Xe,zg),e(zg,Hq),e(Xe,Qq),e(Xe,Wg),e(Wg,Kq),e(Xe,eU),e(Xe,Og),e(Og,tU),e(Xe,oU),p(t,v1,c),p(t,Ho,c),e(Ho,Ma),e(Ma,Rg),_(Rl,Rg,null),e(Ho,rU),e(Ho,Lg),e(Lg,aU),p(t,y1,c),p(t,Qt,c),e(Qt,nU),e(Qt,Bg),e(Bg,sU),e(Qt,lU),e(Qt,Gg),e(Gg,iU),e(Qt,dU),p(t,w1,c),p(t,ac,c),e(ac,cU),p(t,T1,c),p(t,nc,c),e(nc,pU),p(t,E1,c),p(t,Ia,c),e(Ia,mU),e(Ia,Zg),e(Zg,hU),e(Ia,uU),p(t,A1,c),_(Ll,t,c),p(t,$1,c),p(t,te,c),e(te,fU),e(te,Vg),e(Vg,gU),e(te,_U),e(te,Xg),e(Xg,bU),e(te,vU),e(te,Yg),e(Yg,yU),e(te,wU),e(te,Hg),e(Hg,TU),e(te,EU),e(te,Qg),e(Qg,AU),e(te,$U),e(te,Kg),e(Kg,kU),e(te,xU),p(t,k1,c),p(t,sc,c),e(sc,MU),p(t,x1,c),p(t,Qo,c),e(Qo,Sa),e(Sa,e_),_(Bl,e_,null),e(Qo,IU),e(Qo,t_),e(t_,SU),p(t,M1,c),p(t,qa,c),e(qa,qU),e(qa,Gl),e(Gl,UU),e(qa,DU),p(t,I1,c),p(t,Zl,c),e(Zl,o_),e(o_,jU),e(Zl,PU),p(t,S1,c),p(t,Vl,c),e(Vl,r_),e(r_,JU),e(Vl,CU),p(t,q1,c),p(t,me,c),e(me,a_),e(a_,Xl),e(Xl,FU),e(Xl,n_),e(n_,NU),e(Xl,zU),e(me,WU),e(me,Yl),e(Yl,lc),e(lc,s_),e(s_,OU),e(lc,RU),e(Yl,LU),e(Yl,Ko),e(Ko,Hl),e(Hl,BU),e(Hl,l_),e(l_,GU),e(Hl,ZU),e(Ko,VU),e(Ko,Ql),e(Ql,XU),e(Ql,i_),e(i_,YU),e(Ql,HU),e(Ko,QU),e(Ko,Kl),e(Kl,KU),e(Kl,d_),e(d_,eD),e(Kl,tD),e(me,oD),e(me,c_),e(c_,er),e(er,rD),e(er,p_),e(p_,aD),e(er,nD),e(er,m_),e(m_,sD),e(er,lD),e(me,iD),e(me,h_),e(h_,pt),e(pt,dD),e(pt,u_),e(u_,cD),e(pt,pD),e(pt,f_),e(f_,mD),e(pt,hD),e(pt,g_),e(g_,uD),e(pt,fD),e(me,gD),e(me,__),e(__,tr),e(tr,_D),e(tr,b_),e(b_,bD),e(tr,vD),e(tr,v_),e(v_,yD),e(tr,wD),e(me,TD),e(me,ei),e(ei,mt),e(mt,ED),e(mt,y_),e(y_,AD),e(mt,$D),e(mt,w_),e(w_,kD),e(mt,xD),e(mt,T_),e(T_,MD),e(mt,ID),e(ei,SD),e(ei,ht),e(ht,ic),e(ic,qD),e(ic,ti),e(ti,Se),e(Se,UD),e(Se,E_),e(E_,DD),e(Se,jD),e(Se,A_),e(A_,PD),e(Se,JD),e(Se,$_),e($_,CD),e(Se,FD),e(Se,k_),e(k_,ND),e(Se,zD),e(ti,WD),e(ti,oi),e(oi,OD),e(oi,x_),e(x_,RD),e(oi,LD),e(ht,BD),e(ht,ut),e(ut,M_),e(M_,GD),e(ut,ZD),e(ut,I_),e(I_,VD),e(ut,XD),e(ut,S_),e(S_,YD),e(ut,HD),e(ut,q_),e(q_,QD),e(ht,KD),e(ht,Ua),e(Ua,U_),e(U_,ej),e(Ua,tj),e(Ua,D_),e(D_,oj),e(Ua,rj),e(ht,aj),e(ht,Da),e(Da,j_),e(j_,nj),e(Da,sj),e(Da,P_),e(P_,lj),e(Da,ij),p(t,U1,c),p(t,dc,c),e(dc,J_),e(J_,dj),p(t,D1,c),p(t,cc,c),e(cc,Ye),e(Ye,cj),e(Ye,C_),e(C_,pj),e(Ye,mj),e(Ye,F_),e(F_,hj),e(Ye,uj),e(Ye,fj),e(Ye,gj),e(Ye,ri),e(ri,_j),p(t,j1,c),p(t,or,c),e(or,ja),e(ja,N_),_(ai,N_,null),e(or,bj),e(or,z_),e(z_,vj),p(t,P1,c),p(t,Kt,c),e(Kt,yj),e(Kt,ni),e(ni,wj),e(Kt,Tj),e(Kt,si),e(si,Ej),e(Kt,Aj),p(t,J1,c),p(t,li,c),e(li,W_),e(W_,$j),e(li,kj),p(t,C1,c),p(t,ii,c),e(ii,O_),e(O_,xj),e(ii,Mj),p(t,F1,c),p(t,eo,c),e(eo,Ij),e(eo,R_),e(R_,Sj),e(eo,qj),e(eo,L_),e(L_,Uj),e(eo,Dj),p(t,N1,c),p(t,He,c),e(He,Pa),e(Pa,B_),e(B_,jj),e(Pa,Pj),e(Pa,G_),e(G_,Jj),e(Pa,Cj),e(He,Fj),e(He,Ja),e(Ja,Z_),e(Z_,Nj),e(Ja,zj),e(Ja,di),e(di,Wj),e(Ja,Oj),e(He,Rj),e(He,Qe),e(Qe,V_),e(V_,Lj),e(Qe,Bj),e(Qe,X_),e(X_,Gj),e(Qe,Zj),e(Qe,Y_),e(Y_,Vj),e(Qe,Xj),e(Qe,H_),e(H_,Yj),e(Qe,Hj),e(He,Qj),e(He,pc),e(pc,Kj),e(pc,ci),e(ci,qe),e(qe,eP),e(qe,Q_),e(Q_,tP),e(qe,oP),e(qe,K_),e(K_,rP),e(qe,aP),e(qe,eb),e(eb,nP),e(qe,sP),e(qe,tb),e(tb,lP),e(qe,iP),e(ci,dP),e(ci,pi),e(pi,cP),e(pi,ob),e(ob,pP),e(pi,mP),p(t,z1,c),p(t,rr,c),e(rr,Ca),e(Ca,rb),_(mi,rb,null),e(rr,hP),e(rr,ab),e(ab,uP),p(t,W1,c),p(t,Ke,c),e(Ke,fP),e(Ke,nb),e(nb,gP),e(Ke,_P),e(Ke,hi),e(hi,bP),e(Ke,vP),e(Ke,ui),e(ui,yP),e(Ke,wP),p(t,O1,c),_(Fa,t,c),p(t,R1,c),p(t,mc,c),e(mc,sb),e(sb,TP),p(t,L1,c),p(t,to,c),e(to,lb),e(lb,EP),e(to,AP),e(to,ib),e(ib,$P),e(to,kP),e(to,db),e(db,xP),p(t,B1,c),p(t,ar,c),e(ar,cb),e(cb,MP),e(ar,IP),e(ar,fi),e(fi,SP),e(ar,qP),p(t,G1,c),p(t,ft,c),e(ft,pb),e(pb,UP),e(ft,DP),e(ft,mb),e(mb,jP),e(ft,PP),e(ft,hb),e(hb,JP),e(ft,CP),p(t,Z1,c),_(gi,t,c),p(t,V1,c),p(t,hc,c),e(hc,ub),e(ub,FP),p(t,X1,c),p(t,Na,c),e(Na,_i),e(_i,NP),e(_i,fb),e(fb,zP),e(_i,WP),e(Na,OP),e(Na,Ue),e(Ue,RP),e(Ue,gb),e(gb,LP),e(Ue,BP),e(Ue,_b),e(_b,GP),e(Ue,ZP),e(Ue,bb),e(bb,VP),e(Ue,XP),e(Ue,vb),e(vb,YP),e(Ue,HP),p(t,Y1,c),p(t,oo,c),e(oo,QP),e(oo,yb),e(yb,KP),e(oo,e6),e(oo,bi),e(bi,t6),e(oo,o6),p(t,H1,c),p(t,nr,c),e(nr,za),e(za,wb),_(vi,wb,null),e(nr,r6),e(nr,Tb),e(Tb,a6),p(t,Q1,c),p(t,uc,c),e(uc,n6),p(t,K1,c),p(t,Wa,c),e(Wa,Eb),e(Eb,s6),e(Wa,l6),e(Wa,Ab),e(Ab,i6),p(t,ew,c),p(t,fc,c),e(fc,d6),p(t,tw,c),p(t,ro,c),e(ro,$b),e($b,ao),e(ao,c6),e(ao,kb),e(kb,p6),e(ao,m6),e(ao,xb),e(xb,h6),e(ao,u6),e(ao,Mb),e(Mb,f6),e(ro,g6),e(ro,K),e(K,yi),e(yi,_6),e(yi,Ib),e(Ib,b6),e(yi,v6),e(K,y6),_(wi,K,null),e(K,w6),e(K,Sb),e(Sb,T6),e(K,E6),_(Ti,K,null),e(K,A6),e(K,qb),e(qb,$6),e(K,k6),_(Ei,K,null),e(K,x6),e(K,Ub),e(Ub,M6),e(K,I6),_(Ai,K,null),e(ro,S6),e(ro,Db),e(Db,sr),e(sr,q6),e(sr,jb),e(jb,U6),e(sr,D6),e(sr,Pb),e(Pb,j6),e(sr,P6),p(t,ow,c),_($i,t,c),p(t,rw,c),p(t,ki,c),e(ki,xi),e(xi,J6),e(xi,Jb),e(Jb,C6),e(xi,F6),p(t,aw,c),_(Mi,t,c),p(t,nw,c),p(t,Oa,c),e(Oa,N6),e(Oa,Ii),e(Ii,z6),e(Oa,W6),p(t,sw,c),p(t,gc,c),e(gc,O6),p(t,lw,c),p(t,M,c),e(M,R6),e(M,_c),e(_c,L6),e(M,Cb),e(M,B6),e(M,bc),e(bc,G6),e(M,Fb),e(M,Z6),e(M,vc),e(vc,V6),e(M,Nb),e(M,X6),e(M,yc),e(yc,Y6),e(M,zb),e(M,H6),e(M,wc),e(wc,Q6),e(M,Wb),e(M,K6),e(M,Tc),e(Tc,eJ),e(M,Ob),e(M,tJ),e(M,Ec),e(Ec,oJ),e(M,Rb),e(M,rJ),e(M,Ac),e(Ac,aJ),e(M,Lb),e(M,nJ),e(M,$c),e($c,sJ),e(M,Bb),e(M,lJ),e(M,kc),e(kc,iJ),e(M,Gb),e(M,dJ),e(M,xc),e(xc,cJ),e(M,Zb),e(M,pJ),e(M,Mc),e(Mc,mJ),e(M,Vb),e(M,hJ),e(M,Ic),e(Ic,uJ),e(M,Xb),e(M,fJ),e(M,Sc),e(Sc,gJ),e(M,Yb),e(M,_J),e(M,qc),e(qc,bJ),e(M,Hb),e(M,vJ),e(M,Uc),e(Uc,yJ),e(M,Qb),e(M,wJ),e(M,Dc),e(Dc,TJ),e(M,Kb),e(M,EJ),e(M,jc),e(jc,AJ),e(M,ev),e(M,$J),e(M,Pc),e(Pc,kJ),e(M,tv),e(M,xJ),e(M,Jc),e(Jc,MJ),e(M,ov),e(M,IJ),e(M,Cc),e(Cc,SJ),e(M,rv),e(M,qJ),e(M,Fc),e(Fc,UJ),e(M,av),e(M,DJ),e(M,Nc),e(Nc,jJ),e(M,nv),e(M,PJ),iw=!0},p(t,[c]){const Si={};c&2&&(Si.$$scope={dirty:c,ctx:t}),fr.$set(Si);const sv={};c&2&&(sv.$$scope={dirty:c,ctx:t}),kr.$set(sv);const lv={};c&2&&(lv.$$scope={dirty:c,ctx:t}),Sr.$set(lv);const iv={};c&2&&(iv.$$scope={dirty:c,ctx:t}),Dr.$set(iv);const lr={};c&2&&(lr.$$scope={dirty:c,ctx:t}),Fr.$set(lr);const dv={};c&2&&(dv.$$scope={dirty:c,ctx:t}),Wr.$set(dv);const cv={};c&2&&(cv.$$scope={dirty:c,ctx:t}),Or.$set(cv);const ir={};c&2&&(ir.$$scope={dirty:c,ctx:t}),Rr.$set(ir);const pv={};c&2&&(pv.$$scope={dirty:c,ctx:t}),Lr.$set(pv);const mv={};c&2&&(mv.$$scope={dirty:c,ctx:t}),Br.$set(mv);const qi={};c&2&&(qi.$$scope={dirty:c,ctx:t}),Gr.$set(qi);const hv={};c&2&&(hv.$$scope={dirty:c,ctx:t}),Zr.$set(hv);const Ui={};c&2&&(Ui.$$scope={dirty:c,ctx:t}),Vr.$set(Ui);const uv={};c&2&&(uv.$$scope={dirty:c,ctx:t}),Xr.$set(uv);const B={};c&2&&(B.$$scope={dirty:c,ctx:t}),Yr.$set(B);const zc={};c&2&&(zc.$$scope={dirty:c,ctx:t}),Hr.$set(zc);const fv={};c&2&&(fv.$$scope={dirty:c,ctx:t}),Qr.$set(fv);const Wc={};c&2&&(Wc.$$scope={dirty:c,ctx:t}),Fa.$set(Wc)},i(t){iw||(b(h.$$.fragment,t),b(fr.$$.fragment,t),b(bn.$$.fragment,t),b(vn.$$.fragment,t),b(yn.$$.fragment,t),b(wn.$$.fragment,t),b(En.$$.fragment,t),b($n.$$.fragment,t),b(kn.$$.fragment,t),b(xn.$$.fragment,t),b(In.$$.fragment,t),b(qn.$$.fragment,t),b(Un.$$.fragment,t),b(Dn.$$.fragment,t),b(Pn.$$.fragment,t),b(Jn.$$.fragment,t),b(Fn.$$.fragment,t),b(zn.$$.fragment,t),b(Wn.$$.fragment,t),b(Rn.$$.fragment,t),b(Bn.$$.fragment,t),b(kr.$$.fragment,t),b(Gn.$$.fragment,t),b(Vn.$$.fragment,t),b(Xn.$$.fragment,t),b(Hn.$$.fragment,t),b(Kn.$$.fragment,t),b(Sr.$$.fragment,t),b(os.$$.fragment,t),b(rs.$$.fragment,t),b(ns.$$.fragment,t),b(is.$$.fragment,t),b(Dr.$$.fragment,t),b(ps.$$.fragment,t),b(ms.$$.fragment,t),b(hs.$$.fragment,t),b(us.$$.fragment,t),b(gs.$$.fragment,t),b(vs.$$.fragment,t),b(ws.$$.fragment,t),b(Ts.$$.fragment,t),b(Es.$$.fragment,t),b(As.$$.fragment,t),b($s.$$.fragment,t),b(ks.$$.fragment,t),b(Ms.$$.fragment,t),b(Fr.$$.fragment,t),b(qs.$$.fragment,t),b(Us.$$.fragment,t),b(Ps.$$.fragment,t),b(Cs.$$.fragment,t),b(Fs.$$.fragment,t),b(Ns.$$.fragment,t),b(Wr.$$.fragment,t),b(zs.$$.fragment,t),b(Or.$$.fragment,t),b(Ws.$$.fragment,t),b(Rr.$$.fragment,t),b(Os.$$.fragment,t),b(Lr.$$.fragment,t),b(Rs.$$.fragment,t),b(Br.$$.fragment,t),b(Ls.$$.fragment,t),b(Gr.$$.fragment,t),b(Zr.$$.fragment,t),b(Bs.$$.fragment,t),b(Vr.$$.fragment,t),b(Gs.$$.fragment,t),b(Xr.$$.fragment,t),b(Yr.$$.fragment,t),b(Zs.$$.fragment,t),b(Hr.$$.fragment,t),b(Qr.$$.fragment,t),b(Vs.$$.fragment,t),b(Ys.$$.fragment,t),b(Hs.$$.fragment,t),b(Qs.$$.fragment,t),b(Ks.$$.fragment,t),b(ol.$$.fragment,t),b(rl.$$.fragment,t),b(al.$$.fragment,t),b(nl.$$.fragment,t),b(sl.$$.fragment,t),b(ll.$$.fragment,t),b(il.$$.fragment,t),b(dl.$$.fragment,t),b(pl.$$.fragment,t),b(hl.$$.fragment,t),b(gl.$$.fragment,t),b(_l.$$.fragment,t),b(bl.$$.fragment,t),b(vl.$$.fragment,t),b(wl.$$.fragment,t),b(Tl.$$.fragment,t),b(El.$$.fragment,t),b($l.$$.fragment,t),b(xl.$$.fragment,t),b(Ml.$$.fragment,t),b(Il.$$.fragment,t),b(Dl.$$.fragment,t),b(Pl.$$.fragment,t),b(Jl.$$.fragment,t),b(Cl.$$.fragment,t),b(Nl.$$.fragment,t),b(zl.$$.fragment,t),b(Wl.$$.fragment,t),b(Ol.$$.fragment,t),b(Rl.$$.fragment,t),b(Ll.$$.fragment,t),b(Bl.$$.fragment,t),b(ai.$$.fragment,t),b(mi.$$.fragment,t),b(Fa.$$.fragment,t),b(gi.$$.fragment,t),b(vi.$$.fragment,t),b(wi.$$.fragment,t),b(Ti.$$.fragment,t),b(Ei.$$.fragment,t),b(Ai.$$.fragment,t),b($i.$$.fragment,t),b(Mi.$$.fragment,t),iw=!0)},o(t){v(h.$$.fragment,t),v(fr.$$.fragment,t),v(bn.$$.fragment,t),v(vn.$$.fragment,t),v(yn.$$.fragment,t),v(wn.$$.fragment,t),v(En.$$.fragment,t),v($n.$$.fragment,t),v(kn.$$.fragment,t),v(xn.$$.fragment,t),v(In.$$.fragment,t),v(qn.$$.fragment,t),v(Un.$$.fragment,t),v(Dn.$$.fragment,t),v(Pn.$$.fragment,t),v(Jn.$$.fragment,t),v(Fn.$$.fragment,t),v(zn.$$.fragment,t),v(Wn.$$.fragment,t),v(Rn.$$.fragment,t),v(Bn.$$.fragment,t),v(kr.$$.fragment,t),v(Gn.$$.fragment,t),v(Vn.$$.fragment,t),v(Xn.$$.fragment,t),v(Hn.$$.fragment,t),v(Kn.$$.fragment,t),v(Sr.$$.fragment,t),v(os.$$.fragment,t),v(rs.$$.fragment,t),v(ns.$$.fragment,t),v(is.$$.fragment,t),v(Dr.$$.fragment,t),v(ps.$$.fragment,t),v(ms.$$.fragment,t),v(hs.$$.fragment,t),v(us.$$.fragment,t),v(gs.$$.fragment,t),v(vs.$$.fragment,t),v(ws.$$.fragment,t),v(Ts.$$.fragment,t),v(Es.$$.fragment,t),v(As.$$.fragment,t),v($s.$$.fragment,t),v(ks.$$.fragment,t),v(Ms.$$.fragment,t),v(Fr.$$.fragment,t),v(qs.$$.fragment,t),v(Us.$$.fragment,t),v(Ps.$$.fragment,t),v(Cs.$$.fragment,t),v(Fs.$$.fragment,t),v(Ns.$$.fragment,t),v(Wr.$$.fragment,t),v(zs.$$.fragment,t),v(Or.$$.fragment,t),v(Ws.$$.fragment,t),v(Rr.$$.fragment,t),v(Os.$$.fragment,t),v(Lr.$$.fragment,t),v(Rs.$$.fragment,t),v(Br.$$.fragment,t),v(Ls.$$.fragment,t),v(Gr.$$.fragment,t),v(Zr.$$.fragment,t),v(Bs.$$.fragment,t),v(Vr.$$.fragment,t),v(Gs.$$.fragment,t),v(Xr.$$.fragment,t),v(Yr.$$.fragment,t),v(Zs.$$.fragment,t),v(Hr.$$.fragment,t),v(Qr.$$.fragment,t),v(Vs.$$.fragment,t),v(Ys.$$.fragment,t),v(Hs.$$.fragment,t),v(Qs.$$.fragment,t),v(Ks.$$.fragment,t),v(ol.$$.fragment,t),v(rl.$$.fragment,t),v(al.$$.fragment,t),v(nl.$$.fragment,t),v(sl.$$.fragment,t),v(ll.$$.fragment,t),v(il.$$.fragment,t),v(dl.$$.fragment,t),v(pl.$$.fragment,t),v(hl.$$.fragment,t),v(gl.$$.fragment,t),v(_l.$$.fragment,t),v(bl.$$.fragment,t),v(vl.$$.fragment,t),v(wl.$$.fragment,t),v(Tl.$$.fragment,t),v(El.$$.fragment,t),v($l.$$.fragment,t),v(xl.$$.fragment,t),v(Ml.$$.fragment,t),v(Il.$$.fragment,t),v(Dl.$$.fragment,t),v(Pl.$$.fragment,t),v(Jl.$$.fragment,t),v(Cl.$$.fragment,t),v(Nl.$$.fragment,t),v(zl.$$.fragment,t),v(Wl.$$.fragment,t),v(Ol.$$.fragment,t),v(Rl.$$.fragment,t),v(Ll.$$.fragment,t),v(Bl.$$.fragment,t),v(ai.$$.fragment,t),v(mi.$$.fragment,t),v(Fa.$$.fragment,t),v(gi.$$.fragment,t),v(vi.$$.fragment,t),v(wi.$$.fragment,t),v(Ti.$$.fragment,t),v(Ei.$$.fragment,t),v(Ai.$$.fragment,t),v($i.$$.fragment,t),v(Mi.$$.fragment,t),iw=!1},d(t){o(u),t&&o(k),t&&o(T),y(h),t&&o(j),t&&o(R),t&&o(L),t&&o(W),t&&o(ge),t&&o(je),t&&o(le),t&&o(re),t&&o(bo),t&&o(O),t&&o(Ev),y(fr,t),t&&o(Av),t&&o(gr),t&&o($v),y(bn,t),t&&o(kv),t&&o(vt),t&&o(xv),t&&o(vo),y(vn),t&&o(Mv),t&&o(A),y(yn),y(wn),y(En),y($n),y(kn),y(xn),y(In),y(qn),y(Un),y(Dn),y(Pn),y(Jn),y(Fn),y(zn),y(Wn),y(Rn),y(Bn),y(kr),y(Gn),y(Vn),y(Xn),y(Hn),y(Kn),y(Sr),y(os),y(rs),y(ns),y(is),y(Dr),y(ps),y(ms),y(hs),y(us),y(gs),y(vs),y(ws),y(Ts),y(Es),t&&o(Iv),t&&o(So),y(As),t&&o(Sv),t&&o(dt),y($s),y(ks),y(Ms),y(Fr),t&&o(qv),t&&o(Po),y(qs),t&&o(Uv),t&&o(q),y(Us),y(Ps),y(Cs),y(Fs),y(Ns),y(Wr),y(zs),y(Or),y(Ws),y(Rr),y(Os),y(Lr),y(Rs),y(Br),y(Ls),y(Gr),y(Zr),y(Bs),y(Vr),y(Gs),y(Xr),y(Yr),y(Zs),y(Hr),y(Qr),y(Vs),y(Ys),y(Hs),t&&o(Dv),t&&o(zo),y(Qs),t&&o(jv),t&&o(Ie),y(Ks),y(ol),t&&o(Pv),t&&o(Ro),y(rl),t&&o(Jv),t&&o(be),t&&o(Cv),t&&o(na),t&&o(Fv),t&&o(sa),t&&o(Nv),t&&o(Le),t&&o(zv),t&&o(la),t&&o(Wv),t&&o(Lo),y(al),t&&o(Ov),t&&o(Be),t&&o(Rv),t&&o(Ot),t&&o(Lv),t&&o(ca),t&&o(Bv),t&&o(Ge),t&&o(Gv),t&&o(pe),t&&o(Zv),t&&o(kd),t&&o(Vv),y(nl,t),t&&o(Xv),t&&o(xd),t&&o(Yv),y(sl,t),t&&o(Hv),t&&o(Md),t&&o(Qv),y(ll,t),t&&o(Kv),t&&o(Id),t&&o(ey),t&&o(Sd),t&&o(ty),y(il,t),t&&o(oy),t&&o(pa),t&&o(ry),t&&o(Bo),y(dl),t&&o(ay),t&&o(ve),t&&o(ny),t&&o(Rt),t&&o(sy),t&&o(Go),y(pl),t&&o(ly),t&&o(Ud),t&&o(iy),t&&o(ua),t&&o(dy),y(hl,t),t&&o(cy),t&&o(Lt),t&&o(py),y(gl,t),t&&o(my),y(_l,t),t&&o(hy),t&&o(fa),t&&o(uy),t&&o(jd),t&&o(fy),t&&o(Pd),t&&o(gy),t&&o(Jd),t&&o(_y),t&&o(ga),t&&o(by),t&&o(Cd),t&&o(vy),y(bl,t),t&&o(yy),t&&o(Bt),t&&o(wy),t&&o(Fd),t&&o(Ty),y(vl,t),t&&o(Ey),t&&o(Gt),t&&o(Ay),t&&o(Zt),t&&o($y),y(wl,t),t&&o(ky),t&&o(Nd),t&&o(xy),y(Tl,t),t&&o(My),t&&o(zd),t&&o(Iy),y(El,t),t&&o(Sy),t&&o(Wd),t&&o(qy),t&&o(Od),t&&o(Uy),t&&o(_a),t&&o(Dy),t&&o(Rd),t&&o(jy),y($l,t),t&&o(Py),t&&o(kl),t&&o(Jy),y(xl,t),t&&o(Cy),t&&o(Vt),t&&o(Fy),t&&o(Ld),t&&o(Ny),y(Ml,t),t&&o(zy),t&&o(Bd),t&&o(Wy),t&&o(ba),t&&o(Oy),t&&o(Zo),y(Il),t&&o(Ry),t&&o(ya),t&&o(Ly),t&&o(Ze),t&&o(By),t&&o(wa),t&&o(Gy),t&&o(Vd),t&&o(Zy),t&&o(Vo),y(Dl),t&&o(Vy),t&&o(Xd),t&&o(Xy),t&&o(Ea),t&&o(Yy),t&&o(Yd),t&&o(Hy),y(Pl,t),t&&o(Qy),t&&o(Hd),t&&o(Ky),t&&o(Xt),t&&o(e1),t&&o(Xo),y(Jl),t&&o(t1),t&&o(Qd),t&&o(o1),t&&o(Ve),t&&o(r1),t&&o(Yt),t&&o(a1),y(Cl,t),t&&o(n1),t&&o($a),t&&o(s1),t&&o(Yo),y(Nl),t&&o(l1),t&&o(Kd),t&&o(i1),y(zl,t),t&&o(d1),t&&o(Ht),t&&o(c1),t&&o(ec),t&&o(p1),y(Wl,t),t&&o(m1),t&&o(tc),t&&o(h1),t&&o(xa),t&&o(u1),t&&o(ct),t&&o(f1),t&&o(oc),t&&o(g1),y(Ol,t),t&&o(_1),t&&o(rc),t&&o(b1),t&&o(Xe),t&&o(v1),t&&o(Ho),y(Rl),t&&o(y1),t&&o(Qt),t&&o(w1),t&&o(ac),t&&o(T1),t&&o(nc),t&&o(E1),t&&o(Ia),t&&o(A1),y(Ll,t),t&&o($1),t&&o(te),t&&o(k1),t&&o(sc),t&&o(x1),t&&o(Qo),y(Bl),t&&o(M1),t&&o(qa),t&&o(I1),t&&o(Zl),t&&o(S1),t&&o(Vl),t&&o(q1),t&&o(me),t&&o(U1),t&&o(dc),t&&o(D1),t&&o(cc),t&&o(j1),t&&o(or),y(ai),t&&o(P1),t&&o(Kt),t&&o(J1),t&&o(li),t&&o(C1),t&&o(ii),t&&o(F1),t&&o(eo),t&&o(N1),t&&o(He),t&&o(z1),t&&o(rr),y(mi),t&&o(W1),t&&o(Ke),t&&o(O1),y(Fa,t),t&&o(R1),t&&o(mc),t&&o(L1),t&&o(to),t&&o(B1),t&&o(ar),t&&o(G1),t&&o(ft),t&&o(Z1),y(gi,t),t&&o(V1),t&&o(hc),t&&o(X1),t&&o(Na),t&&o(Y1),t&&o(oo),t&&o(H1),t&&o(nr),y(vi),t&&o(Q1),t&&o(uc),t&&o(K1),t&&o(Wa),t&&o(ew),t&&o(fc),t&&o(tw),t&&o(ro),y(wi),y(Ti),y(Ei),y(Ai),t&&o(ow),y($i,t),t&&o(rw),t&&o(ki),t&&o(aw),y(Mi,t),t&&o(nw),t&&o(Oa),t&&o(sw),t&&o(gc),t&&o(lw),t&&o(M)}}}const UL={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:"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"},{local:"using-accelerate-launcher-with-trainer",title:"Using Accelerate Launcher with Trainer"}],title:"Trainer"};function DL(D){return mL(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class zL extends iL{constructor(u){super();dL(this,u,DL,qL,cL,{})}}export{zL as default,UL as metadata};
