import{S as OL,i as WL,s as RL,e as n,k as l,w as f,t as r,M as LL,c as s,d as o,m as d,a as i,x as g,h as a,b as m,G as e,g as p,y as _,q as b,o as v,B as y,v as BL,L as vo}from"../../chunks/vendor-hf-doc-builder.js";import{T as fr}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 bo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function GL(D){let u,$,T,w,k,h,E,C,z,j,R,G,ee,Q,Y,X,ue,H,L,O,ne,F,Ee,Ae,se,bt,vt,be,Pe,bn,$e,vn,yn;return{c(){u=n("p"),$=r("The "),T=n("a"),w=r("Trainer"),k=r(` class is optimized for \u{1F917} Transformers models and can have surprising behaviors
when you use it on other models. When using it on your own model, make sure:`),h=l(),E=n("ul"),C=n("li"),z=r("your model always return tuples or subclasses of "),j=n("a"),R=r("ModelOutput"),G=r("."),ee=l(),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=l(),O=n("li"),ne=r("your model can accept multiple label arguments (use the "),F=n("code"),Ee=r("label_names"),Ae=r(" in your "),se=n("a"),bt=r("TrainingArguments"),vt=r(" to indicate their name to the "),be=n("a"),Pe=r("Trainer"),bn=r(") but none of them should be named "),$e=n("code"),vn=r('"label"'),yn=r("."),this.h()},l(ie){u=s(ie,"P",{});var re=i(u);$=a(re,"The "),T=s(re,"A",{href:!0});var Rl=i(T);w=a(Rl,"Trainer"),Rl.forEach(o),k=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(ie),E=s(ie,"UL",{});var ke=i(E);C=s(ke,"LI",{});var gr=i(C);z=a(gr,"your model always return tuples or subclasses of "),j=s(gr,"A",{href:!0});var Ll=i(j);R=a(Ll,"ModelOutput"),Ll.forEach(o),G=a(gr,"."),gr.forEach(o),ee=d(ke),Q=s(ke,"LI",{});var yo=i(Q);Y=a(yo,"your model can compute the loss if a "),X=s(yo,"CODE",{});var W=i(X);ue=a(W,"labels"),W.forEach(o),H=a(yo,` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),yo.forEach(o),L=d(ke),O=s(ke,"LI",{});var ae=i(O);ne=a(ae,"your model can accept multiple label arguments (use the "),F=s(ae,"CODE",{});var _r=i(F);Ee=a(_r,"label_names"),_r.forEach(o),Ae=a(ae," in your "),se=s(ae,"A",{href:!0});var Bl=i(se);bt=a(Bl,"TrainingArguments"),Bl.forEach(o),vt=a(ae," to indicate their name to the "),be=s(ae,"A",{href:!0});var Gl=i(be);Pe=a(Gl,"Trainer"),Gl.forEach(o),bn=a(ae,") but none of them should be named "),$e=s(ae,"CODE",{});var Zl=i($e);vn=a(Zl,'"label"'),Zl.forEach(o),yn=a(ae,"."),ae.forEach(o),ke.forEach(o),this.h()},h(){m(T,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(j,"href","/docs/transformers/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput"),m(se,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.TrainingArguments"),m(be,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer")},m(ie,re){p(ie,u,re),e(u,$),e(u,T),e(T,w),e(u,k),p(ie,h,re),p(ie,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,O),e(O,ne),e(O,F),e(F,Ee),e(O,Ae),e(O,se),e(se,bt),e(O,vt),e(O,be),e(be,Pe),e(O,bn),e(O,$e),e($e,vn),e(O,yn)},d(ie){ie&&o(u),ie&&o(h),ie&&o(E)}}}function ZL(D){let u,$,T,w,k,h,E,C,z,j,R,G,ee,Q,Y,X,ue;return{c(){u=n("p"),$=r("To use this method, you need to have provided a "),T=n("code"),w=r("model_init"),k=r(" when initializing your "),h=n("a"),E=r("Trainer"),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=i(u);$=a(L,"To use this method, you need to have provided a "),T=s(L,"CODE",{});var O=i(T);w=a(O,"model_init"),O.forEach(o),k=a(L," when initializing your "),h=s(L,"A",{href:!0});var ne=i(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=i(z);j=a(F,"optimizers"),F.forEach(o),R=a(L,` argument, so you need to
subclass `),G=s(L,"A",{href:!0});var Ee=i(G);ee=a(Ee,"Trainer"),Ee.forEach(o),Q=a(L," and override the method "),Y=s(L,"A",{href:!0});var Ae=i(Y);X=a(Ae,"create_optimizer_and_scheduler()"),Ae.forEach(o),ue=a(L,` for custom
optimizer/scheduler.`),L.forEach(o),this.h()},h(){m(h,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(G,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(Y,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer.create_optimizer_and_scheduler")},m(H,L){p(H,u,L),e(u,$),e(u,T),e(T,w),e(u,k),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 VL(D){let u,$;return{c(){u=n("p"),$=r("This function is deprecated and will be removed in v4.34.0 of Transformers.")},l(T){u=s(T,"P",{});var w=i(u);$=a(w,"This function is deprecated and will be removed in v4.34.0 of Transformers."),w.forEach(o)},m(T,w){p(T,u,w),e(u,$)},d(T){T&&o(u)}}}function XL(D){let u,$,T,w,k;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"),$=r("Now when this method is run, you will see a report that will include: :"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=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,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function YL(D){let u,$;return{c(){u=n("p"),$=r(`If your predictions or labels have different sequence length (for instance because you\u2019re doing dynamic padding
in a token classification task) the predictions will be padded (on the right) to allow for concatenation into
one array. The padding index is -100.`)},l(T){u=s(T,"P",{});var w=i(u);$=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,$)},d(T){T&&o(u)}}}function HL(D){let u,$;return{c(){u=n("p"),$=r(`If your predictions or labels have different sequence lengths (for instance because you\u2019re doing dynamic
padding in a token classification task) the predictions will be padded (on the right) to allow for
concatenation into one array. The padding index is -100.`)},l(T){u=s(T,"P",{});var w=i(u);$=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,$)},d(T){T&&o(u)}}}function QL(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function KL(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function eB(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function tB(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function oB(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function rB(D){let u,$,T,w,k,h,E,C,z,j,R,G,ee,Q,Y,X,ue,H,L,O;return{c(){u=n("p"),$=r("Calling this method will set "),T=n("code"),w=r("self.push_to_hub"),k=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()"),O=r(" will also trigger a push."),this.h()},l(ne){u=s(ne,"P",{});var F=i(u);$=a(F,"Calling this method will set "),T=s(F,"CODE",{});var Ee=i(T);w=a(Ee,"self.push_to_hub"),Ee.forEach(o),k=a(F," to "),h=s(F,"CODE",{});var Ae=i(h);E=a(Ae,"True"),Ae.forEach(o),C=a(F,", which means the "),z=s(F,"CODE",{});var se=i(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 bt=i(G);ee=a(bt,"model_id"),bt.forEach(o),Q=a(F,`) and the content will be pushed each time a save is
triggered (depending on`),Y=s(F,"CODE",{});var vt=i(Y);X=a(vt,"self.save_strategy"),vt.forEach(o),ue=a(F,"). Calling "),H=s(F,"A",{href:!0});var be=i(H);L=a(be,"save_model()"),be.forEach(o),O=a(F," will also trigger a push."),F.forEach(o),this.h()},h(){m(H,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer.save_model")},m(ne,F){p(ne,u,F),e(u,$),e(u,T),e(T,w),e(u,k),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,O)},d(ne){ne&&o(u)}}}function aB(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function nB(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function sB(D){let u,$,T,w,k,h,E,C;return{c(){u=n("p"),$=r("Calling this method will automatically set "),T=n("code"),w=r("self.do_predict"),k=r(" to "),h=n("code"),E=r("True"),C=r(".")},l(z){u=s(z,"P",{});var j=i(u);$=a(j,"Calling this method will automatically set "),T=s(j,"CODE",{});var R=i(T);w=a(R,"self.do_predict"),R.forEach(o),k=a(j," to "),h=s(j,"CODE",{});var G=i(h);E=a(G,"True"),G.forEach(o),C=a(j,"."),j.forEach(o)},m(z,j){p(z,u,j),e(u,$),e(u,T),e(T,w),e(u,k),e(u,h),e(h,E),e(u,C)},d(z){z&&o(u)}}}function iB(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function lB(D){let u,$,T,w,k,h,E,C;return{c(){u=n("p"),$=r("Calling this method will automatically set "),T=n("code"),w=r("self.do_train"),k=r(" to "),h=n("code"),E=r("True"),C=r(".")},l(z){u=s(z,"P",{});var j=i(u);$=a(j,"Calling this method will automatically set "),T=s(j,"CODE",{});var R=i(T);w=a(R,"self.do_train"),R.forEach(o),k=a(j," to "),h=s(j,"CODE",{});var G=i(h);E=a(G,"True"),G.forEach(o),C=a(j,"."),j.forEach(o)},m(z,j){p(z,u,j),e(u,$),e(u,T),e(T,w),e(u,k),e(u,h),e(h,E),e(u,C)},d(z){z&&o(u)}}}function dB(D){let u,$,T,w,k;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"),$=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);$=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){p(h,u,E),e(u,$),p(h,T,E),_(w,h,E),k=!0},p:vo,i(h){k||(b(w.$$.fragment,h),k=!0)},o(h){v(w.$$.fragment,h),k=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function cB(D){let u,$,T,w,k;return{c(){u=n("p"),$=r(`We strongly recommend to install PyTorch >= 1.13 (nightly version at the time of writing) on your MacOS machine.
It has major fixes related to model correctness and performance improvements for transformer based models.
Please refer to `),T=n("a"),w=r("https://github.com/pytorch/pytorch/issues/82707"),k=r(" for more details."),this.h()},l(h){u=s(h,"P",{});var E=i(u);$=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=i(T);w=a(C,"https://github.com/pytorch/pytorch/issues/82707"),C.forEach(o),k=a(E," for more details."),E.forEach(o),this.h()},h(){m(T,"href","https://github.com/pytorch/pytorch/issues/82707"),m(T,"rel","nofollow")},m(h,E){p(h,u,E),e(u,$),e(u,T),e(T,w),e(u,k)},d(h){h&&o(u)}}}function pB(D){let u,$,T,w,k,h,E,C,z,j,R,G,ee,Q,Y,X,ue,H,L,O,ne,F,Ee,Ae,se,bt,vt,be,Pe,bn,$e,vn,yn,ie,re,Rl,ke,gr,Ll,yo,W,ae,_r,Bl,Gl,Zl,Vl,rm,gT,_T,bT,Xl,am,vT,yT,wT,Yl,nm,TT,ET,AT,yt,sm,$T,kT,im,xT,MT,lm,IT,ST,qT,Hl,dm,DT,UT,jT,Ql,cm,PT,JT,CT,Kl,pm,FT,NT,zT,ed,mm,OT,WT,RT,td,hm,LT,BT,GT,od,um,ZT,VT,XT,rd,fm,YT,HT,Jv,br,Cv,vr,QT,ad,KT,e0,Fv,wn,Nv,wt,t0,nd,o0,r0,sd,a0,n0,zv,wo,yr,gm,Tn,s0,_m,i0,Ov,A,En,l0,bm,d0,c0,vm,p0,m0,xe,wr,ym,h0,u0,id,f0,g0,_0,le,wm,b0,v0,Tm,y0,w0,Em,T0,E0,Am,A0,$0,$m,k0,x0,km,M0,I0,S0,ld,xm,q0,D0,U0,Je,Mm,j0,P0,Im,J0,C0,Sm,F0,N0,qm,z0,O0,W0,Ce,Dm,R0,L0,Um,B0,G0,jm,Z0,V0,Pm,X0,Y0,H0,Tr,An,Q0,$n,K0,Jm,eE,tE,oE,Er,kn,rE,xn,aE,Cm,nE,sE,iE,Tt,Mn,lE,Fm,dE,cE,Nm,pE,mE,Ar,In,hE,zm,uE,fE,$r,Sn,gE,qn,_E,Om,bE,vE,yE,Et,Dn,wE,Wm,TE,EE,Un,AE,Rm,$E,kE,xE,At,jn,ME,Lm,IE,SE,lt,qE,Bm,DE,UE,Gm,jE,PE,Zm,JE,CE,FE,kr,Pn,NE,Vm,zE,OE,Fe,Jn,WE,Xm,RE,LE,Cn,BE,Ym,GE,ZE,VE,Hm,XE,YE,$t,Fn,HE,To,QE,Qm,KE,e3,Km,t3,o3,r3,eh,a3,n3,xr,Nn,s3,zn,i3,dd,l3,d3,c3,kt,On,p3,Wn,m3,th,h3,u3,f3,oh,g3,_3,Mr,Rn,b3,rh,v3,y3,xt,Ln,w3,Bn,T3,ah,E3,A3,$3,nh,k3,x3,Ne,Gn,M3,Zn,I3,sh,S3,q3,D3,Eo,U3,ih,j3,P3,lh,J3,C3,F3,dh,N3,z3,Mt,Vn,O3,Me,W3,ch,R3,L3,ph,B3,G3,mh,Z3,V3,hh,X3,Y3,H3,Ir,Q3,It,Xn,K3,Yn,e4,uh,t4,o4,r4,Sr,a4,qr,Hn,n4,Qn,s4,fh,i4,l4,d4,Dr,Kn,c4,gh,p4,m4,Ur,es,h4,ts,u4,_h,f4,g4,_4,St,os,b4,rs,v4,bh,y4,w4,T4,vh,E4,A4,P,as,$4,yh,k4,x4,wh,M4,I4,Th,S4,q4,Ao,D4,Eh,U4,j4,Ah,P4,J4,C4,jr,F4,$h,kh,N4,z4,dt,Ie,O4,xh,W4,R4,Mh,L4,B4,Ih,G4,Z4,Sh,V4,X4,Y4,$o,H4,qh,Q4,K4,Dh,eA,tA,oA,cd,Uh,rA,aA,nA,qt,jh,sA,iA,Ph,lA,dA,Jh,cA,pA,mA,Ch,hA,uA,Fh,fA,gA,ns,_A,Nh,bA,vA,yA,ct,wA,zh,TA,EA,Oh,AA,$A,Wh,kA,xA,MA,fe,IA,pd,SA,qA,Rh,DA,UA,Lh,jA,PA,Bh,JA,CA,Gh,FA,NA,zA,Z,OA,Zh,WA,RA,Vh,LA,BA,Xh,GA,ZA,Yh,VA,XA,ss,YA,HA,Hh,QA,KA,Qh,e$,t$,Kh,o$,r$,eu,a$,n$,tu,s$,i$,l$,Se,d$,md,c$,p$,ou,m$,h$,hd,u$,f$,ru,g$,_$,b$,au,v$,y$,Pr,is,w$,nu,T$,E$,Jr,ls,A$,ds,$$,su,k$,x$,M$,Dt,cs,I$,ps,S$,iu,q$,D$,U$,ms,j$,lu,P$,J$,C$,de,hs,F$,du,N$,z$,us,O$,cu,W$,R$,L$,Cr,B$,fs,G$,pu,Z$,V$,X$,ko,xo,Y$,mu,H$,Q$,hu,K$,ek,tk,Mo,ok,uu,rk,ak,fu,nk,sk,ik,Io,lk,gu,dk,ck,_u,pk,mk,hk,Ut,gs,uk,So,fk,bu,gk,_k,vu,bk,vk,yk,yu,wk,Tk,jt,_s,Ek,qo,Ak,wu,$k,kk,Tu,xk,Mk,Ik,Eu,Sk,qk,Fr,bs,Dk,pt,Uk,Au,jk,Pk,$u,Jk,Ck,ku,Fk,Nk,zk,Nr,vs,Ok,ys,Wk,xu,Rk,Lk,Bk,ze,ws,Gk,Ts,Zk,Mu,Vk,Xk,Yk,Iu,Hk,Qk,Es,Kk,ud,ex,tx,ox,Pt,As,rx,$s,ax,Su,nx,sx,ix,qu,lx,dx,Jt,ks,cx,Du,px,mx,Uu,hx,ux,zr,xs,fx,ju,gx,_x,Ct,Ms,bx,Pu,vx,yx,Ju,wx,Wv,Do,Or,Cu,Is,Tx,Fu,Ex,Rv,mt,Ss,Ax,Oe,qs,$x,Nu,kx,xx,Ds,Mx,zu,Ix,Sx,qx,Ou,Dx,Ux,ce,Us,jx,Wu,Px,Jx,js,Cx,Ru,Fx,Nx,zx,Wr,Ox,Ps,Wx,Lu,Rx,Lx,Bx,Uo,jo,Gx,Bu,Zx,Vx,Gu,Xx,Yx,Hx,Po,Qx,Zu,Kx,eM,Vu,tM,oM,rM,Jo,aM,Xu,nM,sM,Yu,iM,lM,Lv,Co,Rr,Hu,Js,dM,Qu,cM,Bv,q,Cs,pM,Fs,mM,Ku,hM,uM,fM,Fo,gM,fd,_M,bM,Ns,vM,yM,wM,ve,zs,TM,ef,EM,AM,No,$M,tf,kM,xM,of,MM,IM,SM,zo,qM,rf,DM,UM,af,jM,PM,JM,Os,CM,nf,FM,NM,zM,Lr,Ws,OM,sf,WM,RM,Ft,Rs,LM,lf,BM,GM,Oo,ZM,df,VM,XM,cf,YM,HM,QM,Nt,Ls,KM,pf,e5,t5,Br,o5,zt,Bs,r5,mf,a5,n5,Gr,s5,Ot,Gs,i5,hf,l5,d5,Zr,c5,Wt,Zs,p5,uf,m5,h5,Vr,u5,Rt,Vs,f5,ff,g5,_5,Xr,b5,We,Xs,v5,gf,y5,w5,Yr,T5,Hr,E5,Lt,Ys,A5,_f,$5,k5,Qr,x5,Re,Hs,M5,bf,I5,S5,Kr,q5,ea,D5,Le,Qs,U5,vf,j5,P5,ta,J5,oa,C5,ra,Ks,F5,ei,N5,yf,z5,O5,W5,aa,ti,R5,wf,L5,B5,na,oi,G5,Tf,Z5,Gv,Wo,sa,Ef,ri,V5,Af,X5,Zv,qe,ai,Y5,ni,H5,$f,Q5,K5,e9,Ro,t9,gd,o9,r9,si,a9,n9,s9,ia,ii,i9,Lo,l9,kf,d9,c9,xf,p9,m9,Vv,Bo,la,Mf,li,h9,If,u9,Xv,ye,f9,_d,g9,_9,Sf,b9,v9,bd,y9,w9,qf,T9,E9,Yv,da,A9,vd,$9,k9,Hv,ca,yd,Df,x9,M9,I9,wd,Uf,S9,q9,Qv,Be,D9,jf,U9,j9,Pf,P9,J9,Td,C9,F9,Kv,pa,ma,Jf,N9,z9,Cf,O9,W9,R9,Ed,Ff,L9,B9,ey,Go,ha,Nf,di,G9,zf,Z9,ty,Ge,V9,Ad,X9,Y9,Of,H9,Q9,Wf,K9,eI,oy,Bt,tI,Rf,oI,rI,$d,aI,nI,ry,ua,kd,Lf,sI,iI,lI,xd,Bf,dI,cI,ay,Ze,pI,Md,mI,hI,Gf,uI,fI,Zf,gI,_I,ny,pe,bI,Id,vI,yI,Vf,wI,TI,Xf,EI,AI,Yf,$I,kI,Sd,xI,MI,sy,qd,II,iy,ci,ly,Dd,SI,dy,pi,cy,Ud,qI,py,mi,my,jd,DI,hy,Pd,UI,uy,hi,fy,fa,jI,Hf,PI,JI,gy,Zo,ga,Qf,ui,CI,Kf,FI,_y,we,NI,Jd,zI,OI,eg,WI,RI,tg,LI,BI,og,GI,ZI,by,Gt,VI,fi,XI,YI,rg,HI,QI,vy,Vo,_a,ag,gi,KI,ng,eS,yy,Cd,tS,wy,ba,oS,_i,sg,rS,aS,Ty,bi,Ey,Zt,nS,vi,ig,sS,iS,yi,lg,lS,dS,Ay,wi,$y,Ti,ky,va,cS,Fd,pS,mS,xy,Nd,hS,My,zd,uS,Iy,Od,dg,cg,fS,Sy,ya,gS,pg,_S,bS,qy,Wd,vS,Dy,Ei,Uy,Vt,yS,mg,wS,TS,hg,ES,AS,jy,Rd,$S,Py,Ai,Jy,Xt,kS,ug,xS,MS,fg,IS,SS,Cy,Yt,qS,gg,DS,US,$i,_g,jS,PS,Fy,ki,Ny,Ld,JS,zy,xi,Oy,Bd,CS,Wy,Mi,Ry,Gd,FS,Ly,Zd,bg,vg,NS,By,wa,zS,yg,OS,WS,Gy,Vd,Ii,RS,wg,LS,BS,Zy,Si,Vy,qi,Tg,GS,Xy,Di,Yy,Ht,ZS,Eg,VS,XS,Ag,YS,HS,Hy,Xd,QS,Qy,Ui,Ky,Yd,KS,e1,Ta,eq,$g,tq,oq,t1,Xo,Ea,kg,ji,rq,xg,aq,o1,Aa,nq,Hd,sq,iq,r1,Ve,lq,Pi,dq,cq,Ji,pq,mq,Ci,hq,uq,a1,$a,fq,Qd,gq,_q,n1,Kd,s1,Yo,ka,Mg,Fi,bq,Ig,vq,i1,ec,yq,l1,xa,wq,Ni,Tq,Eq,d1,tc,Aq,c1,zi,p1,oc,$q,m1,Qt,kq,Sg,xq,Mq,qg,Iq,Sq,h1,Ho,Ma,Dg,Oi,qq,Ug,Dq,u1,rc,Uq,f1,Xe,jq,jg,Pq,Jq,Pg,Cq,Fq,Jg,Nq,zq,g1,Kt,Oq,Cg,Wq,Rq,Fg,Lq,Bq,_1,Wi,b1,Ia,Gq,Ri,Zq,Vq,v1,Qo,Sa,Ng,Li,Xq,zg,Yq,y1,ac,Hq,w1,Bi,T1,eo,Qq,Og,Kq,eD,Wg,tD,oD,E1,nc,rD,A1,Gi,$1,sc,aD,k1,qa,nD,Rg,sD,iD,x1,ht,Lg,lD,dD,Bg,cD,pD,Gg,mD,hD,M1,ic,uD,I1,Zi,S1,lc,fD,q1,Ye,gD,Zg,_D,bD,Vg,vD,yD,Xg,wD,TD,D1,Ko,Da,Yg,Vi,ED,Hg,AD,U1,to,$D,Qg,kD,xD,Kg,MD,ID,j1,dc,SD,P1,cc,qD,J1,Ua,DD,e_,UD,jD,C1,Xi,F1,te,PD,t_,JD,CD,o_,FD,ND,r_,zD,OD,a_,WD,RD,n_,LD,BD,s_,GD,ZD,N1,pc,VD,z1,er,ja,i_,Yi,XD,l_,YD,O1,Pa,HD,Hi,QD,KD,W1,Qi,d_,eU,tU,R1,Ki,c_,oU,rU,L1,me,p_,el,aU,m_,nU,sU,iU,tl,mc,h_,lU,dU,cU,tr,ol,pU,u_,mU,hU,uU,rl,fU,f_,gU,_U,bU,al,vU,g_,yU,wU,TU,__,or,EU,b_,AU,$U,v_,kU,xU,MU,y_,ut,IU,w_,SU,qU,T_,DU,UU,E_,jU,PU,JU,A_,rr,CU,$_,FU,NU,k_,zU,OU,WU,nl,ft,RU,x_,LU,BU,M_,GU,ZU,I_,VU,XU,YU,De,hc,HU,sl,ge,QU,S_,KU,ej,q_,tj,oj,D_,rj,aj,U_,nj,sj,j_,ij,lj,dj,il,cj,P_,pj,mj,hj,gt,J_,uj,fj,C_,gj,_j,F_,bj,vj,N_,yj,wj,Ja,z_,Tj,Ej,O_,Aj,$j,kj,Ca,W_,xj,Mj,R_,Ij,Sj,qj,Fa,L_,Dj,Uj,B_,jj,Pj,B1,uc,G_,Jj,G1,fc,He,Cj,Z_,Fj,Nj,V_,zj,Oj,Wj,Rj,ll,Lj,Z1,ar,Na,X_,dl,Bj,Y_,Gj,V1,oo,Zj,cl,Vj,Xj,pl,Yj,Hj,X1,ml,H_,Qj,Kj,Y1,hl,Q_,eP,tP,H1,ro,oP,K_,rP,aP,eb,nP,sP,Q1,Qe,za,tb,iP,lP,ob,dP,cP,pP,Oa,rb,mP,hP,ul,uP,fP,gP,Ke,ab,_P,bP,nb,vP,yP,sb,wP,TP,ib,EP,AP,$P,gc,kP,fl,_e,xP,lb,MP,IP,db,SP,qP,cb,DP,UP,pb,jP,PP,mb,JP,CP,FP,gl,NP,hb,zP,OP,K1,nr,Wa,ub,_l,WP,fb,RP,ew,et,LP,gb,BP,GP,bl,ZP,VP,vl,XP,YP,tw,Ra,ow,_c,_b,HP,rw,ao,bb,QP,KP,vb,e6,t6,yb,o6,aw,sr,wb,r6,a6,yl,n6,s6,nw,_t,Tb,i6,l6,Eb,d6,c6,Ab,p6,m6,sw,wl,iw,bc,$b,h6,lw,La,Tl,u6,kb,f6,g6,_6,Ue,b6,xb,v6,y6,Mb,w6,T6,Ib,E6,A6,Sb,$6,k6,dw,no,x6,qb,M6,I6,El,S6,q6,cw,ir,Ba,Db,Al,D6,Ub,U6,pw,vc,j6,mw,Ga,jb,P6,J6,Pb,C6,hw,yc,F6,uw,so,Jb,io,N6,Cb,z6,O6,Fb,W6,R6,Nb,L6,B6,K,$l,G6,zb,Z6,V6,X6,kl,Y6,Ob,H6,Q6,xl,K6,Wb,eJ,tJ,Ml,oJ,Rb,rJ,aJ,Il,nJ,Lb,lr,sJ,Bb,iJ,lJ,Gb,dJ,cJ,fw,Sl,gw,ql,Dl,pJ,Zb,mJ,hJ,_w,Ul,bw,Za,uJ,jl,fJ,gJ,vw,wc,_J,yw,M,bJ,Tc,vJ,Vb,yJ,Ec,wJ,Xb,TJ,Ac,EJ,Yb,AJ,$c,$J,Hb,kJ,kc,xJ,Qb,MJ,xc,IJ,Kb,SJ,Mc,qJ,ev,DJ,Ic,UJ,tv,jJ,Sc,PJ,ov,JJ,qc,CJ,rv,FJ,Dc,NJ,av,zJ,Uc,OJ,nv,WJ,jc,RJ,sv,LJ,Pc,BJ,iv,GJ,Jc,ZJ,lv,VJ,Cc,XJ,dv,YJ,Fc,HJ,cv,QJ,Nc,KJ,pv,e8,zc,t8,mv,o8,Oc,r8,hv,a8,Wc,n8,uv,s8,Rc,i8,fv,l8,Lc,d8,gv,c8,ww;return h=new oe({}),br=new fr({props:{warning:!0,$$slots:{default:[GL]},$$scope:{ctx:D}}}),wn=new U({props:{code:"ZnJvbSUyMHRvcmNoJTIwaW1wb3J0JTIwbm4lMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwVHJhaW5lciUwQSUwQSUwQWNsYXNzJTIwQ3VzdG9tVHJhaW5lcihUcmFpbmVyKSUzQSUwQSUyMCUyMCUyMCUyMGRlZiUyMGNvbXB1dGVfbG9zcyhzZWxmJTJDJTIwbW9kZWwlMkMlMjBpbnB1dHMlMkMlMjByZXR1cm5fb3V0cHV0cyUzREZhbHNlKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVscyUyMCUzRCUyMGlucHV0cy5wb3AoJTIybGFiZWxzJTIyKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMGZvcndhcmQlMjBwYXNzJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG91dHB1dHMuZ2V0KCUyMmxvZ2l0cyUyMiklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBjb21wdXRlJTIwY3VzdG9tJTIwbG9zcyUyMChzdXBwb3NlJTIwb25lJTIwaGFzJTIwMyUyMGxhYmVscyUyMHdpdGglMjBkaWZmZXJlbnQlMjB3ZWlnaHRzKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxvc3NfZmN0JTIwJTNEJTIwbm4uQ3Jvc3NFbnRyb3B5TG9zcyh3ZWlnaHQlM0R0b3JjaC50ZW5zb3IoJTVCMS4wJTJDJTIwMi4wJTJDJTIwMy4wJTVEJTJDJTIwZGV2aWNlJTNEbW9kZWwuZGV2aWNlKSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwbG9zc19mY3QobG9naXRzLnZpZXcoLTElMkMlMjBzZWxmLm1vZGVsLmNvbmZpZy5udW1fbGFiZWxzKSUyQyUyMGxhYmVscy52aWV3KC0xKSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAobG9zcyUyQyUyMG91dHB1dHMpJTIwaWYlMjByZXR1cm5fb3V0cHV0cyUyMGVsc2UlMjBsb3Nz",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.pop(<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`}}),Tn=new oe({}),En=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.33.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.33.0/en/main_classes/trainer#transformers.Trainer">Trainer</a> is optimized to work with the <a href="/docs/transformers/v4.33.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.33.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.33.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.33.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.33.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.14.4/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.14.4/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.33.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.33.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.33.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.33.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.33.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.33.0/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> on your model
and a scheduler given by <a href="/docs/transformers/v4.33.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.33.0/src/transformers/trainer.py#L231"}}),An=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.33.0/src/transformers/trainer.py#L691"}}),kn=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.33.0/src/transformers/trainer.py#L2637"}}),Mn=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.33.0/src/transformers/trainer.py#L2694"}}),In=new S({props:{name:"compute_loss_context_manager",anchor:"transformers.Trainer.compute_loss_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer.py#L2631"}}),Sn=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.33.0/src/transformers/trainer.py#L3496"}}),Dn=new S({props:{name:"create_optimizer",anchor:"transformers.Trainer.create_optimizer",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer.py#L949"}}),jn=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.33.0/src/transformers/trainer.py#L933"}}),Pn=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.33.0/src/transformers/trainer.py#L1127"}}),Jn=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.14.4/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.33.0/src/transformers/trainer.py#L2931",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>
`}}),Fn=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.33.0/src/transformers/trainer.py#L3064"}}),Nn=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.33.0/src/transformers/trainer.py#L3404",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),On=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.14.4/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.33.0/src/transformers/trainer.py#L867"}}),Rn=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.33.0/src/transformers/trainer.py#L1005"}}),Ln=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.14.4/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.33.0/src/transformers/trainer.py#L901"}}),Gn=new S({props:{name:"get_train_dataloader",anchor:"transformers.Trainer.get_train_dataloader",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer.py#L812"}}),Vn=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.33.0/src/transformers/trainer.py#L2505",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>
`}}),Ir=new fr({props:{warning:!0,$$slots:{default:[ZL]},$$scope:{ctx:D}}}),Xn=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.33.0/src/transformers/trainer.py#L3439"}}),Sr=new fr({props:{warning:!0,$$slots:{default:[VL]},$$scope:{ctx:D}}}),Hn=new S({props:{name:"init_hf_repo",anchor:"transformers.Trainer.init_hf_repo",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer.py#L3422"}}),Kn=new S({props:{name:"is_local_process_zero",anchor:"transformers.Trainer.is_local_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer.py#L2730"}}),es=new S({props:{name:"is_world_process_zero",anchor:"transformers.Trainer.is_world_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer.py#L2737"}}),os=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.33.0/src/transformers/trainer.py#L2580"}}),as=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.33.0/src/transformers/trainer_pt_utils.py#L898"}}),jr=new bo({props:{anchor:"transformers.Trainer.log_metrics.example",$$slots:{default:[XL]},$$scope:{ctx:D}}}),is=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.33.0/src/transformers/trainer_pt_utils.py#L872",returnDescription:`
<p>The reformatted metrics</p>
`,returnType:`
<p>metrics (<code>Dict[str, float]</code>)</p>
`}}),ls=new S({props:{name:"num_examples",anchor:"transformers.Trainer.num_examples",parameters:[{name:"dataloader",val:": DataLoader"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer.py#L1145"}}),cs=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.33.0/src/transformers/trainer.py#L702",returnDescription:`
<p>The callback removed, if found.</p>
`,returnType:`
<p><code>~transformer.TrainerCallback</code></p>
`}}),hs=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.33.0/src/transformers/trainer.py#L3002"}}),Cr=new fr({props:{$$slots:{default:[YL]},$$scope:{ctx:D}}}),gs=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.33.0/src/transformers/trainer.py#L3669"}}),_s=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.33.0/src/transformers/trainer.py#L3299",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>
`}}),bs=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.33.0/en/main_classes/trainer#transformers.Trainer.create_model_card">create_model_card()</a>.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer.py#L3616",returnDescription:`
<p>The URL of the repository where the model was pushed if <code>blocking=False</code>, or a <code>Future</code> object tracking the
progress of the commit if <code>blocking=True</code>.</p>
`}}),vs=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.33.0/src/transformers/trainer.py#L718"}}),ws=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.33.0/src/transformers/trainer_pt_utils.py#L988"}}),As=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.33.0/src/transformers/trainer.py#L2749"}}),ks=new S({props:{name:"save_state",anchor:"transformers.Trainer.save_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/trainer_pt_utils.py#L1026"}}),xs=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.33.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.33.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.33.0/src/transformers/trainer.py#L1456"}}),Ms=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.33.0/src/transformers/trainer.py#L2653",returnDescription:`
<p>The tensor with training loss on this batch.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Is=new oe({}),Ss=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.33.0/src/transformers/trainer_seq2seq.py#L41"}}),qs=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.14.4/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.33.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>
`}}),Us=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.14.4/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.33.0/src/transformers/trainer_seq2seq.py#L161"}}),Wr=new fr({props:{$$slots:{default:[HL]},$$scope:{ctx:D}}}),Js=new oe({}),Cs=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_cpu",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:": typing.Union[typing.List[transformers.trainer_utils.ShardedDDPOption], str, NoneType] = ''"},{name:"fsdp",val:": typing.Union[typing.List[transformers.trainer_utils.FSDPOption], str, NoneType] = ''"},{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_torch'"},{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:"hub_always_push",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:"dispatch_batches",val:": typing.Optional[bool] = 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.33.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.33.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.33.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.33.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/MPS/NPU 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/MPS/NPU 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.33.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.33.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.33.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.33.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.33.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.33.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.33.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.33.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.33.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.use_cpu",description:`<strong>use_cpu</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use cpu. If set to False, we will use cuda or mps device if available.`,name:"use_cpu"},{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 (use_cpu). 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>&apos;&apos;</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>&apos;&apos;</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>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>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>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>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>use_orig_params (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
If <code>&quot;True&quot;</code>, allows non-uniform <code>requires_grad</code> during init, which means support for interspersed
frozen and trainable paramteres. Useful in cases such as parameter-efficient fine-tuning. Please
refer this
[blog](<a href="https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019" rel="nofollow">https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019</a></p>
</li>
<li>
<p>sync_module_states (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>)
If <code>&quot;True&quot;</code>, each individually wrapped FSDP unit will broadcast module parameters from rank 0 to
ensure they are the same across all ranks after initialization</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>
<li>
<p>activation_checkpointing (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
If True, activation checkpointing is a technique to reduce memory usage by clearing activations of
certain layers and recomputing them during a backward pass. Effectively, this trades extra
computation time for reduced memory usage.</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_torch&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;clearml&quot;</code>, <code>&quot;codecarbon&quot;</code>, <code>&quot;comet_ml&quot;</code>, <code>&quot;dagshub&quot;</code>, <code>&quot;flyte&quot;</code>, <code>&quot;mlflow&quot;</code>, <code>&quot;neptune&quot;</code>,
<code>&quot;tensorboard&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.33.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.33.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.33.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.33.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.33.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.33.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.hub_always_push",description:`<strong>hub_always_push</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Unless this is <code>True</code>, the <code>Trainer</code> will skip pushing a checkpoint when the previous push is not finished.`,name:"hub_always_push"},{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.33.0/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.33.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.33.0/src/transformers/training_args.py#L159"}}),zs=new S({props:{name:"get_process_log_level",anchor:"transformers.TrainingArguments.get_process_log_level",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/training_args.py#L1959"}}),Ws=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.33.0/src/transformers/training_args.py#L2048"}}),Rs=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.33.0/src/transformers/training_args.py#L1997"}}),Ls=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.33.0/src/transformers/training_args.py#L2559"}}),Br=new bo({props:{anchor:"transformers.TrainingArguments.set_dataloader.example",$$slots:{default:[QL]},$$scope:{ctx:D}}}),Bs=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.33.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.33.0/src/transformers/training_args.py#L2169"}}),Gr=new bo({props:{anchor:"transformers.TrainingArguments.set_evaluate.example",$$slots:{default:[KL]},$$scope:{ctx:D}}}),Gs=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.33.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.33.0/src/transformers/training_args.py#L2319"}}),Zr=new bo({props:{anchor:"transformers.TrainingArguments.set_logging.example",$$slots:{default:[eB]},$$scope:{ctx:D}}}),Zs=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.33.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.33.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.33.0/src/transformers/training_args.py#L2514"}}),Vr=new bo({props:{anchor:"transformers.TrainingArguments.set_lr_scheduler.example",$$slots:{default:[tB]},$$scope:{ctx:D}}}),Vs=new S({props:{name:"set_optimizer",anchor:"transformers.TrainingArguments.set_optimizer",parameters:[{name:"name",val:": typing.Union[str, transformers.training_args.OptimizerNames] = 'adamw_torch'"},{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_torch&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.33.0/src/transformers/training_args.py#L2463"}}),Xr=new bo({props:{anchor:"transformers.TrainingArguments.set_optimizer.example",$$slots:{default:[oB]},$$scope:{ctx:D}}}),Xs=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"},{name:"always_push",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.33.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.33.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.33.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"},{anchor:"transformers.TrainingArguments.set_push_to_hub.always_push",description:`<strong>always_push</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Unless this is <code>True</code>, the <code>Trainer</code> will skip pushing a checkpoint when the previous push is not
finished.`,name:"always_push"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/training_args.py#L2393"}}),Yr=new fr({props:{$$slots:{default:[rB]},$$scope:{ctx:D}}}),Hr=new bo({props:{anchor:"transformers.TrainingArguments.set_push_to_hub.example",$$slots:{default:[aB]},$$scope:{ctx:D}}}),Ys=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.33.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.33.0/src/transformers/training_args.py#L2270"}}),Qr=new bo({props:{anchor:"transformers.TrainingArguments.set_save.example",$$slots:{default:[nB]},$$scope:{ctx:D}}}),Hs=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.33.0/src/transformers/training_args.py#L2230"}}),Kr=new fr({props:{$$slots:{default:[sB]},$$scope:{ctx:D}}}),ea=new bo({props:{anchor:"transformers.TrainingArguments.set_testing.example",$$slots:{default:[iB]},$$scope:{ctx:D}}}),Qs=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.33.0/src/transformers/training_args.py#L2094"}}),ta=new fr({props:{$$slots:{default:[lB]},$$scope:{ctx:D}}}),oa=new bo({props:{anchor:"transformers.TrainingArguments.set_training.example",$$slots:{default:[dB]},$$scope:{ctx:D}}}),Ks=new S({props:{name:"to_dict",anchor:"transformers.TrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/training_args.py#L2057"}}),ti=new S({props:{name:"to_json_string",anchor:"transformers.TrainingArguments.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/training_args.py#L2074"}}),oi=new S({props:{name:"to_sanitized_dict",anchor:"transformers.TrainingArguments.to_sanitized_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/training_args.py#L2080"}}),ri=new oe({}),ai=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_cpu",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:": typing.Union[typing.List[transformers.trainer_utils.ShardedDDPOption], str, NoneType] = ''"},{name:"fsdp",val:": typing.Union[typing.List[transformers.trainer_utils.FSDPOption], str, NoneType] = ''"},{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_torch'"},{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:"hub_always_push",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:"dispatch_batches",val:": typing.Optional[bool] = 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.33.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.33.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.33.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.33.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/MPS/NPU 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/MPS/NPU 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.33.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.33.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.33.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.33.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.33.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.33.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.33.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.33.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.33.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.use_cpu",description:`<strong>use_cpu</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use cpu. If set to False, we will use cuda or mps device if available.`,name:"use_cpu"},{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 (use_cpu). 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>&apos;&apos;</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>&apos;&apos;</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>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>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>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>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>use_orig_params (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
If <code>&quot;True&quot;</code>, allows non-uniform <code>requires_grad</code> during init, which means support for interspersed
frozen and trainable paramteres. Useful in cases such as parameter-efficient fine-tuning. Please
refer this
[blog](<a href="https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019" rel="nofollow">https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019</a></p>
</li>
<li>
<p>sync_module_states (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>)
If <code>&quot;True&quot;</code>, each individually wrapped FSDP unit will broadcast module parameters from rank 0 to
ensure they are the same across all ranks after initialization</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>
<li>
<p>activation_checkpointing (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
If True, activation checkpointing is a technique to reduce memory usage by clearing activations of
certain layers and recomputing them during a backward pass. Effectively, this trades extra
computation time for reduced memory usage.</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_torch&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;clearml&quot;</code>, <code>&quot;codecarbon&quot;</code>, <code>&quot;comet_ml&quot;</code>, <code>&quot;dagshub&quot;</code>, <code>&quot;flyte&quot;</code>, <code>&quot;mlflow&quot;</code>, <code>&quot;neptune&quot;</code>,
<code>&quot;tensorboard&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.33.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.33.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.33.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.33.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.33.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.33.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.hub_always_push",description:`<strong>hub_always_push</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Unless this is <code>True</code>, the <code>Trainer</code> will skip pushing a checkpoint when the previous push is not finished.`,name:"hub_always_push"},{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.33.0/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.33.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.33.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a>, <em>optional</em>) &#x2014;
Allows to load a <a href="/docs/transformers/v4.33.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.33.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.33.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a> object.</li>
</ul>`,name:"generation_config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/training_args_seq2seq.py#L30"}}),ii=new S({props:{name:"to_dict",anchor:"transformers.Seq2SeqTrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/training_args_seq2seq.py#L87"}}),li=new oe({}),di=new oe({}),ci=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(...)`}}),pi=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9y",highlighted:"my_app.py ... --log_level warning --log_level_replica error"}}),mi=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9yJTIwLS1sb2dfb25fZWFjaF9ub2RlJTIwMA==",highlighted:"my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0"}}),hi=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjBlcnJvciUyMC0tbG9nX2xldmVsX3JlcGxpY2ElMjBlcnJvciUyMC0tbG9nX29uX2VhY2hfbm9kZSUyMDA=",highlighted:"my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0"}}),ui=new oe({}),gi=new oe({}),bi=new U({props:{code:"cHl0aG9uJTIwLW0lMjB0b3JjaC5kaXN0cmlidXRlZC5sYXVuY2glMjAtLW5wcm9jX3Blcl9ub2RlJTNEMiUyMCUyMHRyYWluZXItcHJvZ3JhbS5weSUyMC4uLg==",highlighted:"python -m torch.distributed.launch --nproc_per_node=2  trainer-program.py ..."}}),wi=new U({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbnVtX3Byb2Nlc3NlcyUyMDIlMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"accelerate launch --num_processes 2 trainer-program.py ..."}}),Ti=new U({props:{code:"ZGVlcHNwZWVkJTIwLS1udW1fZ3B1cyUyMDIlMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"deepspeed --num_gpus 2 trainer-program.py ..."}}),Ei=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QwJTJDMiUyMHB5dGhvbiUyMC1tJTIwdG9yY2guZGlzdHJpYnV0ZWQubGF1bmNoJTIwdHJhaW5lci1wcm9ncmFtLnB5JTIwLi4u",highlighted:"CUDA_VISIBLE_DEVICES=0,2 python -m torch.distributed.launch trainer-program.py ..."}}),Ai=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QyJTJDMCUyMHB5dGhvbiUyMC1tJTIwdG9yY2guZGlzdHJpYnV0ZWQubGF1bmNoJTIwdHJhaW5lci1wcm9ncmFtLnB5JTIwLi4u",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python -m torch.distributed.launch trainer-program.py ..."}}),ki=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QyJTJDMCUyMHB5dGhvbiUyMHRyYWluZXItcHJvZ3JhbS5weSUyMC4uLg==",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ..."}}),xi=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QlMjBweXRob24lMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"CUDA_VISIBLE_DEVICES= python trainer-program.py ..."}}),Mi=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 ...`}}),Si=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9ERVZJQ0VfT1JERVIlM0RQQ0lfQlVTX0lE",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=PCI_BUS_ID'}}),Di=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9ERVZJQ0VfT1JERVIlM0RGQVNURVNUX0ZJUlNU",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=FASTEST_FIRST'}}),Ui=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9WSVNJQkxFX0RFVklDRVMlM0QxJTJDMA==",highlighted:'<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=1,0'}}),ji=new oe({}),Fi=new oe({}),zi=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRlZXBzcGVlZA==",highlighted:"pip install deepspeed"}}),Oi=new oe({}),Wi=new U({props:{code:"d2hpY2glMjBudmNj",highlighted:'<span class="hljs-built_in">which</span> nvcc'}}),Li=new oe({}),Bi=new U({props:{code:"JTJGdXNyJTJGbG9jYWwlMkZjdWRhLTEwLjIlMEElMkZ1c3IlMkZsb2NhbCUyRmN1ZGEtMTEuMA==",highlighted:`/usr/local/cuda-10.2
/usr/local/cuda-11.0`}}),Gi=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>`}}),Zi=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>`}}),Vi=new oe({}),Xi=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++`}}),Yi=new oe({}),dl=new oe({}),_l=new oe({}),Ra=new fr({props:{warning:!1,$$slots:{default:[cB]},$$scope:{ctx:D}}}),wl=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`}}),Al=new oe({}),kl=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>`}}),xl=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>`}}),Ml=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>`}}),Il=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>`}}),Sl=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`}}),Ul=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"),$=l(),T=n("h1"),w=n("a"),k=n("span"),f(h.$$.fragment),E=l(),C=n("span"),z=r("Trainer"),j=l(),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=l(),O=n("p"),ne=r("Before instantiating your "),F=n("a"),Ee=r("Trainer"),Ae=r(", create a "),se=n("a"),bt=r("TrainingArguments"),vt=r(" to access all the points of customization during training."),be=l(),Pe=n("p"),bn=r("The API supports distributed training on multiple GPUs/TPUs, mixed precision through "),$e=n("a"),vn=r("NVIDIA Apex"),yn=r(" and Native AMP for PyTorch."),ie=l(),re=n("p"),Rl=r("The "),ke=n("a"),gr=r("Trainer"),Ll=r(" contains the basic training loop which supports the above features. To inject custom behavior you can subclass them and override the following methods:"),yo=l(),W=n("ul"),ae=n("li"),_r=n("strong"),Bl=r("get_train_dataloader"),Gl=r(" \u2014 Creates the training DataLoader."),Zl=l(),Vl=n("li"),rm=n("strong"),gT=r("get_eval_dataloader"),_T=r(" \u2014 Creates the evaluation DataLoader."),bT=l(),Xl=n("li"),am=n("strong"),vT=r("get_test_dataloader"),yT=r(" \u2014 Creates the test DataLoader."),wT=l(),Yl=n("li"),nm=n("strong"),TT=r("log"),ET=r(" \u2014 Logs information on the various objects watching training."),AT=l(),yt=n("li"),sm=n("strong"),$T=r("create_optimizer_and_scheduler"),kT=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 `),im=n("code"),xT=r("create_optimizer"),MT=r(" and "),lm=n("code"),IT=r("create_scheduler"),ST=r(` methods
separately.`),qT=l(),Hl=n("li"),dm=n("strong"),DT=r("create_optimizer"),UT=r(" \u2014 Sets up the optimizer if it wasn\u2019t passed at init."),jT=l(),Ql=n("li"),cm=n("strong"),PT=r("create_scheduler"),JT=r(" \u2014 Sets up the learning rate scheduler if it wasn\u2019t passed at init."),CT=l(),Kl=n("li"),pm=n("strong"),FT=r("compute_loss"),NT=r(" - Computes the loss on a batch of training inputs."),zT=l(),ed=n("li"),mm=n("strong"),OT=r("training_step"),WT=r(" \u2014 Performs a training step."),RT=l(),td=n("li"),hm=n("strong"),LT=r("prediction_step"),BT=r(" \u2014 Performs an evaluation/test step."),GT=l(),od=n("li"),um=n("strong"),ZT=r("evaluate"),VT=r(" \u2014 Runs an evaluation loop and returns metrics."),XT=l(),rd=n("li"),fm=n("strong"),YT=r("predict"),HT=r(" \u2014 Returns predictions (with metrics if labels are available) on a test set."),Jv=l(),f(br.$$.fragment),Cv=l(),vr=n("p"),QT=r("Here is an example of how to customize "),ad=n("a"),KT=r("Trainer"),e0=r(" to use a weighted loss (useful when you have an unbalanced training set):"),Fv=l(),f(wn.$$.fragment),Nv=l(),wt=n("p"),t0=r("Another way to customize the training loop behavior for the PyTorch "),nd=n("a"),o0=r("Trainer"),r0=r(" is to use "),sd=n("a"),a0=r("callbacks"),n0=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)."),zv=l(),wo=n("h2"),yr=n("a"),gm=n("span"),f(Tn.$$.fragment),s0=l(),_m=n("span"),i0=r("Trainer"),Ov=l(),A=n("div"),f(En.$$.fragment),l0=l(),bm=n("p"),d0=r("Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for \u{1F917} Transformers."),c0=l(),vm=n("p"),p0=r("Important attributes:"),m0=l(),xe=n("ul"),wr=n("li"),ym=n("strong"),h0=r("model"),u0=r(" \u2014 Always points to the core model. If using a transformers model, it will be a "),id=n("a"),f0=r("PreTrainedModel"),g0=r(`
subclass.`),_0=l(),le=n("li"),wm=n("strong"),b0=r("model_wrapped"),v0=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 `),Tm=n("code"),y0=r("DeepSpeed"),w0=r(`,
the inner model is wrapped in `),Em=n("code"),T0=r("DeepSpeed"),E0=r(" and then again in "),Am=n("code"),A0=r("torch.nn.DistributedDataParallel"),$0=r(`. If the inner
model hasn\u2019t been wrapped, then `),$m=n("code"),k0=r("self.model_wrapped"),x0=r(" is the same as "),km=n("code"),M0=r("self.model"),I0=r("."),S0=l(),ld=n("li"),xm=n("strong"),q0=r("is_model_parallel"),D0=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).`),U0=l(),Je=n("li"),Mm=n("strong"),j0=r("place_model_on_device"),P0=r(` \u2014 Whether or not to automatically place the model on the device - it will be set
to `),Im=n("code"),J0=r("False"),C0=r(` if model parallel or deepspeed is used, or if the default
`),Sm=n("code"),F0=r("TrainingArguments.place_model_on_device"),N0=r(" is overridden to return "),qm=n("code"),z0=r("False"),O0=r(" ."),W0=l(),Ce=n("li"),Dm=n("strong"),R0=r("is_in_train"),L0=r(" \u2014 Whether or not a model is currently running "),Um=n("code"),B0=r("train"),G0=r(" (e.g. when "),jm=n("code"),Z0=r("evaluate"),V0=r(` is called while
in `),Pm=n("code"),X0=r("train"),Y0=r(")"),H0=l(),Tr=n("div"),f(An.$$.fragment),Q0=l(),$n=n("p"),K0=r("Add a callback to the current list of "),Jm=n("code"),eE=r("~transformer.TrainerCallback"),tE=r("."),oE=l(),Er=n("div"),f(kn.$$.fragment),rE=l(),xn=n("p"),aE=r("A helper wrapper that creates an appropriate context manager for "),Cm=n("code"),nE=r("autocast"),sE=r(` while feeding it the desired
arguments, depending on the situation.`),iE=l(),Tt=n("div"),f(Mn.$$.fragment),lE=l(),Fm=n("p"),dE=r("How the loss is computed by Trainer. By default, all models return the loss in the first element."),cE=l(),Nm=n("p"),pE=r("Subclass and override for custom behavior."),mE=l(),Ar=n("div"),f(In.$$.fragment),hE=l(),zm=n("p"),uE=r("A helper wrapper to group together context managers."),fE=l(),$r=n("div"),f(Sn.$$.fragment),gE=l(),qn=n("p"),_E=r("Creates a draft of a model card using the information available to the "),Om=n("code"),bE=r("Trainer"),vE=r("."),yE=l(),Et=n("div"),f(Dn.$$.fragment),wE=l(),Wm=n("p"),TE=r("Setup the optimizer."),EE=l(),Un=n("p"),AE=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 `),Rm=n("code"),$E=r("optimizers"),kE=r(", or subclass and override this method in a subclass."),xE=l(),At=n("div"),f(jn.$$.fragment),ME=l(),Lm=n("p"),IE=r("Setup the optimizer and the learning rate scheduler."),SE=l(),lt=n("p"),qE=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 `),Bm=n("code"),DE=r("optimizers"),UE=r(", or subclass and override this method (or "),Gm=n("code"),jE=r("create_optimizer"),PE=r(` and/or
`),Zm=n("code"),JE=r("create_scheduler"),CE=r(") in a subclass."),FE=l(),kr=n("div"),f(Pn.$$.fragment),NE=l(),Vm=n("p"),zE=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.`),OE=l(),Fe=n("div"),f(Jn.$$.fragment),WE=l(),Xm=n("p"),RE=r("Run evaluation and returns metrics."),LE=l(),Cn=n("p"),BE=r(`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Ym=n("code"),GE=r("compute_metrics"),ZE=r(" argument)."),VE=l(),Hm=n("p"),XE=r("You can also subclass and override this method to inject custom behavior."),YE=l(),$t=n("div"),f(Fn.$$.fragment),HE=l(),To=n("p"),QE=r("Prediction/evaluation loop, shared by "),Qm=n("code"),KE=r("Trainer.evaluate()"),e3=r(" and "),Km=n("code"),t3=r("Trainer.predict()"),o3=r("."),r3=l(),eh=n("p"),a3=r("Works both with or without labels."),n3=l(),xr=n("div"),f(Nn.$$.fragment),s3=l(),zn=n("p"),i3=r("For models that inherit from "),dd=n("a"),l3=r("PreTrainedModel"),d3=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.`),c3=l(),kt=n("div"),f(On.$$.fragment),p3=l(),Wn=n("p"),m3=r("Returns the evaluation "),th=n("code"),h3=r("~torch.utils.data.DataLoader"),u3=r("."),f3=l(),oh=n("p"),g3=r("Subclass and override this method if you want to inject some custom behavior."),_3=l(),Mr=n("div"),f(Rn.$$.fragment),b3=l(),rh=n("p"),v3=r("Returns the optimizer class and optimizer parameters based on the training arguments."),y3=l(),xt=n("div"),f(Ln.$$.fragment),w3=l(),Bn=n("p"),T3=r("Returns the test "),ah=n("code"),E3=r("~torch.utils.data.DataLoader"),A3=r("."),$3=l(),nh=n("p"),k3=r("Subclass and override this method if you want to inject some custom behavior."),x3=l(),Ne=n("div"),f(Gn.$$.fragment),M3=l(),Zn=n("p"),I3=r("Returns the training "),sh=n("code"),S3=r("~torch.utils.data.DataLoader"),q3=r("."),D3=l(),Eo=n("p"),U3=r("Will use no sampler if "),ih=n("code"),j3=r("train_dataset"),P3=r(" does not implement "),lh=n("code"),J3=r("__len__"),C3=r(`, a random sampler (adapted to distributed
training if necessary) otherwise.`),F3=l(),dh=n("p"),N3=r("Subclass and override this method if you want to inject some custom behavior."),z3=l(),Mt=n("div"),f(Vn.$$.fragment),O3=l(),Me=n("p"),W3=r("Launch an hyperparameter search using "),ch=n("code"),R3=r("optuna"),L3=r(" or "),ph=n("code"),B3=r("Ray Tune"),G3=r(" or "),mh=n("code"),Z3=r("SigOpt"),V3=r(`. The optimized quantity is determined
by `),hh=n("code"),X3=r("compute_objective"),Y3=r(`, which defaults to a function returning the evaluation loss when no metric is provided,
the sum of all metrics otherwise.`),H3=l(),f(Ir.$$.fragment),Q3=l(),It=n("div"),f(Xn.$$.fragment),K3=l(),Yn=n("p"),e4=r("Initializes a git repo in "),uh=n("code"),t4=r("self.args.hub_model_id"),o4=r("."),r4=l(),f(Sr.$$.fragment),a4=l(),qr=n("div"),f(Hn.$$.fragment),n4=l(),Qn=n("p"),s4=r("Initializes a git repo in "),fh=n("code"),i4=r("self.args.hub_model_id"),l4=r("."),d4=l(),Dr=n("div"),f(Kn.$$.fragment),c4=l(),gh=n("p"),p4=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.`),m4=l(),Ur=n("div"),f(es.$$.fragment),h4=l(),ts=n("p"),u4=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 `),_h=n("code"),f4=r("True"),g4=r(" for one process)."),_4=l(),St=n("div"),f(os.$$.fragment),b4=l(),rs=n("p"),v4=r("Log "),bh=n("code"),y4=r("logs"),w4=r(" on the various objects watching training."),T4=l(),vh=n("p"),E4=r("Subclass and override this method to inject custom behavior."),A4=l(),P=n("div"),f(as.$$.fragment),$4=l(),yh=n("p"),k4=r("Log metrics in a specially formatted way"),x4=l(),wh=n("p"),M4=r("Under distributed environment this is done only for a process with rank 0."),I4=l(),Th=n("p"),S4=r("Notes on memory reports:"),q4=l(),Ao=n("p"),D4=r("In order to get memory usage report you need to install "),Eh=n("code"),U4=r("psutil"),j4=r(". You can do that with "),Ah=n("code"),P4=r("pip install psutil"),J4=r("."),C4=l(),f(jr.$$.fragment),F4=l(),$h=n("p"),kh=n("strong"),N4=r("Understanding the reports:"),z4=l(),dt=n("ul"),Ie=n("li"),O4=r("the first segment, e.g., "),xh=n("code"),W4=r("train__"),R4=r(", tells you which stage the metrics are for. Reports starting with "),Mh=n("code"),L4=r("init_"),B4=r(`
will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the
`),Ih=n("code"),G4=r("__init__"),Z4=r(" will be reported along with the "),Sh=n("code"),V4=r("eval_"),X4=r(" metrics."),Y4=l(),$o=n("li"),H4=r("the third segment, is either "),qh=n("code"),Q4=r("cpu"),K4=r(" or "),Dh=n("code"),eA=r("gpu"),tA=r(`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),oA=l(),cd=n("li"),Uh=n("code"),rA=r("*_alloc_delta"),aA=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=l(),qt=n("li"),jh=n("code"),sA=r("*_peaked_delta"),iA=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 `),Ph=n("code"),lA=r("alloc_delta"),dA=r(` +
`),Jh=n("code"),cA=r("peaked_delta"),pA=r(" and you know how much memory was needed to complete that stage."),mA=l(),Ch=n("p"),hA=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.`),uA=l(),Fh=n("p"),fA=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.`),gA=l(),ns=n("p"),_A=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 `),Nh=n("code"),bA=r("tracemalloc"),vA=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.`),yA=l(),ct=n("p"),wA=r("The GPU allocated and peak memory reporting is done with "),zh=n("code"),TA=r("torch.cuda.memory_allocated()"),EA=r(` and
`),Oh=n("code"),AA=r("torch.cuda.max_memory_allocated()"),$A=r(`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),Wh=n("code"),kA=r("torch.cuda"),xA=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.`),MA=l(),fe=n("p"),IA=r("Note that this tracker doesn\u2019t account for memory allocations outside of "),pd=n("a"),SA=r("Trainer"),qA=r("\u2019s "),Rh=n("code"),DA=r("__init__"),UA=r(", "),Lh=n("code"),jA=r("train"),PA=r(`,
`),Bh=n("code"),JA=r("evaluate"),CA=r(" and "),Gh=n("code"),FA=r("predict"),NA=r(" calls."),zA=l(),Z=n("p"),OA=r("Because "),Zh=n("code"),WA=r("evaluation"),RA=r(" calls may happen during "),Vh=n("code"),LA=r("train"),BA=r(`, we can\u2019t handle nested invocations because
`),Xh=n("code"),GA=r("torch.cuda.max_memory_allocated"),ZA=r(" is a single counter, so if it gets reset by a nested eval call, "),Yh=n("code"),VA=r("train"),XA=r(`\u2019s tracker
will report incorrect info. If this `),ss=n("a"),YA=r("pytorch issue"),HA=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
`),Hh=n("code"),QA=r("train"),KA=r(", "),Qh=n("code"),e$=r("evaluate"),t$=r(" and "),Kh=n("code"),o$=r("predict"),r$=r(" methods. Which means that if "),eu=n("code"),a$=r("eval"),n$=r(" is called during "),tu=n("code"),s$=r("train"),i$=r(`, it\u2019s the latter
that will account for its memory usage and that of the former.`),l$=l(),Se=n("p"),d$=r("This also means that if any other tool that is used along the "),md=n("a"),c$=r("Trainer"),p$=r(` calls
`),ou=n("code"),m$=r("torch.cuda.reset_peak_memory_stats"),h$=r(", the gpu peak memory stats could be invalid. And the "),hd=n("a"),u$=r("Trainer"),f$=r(` will disrupt
the normal behavior of any such tools that rely on calling `),ru=n("code"),g$=r("torch.cuda.reset_peak_memory_stats"),_$=r(" themselves."),b$=l(),au=n("p"),v$=r("For best performance you may want to consider turning the memory profiling off for production runs."),y$=l(),Pr=n("div"),f(is.$$.fragment),w$=l(),nu=n("p"),T$=r("Reformat Trainer metrics values to a human-readable format"),E$=l(),Jr=n("div"),f(ls.$$.fragment),A$=l(),ds=n("p"),$$=r("Helper to get number of samples in a "),su=n("code"),k$=r("~torch.utils.data.DataLoader"),x$=r(` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),M$=l(),Dt=n("div"),f(cs.$$.fragment),I$=l(),ps=n("p"),S$=r("Remove a callback from the current list of "),iu=n("code"),q$=r("~transformer.TrainerCallback"),D$=r(" and returns it."),U$=l(),ms=n("p"),j$=r("If the callback is not found, returns "),lu=n("code"),P$=r("None"),J$=r(" (and no error is raised)."),C$=l(),de=n("div"),f(hs.$$.fragment),F$=l(),du=n("p"),N$=r("Run prediction and returns predictions and potential metrics."),z$=l(),us=n("p"),O$=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 `),cu=n("code"),W$=r("evaluate()"),R$=r("."),L$=l(),f(Cr.$$.fragment),B$=l(),fs=n("p"),G$=r("Returns: "),pu=n("em"),Z$=r("NamedTuple"),V$=r(" A namedtuple with the following keys:"),X$=l(),ko=n("ul"),xo=n("li"),Y$=r("predictions ("),mu=n("code"),H$=r("np.ndarray"),Q$=r("): The predictions on "),hu=n("code"),K$=r("test_dataset"),ek=r("."),tk=l(),Mo=n("li"),ok=r("label_ids ("),uu=n("code"),rk=r("np.ndarray"),ak=r(", "),fu=n("em"),nk=r("optional"),sk=r("): The labels (if the dataset contained some)."),ik=l(),Io=n("li"),lk=r("metrics ("),gu=n("code"),dk=r("Dict[str, float]"),ck=r(", "),_u=n("em"),pk=r("optional"),mk=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),hk=l(),Ut=n("div"),f(gs.$$.fragment),uk=l(),So=n("p"),fk=r("Prediction/evaluation loop, shared by "),bu=n("code"),gk=r("Trainer.evaluate()"),_k=r(" and "),vu=n("code"),bk=r("Trainer.predict()"),vk=r("."),yk=l(),yu=n("p"),wk=r("Works both with or without labels."),Tk=l(),jt=n("div"),f(_s.$$.fragment),Ek=l(),qo=n("p"),Ak=r("Perform an evaluation step on "),wu=n("code"),$k=r("model"),kk=r(" using "),Tu=n("code"),xk=r("inputs"),Mk=r("."),Ik=l(),Eu=n("p"),Sk=r("Subclass and override to inject custom behavior."),qk=l(),Fr=n("div"),f(bs.$$.fragment),Dk=l(),pt=n("p"),Uk=r("Upload "),Au=n("code"),jk=r("self.model"),Pk=r(" and "),$u=n("code"),Jk=r("self.tokenizer"),Ck=r(" to the \u{1F917} model hub on the repo "),ku=n("code"),Fk=r("self.args.hub_model_id"),Nk=r("."),zk=l(),Nr=n("div"),f(vs.$$.fragment),Ok=l(),ys=n("p"),Wk=r("Remove a callback from the current list of "),xu=n("code"),Rk=r("~transformer.TrainerCallback"),Lk=r("."),Bk=l(),ze=n("div"),f(ws.$$.fragment),Gk=l(),Ts=n("p"),Zk=r("Save metrics into a json file for that split, e.g. "),Mu=n("code"),Vk=r("train_results.json"),Xk=r("."),Yk=l(),Iu=n("p"),Hk=r("Under distributed environment this is done only for a process with rank 0."),Qk=l(),Es=n("p"),Kk=r("To understand the metrics please read the docstring of "),ud=n("a"),ex=r("log_metrics()"),tx=r(`. The only difference is that raw
unformatted numbers are saved in the current method.`),ox=l(),Pt=n("div"),f(As.$$.fragment),rx=l(),$s=n("p"),ax=r("Will save the model, so you can reload it using "),Su=n("code"),nx=r("from_pretrained()"),sx=r("."),ix=l(),qu=n("p"),lx=r("Will only save from the main process."),dx=l(),Jt=n("div"),f(ks.$$.fragment),cx=l(),Du=n("p"),px=r("Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),mx=l(),Uu=n("p"),hx=r("Under distributed environment this is done only for a process with rank 0."),ux=l(),zr=n("div"),f(xs.$$.fragment),fx=l(),ju=n("p"),gx=r("Main training entry point."),_x=l(),Ct=n("div"),f(Ms.$$.fragment),bx=l(),Pu=n("p"),vx=r("Perform a training step on a batch of inputs."),yx=l(),Ju=n("p"),wx=r("Subclass and override to inject custom behavior."),Wv=l(),Do=n("h2"),Or=n("a"),Cu=n("span"),f(Is.$$.fragment),Tx=l(),Fu=n("span"),Ex=r("Seq2SeqTrainer"),Rv=l(),mt=n("div"),f(Ss.$$.fragment),Ax=l(),Oe=n("div"),f(qs.$$.fragment),$x=l(),Nu=n("p"),kx=r("Run evaluation and returns metrics."),xx=l(),Ds=n("p"),Mx=r(`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),zu=n("code"),Ix=r("compute_metrics"),Sx=r(" argument)."),qx=l(),Ou=n("p"),Dx=r("You can also subclass and override this method to inject custom behavior."),Ux=l(),ce=n("div"),f(Us.$$.fragment),jx=l(),Wu=n("p"),Px=r("Run prediction and returns predictions and potential metrics."),Jx=l(),js=n("p"),Cx=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"),Fx=r("evaluate()"),Nx=r("."),zx=l(),f(Wr.$$.fragment),Ox=l(),Ps=n("p"),Wx=r("Returns: "),Lu=n("em"),Rx=r("NamedTuple"),Lx=r(" A namedtuple with the following keys:"),Bx=l(),Uo=n("ul"),jo=n("li"),Gx=r("predictions ("),Bu=n("code"),Zx=r("np.ndarray"),Vx=r("): The predictions on "),Gu=n("code"),Xx=r("test_dataset"),Yx=r("."),Hx=l(),Po=n("li"),Qx=r("label_ids ("),Zu=n("code"),Kx=r("np.ndarray"),eM=r(", "),Vu=n("em"),tM=r("optional"),oM=r("): The labels (if the dataset contained some)."),rM=l(),Jo=n("li"),aM=r("metrics ("),Xu=n("code"),nM=r("Dict[str, float]"),sM=r(", "),Yu=n("em"),iM=r("optional"),lM=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),Lv=l(),Co=n("h2"),Rr=n("a"),Hu=n("span"),f(Js.$$.fragment),dM=l(),Qu=n("span"),cM=r("TrainingArguments"),Bv=l(),q=n("div"),f(Cs.$$.fragment),pM=l(),Fs=n("p"),mM=r("TrainingArguments is the subset of the arguments we use in our example scripts "),Ku=n("strong"),hM=r(`which relate to the training loop
itself`),uM=r("."),fM=l(),Fo=n("p"),gM=r("Using "),fd=n("a"),_M=r("HfArgumentParser"),bM=r(` we can turn this class into
`),Ns=n("a"),vM=r("argparse"),yM=r(` arguments that can be specified on the
command line.`),wM=l(),ve=n("div"),f(zs.$$.fragment),TM=l(),ef=n("p"),EM=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=l(),No=n("p"),$M=r("For the main process the log level defaults to the logging level set ("),tf=n("code"),kM=r("logging.WARNING"),xM=r(` if you didn\u2019t do
anything) unless overridden by `),of=n("code"),MM=r("log_level"),IM=r(" argument."),SM=l(),zo=n("p"),qM=r("For the replica processes the log level defaults to "),rf=n("code"),DM=r("logging.WARNING"),UM=r(" unless overridden by "),af=n("code"),jM=r("log_level_replica"),PM=r(`
argument.`),JM=l(),Os=n("p"),CM=r("The choice between the main and replica process settings is made according to the return value of "),nf=n("code"),FM=r("should_log"),NM=r("."),zM=l(),Lr=n("div"),f(Ws.$$.fragment),OM=l(),sf=n("p"),WM=r("Get number of steps used for a linear warmup."),RM=l(),Ft=n("div"),f(Rs.$$.fragment),LM=l(),lf=n("p"),BM=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.`),GM=l(),Oo=n("p"),ZM=r("One such use is for "),df=n("code"),VM=r("datasets"),XM=r("\u2019s "),cf=n("code"),YM=r("map"),HM=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.`),QM=l(),Nt=n("div"),f(Ls.$$.fragment),KM=l(),pf=n("p"),e5=r("A method that regroups all arguments linked to the dataloaders creation."),t5=l(),f(Br.$$.fragment),o5=l(),zt=n("div"),f(Bs.$$.fragment),r5=l(),mf=n("p"),a5=r("A method that regroups all arguments linked to the evaluation."),n5=l(),f(Gr.$$.fragment),s5=l(),Ot=n("div"),f(Gs.$$.fragment),i5=l(),hf=n("p"),l5=r("A method that regroups all arguments linked to the evaluation."),d5=l(),f(Zr.$$.fragment),c5=l(),Wt=n("div"),f(Zs.$$.fragment),p5=l(),uf=n("p"),m5=r("A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters."),h5=l(),f(Vr.$$.fragment),u5=l(),Rt=n("div"),f(Vs.$$.fragment),f5=l(),ff=n("p"),g5=r("A method that regroups all arguments linked to the optimizer and its hyperparameters."),_5=l(),f(Xr.$$.fragment),b5=l(),We=n("div"),f(Xs.$$.fragment),v5=l(),gf=n("p"),y5=r("A method that regroups all arguments linked to synchronizing checkpoints with the Hub."),w5=l(),f(Yr.$$.fragment),T5=l(),f(Hr.$$.fragment),E5=l(),Lt=n("div"),f(Ys.$$.fragment),A5=l(),_f=n("p"),$5=r("A method that regroups all arguments linked to the evaluation."),k5=l(),f(Qr.$$.fragment),x5=l(),Re=n("div"),f(Hs.$$.fragment),M5=l(),bf=n("p"),I5=r("A method that regroups all basic arguments linked to testing on a held-out dataset."),S5=l(),f(Kr.$$.fragment),q5=l(),f(ea.$$.fragment),D5=l(),Le=n("div"),f(Qs.$$.fragment),U5=l(),vf=n("p"),j5=r("A method that regroups all basic arguments linked to the training."),P5=l(),f(ta.$$.fragment),J5=l(),f(oa.$$.fragment),C5=l(),ra=n("div"),f(Ks.$$.fragment),F5=l(),ei=n("p"),N5=r("Serializes this instance while replace "),yf=n("code"),z5=r("Enum"),O5=r(` by their values (for JSON serialization support). It obfuscates
the token values by removing their value.`),W5=l(),aa=n("div"),f(ti.$$.fragment),R5=l(),wf=n("p"),L5=r("Serializes this instance to a JSON string."),B5=l(),na=n("div"),f(oi.$$.fragment),G5=l(),Tf=n("p"),Z5=r("Sanitized serialization to use with TensorBoard\u2019s hparams"),Gv=l(),Wo=n("h2"),sa=n("a"),Ef=n("span"),f(ri.$$.fragment),V5=l(),Af=n("span"),X5=r("Seq2SeqTrainingArguments"),Zv=l(),qe=n("div"),f(ai.$$.fragment),Y5=l(),ni=n("p"),H5=r("TrainingArguments is the subset of the arguments we use in our example scripts "),$f=n("strong"),Q5=r(`which relate to the training loop
itself`),K5=r("."),e9=l(),Ro=n("p"),t9=r("Using "),gd=n("a"),o9=r("HfArgumentParser"),r9=r(` we can turn this class into
`),si=n("a"),a9=r("argparse"),n9=r(` arguments that can be specified on the
command line.`),s9=l(),ia=n("div"),f(ii.$$.fragment),i9=l(),Lo=n("p"),l9=r("Serializes this instance while replace "),kf=n("code"),d9=r("Enum"),c9=r(" by their values and "),xf=n("code"),p9=r("GenerationConfig"),m9=r(` by dictionaries (for JSON
serialization support). It obfuscates the token values by removing their value.`),Vv=l(),Bo=n("h2"),la=n("a"),Mf=n("span"),f(li.$$.fragment),h9=l(),If=n("span"),u9=r("Checkpoints"),Xv=l(),ye=n("p"),f9=r("By default, "),_d=n("a"),g9=r("Trainer"),_9=r(" will save all checkpoints in the "),Sf=n("code"),b9=r("output_dir"),v9=r(` you set in the
`),bd=n("a"),y9=r("TrainingArguments"),w9=r(" you are using. Those will go in subfolder named "),qf=n("code"),T9=r("checkpoint-xxx"),E9=r(` with xxx
being the step at which the training was at.`),Yv=l(),da=n("p"),A9=r("Resuming training from a checkpoint can be done when calling "),vd=n("a"),$9=r("Trainer.train()"),k9=r(" with either:"),Hv=l(),ca=n("ul"),yd=n("li"),Df=n("code"),x9=r("resume_from_checkpoint=True"),M9=r(" which will resume training from the latest checkpoint"),I9=l(),wd=n("li"),Uf=n("code"),S9=r("resume_from_checkpoint=checkpoint_dir"),q9=r(` which will resume training from the specific checkpoint in the directory
passed.`),Qv=l(),Be=n("p"),D9=r("In addition, you can easily save your checkpoints on the Model Hub when using "),jf=n("code"),U9=r("push_to_hub=True"),j9=r(`. By default, all
the models saved in intermediate checkpoints are saved in different commits, but not the optimizer state. You can adapt
the `),Pf=n("code"),P9=r("hub-strategy"),J9=r(" value of your "),Td=n("a"),C9=r("TrainingArguments"),F9=r(" to either:"),Kv=l(),pa=n("ul"),ma=n("li"),Jf=n("code"),N9=r('"checkpoint"'),z9=r(`: the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to
resume training easily with `),Cf=n("code"),O9=r('trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")'),W9=r("."),R9=l(),Ed=n("li"),Ff=n("code"),L9=r('"all_checkpoints"'),B9=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)`),ey=l(),Go=n("h2"),ha=n("a"),Nf=n("span"),f(di.$$.fragment),G9=l(),zf=n("span"),Z9=r("Logging"),ty=l(),Ge=n("p"),V9=r("By default "),Ad=n("a"),X9=r("Trainer"),Y9=r(" will use "),Of=n("code"),H9=r("logging.INFO"),Q9=r(" for the main process and "),Wf=n("code"),K9=r("logging.WARNING"),eI=r(" for the replicas if any."),oy=l(),Bt=n("p"),tI=r("These defaults can be overridden to use any of the 5 "),Rf=n("code"),oI=r("logging"),rI=r(" levels with "),$d=n("a"),aI=r("TrainingArguments"),nI=r(`\u2019s
arguments:`),ry=l(),ua=n("ul"),kd=n("li"),Lf=n("code"),sI=r("log_level"),iI=r(" - for the main process"),lI=l(),xd=n("li"),Bf=n("code"),dI=r("log_level_replica"),cI=r(" - for the replicas"),ay=l(),Ze=n("p"),pI=r("Further, if "),Md=n("a"),mI=r("TrainingArguments"),hI=r("\u2019s "),Gf=n("code"),uI=r("log_on_each_node"),fI=r(" is set to "),Zf=n("code"),gI=r("False"),_I=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.`),ny=l(),pe=n("p"),bI=r("Note that "),Id=n("a"),vI=r("Trainer"),yI=r(" is going to set "),Vf=n("code"),wI=r("transformers"),TI=r(`\u2019s log level separately for each node in its
`),Xf=n("code"),EI=r("Trainer.__init__()"),AI=r(`. So you may want to set this sooner (see the next example) if you tap into other
`),Yf=n("code"),$I=r("transformers"),kI=r(" functionality before creating the "),Sd=n("a"),xI=r("Trainer"),MI=r(" object."),sy=l(),qd=n("p"),II=r("Here is an example of how this can be used in an application:"),iy=l(),f(ci.$$.fragment),ly=l(),Dd=n("p"),SI=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:`),dy=l(),f(pi.$$.fragment),cy=l(),Ud=n("p"),qI=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:`),py=l(),f(mi.$$.fragment),my=l(),jd=n("p"),DI=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.`),hy=l(),Pd=n("p"),UI=r("If you need your application to be as quiet as possible you could do:"),uy=l(),f(hi.$$.fragment),fy=l(),fa=n("p"),jI=r("(add "),Hf=n("code"),PI=r("--log_on_each_node 0"),JI=r(" if on multi-node environment)"),gy=l(),Zo=n("h2"),ga=n("a"),Qf=n("span"),f(ui.$$.fragment),CI=l(),Kf=n("span"),FI=r("Randomness"),_y=l(),we=n("p"),NI=r("When resuming from a checkpoint generated by "),Jd=n("a"),zI=r("Trainer"),OI=r(` all efforts are made to restore the
`),eg=n("em"),WI=r("python"),RI=r(", "),tg=n("em"),LI=r("numpy"),BI=r(" and "),og=n("em"),GI=r("pytorch"),ZI=r(` RNG states to the same states as they were at the moment of saving that checkpoint,
which should make the \u201Cstop and resume\u201D style of training as close as possible to non-stop training.`),by=l(),Gt=n("p"),VI=r(`However, due to various default non-deterministic pytorch settings this might not fully work. If you want full
determinism please refer to `),fi=n("a"),XI=r("Controlling sources of randomness"),YI=r(`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),rg=n("code"),HI=r("torch.backends.cudnn.deterministic"),QI=r(`) may slow things down, therefore this
can\u2019t be done by default, but you can enable those yourself if needed.`),vy=l(),Vo=n("h2"),_a=n("a"),ag=n("span"),f(gi.$$.fragment),KI=l(),ng=n("span"),eS=r("Specific GPUs Selection"),yy=l(),Cd=n("p"),tS=r("Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),wy=l(),ba=n("p"),oS=r("When using "),_i=n("a"),sg=n("code"),rS=r("DistributedDataParallel"),aS=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:"),Ty=l(),f(bi.$$.fragment),Ey=l(),Zt=n("p"),nS=r("if you have either "),vi=n("a"),ig=n("code"),sS=r("accelerate"),iS=r(" or "),yi=n("a"),lg=n("code"),lS=r("deepspeed"),dS=r(" installed you can also accomplish the same by using one of:"),Ay=l(),f(wi.$$.fragment),$y=l(),f(Ti.$$.fragment),ky=l(),va=n("p"),cS=r("You don\u2019t need to use the Accelerate or "),Fd=n("a"),pS=r("the Deepspeed integration"),mS=r(" features to use these launchers."),xy=l(),Nd=n("p"),hS=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."),My=l(),zd=n("p"),uS=r("The following environment variables help you control which GPUs to use and their order."),Iy=l(),Od=n("p"),dg=n("strong"),cg=n("code"),fS=r("CUDA_VISIBLE_DEVICES"),Sy=l(),ya=n("p"),gS=r("If you have multiple GPUs and you\u2019d like to use only 1 or a few of those GPUs, set the environment variable "),pg=n("code"),_S=r("CUDA_VISIBLE_DEVICES"),bS=r(" to a list of the GPUs to be used."),qy=l(),Wd=n("p"),vS=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:"),Dy=l(),f(Ei.$$.fragment),Uy=l(),Vt=n("p"),yS=r("So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),mg=n("code"),wS=r("cuda:0"),TS=r(" and "),hg=n("code"),ES=r("cuda:1"),AS=r(" correspondingly."),jy=l(),Rd=n("p"),$S=r("You can even change their order:"),Py=l(),f(Ai.$$.fragment),Jy=l(),Xt=n("p"),kS=r("Here your physical GPUs 0 and 2 are mapped to "),ug=n("code"),xS=r("cuda:1"),MS=r(" and "),fg=n("code"),IS=r("cuda:0"),SS=r(" correspondingly."),Cy=l(),Yt=n("p"),qS=r("The above examples were all for "),gg=n("code"),DS=r("DistributedDataParallel"),US=r(" use pattern, but the same method works for "),$i=n("a"),_g=n("code"),jS=r("DataParallel"),PS=r(" as well:"),Fy=l(),f(ki.$$.fragment),Ny=l(),Ld=n("p"),JS=r("To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),zy=l(),f(xi.$$.fragment),Oy=l(),Bd=n("p"),CS=r("As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),Wy=l(),f(Mi.$$.fragment),Ry=l(),Gd=n("p"),FS=r("but this approach can be confusing since you may forget you set up the environment variable earlier and not understand why the wrong GPUs are used. Therefore, it\u2019s a common practice to set the environment variable just for a specific run on the same command line as it\u2019s shown in most examples of this section."),Ly=l(),Zd=n("p"),bg=n("strong"),vg=n("code"),NS=r("CUDA_DEVICE_ORDER"),By=l(),wa=n("p"),zS=r("There is an additional environment variable "),yg=n("code"),OS=r("CUDA_DEVICE_ORDER"),WS=r(" that controls how the physical devices are ordered. The two choices are:"),Gy=l(),Vd=n("ol"),Ii=n("li"),RS=r("ordered by PCIe bus IDs (matches "),wg=n("code"),LS=r("nvidia-smi"),BS=r("\u2019s order) - this is the default."),Zy=l(),f(Si.$$.fragment),Vy=l(),qi=n("ol"),Tg=n("li"),GS=r("ordered by GPU compute capabilities"),Xy=l(),f(Di.$$.fragment),Yy=l(),Ht=n("p"),ZS=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 "),Eg=n("code"),VS=r("CUDA_DEVICE_ORDER=FASTEST_FIRST"),XS=r(" will always put the newer faster card first. It\u2019ll be somewhat confusing though since "),Ag=n("code"),YS=r("nvidia-smi"),HS=r(" will still report them in the PCIe order."),Hy=l(),Xd=n("p"),QS=r("The other solution to swapping the order is to use:"),Qy=l(),f(Ui.$$.fragment),Ky=l(),Yd=n("p"),KS=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."),e1=l(),Ta=n("p"),eq=r("Also if you do set this environment variable it\u2019s the best to set it in your "),$g=n("code"),tq=r("~/.bashrc"),oq=r(" file or some other startup config file and forget about it."),t1=l(),Xo=n("h2"),Ea=n("a"),kg=n("span"),f(ji.$$.fragment),rq=l(),xg=n("span"),aq=r("Trainer Integrations"),o1=l(),Aa=n("p"),nq=r("The "),Hd=n("a"),sq=r("Trainer"),iq=r(` has been extended to support libraries that may dramatically improve your training
time and fit much bigger models.`),r1=l(),Ve=n("p"),lq=r("Currently it supports third party solutions, "),Pi=n("a"),dq=r("DeepSpeed"),cq=r(" and "),Ji=n("a"),pq=r("PyTorch FSDP"),mq=r(", which implement parts of the paper "),Ci=n("a"),hq=r(`ZeRO: Memory Optimizations
Toward Training Trillion Parameter Models, by Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, Yuxiong He`),uq=r("."),a1=l(),$a=n("p"),fq=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 "),Qd=n("a"),gq=r("PyTorch FSDP integration"),_q=r(")"),n1=l(),Kd=n("a"),s1=l(),Yo=n("h3"),ka=n("a"),Mg=n("span"),f(Fi.$$.fragment),bq=l(),Ig=n("span"),vq=r("CUDA Extension Installation Notes"),i1=l(),ec=n("p"),yq=r("As of this writing, Deepspeed require compilation of CUDA C++ code, before it can be used."),l1=l(),xa=n("p"),wq=r("While all installation issues should be dealt with through the corresponding GitHub Issues of "),Ni=n("a"),Tq=r("Deepspeed"),Eq=r(`, there are a few common issues that one may encounter while building
any PyTorch extension that needs to build CUDA extensions.`),d1=l(),tc=n("p"),Aq=r("Therefore, if you encounter a CUDA-related build issue while doing the following:"),c1=l(),f(zi.$$.fragment),p1=l(),oc=n("p"),$q=r("please, read the following notes first."),m1=l(),Qt=n("p"),kq=r("In these notes we give examples for what to do when "),Sg=n("code"),xq=r("pytorch"),Mq=r(" has been built with CUDA "),qg=n("code"),Iq=r("10.2"),Sq=r(`. If your situation is
different remember to adjust the version number to the one you are after.`),h1=l(),Ho=n("h4"),Ma=n("a"),Dg=n("span"),f(Oi.$$.fragment),qq=l(),Ug=n("span"),Dq=r("Possible problem #1"),u1=l(),rc=n("p"),Uq=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.`),f1=l(),Xe=n("p"),jq=r("For example, if you installed "),jg=n("code"),Pq=r("pytorch"),Jq=r(" with "),Pg=n("code"),Cq=r("cudatoolkit==10.2"),Fq=r(` in the Python environment, you also need to have
CUDA `),Jg=n("code"),Nq=r("10.2"),zq=r(" installed system-wide."),g1=l(),Kt=n("p"),Oq=r("The exact location may vary from system to system, but "),Cg=n("code"),Wq=r("/usr/local/cuda-10.2"),Rq=r(` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),Fg=n("code"),Lq=r("PATH"),Bq=r(` environment variable, one can find the
installation location by doing:`),_1=l(),f(Wi.$$.fragment),b1=l(),Ia=n("p"),Gq=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: `),Ri=n("a"),Zq=r("ubuntu cuda 10.2 install"),Vq=r("."),v1=l(),Qo=n("h4"),Sa=n("a"),Ng=n("span"),f(Li.$$.fragment),Xq=l(),zg=n("span"),Yq=r("Possible problem #2"),y1=l(),ac=n("p"),Hq=r(`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),w1=l(),f(Bi.$$.fragment),T1=l(),eo=n("p"),Qq=r("Now, in this situation you need to make sure that your "),Og=n("code"),Kq=r("PATH"),eD=r(" and "),Wg=n("code"),tD=r("LD_LIBRARY_PATH"),oD=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.`),E1=l(),nc=n("p"),rD=r("First, you may look at their contents:"),A1=l(),f(Gi.$$.fragment),$1=l(),sc=n("p"),aD=r("so you get an idea of what is inside."),k1=l(),qa=n("p"),nD=r("It\u2019s possible that "),Rg=n("code"),sD=r("LD_LIBRARY_PATH"),iD=r(" is empty."),x1=l(),ht=n("p"),Lg=n("code"),lD=r("PATH"),dD=r(" lists the locations of where executables can be found and "),Bg=n("code"),cD=r("LD_LIBRARY_PATH"),pD=r(` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),Gg=n("code"),mD=r(":"),hD=r(` is used to separate multiple
entries.`),M1=l(),ic=n("p"),uD=r(`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),I1=l(),f(Zi.$$.fragment),S1=l(),lc=n("p"),fD=r("Note that we aren\u2019t overwriting the existing values, but prepending instead."),q1=l(),Ye=n("p"),gD=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"),_D=r("lib64"),bD=r(" sub-directory is where the various CUDA "),Vg=n("code"),vD=r(".so"),yD=r(" objects, like "),Xg=n("code"),wD=r("libcudart.so"),TD=r(` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),D1=l(),Ko=n("h4"),Da=n("a"),Yg=n("span"),f(Vi.$$.fragment),ED=l(),Hg=n("span"),AD=r("Possible problem #3"),U1=l(),to=n("p"),$D=r("Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),Qg=n("code"),kD=r("gcc-9"),xD=r(` but it wants
`),Kg=n("code"),MD=r("gcc-7"),ID=r("."),j1=l(),dc=n("p"),SD=r("There are various ways to go about it."),P1=l(),cc=n("p"),qD=r("If you can install the latest CUDA toolkit it typically should support the newer compiler."),J1=l(),Ua=n("p"),DD=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 `),e_=n("code"),UD=r("gcc-7"),jD=r(` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),C1=l(),f(Xi.$$.fragment),F1=l(),te=n("p"),PD=r("Here, we are making a symlink to "),t_=n("code"),JD=r("gcc-7"),CD=r(" from "),o_=n("code"),FD=r("/usr/local/cuda-10.2/bin/gcc"),ND=r(` and since
`),r_=n("code"),zD=r("/usr/local/cuda-10.2/bin/"),OD=r(" should be in the "),a_=n("code"),WD=r("PATH"),RD=r(` environment variable (see the previous problem\u2019s solution), it
should find `),n_=n("code"),LD=r("gcc-7"),BD=r(" (and "),s_=n("code"),GD=r("g++7"),ZD=r(") and then the build will succeed."),N1=l(),pc=n("p"),VD=r("As always make sure to edit the paths in the example to match your situation."),z1=l(),er=n("h3"),ja=n("a"),i_=n("span"),f(Yi.$$.fragment),XD=l(),l_=n("span"),YD=r("PyTorch Fully Sharded Data parallel"),O1=l(),Pa=n("p"),HD=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 `),Hi=n("a"),QD=r("Fully Sharded Data Parallel blog"),KD=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.`),W1=l(),Qi=n("p"),d_=n("strong"),eU=r("Required PyTorch version for FSDP support"),tU=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.`),R1=l(),Ki=n("p"),c_=n("strong"),oU=r("Usage"),rU=r(":"),L1=l(),me=n("ul"),p_=n("li"),el=n("p"),aU=r(`Make sure you have added the distributed launcher
`),m_=n("code"),nU=r("-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),sU=r(" if you haven\u2019t been using it already."),iU=l(),tl=n("li"),mc=n("p"),h_=n("strong"),lU=r("Sharding Strategy"),dU=r(":"),cU=l(),tr=n("ul"),ol=n("li"),pU=r(`FULL_SHARD : Shards optimizer states + gradients + model parameters across data parallel workers/GPUs.
For this, add `),u_=n("code"),mU=r("--fsdp full_shard"),hU=r(" to the command line arguments."),uU=l(),rl=n("li"),fU=r(`SHARD_GRAD_OP : Shards optimizer states + gradients across data parallel workers/GPUs.
For this, add `),f_=n("code"),gU=r("--fsdp shard_grad_op"),_U=r(" to the command line arguments."),bU=l(),al=n("li"),vU=r("NO_SHARD : No sharding. For this, add "),g_=n("code"),yU=r("--fsdp no_shard"),wU=r(" to the command line arguments."),TU=l(),__=n("li"),or=n("p"),EU=r(`To offload the parameters and gradients to the CPU,
add `),b_=n("code"),AU=r('--fsdp "full_shard offload"'),$U=r(" or "),v_=n("code"),kU=r('--fsdp "shard_grad_op offload"'),xU=r(" to the command line arguments."),MU=l(),y_=n("li"),ut=n("p"),IU=r("To automatically recursively wrap layers with FSDP using "),w_=n("code"),SU=r("default_auto_wrap_policy"),qU=r(`,
add `),T_=n("code"),DU=r('--fsdp "full_shard auto_wrap"'),UU=r(" or "),E_=n("code"),jU=r('--fsdp "shard_grad_op auto_wrap"'),PU=r(" to the command line arguments."),JU=l(),A_=n("li"),rr=n("p"),CU=r(`To enable both CPU offloading and auto wrapping,
add `),$_=n("code"),FU=r('--fsdp "full_shard offload auto_wrap"'),NU=r(" or "),k_=n("code"),zU=r('--fsdp "shard_grad_op offload auto_wrap"'),OU=r(" to the command line arguments."),WU=l(),nl=n("li"),ft=n("p"),RU=r("Remaining FSDP config is passed via "),x_=n("code"),LU=r("--fsdp_config <path_to_fsdp_config.json>"),BU=r(`. It is either a location of
FSDP json config file (e.g., `),M_=n("code"),GU=r("fsdp_config.json"),ZU=r(") or an already loaded json file as "),I_=n("code"),VU=r("dict"),XU=r("."),YU=l(),De=n("ul"),hc=n("li"),HU=r("If auto wrapping is enabled, you can either use transformer based auto wrap policy or size based auto wrap policy."),sl=n("ul"),ge=n("li"),QU=r("For transformer based auto wrap policy, it is recommended to specify "),S_=n("code"),KU=r("fsdp_transformer_layer_cls_to_wrap"),ej=r(" in the config file. If not specified, the default value is "),q_=n("code"),tj=r("model._no_split_modules"),oj=r(` when available.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),D_=n("code"),rj=r("BertLayer"),aj=r(", "),U_=n("code"),nj=r("GPTJBlock"),sj=r(", "),j_=n("code"),ij=r("T5Block"),lj=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.`),dj=l(),il=n("li"),cj=r("For size based auto wrap policy, please add "),P_=n("code"),pj=r("fsdp_min_num_params"),mj=r(` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),hj=l(),gt=n("li"),J_=n("code"),uj=r("fsdp_backward_prefetch"),fj=r(` can be specified in the config file. It controls when to prefetch next set of parameters.
`),C_=n("code"),gj=r("backward_pre"),_j=r(" and "),F_=n("code"),bj=r("backward_pos"),vj=r(` are available options.
For more information refer `),N_=n("code"),yj=r("torch.distributed.fsdp.fully_sharded_data_parallel.BackwardPrefetch"),wj=l(),Ja=n("li"),z_=n("code"),Tj=r("fsdp_forward_prefetch"),Ej=r(` can be specified in the config file. It controls when to prefetch next set of parameters.
If `),O_=n("code"),Aj=r('"True"'),$j=r(", FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass."),kj=l(),Ca=n("li"),W_=n("code"),xj=r("limit_all_gathers"),Mj=r(` can be specified in the config file.
If `),R_=n("code"),Ij=r('"True"'),Sj=r(", FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers."),qj=l(),Fa=n("li"),L_=n("code"),Dj=r("activation_checkpointing"),Uj=r(` can be specified in the config file.
If `),B_=n("code"),jj=r('"True"'),Pj=r(`, FSDP activation checkpointing is a technique to reduce memory usage by clearing activations of
certain layers and recomputing them during a backward pass. Effectively, this trades extra computation time
for reduced memory usage.`),B1=l(),uc=n("p"),G_=n("strong"),Jj=r("Few caveats to be aware of"),G1=l(),fc=n("ul"),He=n("li"),Cj=r("it is incompatible with "),Z_=n("code"),Fj=r("generate"),Nj=r(", thus is incompatible with "),V_=n("code"),zj=r("--predict_with_generate"),Oj=r(`
in all seq2seq/clm scripts (translation/summarization/clm etc.).`),Wj=n("br"),Rj=r(`
Please refer issue `),ll=n("a"),Lj=r("#21667"),Z1=l(),ar=n("h3"),Na=n("a"),X_=n("span"),f(dl.$$.fragment),Bj=l(),Y_=n("span"),Gj=r("PyTorch/XLA Fully Sharded Data parallel"),V1=l(),oo=n("p"),Zj=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 `),cl=n("a"),Vj=r("Scaling PyTorch models on Cloud TPUs with FSDP"),Xj=r(" and "),pl=n("a"),Yj=r("PyTorch/XLA implementation of FSDP"),Hj=r(`
All you need to do is enable it through the config.`),X1=l(),ml=n("p"),H_=n("strong"),Qj=r("Required PyTorch/XLA version for FSDP support"),Kj=r(": >=2.0"),Y1=l(),hl=n("p"),Q_=n("strong"),eP=r("Usage"),tP=r(":"),H1=l(),ro=n("p"),oP=r("Pass "),K_=n("code"),rP=r('--fsdp "full shard"'),aP=r(" along with following changes to be made in "),eb=n("code"),nP=r("--fsdp_config <path_to_fsdp_config.json>"),sP=r(":"),Q1=l(),Qe=n("ul"),za=n("li"),tb=n("code"),iP=r("xla"),lP=r(" should be set to "),ob=n("code"),dP=r("True"),cP=r(" to enable PyTorch/XLA FSDP."),pP=l(),Oa=n("li"),rb=n("code"),mP=r("xla_fsdp_settings"),hP=r(` The value is a dictionary which stores the XLA FSDP wrapping parameters.
For a complete list of options, please see `),ul=n("a"),uP=r("here"),fP=r("."),gP=l(),Ke=n("li"),ab=n("code"),_P=r("xla_fsdp_grad_ckpt"),bP=r(". When "),nb=n("code"),vP=r("True"),yP=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
`),sb=n("code"),wP=r("fsdp_min_num_params"),TP=r(" or "),ib=n("code"),EP=r("fsdp_transformer_layer_cls_to_wrap"),AP=r("."),$P=l(),gc=n("li"),kP=r("You can either use transformer based auto wrap policy or size based auto wrap policy."),fl=n("ul"),_e=n("li"),xP=r("For transformer based auto wrap policy, it is recommended to specify "),lb=n("code"),MP=r("fsdp_transformer_layer_cls_to_wrap"),IP=r(" in the config file. If not specified, the default value is "),db=n("code"),SP=r("model._no_split_modules"),qP=r(` when available.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),cb=n("code"),DP=r("BertLayer"),UP=r(", "),pb=n("code"),jP=r("GPTJBlock"),PP=r(", "),mb=n("code"),JP=r("T5Block"),CP=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.`),FP=l(),gl=n("li"),NP=r("For size based auto wrap policy, please add "),hb=n("code"),zP=r("fsdp_min_num_params"),OP=r(` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),K1=l(),nr=n("h3"),Wa=n("a"),ub=n("span"),f(_l.$$.fragment),WP=l(),fb=n("span"),RP=r("Using Trainer for accelerated PyTorch Training on Mac"),ew=l(),et=n("p"),LP=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 `),gb=n("code"),BP=r('"mps"'),GP=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 `),bl=n("a"),ZP=r("Introducing Accelerated PyTorch Training on Mac"),VP=r(`
and `),vl=n("a"),XP=r("MPS BACKEND"),YP=r("."),tw=l(),f(Ra.$$.fragment),ow=l(),_c=n("p"),_b=n("strong"),HP=r("Benefits of Training and Inference using Apple Silicon Chips"),rw=l(),ao=n("ol"),bb=n("li"),QP=r("Enables users to train larger networks or batch sizes locally"),KP=l(),vb=n("li"),e6=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.`),t6=l(),yb=n("li"),o6=r("Reduces costs associated with cloud-based development or the need for additional local GPUs."),aw=l(),sr=n("p"),wb=n("strong"),r6=r("Pre-requisites"),a6=r(`: To install torch with mps support,
please follow this nice medium article `),yl=n("a"),n6=r("GPU-Acceleration Comes to PyTorch on M1 Macs"),s6=r("."),nw=l(),_t=n("p"),Tb=n("strong"),i6=r("Usage"),l6=r(`:
`),Eb=n("code"),d6=r("mps"),c6=r(" device will be used by default if available similar to the way "),Ab=n("code"),p6=r("cuda"),m6=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:`),sw=l(),f(wl.$$.fragment),iw=l(),bc=n("p"),$b=n("strong"),h6=r("A few caveats to be aware of"),lw=l(),La=n("ol"),Tl=n("li"),u6=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 `),kb=n("code"),f6=r("PYTORCH_ENABLE_MPS_FALLBACK=1"),g6=r(`,
which will fallback to CPU for these operations. It still throws a UserWarning however.`),_6=l(),Ue=n("li"),b6=r("Distributed setups "),xb=n("code"),v6=r("gloo"),y6=r(" and "),Mb=n("code"),w6=r("nccl"),T6=r(" are not working with "),Ib=n("code"),E6=r("mps"),A6=r(` device.
This means that currently only single GPU of `),Sb=n("code"),$6=r("mps"),k6=r(" device type can be used."),dw=l(),no=n("p"),x6=r("Finally, please, remember that, \u{1F917} "),qb=n("code"),M6=r("Trainer"),I6=r(` only integrates MPS backend, therefore if you
have any problems or questions with regards to MPS backend usage, please,
file an issue with `),El=n("a"),S6=r("PyTorch GitHub"),q6=r("."),cw=l(),ir=n("h2"),Ba=n("a"),Db=n("span"),f(Al.$$.fragment),D6=l(),Ub=n("span"),U6=r("Using Accelerate Launcher with Trainer"),pw=l(),vc=n("p"),j6=r("Accelerate now powers Trainer. In terms of what users should expect:"),mw=l(),Ga=n("ul"),jb=n("li"),P6=r("They can keep using the Trainer ingterations such as FSDP, DeepSpeed vis trainer arguments without any changes on their part."),J6=l(),Pb=n("li"),C6=r("They can now use Accelerate Launcher with Trainer (recommended)."),hw=l(),yc=n("p"),F6=r("Steps to use Accelerate Launcher with Trainer:"),uw=l(),so=n("ol"),Jb=n("li"),io=n("p"),N6=r("Make sure \u{1F917} Accelerate is installed, you can\u2019t use the "),Cb=n("code"),z6=r("Trainer"),O6=r(" without it anyway. If not "),Fb=n("code"),W6=r("pip install accelerate"),R6=r(". You may also need to update your version of Accelerate: "),Nb=n("code"),L6=r("pip install accelerate --upgrade"),B6=l(),K=n("li"),$l=n("p"),G6=r("Run "),zb=n("code"),Z6=r("accelerate config"),V6=r(` and fill the questionnaire. Below are example accelerate configs:
a. DDP Multi-node Multi-GPU config:`),X6=l(),f(kl.$$.fragment),Y6=l(),Ob=n("p"),H6=r("b. FSDP config:"),Q6=l(),f(xl.$$.fragment),K6=l(),Wb=n("p"),eJ=r("c. DeepSpeed config pointing to a file:"),tJ=l(),f(Ml.$$.fragment),oJ=l(),Rb=n("p"),rJ=r("d. DeepSpeed config using accelerate plugin:"),aJ=l(),f(Il.$$.fragment),nJ=l(),Lb=n("li"),lr=n("p"),sJ=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 `),Bb=n("code"),iJ=r("run_glue.py"),lJ=r(" using "),Gb=n("code"),dJ=r("accelerate launcher"),cJ=r(" with FSDP config from above."),fw=l(),f(Sl.$$.fragment),gw=l(),ql=n("ol"),Dl=n("li"),pJ=r("You can also directly use the cmd args for "),Zb=n("code"),mJ=r("accelerate launch"),hJ=r(". Above example would map to:"),_w=l(),f(Ul.$$.fragment),bw=l(),Za=n("p"),uJ=r("For more information, please refer the \u{1F917} Accelerate CLI guide: "),jl=n("a"),fJ=r("Launching your \u{1F917} Accelerate scripts"),gJ=r("."),vw=l(),wc=n("p"),_J=r("Sections that were moved:"),yw=l(),M=n("p"),bJ=r("[ "),Tc=n("a"),vJ=r("DeepSpeed"),Vb=n("a"),yJ=r(`
| `),Ec=n("a"),wJ=r("Installation"),Xb=n("a"),TJ=r(`
| `),Ac=n("a"),EJ=r("Deployment with multiple GPUs"),Yb=n("a"),AJ=r(`
| `),$c=n("a"),$J=r("Deployment with one GPU"),Hb=n("a"),kJ=r(`
| `),kc=n("a"),xJ=r("Deployment in Notebooks"),Qb=n("a"),MJ=r(`
| `),xc=n("a"),IJ=r("Configuration"),Kb=n("a"),SJ=r(`
| `),Mc=n("a"),qJ=r("Passing Configuration"),ev=n("a"),DJ=r(`
| `),Ic=n("a"),UJ=r("Shared Configuration"),tv=n("a"),jJ=r(`
| `),Sc=n("a"),PJ=r("ZeRO"),ov=n("a"),JJ=r(`
| `),qc=n("a"),CJ=r("ZeRO-2 Config"),rv=n("a"),FJ=r(`
| `),Dc=n("a"),NJ=r("ZeRO-3 Config"),av=n("a"),zJ=r(`
| `),Uc=n("a"),OJ=r("NVMe Support"),nv=n("a"),WJ=r(`
| `),jc=n("a"),RJ=r("ZeRO-2 vs ZeRO-3 Performance"),sv=n("a"),LJ=r(`
| `),Pc=n("a"),BJ=r("ZeRO-2 Example"),iv=n("a"),GJ=r(`
| `),Jc=n("a"),ZJ=r("ZeRO-3 Example"),lv=n("a"),VJ=r(`
| `),Cc=n("a"),XJ=r("Optimizer"),dv=n("a"),YJ=r(`
| `),Fc=n("a"),HJ=r("Scheduler"),cv=n("a"),QJ=r(`
| `),Nc=n("a"),KJ=r("fp32 Precision"),pv=n("a"),e8=r(`
| `),zc=n("a"),t8=r("Automatic Mixed Precision"),mv=n("a"),o8=r(`
| `),Oc=n("a"),r8=r("Batch Size"),hv=n("a"),a8=r(`
| `),Wc=n("a"),n8=r("Gradient Accumulation"),uv=n("a"),s8=r(`
| `),Rc=n("a"),i8=r("Gradient Clipping"),fv=n("a"),l8=r(`
| `),Lc=n("a"),d8=r("Getting The Model Weights Out"),gv=n("a"),c8=r(`
]`),this.h()},l(t){const c=LL('[data-svelte="svelte-1phssyn"]',document.head);u=s(c,"META",{name:!0,content:!0}),c.forEach(o),$=d(t),T=s(t,"H1",{class:!0});var Pl=i(T);w=s(Pl,"A",{id:!0,class:!0,href:!0});var _v=i(w);k=s(_v,"SPAN",{});var bv=i(k);g(h.$$.fragment,bv),bv.forEach(o),_v.forEach(o),E=d(Pl),C=s(Pl,"SPAN",{});var vv=i(C);z=a(vv,"Trainer"),vv.forEach(o),Pl.forEach(o),j=d(t),R=s(t,"P",{});var dr=i(R);G=a(dr,"The "),ee=s(dr,"A",{href:!0});var yv=i(ee);Q=a(yv,"Trainer"),yv.forEach(o),Y=a(dr," class provides an API for feature-complete training in PyTorch for most standard use cases. It\u2019s used in most of the "),X=s(dr,"A",{href:!0,rel:!0});var wv=i(X);ue=a(wv,"example scripts"),wv.forEach(o),H=a(dr,"."),dr.forEach(o),L=d(t),O=s(t,"P",{});var cr=i(O);ne=a(cr,"Before instantiating your "),F=s(cr,"A",{href:!0});var Tv=i(F);Ee=a(Tv,"Trainer"),Tv.forEach(o),Ae=a(cr,", create a "),se=s(cr,"A",{href:!0});var Ev=i(se);bt=a(Ev,"TrainingArguments"),Ev.forEach(o),vt=a(cr," to access all the points of customization during training."),cr.forEach(o),be=d(t),Pe=s(t,"P",{});var Jl=i(Pe);bn=a(Jl,"The API supports distributed training on multiple GPUs/TPUs, mixed precision through "),$e=s(Jl,"A",{href:!0,rel:!0});var Av=i($e);vn=a(Av,"NVIDIA Apex"),Av.forEach(o),yn=a(Jl," and Native AMP for PyTorch."),Jl.forEach(o),ie=d(t),re=s(t,"P",{});var Cl=i(re);Rl=a(Cl,"The "),ke=s(Cl,"A",{href:!0});var $v=i(ke);gr=a($v,"Trainer"),$v.forEach(o),Ll=a(Cl," contains the basic training loop which supports the above features. To inject custom behavior you can subclass them and override the following methods:"),Cl.forEach(o),yo=d(t),W=s(t,"UL",{});var B=i(W);ae=s(B,"LI",{});var Bc=i(ae);_r=s(Bc,"STRONG",{});var kv=i(_r);Bl=a(kv,"get_train_dataloader"),kv.forEach(o),Gl=a(Bc," \u2014 Creates the training DataLoader."),Bc.forEach(o),Zl=d(B),Vl=s(B,"LI",{});var Gc=i(Vl);rm=s(Gc,"STRONG",{});var xv=i(rm);gT=a(xv,"get_eval_dataloader"),xv.forEach(o),_T=a(Gc," \u2014 Creates the evaluation DataLoader."),Gc.forEach(o),bT=d(B),Xl=s(B,"LI",{});var p8=i(Xl);am=s(p8,"STRONG",{});var j8=i(am);vT=a(j8,"get_test_dataloader"),j8.forEach(o),yT=a(p8," \u2014 Creates the test DataLoader."),p8.forEach(o),wT=d(B),Yl=s(B,"LI",{});var m8=i(Yl);nm=s(m8,"STRONG",{});var P8=i(nm);TT=a(P8,"log"),P8.forEach(o),ET=a(m8," \u2014 Logs information on the various objects watching training."),m8.forEach(o),AT=d(B),yt=s(B,"LI",{});var Fl=i(yt);sm=s(Fl,"STRONG",{});var J8=i(sm);$T=a(J8,"create_optimizer_and_scheduler"),J8.forEach(o),kT=a(Fl,` \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 `),im=s(Fl,"CODE",{});var C8=i(im);xT=a(C8,"create_optimizer"),C8.forEach(o),MT=a(Fl," and "),lm=s(Fl,"CODE",{});var F8=i(lm);IT=a(F8,"create_scheduler"),F8.forEach(o),ST=a(Fl,` methods
separately.`),Fl.forEach(o),qT=d(B),Hl=s(B,"LI",{});var h8=i(Hl);dm=s(h8,"STRONG",{});var N8=i(dm);DT=a(N8,"create_optimizer"),N8.forEach(o),UT=a(h8," \u2014 Sets up the optimizer if it wasn\u2019t passed at init."),h8.forEach(o),jT=d(B),Ql=s(B,"LI",{});var u8=i(Ql);cm=s(u8,"STRONG",{});var z8=i(cm);PT=a(z8,"create_scheduler"),z8.forEach(o),JT=a(u8," \u2014 Sets up the learning rate scheduler if it wasn\u2019t passed at init."),u8.forEach(o),CT=d(B),Kl=s(B,"LI",{});var f8=i(Kl);pm=s(f8,"STRONG",{});var O8=i(pm);FT=a(O8,"compute_loss"),O8.forEach(o),NT=a(f8," - Computes the loss on a batch of training inputs."),f8.forEach(o),zT=d(B),ed=s(B,"LI",{});var g8=i(ed);mm=s(g8,"STRONG",{});var W8=i(mm);OT=a(W8,"training_step"),W8.forEach(o),WT=a(g8," \u2014 Performs a training step."),g8.forEach(o),RT=d(B),td=s(B,"LI",{});var _8=i(td);hm=s(_8,"STRONG",{});var R8=i(hm);LT=a(R8,"prediction_step"),R8.forEach(o),BT=a(_8," \u2014 Performs an evaluation/test step."),_8.forEach(o),GT=d(B),od=s(B,"LI",{});var b8=i(od);um=s(b8,"STRONG",{});var L8=i(um);ZT=a(L8,"evaluate"),L8.forEach(o),VT=a(b8," \u2014 Runs an evaluation loop and returns metrics."),b8.forEach(o),XT=d(B),rd=s(B,"LI",{});var v8=i(rd);fm=s(v8,"STRONG",{});var B8=i(fm);YT=a(B8,"predict"),B8.forEach(o),HT=a(v8," \u2014 Returns predictions (with metrics if labels are available) on a test set."),v8.forEach(o),B.forEach(o),Jv=d(t),g(br.$$.fragment,t),Cv=d(t),vr=s(t,"P",{});var Tw=i(vr);QT=a(Tw,"Here is an example of how to customize "),ad=s(Tw,"A",{href:!0});var G8=i(ad);KT=a(G8,"Trainer"),G8.forEach(o),e0=a(Tw," to use a weighted loss (useful when you have an unbalanced training set):"),Tw.forEach(o),Fv=d(t),g(wn.$$.fragment,t),Nv=d(t),wt=s(t,"P",{});var Zc=i(wt);t0=a(Zc,"Another way to customize the training loop behavior for the PyTorch "),nd=s(Zc,"A",{href:!0});var Z8=i(nd);o0=a(Z8,"Trainer"),Z8.forEach(o),r0=a(Zc," is to use "),sd=s(Zc,"A",{href:!0});var V8=i(sd);a0=a(V8,"callbacks"),V8.forEach(o),n0=a(Zc," that can inspect the training loop state (for progress reporting, logging on TensorBoard or other ML platforms\u2026) and take decisions (like early stopping)."),Zc.forEach(o),zv=d(t),wo=s(t,"H2",{class:!0});var Ew=i(wo);yr=s(Ew,"A",{id:!0,class:!0,href:!0});var X8=i(yr);gm=s(X8,"SPAN",{});var Y8=i(gm);g(Tn.$$.fragment,Y8),Y8.forEach(o),X8.forEach(o),s0=d(Ew),_m=s(Ew,"SPAN",{});var H8=i(_m);i0=a(H8,"Trainer"),H8.forEach(o),Ew.forEach(o),Ov=d(t),A=s(t,"DIV",{class:!0});var x=i(A);g(En.$$.fragment,x),l0=d(x),bm=s(x,"P",{});var Q8=i(bm);d0=a(Q8,"Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for \u{1F917} Transformers."),Q8.forEach(o),c0=d(x),vm=s(x,"P",{});var K8=i(vm);p0=a(K8,"Important attributes:"),K8.forEach(o),m0=d(x),xe=s(x,"UL",{});var lo=i(xe);wr=s(lo,"LI",{});var Mv=i(wr);ym=s(Mv,"STRONG",{});var eC=i(ym);h0=a(eC,"model"),eC.forEach(o),u0=a(Mv," \u2014 Always points to the core model. If using a transformers model, it will be a "),id=s(Mv,"A",{href:!0});var tC=i(id);f0=a(tC,"PreTrainedModel"),tC.forEach(o),g0=a(Mv,`
subclass.`),Mv.forEach(o),_0=d(lo),le=s(lo,"LI",{});var je=i(le);wm=s(je,"STRONG",{});var oC=i(wm);b0=a(oC,"model_wrapped"),oC.forEach(o),v0=a(je,` \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 `),Tm=s(je,"CODE",{});var rC=i(Tm);y0=a(rC,"DeepSpeed"),rC.forEach(o),w0=a(je,`,
the inner model is wrapped in `),Em=s(je,"CODE",{});var aC=i(Em);T0=a(aC,"DeepSpeed"),aC.forEach(o),E0=a(je," and then again in "),Am=s(je,"CODE",{});var nC=i(Am);A0=a(nC,"torch.nn.DistributedDataParallel"),nC.forEach(o),$0=a(je,`. If the inner
model hasn\u2019t been wrapped, then `),$m=s(je,"CODE",{});var sC=i($m);k0=a(sC,"self.model_wrapped"),sC.forEach(o),x0=a(je," is the same as "),km=s(je,"CODE",{});var iC=i(km);M0=a(iC,"self.model"),iC.forEach(o),I0=a(je,"."),je.forEach(o),S0=d(lo),ld=s(lo,"LI",{});var y8=i(ld);xm=s(y8,"STRONG",{});var lC=i(xm);q0=a(lC,"is_model_parallel"),lC.forEach(o),D0=a(y8,` \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).`),y8.forEach(o),U0=d(lo),Je=s(lo,"LI",{});var pr=i(Je);Mm=s(pr,"STRONG",{});var dC=i(Mm);j0=a(dC,"place_model_on_device"),dC.forEach(o),P0=a(pr,` \u2014 Whether or not to automatically place the model on the device - it will be set
to `),Im=s(pr,"CODE",{});var cC=i(Im);J0=a(cC,"False"),cC.forEach(o),C0=a(pr,` if model parallel or deepspeed is used, or if the default
`),Sm=s(pr,"CODE",{});var pC=i(Sm);F0=a(pC,"TrainingArguments.place_model_on_device"),pC.forEach(o),N0=a(pr," is overridden to return "),qm=s(pr,"CODE",{});var mC=i(qm);z0=a(mC,"False"),mC.forEach(o),O0=a(pr," ."),pr.forEach(o),W0=d(lo),Ce=s(lo,"LI",{});var mr=i(Ce);Dm=s(mr,"STRONG",{});var hC=i(Dm);R0=a(hC,"is_in_train"),hC.forEach(o),L0=a(mr," \u2014 Whether or not a model is currently running "),Um=s(mr,"CODE",{});var uC=i(Um);B0=a(uC,"train"),uC.forEach(o),G0=a(mr," (e.g. when "),jm=s(mr,"CODE",{});var fC=i(jm);Z0=a(fC,"evaluate"),fC.forEach(o),V0=a(mr,` is called while
in `),Pm=s(mr,"CODE",{});var gC=i(Pm);X0=a(gC,"train"),gC.forEach(o),Y0=a(mr,")"),mr.forEach(o),lo.forEach(o),H0=d(x),Tr=s(x,"DIV",{class:!0});var Aw=i(Tr);g(An.$$.fragment,Aw),Q0=d(Aw),$n=s(Aw,"P",{});var $w=i($n);K0=a($w,"Add a callback to the current list of "),Jm=s($w,"CODE",{});var _C=i(Jm);eE=a(_C,"~transformer.TrainerCallback"),_C.forEach(o),tE=a($w,"."),$w.forEach(o),Aw.forEach(o),oE=d(x),Er=s(x,"DIV",{class:!0});var kw=i(Er);g(kn.$$.fragment,kw),rE=d(kw),xn=s(kw,"P",{});var xw=i(xn);aE=a(xw,"A helper wrapper that creates an appropriate context manager for "),Cm=s(xw,"CODE",{});var bC=i(Cm);nE=a(bC,"autocast"),bC.forEach(o),sE=a(xw,` while feeding it the desired
arguments, depending on the situation.`),xw.forEach(o),kw.forEach(o),iE=d(x),Tt=s(x,"DIV",{class:!0});var Vc=i(Tt);g(Mn.$$.fragment,Vc),lE=d(Vc),Fm=s(Vc,"P",{});var vC=i(Fm);dE=a(vC,"How the loss is computed by Trainer. By default, all models return the loss in the first element."),vC.forEach(o),cE=d(Vc),Nm=s(Vc,"P",{});var yC=i(Nm);pE=a(yC,"Subclass and override for custom behavior."),yC.forEach(o),Vc.forEach(o),mE=d(x),Ar=s(x,"DIV",{class:!0});var Mw=i(Ar);g(In.$$.fragment,Mw),hE=d(Mw),zm=s(Mw,"P",{});var wC=i(zm);uE=a(wC,"A helper wrapper to group together context managers."),wC.forEach(o),Mw.forEach(o),fE=d(x),$r=s(x,"DIV",{class:!0});var Iw=i($r);g(Sn.$$.fragment,Iw),gE=d(Iw),qn=s(Iw,"P",{});var Sw=i(qn);_E=a(Sw,"Creates a draft of a model card using the information available to the "),Om=s(Sw,"CODE",{});var TC=i(Om);bE=a(TC,"Trainer"),TC.forEach(o),vE=a(Sw,"."),Sw.forEach(o),Iw.forEach(o),yE=d(x),Et=s(x,"DIV",{class:!0});var Xc=i(Et);g(Dn.$$.fragment,Xc),wE=d(Xc),Wm=s(Xc,"P",{});var EC=i(Wm);TE=a(EC,"Setup the optimizer."),EC.forEach(o),EE=d(Xc),Un=s(Xc,"P",{});var qw=i(Un);AE=a(qw,`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 `),Rm=s(qw,"CODE",{});var AC=i(Rm);$E=a(AC,"optimizers"),AC.forEach(o),kE=a(qw,", or subclass and override this method in a subclass."),qw.forEach(o),Xc.forEach(o),xE=d(x),At=s(x,"DIV",{class:!0});var Yc=i(At);g(jn.$$.fragment,Yc),ME=d(Yc),Lm=s(Yc,"P",{});var $C=i(Lm);IE=a($C,"Setup the optimizer and the learning rate scheduler."),$C.forEach(o),SE=d(Yc),lt=s(Yc,"P",{});var Va=i(lt);qE=a(Va,`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 `),Bm=s(Va,"CODE",{});var kC=i(Bm);DE=a(kC,"optimizers"),kC.forEach(o),UE=a(Va,", or subclass and override this method (or "),Gm=s(Va,"CODE",{});var xC=i(Gm);jE=a(xC,"create_optimizer"),xC.forEach(o),PE=a(Va,` and/or
`),Zm=s(Va,"CODE",{});var MC=i(Zm);JE=a(MC,"create_scheduler"),MC.forEach(o),CE=a(Va,") in a subclass."),Va.forEach(o),Yc.forEach(o),FE=d(x),kr=s(x,"DIV",{class:!0});var Dw=i(kr);g(Pn.$$.fragment,Dw),NE=d(Dw),Vm=s(Dw,"P",{});var IC=i(Vm);zE=a(IC,`Setup the scheduler. The optimizer of the trainer must have been set up either before this method is called or
passed as an argument.`),IC.forEach(o),Dw.forEach(o),OE=d(x),Fe=s(x,"DIV",{class:!0});var Xa=i(Fe);g(Jn.$$.fragment,Xa),WE=d(Xa),Xm=s(Xa,"P",{});var SC=i(Xm);RE=a(SC,"Run evaluation and returns metrics."),SC.forEach(o),LE=d(Xa),Cn=s(Xa,"P",{});var Uw=i(Cn);BE=a(Uw,`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),Ym=s(Uw,"CODE",{});var qC=i(Ym);GE=a(qC,"compute_metrics"),qC.forEach(o),ZE=a(Uw," argument)."),Uw.forEach(o),VE=d(Xa),Hm=s(Xa,"P",{});var DC=i(Hm);XE=a(DC,"You can also subclass and override this method to inject custom behavior."),DC.forEach(o),Xa.forEach(o),YE=d(x),$t=s(x,"DIV",{class:!0});var Hc=i($t);g(Fn.$$.fragment,Hc),HE=d(Hc),To=s(Hc,"P",{});var Qc=i(To);QE=a(Qc,"Prediction/evaluation loop, shared by "),Qm=s(Qc,"CODE",{});var UC=i(Qm);KE=a(UC,"Trainer.evaluate()"),UC.forEach(o),e3=a(Qc," and "),Km=s(Qc,"CODE",{});var jC=i(Km);t3=a(jC,"Trainer.predict()"),jC.forEach(o),o3=a(Qc,"."),Qc.forEach(o),r3=d(Hc),eh=s(Hc,"P",{});var PC=i(eh);a3=a(PC,"Works both with or without labels."),PC.forEach(o),Hc.forEach(o),n3=d(x),xr=s(x,"DIV",{class:!0});var jw=i(xr);g(Nn.$$.fragment,jw),s3=d(jw),zn=s(jw,"P",{});var Pw=i(zn);i3=a(Pw,"For models that inherit from "),dd=s(Pw,"A",{href:!0});var JC=i(dd);l3=a(JC,"PreTrainedModel"),JC.forEach(o),d3=a(Pw,`, uses that method to compute the number of floating point
operations for every backward + forward pass. If using another model, either implement such a method in the
model or subclass and override this method.`),Pw.forEach(o),jw.forEach(o),c3=d(x),kt=s(x,"DIV",{class:!0});var Kc=i(kt);g(On.$$.fragment,Kc),p3=d(Kc),Wn=s(Kc,"P",{});var Jw=i(Wn);m3=a(Jw,"Returns the evaluation "),th=s(Jw,"CODE",{});var CC=i(th);h3=a(CC,"~torch.utils.data.DataLoader"),CC.forEach(o),u3=a(Jw,"."),Jw.forEach(o),f3=d(Kc),oh=s(Kc,"P",{});var FC=i(oh);g3=a(FC,"Subclass and override this method if you want to inject some custom behavior."),FC.forEach(o),Kc.forEach(o),_3=d(x),Mr=s(x,"DIV",{class:!0});var Cw=i(Mr);g(Rn.$$.fragment,Cw),b3=d(Cw),rh=s(Cw,"P",{});var NC=i(rh);v3=a(NC,"Returns the optimizer class and optimizer parameters based on the training arguments."),NC.forEach(o),Cw.forEach(o),y3=d(x),xt=s(x,"DIV",{class:!0});var ep=i(xt);g(Ln.$$.fragment,ep),w3=d(ep),Bn=s(ep,"P",{});var Fw=i(Bn);T3=a(Fw,"Returns the test "),ah=s(Fw,"CODE",{});var zC=i(ah);E3=a(zC,"~torch.utils.data.DataLoader"),zC.forEach(o),A3=a(Fw,"."),Fw.forEach(o),$3=d(ep),nh=s(ep,"P",{});var OC=i(nh);k3=a(OC,"Subclass and override this method if you want to inject some custom behavior."),OC.forEach(o),ep.forEach(o),x3=d(x),Ne=s(x,"DIV",{class:!0});var Ya=i(Ne);g(Gn.$$.fragment,Ya),M3=d(Ya),Zn=s(Ya,"P",{});var Nw=i(Zn);I3=a(Nw,"Returns the training "),sh=s(Nw,"CODE",{});var WC=i(sh);S3=a(WC,"~torch.utils.data.DataLoader"),WC.forEach(o),q3=a(Nw,"."),Nw.forEach(o),D3=d(Ya),Eo=s(Ya,"P",{});var tp=i(Eo);U3=a(tp,"Will use no sampler if "),ih=s(tp,"CODE",{});var RC=i(ih);j3=a(RC,"train_dataset"),RC.forEach(o),P3=a(tp," does not implement "),lh=s(tp,"CODE",{});var LC=i(lh);J3=a(LC,"__len__"),LC.forEach(o),C3=a(tp,`, a random sampler (adapted to distributed
training if necessary) otherwise.`),tp.forEach(o),F3=d(Ya),dh=s(Ya,"P",{});var BC=i(dh);N3=a(BC,"Subclass and override this method if you want to inject some custom behavior."),BC.forEach(o),Ya.forEach(o),z3=d(x),Mt=s(x,"DIV",{class:!0});var op=i(Mt);g(Vn.$$.fragment,op),O3=d(op),Me=s(op,"P",{});var co=i(Me);W3=a(co,"Launch an hyperparameter search using "),ch=s(co,"CODE",{});var GC=i(ch);R3=a(GC,"optuna"),GC.forEach(o),L3=a(co," or "),ph=s(co,"CODE",{});var ZC=i(ph);B3=a(ZC,"Ray Tune"),ZC.forEach(o),G3=a(co," or "),mh=s(co,"CODE",{});var VC=i(mh);Z3=a(VC,"SigOpt"),VC.forEach(o),V3=a(co,`. The optimized quantity is determined
by `),hh=s(co,"CODE",{});var XC=i(hh);X3=a(XC,"compute_objective"),XC.forEach(o),Y3=a(co,`, which defaults to a function returning the evaluation loss when no metric is provided,
the sum of all metrics otherwise.`),co.forEach(o),H3=d(op),g(Ir.$$.fragment,op),op.forEach(o),Q3=d(x),It=s(x,"DIV",{class:!0});var rp=i(It);g(Xn.$$.fragment,rp),K3=d(rp),Yn=s(rp,"P",{});var zw=i(Yn);e4=a(zw,"Initializes a git repo in "),uh=s(zw,"CODE",{});var YC=i(uh);t4=a(YC,"self.args.hub_model_id"),YC.forEach(o),o4=a(zw,"."),zw.forEach(o),r4=d(rp),g(Sr.$$.fragment,rp),rp.forEach(o),a4=d(x),qr=s(x,"DIV",{class:!0});var Ow=i(qr);g(Hn.$$.fragment,Ow),n4=d(Ow),Qn=s(Ow,"P",{});var Ww=i(Qn);s4=a(Ww,"Initializes a git repo in "),fh=s(Ww,"CODE",{});var HC=i(fh);i4=a(HC,"self.args.hub_model_id"),HC.forEach(o),l4=a(Ww,"."),Ww.forEach(o),Ow.forEach(o),d4=d(x),Dr=s(x,"DIV",{class:!0});var Rw=i(Dr);g(Kn.$$.fragment,Rw),c4=d(Rw),gh=s(Rw,"P",{});var QC=i(gh);p4=a(QC,`Whether or not this process is the local (e.g., on one machine if training in a distributed fashion on several
machines) main process.`),QC.forEach(o),Rw.forEach(o),m4=d(x),Ur=s(x,"DIV",{class:!0});var Lw=i(Ur);g(es.$$.fragment,Lw),h4=d(Lw),ts=s(Lw,"P",{});var Bw=i(ts);u4=a(Bw,`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 `),_h=s(Bw,"CODE",{});var KC=i(_h);f4=a(KC,"True"),KC.forEach(o),g4=a(Bw," for one process)."),Bw.forEach(o),Lw.forEach(o),_4=d(x),St=s(x,"DIV",{class:!0});var ap=i(St);g(os.$$.fragment,ap),b4=d(ap),rs=s(ap,"P",{});var Gw=i(rs);v4=a(Gw,"Log "),bh=s(Gw,"CODE",{});var e7=i(bh);y4=a(e7,"logs"),e7.forEach(o),w4=a(Gw," on the various objects watching training."),Gw.forEach(o),T4=d(ap),vh=s(ap,"P",{});var t7=i(vh);E4=a(t7,"Subclass and override this method to inject custom behavior."),t7.forEach(o),ap.forEach(o),A4=d(x),P=s(x,"DIV",{class:!0});var N=i(P);g(as.$$.fragment,N),$4=d(N),yh=s(N,"P",{});var o7=i(yh);k4=a(o7,"Log metrics in a specially formatted way"),o7.forEach(o),x4=d(N),wh=s(N,"P",{});var r7=i(wh);M4=a(r7,"Under distributed environment this is done only for a process with rank 0."),r7.forEach(o),I4=d(N),Th=s(N,"P",{});var a7=i(Th);S4=a(a7,"Notes on memory reports:"),a7.forEach(o),q4=d(N),Ao=s(N,"P",{});var np=i(Ao);D4=a(np,"In order to get memory usage report you need to install "),Eh=s(np,"CODE",{});var n7=i(Eh);U4=a(n7,"psutil"),n7.forEach(o),j4=a(np,". You can do that with "),Ah=s(np,"CODE",{});var s7=i(Ah);P4=a(s7,"pip install psutil"),s7.forEach(o),J4=a(np,"."),np.forEach(o),C4=d(N),g(jr.$$.fragment,N),F4=d(N),$h=s(N,"P",{});var i7=i($h);kh=s(i7,"STRONG",{});var l7=i(kh);N4=a(l7,"Understanding the reports:"),l7.forEach(o),i7.forEach(o),z4=d(N),dt=s(N,"UL",{});var Ha=i(dt);Ie=s(Ha,"LI",{});var po=i(Ie);O4=a(po,"the first segment, e.g., "),xh=s(po,"CODE",{});var d7=i(xh);W4=a(d7,"train__"),d7.forEach(o),R4=a(po,", tells you which stage the metrics are for. Reports starting with "),Mh=s(po,"CODE",{});var c7=i(Mh);L4=a(c7,"init_"),c7.forEach(o),B4=a(po,`
will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the
`),Ih=s(po,"CODE",{});var p7=i(Ih);G4=a(p7,"__init__"),p7.forEach(o),Z4=a(po," will be reported along with the "),Sh=s(po,"CODE",{});var m7=i(Sh);V4=a(m7,"eval_"),m7.forEach(o),X4=a(po," metrics."),po.forEach(o),Y4=d(Ha),$o=s(Ha,"LI",{});var sp=i($o);H4=a(sp,"the third segment, is either "),qh=s(sp,"CODE",{});var h7=i(qh);Q4=a(h7,"cpu"),h7.forEach(o),K4=a(sp," or "),Dh=s(sp,"CODE",{});var u7=i(Dh);eA=a(u7,"gpu"),u7.forEach(o),tA=a(sp,`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),sp.forEach(o),oA=d(Ha),cd=s(Ha,"LI",{});var w8=i(cd);Uh=s(w8,"CODE",{});var f7=i(Uh);rA=a(f7,"*_alloc_delta"),f7.forEach(o),aA=a(w8,` - 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.`),w8.forEach(o),nA=d(Ha),qt=s(Ha,"LI",{});var Nl=i(qt);jh=s(Nl,"CODE",{});var g7=i(jh);sA=a(g7,"*_peaked_delta"),g7.forEach(o),iA=a(Nl,` - 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 `),Ph=s(Nl,"CODE",{});var _7=i(Ph);lA=a(_7,"alloc_delta"),_7.forEach(o),dA=a(Nl,` +
`),Jh=s(Nl,"CODE",{});var b7=i(Jh);cA=a(b7,"peaked_delta"),b7.forEach(o),pA=a(Nl," and you know how much memory was needed to complete that stage."),Nl.forEach(o),Ha.forEach(o),mA=d(N),Ch=s(N,"P",{});var v7=i(Ch);hA=a(v7,`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.`),v7.forEach(o),uA=d(N),Fh=s(N,"P",{});var y7=i(Fh);fA=a(y7,`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.`),y7.forEach(o),gA=d(N),ns=s(N,"P",{});var Zw=i(ns);_A=a(Zw,`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 `),Nh=s(Zw,"CODE",{});var w7=i(Nh);bA=a(w7,"tracemalloc"),w7.forEach(o),vA=a(Zw,` 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.`),Zw.forEach(o),yA=d(N),ct=s(N,"P",{});var Qa=i(ct);wA=a(Qa,"The GPU allocated and peak memory reporting is done with "),zh=s(Qa,"CODE",{});var T7=i(zh);TA=a(T7,"torch.cuda.memory_allocated()"),T7.forEach(o),EA=a(Qa,` and
`),Oh=s(Qa,"CODE",{});var E7=i(Oh);AA=a(E7,"torch.cuda.max_memory_allocated()"),E7.forEach(o),$A=a(Qa,`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),Wh=s(Qa,"CODE",{});var A7=i(Wh);kA=a(A7,"torch.cuda"),A7.forEach(o),xA=a(Qa,` 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.`),Qa.forEach(o),MA=d(N),fe=s(N,"P",{});var tt=i(fe);IA=a(tt,"Note that this tracker doesn\u2019t account for memory allocations outside of "),pd=s(tt,"A",{href:!0});var $7=i(pd);SA=a($7,"Trainer"),$7.forEach(o),qA=a(tt,"\u2019s "),Rh=s(tt,"CODE",{});var k7=i(Rh);DA=a(k7,"__init__"),k7.forEach(o),UA=a(tt,", "),Lh=s(tt,"CODE",{});var x7=i(Lh);jA=a(x7,"train"),x7.forEach(o),PA=a(tt,`,
`),Bh=s(tt,"CODE",{});var M7=i(Bh);JA=a(M7,"evaluate"),M7.forEach(o),CA=a(tt," and "),Gh=s(tt,"CODE",{});var I7=i(Gh);FA=a(I7,"predict"),I7.forEach(o),NA=a(tt," calls."),tt.forEach(o),zA=d(N),Z=s(N,"P",{});var V=i(Z);OA=a(V,"Because "),Zh=s(V,"CODE",{});var S7=i(Zh);WA=a(S7,"evaluation"),S7.forEach(o),RA=a(V," calls may happen during "),Vh=s(V,"CODE",{});var q7=i(Vh);LA=a(q7,"train"),q7.forEach(o),BA=a(V,`, we can\u2019t handle nested invocations because
`),Xh=s(V,"CODE",{});var D7=i(Xh);GA=a(D7,"torch.cuda.max_memory_allocated"),D7.forEach(o),ZA=a(V," is a single counter, so if it gets reset by a nested eval call, "),Yh=s(V,"CODE",{});var U7=i(Yh);VA=a(U7,"train"),U7.forEach(o),XA=a(V,`\u2019s tracker
will report incorrect info. If this `),ss=s(V,"A",{href:!0,rel:!0});var j7=i(ss);YA=a(j7,"pytorch issue"),j7.forEach(o),HA=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
`),Hh=s(V,"CODE",{});var P7=i(Hh);QA=a(P7,"train"),P7.forEach(o),KA=a(V,", "),Qh=s(V,"CODE",{});var J7=i(Qh);e$=a(J7,"evaluate"),J7.forEach(o),t$=a(V," and "),Kh=s(V,"CODE",{});var C7=i(Kh);o$=a(C7,"predict"),C7.forEach(o),r$=a(V," methods. Which means that if "),eu=s(V,"CODE",{});var F7=i(eu);a$=a(F7,"eval"),F7.forEach(o),n$=a(V," is called during "),tu=s(V,"CODE",{});var N7=i(tu);s$=a(N7,"train"),N7.forEach(o),i$=a(V,`, it\u2019s the latter
that will account for its memory usage and that of the former.`),V.forEach(o),l$=d(N),Se=s(N,"P",{});var mo=i(Se);d$=a(mo,"This also means that if any other tool that is used along the "),md=s(mo,"A",{href:!0});var z7=i(md);c$=a(z7,"Trainer"),z7.forEach(o),p$=a(mo,` calls
`),ou=s(mo,"CODE",{});var O7=i(ou);m$=a(O7,"torch.cuda.reset_peak_memory_stats"),O7.forEach(o),h$=a(mo,", the gpu peak memory stats could be invalid. And the "),hd=s(mo,"A",{href:!0});var W7=i(hd);u$=a(W7,"Trainer"),W7.forEach(o),f$=a(mo,` will disrupt
the normal behavior of any such tools that rely on calling `),ru=s(mo,"CODE",{});var R7=i(ru);g$=a(R7,"torch.cuda.reset_peak_memory_stats"),R7.forEach(o),_$=a(mo," themselves."),mo.forEach(o),b$=d(N),au=s(N,"P",{});var L7=i(au);v$=a(L7,"For best performance you may want to consider turning the memory profiling off for production runs."),L7.forEach(o),N.forEach(o),y$=d(x),Pr=s(x,"DIV",{class:!0});var Vw=i(Pr);g(is.$$.fragment,Vw),w$=d(Vw),nu=s(Vw,"P",{});var B7=i(nu);T$=a(B7,"Reformat Trainer metrics values to a human-readable format"),B7.forEach(o),Vw.forEach(o),E$=d(x),Jr=s(x,"DIV",{class:!0});var Xw=i(Jr);g(ls.$$.fragment,Xw),A$=d(Xw),ds=s(Xw,"P",{});var Yw=i(ds);$$=a(Yw,"Helper to get number of samples in a "),su=s(Yw,"CODE",{});var G7=i(su);k$=a(G7,"~torch.utils.data.DataLoader"),G7.forEach(o),x$=a(Yw,` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),Yw.forEach(o),Xw.forEach(o),M$=d(x),Dt=s(x,"DIV",{class:!0});var ip=i(Dt);g(cs.$$.fragment,ip),I$=d(ip),ps=s(ip,"P",{});var Hw=i(ps);S$=a(Hw,"Remove a callback from the current list of "),iu=s(Hw,"CODE",{});var Z7=i(iu);q$=a(Z7,"~transformer.TrainerCallback"),Z7.forEach(o),D$=a(Hw," and returns it."),Hw.forEach(o),U$=d(ip),ms=s(ip,"P",{});var Qw=i(ms);j$=a(Qw,"If the callback is not found, returns "),lu=s(Qw,"CODE",{});var V7=i(lu);P$=a(V7,"None"),V7.forEach(o),J$=a(Qw," (and no error is raised)."),Qw.forEach(o),ip.forEach(o),C$=d(x),de=s(x,"DIV",{class:!0});var ot=i(de);g(hs.$$.fragment,ot),F$=d(ot),du=s(ot,"P",{});var X7=i(du);N$=a(X7,"Run prediction and returns predictions and potential metrics."),X7.forEach(o),z$=d(ot),us=s(ot,"P",{});var Kw=i(us);O$=a(Kw,`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 `),cu=s(Kw,"CODE",{});var Y7=i(cu);W$=a(Y7,"evaluate()"),Y7.forEach(o),R$=a(Kw,"."),Kw.forEach(o),L$=d(ot),g(Cr.$$.fragment,ot),B$=d(ot),fs=s(ot,"P",{});var e2=i(fs);G$=a(e2,"Returns: "),pu=s(e2,"EM",{});var H7=i(pu);Z$=a(H7,"NamedTuple"),H7.forEach(o),V$=a(e2," A namedtuple with the following keys:"),e2.forEach(o),X$=d(ot),ko=s(ot,"UL",{});var lp=i(ko);xo=s(lp,"LI",{});var dp=i(xo);Y$=a(dp,"predictions ("),mu=s(dp,"CODE",{});var Q7=i(mu);H$=a(Q7,"np.ndarray"),Q7.forEach(o),Q$=a(dp,"): The predictions on "),hu=s(dp,"CODE",{});var K7=i(hu);K$=a(K7,"test_dataset"),K7.forEach(o),ek=a(dp,"."),dp.forEach(o),tk=d(lp),Mo=s(lp,"LI",{});var cp=i(Mo);ok=a(cp,"label_ids ("),uu=s(cp,"CODE",{});var eF=i(uu);rk=a(eF,"np.ndarray"),eF.forEach(o),ak=a(cp,", "),fu=s(cp,"EM",{});var tF=i(fu);nk=a(tF,"optional"),tF.forEach(o),sk=a(cp,"): The labels (if the dataset contained some)."),cp.forEach(o),ik=d(lp),Io=s(lp,"LI",{});var pp=i(Io);lk=a(pp,"metrics ("),gu=s(pp,"CODE",{});var oF=i(gu);dk=a(oF,"Dict[str, float]"),oF.forEach(o),ck=a(pp,", "),_u=s(pp,"EM",{});var rF=i(_u);pk=a(rF,"optional"),rF.forEach(o),mk=a(pp,`): The potential dictionary of metrics (if the dataset contained
labels).`),pp.forEach(o),lp.forEach(o),ot.forEach(o),hk=d(x),Ut=s(x,"DIV",{class:!0});var mp=i(Ut);g(gs.$$.fragment,mp),uk=d(mp),So=s(mp,"P",{});var hp=i(So);fk=a(hp,"Prediction/evaluation loop, shared by "),bu=s(hp,"CODE",{});var aF=i(bu);gk=a(aF,"Trainer.evaluate()"),aF.forEach(o),_k=a(hp," and "),vu=s(hp,"CODE",{});var nF=i(vu);bk=a(nF,"Trainer.predict()"),nF.forEach(o),vk=a(hp,"."),hp.forEach(o),yk=d(mp),yu=s(mp,"P",{});var sF=i(yu);wk=a(sF,"Works both with or without labels."),sF.forEach(o),mp.forEach(o),Tk=d(x),jt=s(x,"DIV",{class:!0});var up=i(jt);g(_s.$$.fragment,up),Ek=d(up),qo=s(up,"P",{});var fp=i(qo);Ak=a(fp,"Perform an evaluation step on "),wu=s(fp,"CODE",{});var iF=i(wu);$k=a(iF,"model"),iF.forEach(o),kk=a(fp," using "),Tu=s(fp,"CODE",{});var lF=i(Tu);xk=a(lF,"inputs"),lF.forEach(o),Mk=a(fp,"."),fp.forEach(o),Ik=d(up),Eu=s(up,"P",{});var dF=i(Eu);Sk=a(dF,"Subclass and override to inject custom behavior."),dF.forEach(o),up.forEach(o),qk=d(x),Fr=s(x,"DIV",{class:!0});var t2=i(Fr);g(bs.$$.fragment,t2),Dk=d(t2),pt=s(t2,"P",{});var Ka=i(pt);Uk=a(Ka,"Upload "),Au=s(Ka,"CODE",{});var cF=i(Au);jk=a(cF,"self.model"),cF.forEach(o),Pk=a(Ka," and "),$u=s(Ka,"CODE",{});var pF=i($u);Jk=a(pF,"self.tokenizer"),pF.forEach(o),Ck=a(Ka," to the \u{1F917} model hub on the repo "),ku=s(Ka,"CODE",{});var mF=i(ku);Fk=a(mF,"self.args.hub_model_id"),mF.forEach(o),Nk=a(Ka,"."),Ka.forEach(o),t2.forEach(o),zk=d(x),Nr=s(x,"DIV",{class:!0});var o2=i(Nr);g(vs.$$.fragment,o2),Ok=d(o2),ys=s(o2,"P",{});var r2=i(ys);Wk=a(r2,"Remove a callback from the current list of "),xu=s(r2,"CODE",{});var hF=i(xu);Rk=a(hF,"~transformer.TrainerCallback"),hF.forEach(o),Lk=a(r2,"."),r2.forEach(o),o2.forEach(o),Bk=d(x),ze=s(x,"DIV",{class:!0});var en=i(ze);g(ws.$$.fragment,en),Gk=d(en),Ts=s(en,"P",{});var a2=i(Ts);Zk=a(a2,"Save metrics into a json file for that split, e.g. "),Mu=s(a2,"CODE",{});var uF=i(Mu);Vk=a(uF,"train_results.json"),uF.forEach(o),Xk=a(a2,"."),a2.forEach(o),Yk=d(en),Iu=s(en,"P",{});var fF=i(Iu);Hk=a(fF,"Under distributed environment this is done only for a process with rank 0."),fF.forEach(o),Qk=d(en),Es=s(en,"P",{});var n2=i(Es);Kk=a(n2,"To understand the metrics please read the docstring of "),ud=s(n2,"A",{href:!0});var gF=i(ud);ex=a(gF,"log_metrics()"),gF.forEach(o),tx=a(n2,`. The only difference is that raw
unformatted numbers are saved in the current method.`),n2.forEach(o),en.forEach(o),ox=d(x),Pt=s(x,"DIV",{class:!0});var gp=i(Pt);g(As.$$.fragment,gp),rx=d(gp),$s=s(gp,"P",{});var s2=i($s);ax=a(s2,"Will save the model, so you can reload it using "),Su=s(s2,"CODE",{});var _F=i(Su);nx=a(_F,"from_pretrained()"),_F.forEach(o),sx=a(s2,"."),s2.forEach(o),ix=d(gp),qu=s(gp,"P",{});var bF=i(qu);lx=a(bF,"Will only save from the main process."),bF.forEach(o),gp.forEach(o),dx=d(x),Jt=s(x,"DIV",{class:!0});var _p=i(Jt);g(ks.$$.fragment,_p),cx=d(_p),Du=s(_p,"P",{});var vF=i(Du);px=a(vF,"Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),vF.forEach(o),mx=d(_p),Uu=s(_p,"P",{});var yF=i(Uu);hx=a(yF,"Under distributed environment this is done only for a process with rank 0."),yF.forEach(o),_p.forEach(o),ux=d(x),zr=s(x,"DIV",{class:!0});var i2=i(zr);g(xs.$$.fragment,i2),fx=d(i2),ju=s(i2,"P",{});var wF=i(ju);gx=a(wF,"Main training entry point."),wF.forEach(o),i2.forEach(o),_x=d(x),Ct=s(x,"DIV",{class:!0});var bp=i(Ct);g(Ms.$$.fragment,bp),bx=d(bp),Pu=s(bp,"P",{});var TF=i(Pu);vx=a(TF,"Perform a training step on a batch of inputs."),TF.forEach(o),yx=d(bp),Ju=s(bp,"P",{});var EF=i(Ju);wx=a(EF,"Subclass and override to inject custom behavior."),EF.forEach(o),bp.forEach(o),x.forEach(o),Wv=d(t),Do=s(t,"H2",{class:!0});var l2=i(Do);Or=s(l2,"A",{id:!0,class:!0,href:!0});var AF=i(Or);Cu=s(AF,"SPAN",{});var $F=i(Cu);g(Is.$$.fragment,$F),$F.forEach(o),AF.forEach(o),Tx=d(l2),Fu=s(l2,"SPAN",{});var kF=i(Fu);Ex=a(kF,"Seq2SeqTrainer"),kF.forEach(o),l2.forEach(o),Rv=d(t),mt=s(t,"DIV",{class:!0});var vp=i(mt);g(Ss.$$.fragment,vp),Ax=d(vp),Oe=s(vp,"DIV",{class:!0});var tn=i(Oe);g(qs.$$.fragment,tn),$x=d(tn),Nu=s(tn,"P",{});var xF=i(Nu);kx=a(xF,"Run evaluation and returns metrics."),xF.forEach(o),xx=d(tn),Ds=s(tn,"P",{});var d2=i(Ds);Mx=a(d2,`The calling script will be responsible for providing a method to compute metrics, as they are task-dependent
(pass it to the init `),zu=s(d2,"CODE",{});var MF=i(zu);Ix=a(MF,"compute_metrics"),MF.forEach(o),Sx=a(d2," argument)."),d2.forEach(o),qx=d(tn),Ou=s(tn,"P",{});var IF=i(Ou);Dx=a(IF,"You can also subclass and override this method to inject custom behavior."),IF.forEach(o),tn.forEach(o),Ux=d(vp),ce=s(vp,"DIV",{class:!0});var rt=i(ce);g(Us.$$.fragment,rt),jx=d(rt),Wu=s(rt,"P",{});var SF=i(Wu);Px=a(SF,"Run prediction and returns predictions and potential metrics."),SF.forEach(o),Jx=d(rt),js=s(rt,"P",{});var c2=i(js);Cx=a(c2,`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(c2,"CODE",{});var qF=i(Ru);Fx=a(qF,"evaluate()"),qF.forEach(o),Nx=a(c2,"."),c2.forEach(o),zx=d(rt),g(Wr.$$.fragment,rt),Ox=d(rt),Ps=s(rt,"P",{});var p2=i(Ps);Wx=a(p2,"Returns: "),Lu=s(p2,"EM",{});var DF=i(Lu);Rx=a(DF,"NamedTuple"),DF.forEach(o),Lx=a(p2," A namedtuple with the following keys:"),p2.forEach(o),Bx=d(rt),Uo=s(rt,"UL",{});var yp=i(Uo);jo=s(yp,"LI",{});var wp=i(jo);Gx=a(wp,"predictions ("),Bu=s(wp,"CODE",{});var UF=i(Bu);Zx=a(UF,"np.ndarray"),UF.forEach(o),Vx=a(wp,"): The predictions on "),Gu=s(wp,"CODE",{});var jF=i(Gu);Xx=a(jF,"test_dataset"),jF.forEach(o),Yx=a(wp,"."),wp.forEach(o),Hx=d(yp),Po=s(yp,"LI",{});var Tp=i(Po);Qx=a(Tp,"label_ids ("),Zu=s(Tp,"CODE",{});var PF=i(Zu);Kx=a(PF,"np.ndarray"),PF.forEach(o),eM=a(Tp,", "),Vu=s(Tp,"EM",{});var JF=i(Vu);tM=a(JF,"optional"),JF.forEach(o),oM=a(Tp,"): The labels (if the dataset contained some)."),Tp.forEach(o),rM=d(yp),Jo=s(yp,"LI",{});var Ep=i(Jo);aM=a(Ep,"metrics ("),Xu=s(Ep,"CODE",{});var CF=i(Xu);nM=a(CF,"Dict[str, float]"),CF.forEach(o),sM=a(Ep,", "),Yu=s(Ep,"EM",{});var FF=i(Yu);iM=a(FF,"optional"),FF.forEach(o),lM=a(Ep,`): The potential dictionary of metrics (if the dataset contained
labels).`),Ep.forEach(o),yp.forEach(o),rt.forEach(o),vp.forEach(o),Lv=d(t),Co=s(t,"H2",{class:!0});var m2=i(Co);Rr=s(m2,"A",{id:!0,class:!0,href:!0});var NF=i(Rr);Hu=s(NF,"SPAN",{});var zF=i(Hu);g(Js.$$.fragment,zF),zF.forEach(o),NF.forEach(o),dM=d(m2),Qu=s(m2,"SPAN",{});var OF=i(Qu);cM=a(OF,"TrainingArguments"),OF.forEach(o),m2.forEach(o),Bv=d(t),q=s(t,"DIV",{class:!0});var J=i(q);g(Cs.$$.fragment,J),pM=d(J),Fs=s(J,"P",{});var h2=i(Fs);mM=a(h2,"TrainingArguments is the subset of the arguments we use in our example scripts "),Ku=s(h2,"STRONG",{});var WF=i(Ku);hM=a(WF,`which relate to the training loop
itself`),WF.forEach(o),uM=a(h2,"."),h2.forEach(o),fM=d(J),Fo=s(J,"P",{});var Ap=i(Fo);gM=a(Ap,"Using "),fd=s(Ap,"A",{href:!0});var RF=i(fd);_M=a(RF,"HfArgumentParser"),RF.forEach(o),bM=a(Ap,` we can turn this class into
`),Ns=s(Ap,"A",{href:!0,rel:!0});var LF=i(Ns);vM=a(LF,"argparse"),LF.forEach(o),yM=a(Ap,` arguments that can be specified on the
command line.`),Ap.forEach(o),wM=d(J),ve=s(J,"DIV",{class:!0});var ho=i(ve);g(zs.$$.fragment,ho),TM=d(ho),ef=s(ho,"P",{});var BF=i(ef);EM=a(BF,`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.`),BF.forEach(o),AM=d(ho),No=s(ho,"P",{});var $p=i(No);$M=a($p,"For the main process the log level defaults to the logging level set ("),tf=s($p,"CODE",{});var GF=i(tf);kM=a(GF,"logging.WARNING"),GF.forEach(o),xM=a($p,` if you didn\u2019t do
anything) unless overridden by `),of=s($p,"CODE",{});var ZF=i(of);MM=a(ZF,"log_level"),ZF.forEach(o),IM=a($p," argument."),$p.forEach(o),SM=d(ho),zo=s(ho,"P",{});var kp=i(zo);qM=a(kp,"For the replica processes the log level defaults to "),rf=s(kp,"CODE",{});var VF=i(rf);DM=a(VF,"logging.WARNING"),VF.forEach(o),UM=a(kp," unless overridden by "),af=s(kp,"CODE",{});var XF=i(af);jM=a(XF,"log_level_replica"),XF.forEach(o),PM=a(kp,`
argument.`),kp.forEach(o),JM=d(ho),Os=s(ho,"P",{});var u2=i(Os);CM=a(u2,"The choice between the main and replica process settings is made according to the return value of "),nf=s(u2,"CODE",{});var YF=i(nf);FM=a(YF,"should_log"),YF.forEach(o),NM=a(u2,"."),u2.forEach(o),ho.forEach(o),zM=d(J),Lr=s(J,"DIV",{class:!0});var f2=i(Lr);g(Ws.$$.fragment,f2),OM=d(f2),sf=s(f2,"P",{});var HF=i(sf);WM=a(HF,"Get number of steps used for a linear warmup."),HF.forEach(o),f2.forEach(o),RM=d(J),Ft=s(J,"DIV",{class:!0});var xp=i(Ft);g(Rs.$$.fragment,xp),LM=d(xp),lf=s(xp,"P",{});var QF=i(lf);BM=a(QF,`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.`),QF.forEach(o),GM=d(xp),Oo=s(xp,"P",{});var Mp=i(Oo);ZM=a(Mp,"One such use is for "),df=s(Mp,"CODE",{});var KF=i(df);VM=a(KF,"datasets"),KF.forEach(o),XM=a(Mp,"\u2019s "),cf=s(Mp,"CODE",{});var eN=i(cf);YM=a(eN,"map"),eN.forEach(o),HM=a(Mp,` 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.`),Mp.forEach(o),xp.forEach(o),QM=d(J),Nt=s(J,"DIV",{class:!0});var Ip=i(Nt);g(Ls.$$.fragment,Ip),KM=d(Ip),pf=s(Ip,"P",{});var tN=i(pf);e5=a(tN,"A method that regroups all arguments linked to the dataloaders creation."),tN.forEach(o),t5=d(Ip),g(Br.$$.fragment,Ip),Ip.forEach(o),o5=d(J),zt=s(J,"DIV",{class:!0});var Sp=i(zt);g(Bs.$$.fragment,Sp),r5=d(Sp),mf=s(Sp,"P",{});var oN=i(mf);a5=a(oN,"A method that regroups all arguments linked to the evaluation."),oN.forEach(o),n5=d(Sp),g(Gr.$$.fragment,Sp),Sp.forEach(o),s5=d(J),Ot=s(J,"DIV",{class:!0});var qp=i(Ot);g(Gs.$$.fragment,qp),i5=d(qp),hf=s(qp,"P",{});var rN=i(hf);l5=a(rN,"A method that regroups all arguments linked to the evaluation."),rN.forEach(o),d5=d(qp),g(Zr.$$.fragment,qp),qp.forEach(o),c5=d(J),Wt=s(J,"DIV",{class:!0});var Dp=i(Wt);g(Zs.$$.fragment,Dp),p5=d(Dp),uf=s(Dp,"P",{});var aN=i(uf);m5=a(aN,"A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters."),aN.forEach(o),h5=d(Dp),g(Vr.$$.fragment,Dp),Dp.forEach(o),u5=d(J),Rt=s(J,"DIV",{class:!0});var Up=i(Rt);g(Vs.$$.fragment,Up),f5=d(Up),ff=s(Up,"P",{});var nN=i(ff);g5=a(nN,"A method that regroups all arguments linked to the optimizer and its hyperparameters."),nN.forEach(o),_5=d(Up),g(Xr.$$.fragment,Up),Up.forEach(o),b5=d(J),We=s(J,"DIV",{class:!0});var on=i(We);g(Xs.$$.fragment,on),v5=d(on),gf=s(on,"P",{});var sN=i(gf);y5=a(sN,"A method that regroups all arguments linked to synchronizing checkpoints with the Hub."),sN.forEach(o),w5=d(on),g(Yr.$$.fragment,on),T5=d(on),g(Hr.$$.fragment,on),on.forEach(o),E5=d(J),Lt=s(J,"DIV",{class:!0});var jp=i(Lt);g(Ys.$$.fragment,jp),A5=d(jp),_f=s(jp,"P",{});var iN=i(_f);$5=a(iN,"A method that regroups all arguments linked to the evaluation."),iN.forEach(o),k5=d(jp),g(Qr.$$.fragment,jp),jp.forEach(o),x5=d(J),Re=s(J,"DIV",{class:!0});var rn=i(Re);g(Hs.$$.fragment,rn),M5=d(rn),bf=s(rn,"P",{});var lN=i(bf);I5=a(lN,"A method that regroups all basic arguments linked to testing on a held-out dataset."),lN.forEach(o),S5=d(rn),g(Kr.$$.fragment,rn),q5=d(rn),g(ea.$$.fragment,rn),rn.forEach(o),D5=d(J),Le=s(J,"DIV",{class:!0});var an=i(Le);g(Qs.$$.fragment,an),U5=d(an),vf=s(an,"P",{});var dN=i(vf);j5=a(dN,"A method that regroups all basic arguments linked to the training."),dN.forEach(o),P5=d(an),g(ta.$$.fragment,an),J5=d(an),g(oa.$$.fragment,an),an.forEach(o),C5=d(J),ra=s(J,"DIV",{class:!0});var g2=i(ra);g(Ks.$$.fragment,g2),F5=d(g2),ei=s(g2,"P",{});var _2=i(ei);N5=a(_2,"Serializes this instance while replace "),yf=s(_2,"CODE",{});var cN=i(yf);z5=a(cN,"Enum"),cN.forEach(o),O5=a(_2,` by their values (for JSON serialization support). It obfuscates
the token values by removing their value.`),_2.forEach(o),g2.forEach(o),W5=d(J),aa=s(J,"DIV",{class:!0});var b2=i(aa);g(ti.$$.fragment,b2),R5=d(b2),wf=s(b2,"P",{});var pN=i(wf);L5=a(pN,"Serializes this instance to a JSON string."),pN.forEach(o),b2.forEach(o),B5=d(J),na=s(J,"DIV",{class:!0});var v2=i(na);g(oi.$$.fragment,v2),G5=d(v2),Tf=s(v2,"P",{});var mN=i(Tf);Z5=a(mN,"Sanitized serialization to use with TensorBoard\u2019s hparams"),mN.forEach(o),v2.forEach(o),J.forEach(o),Gv=d(t),Wo=s(t,"H2",{class:!0});var y2=i(Wo);sa=s(y2,"A",{id:!0,class:!0,href:!0});var hN=i(sa);Ef=s(hN,"SPAN",{});var uN=i(Ef);g(ri.$$.fragment,uN),uN.forEach(o),hN.forEach(o),V5=d(y2),Af=s(y2,"SPAN",{});var fN=i(Af);X5=a(fN,"Seq2SeqTrainingArguments"),fN.forEach(o),y2.forEach(o),Zv=d(t),qe=s(t,"DIV",{class:!0});var nn=i(qe);g(ai.$$.fragment,nn),Y5=d(nn),ni=s(nn,"P",{});var w2=i(ni);H5=a(w2,"TrainingArguments is the subset of the arguments we use in our example scripts "),$f=s(w2,"STRONG",{});var gN=i($f);Q5=a(gN,`which relate to the training loop
itself`),gN.forEach(o),K5=a(w2,"."),w2.forEach(o),e9=d(nn),Ro=s(nn,"P",{});var Pp=i(Ro);t9=a(Pp,"Using "),gd=s(Pp,"A",{href:!0});var _N=i(gd);o9=a(_N,"HfArgumentParser"),_N.forEach(o),r9=a(Pp,` we can turn this class into
`),si=s(Pp,"A",{href:!0,rel:!0});var bN=i(si);a9=a(bN,"argparse"),bN.forEach(o),n9=a(Pp,` arguments that can be specified on the
command line.`),Pp.forEach(o),s9=d(nn),ia=s(nn,"DIV",{class:!0});var T2=i(ia);g(ii.$$.fragment,T2),i9=d(T2),Lo=s(T2,"P",{});var Jp=i(Lo);l9=a(Jp,"Serializes this instance while replace "),kf=s(Jp,"CODE",{});var vN=i(kf);d9=a(vN,"Enum"),vN.forEach(o),c9=a(Jp," by their values and "),xf=s(Jp,"CODE",{});var yN=i(xf);p9=a(yN,"GenerationConfig"),yN.forEach(o),m9=a(Jp,` by dictionaries (for JSON
serialization support). It obfuscates the token values by removing their value.`),Jp.forEach(o),T2.forEach(o),nn.forEach(o),Vv=d(t),Bo=s(t,"H2",{class:!0});var E2=i(Bo);la=s(E2,"A",{id:!0,class:!0,href:!0});var wN=i(la);Mf=s(wN,"SPAN",{});var TN=i(Mf);g(li.$$.fragment,TN),TN.forEach(o),wN.forEach(o),h9=d(E2),If=s(E2,"SPAN",{});var EN=i(If);u9=a(EN,"Checkpoints"),EN.forEach(o),E2.forEach(o),Xv=d(t),ye=s(t,"P",{});var uo=i(ye);f9=a(uo,"By default, "),_d=s(uo,"A",{href:!0});var AN=i(_d);g9=a(AN,"Trainer"),AN.forEach(o),_9=a(uo," will save all checkpoints in the "),Sf=s(uo,"CODE",{});var $N=i(Sf);b9=a($N,"output_dir"),$N.forEach(o),v9=a(uo,` you set in the
`),bd=s(uo,"A",{href:!0});var kN=i(bd);y9=a(kN,"TrainingArguments"),kN.forEach(o),w9=a(uo," you are using. Those will go in subfolder named "),qf=s(uo,"CODE",{});var xN=i(qf);T9=a(xN,"checkpoint-xxx"),xN.forEach(o),E9=a(uo,` with xxx
being the step at which the training was at.`),uo.forEach(o),Yv=d(t),da=s(t,"P",{});var A2=i(da);A9=a(A2,"Resuming training from a checkpoint can be done when calling "),vd=s(A2,"A",{href:!0});var MN=i(vd);$9=a(MN,"Trainer.train()"),MN.forEach(o),k9=a(A2," with either:"),A2.forEach(o),Hv=d(t),ca=s(t,"UL",{});var $2=i(ca);yd=s($2,"LI",{});var T8=i(yd);Df=s(T8,"CODE",{});var IN=i(Df);x9=a(IN,"resume_from_checkpoint=True"),IN.forEach(o),M9=a(T8," which will resume training from the latest checkpoint"),T8.forEach(o),I9=d($2),wd=s($2,"LI",{});var E8=i(wd);Uf=s(E8,"CODE",{});var SN=i(Uf);S9=a(SN,"resume_from_checkpoint=checkpoint_dir"),SN.forEach(o),q9=a(E8,` which will resume training from the specific checkpoint in the directory
passed.`),E8.forEach(o),$2.forEach(o),Qv=d(t),Be=s(t,"P",{});var sn=i(Be);D9=a(sn,"In addition, you can easily save your checkpoints on the Model Hub when using "),jf=s(sn,"CODE",{});var qN=i(jf);U9=a(qN,"push_to_hub=True"),qN.forEach(o),j9=a(sn,`. By default, all
the models saved in intermediate checkpoints are saved in different commits, but not the optimizer state. You can adapt
the `),Pf=s(sn,"CODE",{});var DN=i(Pf);P9=a(DN,"hub-strategy"),DN.forEach(o),J9=a(sn," value of your "),Td=s(sn,"A",{href:!0});var UN=i(Td);C9=a(UN,"TrainingArguments"),UN.forEach(o),F9=a(sn," to either:"),sn.forEach(o),Kv=d(t),pa=s(t,"UL",{});var k2=i(pa);ma=s(k2,"LI",{});var Iv=i(ma);Jf=s(Iv,"CODE",{});var jN=i(Jf);N9=a(jN,'"checkpoint"'),jN.forEach(o),z9=a(Iv,`: the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to
resume training easily with `),Cf=s(Iv,"CODE",{});var PN=i(Cf);O9=a(PN,'trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")'),PN.forEach(o),W9=a(Iv,"."),Iv.forEach(o),R9=d(k2),Ed=s(k2,"LI",{});var A8=i(Ed);Ff=s(A8,"CODE",{});var JN=i(Ff);L9=a(JN,'"all_checkpoints"'),JN.forEach(o),B9=a(A8,`: all checkpoints are pushed like they appear in the output folder (so you will get one
checkpoint folder per folder in your final repository)`),A8.forEach(o),k2.forEach(o),ey=d(t),Go=s(t,"H2",{class:!0});var x2=i(Go);ha=s(x2,"A",{id:!0,class:!0,href:!0});var CN=i(ha);Nf=s(CN,"SPAN",{});var FN=i(Nf);g(di.$$.fragment,FN),FN.forEach(o),CN.forEach(o),G9=d(x2),zf=s(x2,"SPAN",{});var NN=i(zf);Z9=a(NN,"Logging"),NN.forEach(o),x2.forEach(o),ty=d(t),Ge=s(t,"P",{});var ln=i(Ge);V9=a(ln,"By default "),Ad=s(ln,"A",{href:!0});var zN=i(Ad);X9=a(zN,"Trainer"),zN.forEach(o),Y9=a(ln," will use "),Of=s(ln,"CODE",{});var ON=i(Of);H9=a(ON,"logging.INFO"),ON.forEach(o),Q9=a(ln," for the main process and "),Wf=s(ln,"CODE",{});var WN=i(Wf);K9=a(WN,"logging.WARNING"),WN.forEach(o),eI=a(ln," for the replicas if any."),ln.forEach(o),oy=d(t),Bt=s(t,"P",{});var Cp=i(Bt);tI=a(Cp,"These defaults can be overridden to use any of the 5 "),Rf=s(Cp,"CODE",{});var RN=i(Rf);oI=a(RN,"logging"),RN.forEach(o),rI=a(Cp," levels with "),$d=s(Cp,"A",{href:!0});var LN=i($d);aI=a(LN,"TrainingArguments"),LN.forEach(o),nI=a(Cp,`\u2019s
arguments:`),Cp.forEach(o),ry=d(t),ua=s(t,"UL",{});var M2=i(ua);kd=s(M2,"LI",{});var $8=i(kd);Lf=s($8,"CODE",{});var BN=i(Lf);sI=a(BN,"log_level"),BN.forEach(o),iI=a($8," - for the main process"),$8.forEach(o),lI=d(M2),xd=s(M2,"LI",{});var k8=i(xd);Bf=s(k8,"CODE",{});var GN=i(Bf);dI=a(GN,"log_level_replica"),GN.forEach(o),cI=a(k8," - for the replicas"),k8.forEach(o),M2.forEach(o),ay=d(t),Ze=s(t,"P",{});var dn=i(Ze);pI=a(dn,"Further, if "),Md=s(dn,"A",{href:!0});var ZN=i(Md);mI=a(ZN,"TrainingArguments"),ZN.forEach(o),hI=a(dn,"\u2019s "),Gf=s(dn,"CODE",{});var VN=i(Gf);uI=a(VN,"log_on_each_node"),VN.forEach(o),fI=a(dn," is set to "),Zf=s(dn,"CODE",{});var XN=i(Zf);gI=a(XN,"False"),XN.forEach(o),_I=a(dn,` 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.`),dn.forEach(o),ny=d(t),pe=s(t,"P",{});var at=i(pe);bI=a(at,"Note that "),Id=s(at,"A",{href:!0});var YN=i(Id);vI=a(YN,"Trainer"),YN.forEach(o),yI=a(at," is going to set "),Vf=s(at,"CODE",{});var HN=i(Vf);wI=a(HN,"transformers"),HN.forEach(o),TI=a(at,`\u2019s log level separately for each node in its
`),Xf=s(at,"CODE",{});var QN=i(Xf);EI=a(QN,"Trainer.__init__()"),QN.forEach(o),AI=a(at,`. So you may want to set this sooner (see the next example) if you tap into other
`),Yf=s(at,"CODE",{});var KN=i(Yf);$I=a(KN,"transformers"),KN.forEach(o),kI=a(at," functionality before creating the "),Sd=s(at,"A",{href:!0});var ez=i(Sd);xI=a(ez,"Trainer"),ez.forEach(o),MI=a(at," object."),at.forEach(o),sy=d(t),qd=s(t,"P",{});var tz=i(qd);II=a(tz,"Here is an example of how this can be used in an application:"),tz.forEach(o),iy=d(t),g(ci.$$.fragment,t),ly=d(t),Dd=s(t,"P",{});var oz=i(Dd);SI=a(oz,`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:`),oz.forEach(o),dy=d(t),g(pi.$$.fragment,t),cy=d(t),Ud=s(t,"P",{});var rz=i(Ud);qI=a(rz,`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:`),rz.forEach(o),py=d(t),g(mi.$$.fragment,t),my=d(t),jd=s(t,"P",{});var az=i(jd);DI=a(az,`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.`),az.forEach(o),hy=d(t),Pd=s(t,"P",{});var nz=i(Pd);UI=a(nz,"If you need your application to be as quiet as possible you could do:"),nz.forEach(o),uy=d(t),g(hi.$$.fragment,t),fy=d(t),fa=s(t,"P",{});var I2=i(fa);jI=a(I2,"(add "),Hf=s(I2,"CODE",{});var sz=i(Hf);PI=a(sz,"--log_on_each_node 0"),sz.forEach(o),JI=a(I2," if on multi-node environment)"),I2.forEach(o),gy=d(t),Zo=s(t,"H2",{class:!0});var S2=i(Zo);ga=s(S2,"A",{id:!0,class:!0,href:!0});var iz=i(ga);Qf=s(iz,"SPAN",{});var lz=i(Qf);g(ui.$$.fragment,lz),lz.forEach(o),iz.forEach(o),CI=d(S2),Kf=s(S2,"SPAN",{});var dz=i(Kf);FI=a(dz,"Randomness"),dz.forEach(o),S2.forEach(o),_y=d(t),we=s(t,"P",{});var fo=i(we);NI=a(fo,"When resuming from a checkpoint generated by "),Jd=s(fo,"A",{href:!0});var cz=i(Jd);zI=a(cz,"Trainer"),cz.forEach(o),OI=a(fo,` all efforts are made to restore the
`),eg=s(fo,"EM",{});var pz=i(eg);WI=a(pz,"python"),pz.forEach(o),RI=a(fo,", "),tg=s(fo,"EM",{});var mz=i(tg);LI=a(mz,"numpy"),mz.forEach(o),BI=a(fo," and "),og=s(fo,"EM",{});var hz=i(og);GI=a(hz,"pytorch"),hz.forEach(o),ZI=a(fo,` 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.`),fo.forEach(o),by=d(t),Gt=s(t,"P",{});var Fp=i(Gt);VI=a(Fp,`However, due to various default non-deterministic pytorch settings this might not fully work. If you want full
determinism please refer to `),fi=s(Fp,"A",{href:!0,rel:!0});var uz=i(fi);XI=a(uz,"Controlling sources of randomness"),uz.forEach(o),YI=a(Fp,`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),rg=s(Fp,"CODE",{});var fz=i(rg);HI=a(fz,"torch.backends.cudnn.deterministic"),fz.forEach(o),QI=a(Fp,`) may slow things down, therefore this
can\u2019t be done by default, but you can enable those yourself if needed.`),Fp.forEach(o),vy=d(t),Vo=s(t,"H2",{class:!0});var q2=i(Vo);_a=s(q2,"A",{id:!0,class:!0,href:!0});var gz=i(_a);ag=s(gz,"SPAN",{});var _z=i(ag);g(gi.$$.fragment,_z),_z.forEach(o),gz.forEach(o),KI=d(q2),ng=s(q2,"SPAN",{});var bz=i(ng);eS=a(bz,"Specific GPUs Selection"),bz.forEach(o),q2.forEach(o),yy=d(t),Cd=s(t,"P",{});var vz=i(Cd);tS=a(vz,"Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),vz.forEach(o),wy=d(t),ba=s(t,"P",{});var D2=i(ba);oS=a(D2,"When using "),_i=s(D2,"A",{href:!0,rel:!0});var yz=i(_i);sg=s(yz,"CODE",{});var wz=i(sg);rS=a(wz,"DistributedDataParallel"),wz.forEach(o),yz.forEach(o),aS=a(D2," 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:"),D2.forEach(o),Ty=d(t),g(bi.$$.fragment,t),Ey=d(t),Zt=s(t,"P",{});var Np=i(Zt);nS=a(Np,"if you have either "),vi=s(Np,"A",{href:!0,rel:!0});var Tz=i(vi);ig=s(Tz,"CODE",{});var Ez=i(ig);sS=a(Ez,"accelerate"),Ez.forEach(o),Tz.forEach(o),iS=a(Np," or "),yi=s(Np,"A",{href:!0,rel:!0});var Az=i(yi);lg=s(Az,"CODE",{});var $z=i(lg);lS=a($z,"deepspeed"),$z.forEach(o),Az.forEach(o),dS=a(Np," installed you can also accomplish the same by using one of:"),Np.forEach(o),Ay=d(t),g(wi.$$.fragment,t),$y=d(t),g(Ti.$$.fragment,t),ky=d(t),va=s(t,"P",{});var U2=i(va);cS=a(U2,"You don\u2019t need to use the Accelerate or "),Fd=s(U2,"A",{href:!0});var kz=i(Fd);pS=a(kz,"the Deepspeed integration"),kz.forEach(o),mS=a(U2," features to use these launchers."),U2.forEach(o),xy=d(t),Nd=s(t,"P",{});var xz=i(Nd);hS=a(xz,"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."),xz.forEach(o),My=d(t),zd=s(t,"P",{});var Mz=i(zd);uS=a(Mz,"The following environment variables help you control which GPUs to use and their order."),Mz.forEach(o),Iy=d(t),Od=s(t,"P",{});var Iz=i(Od);dg=s(Iz,"STRONG",{});var Sz=i(dg);cg=s(Sz,"CODE",{});var qz=i(cg);fS=a(qz,"CUDA_VISIBLE_DEVICES"),qz.forEach(o),Sz.forEach(o),Iz.forEach(o),Sy=d(t),ya=s(t,"P",{});var j2=i(ya);gS=a(j2,"If you have multiple GPUs and you\u2019d like to use only 1 or a few of those GPUs, set the environment variable "),pg=s(j2,"CODE",{});var Dz=i(pg);_S=a(Dz,"CUDA_VISIBLE_DEVICES"),Dz.forEach(o),bS=a(j2," to a list of the GPUs to be used."),j2.forEach(o),qy=d(t),Wd=s(t,"P",{});var Uz=i(Wd);vS=a(Uz,"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:"),Uz.forEach(o),Dy=d(t),g(Ei.$$.fragment,t),Uy=d(t),Vt=s(t,"P",{});var zp=i(Vt);yS=a(zp,"So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),mg=s(zp,"CODE",{});var jz=i(mg);wS=a(jz,"cuda:0"),jz.forEach(o),TS=a(zp," and "),hg=s(zp,"CODE",{});var Pz=i(hg);ES=a(Pz,"cuda:1"),Pz.forEach(o),AS=a(zp," correspondingly."),zp.forEach(o),jy=d(t),Rd=s(t,"P",{});var Jz=i(Rd);$S=a(Jz,"You can even change their order:"),Jz.forEach(o),Py=d(t),g(Ai.$$.fragment,t),Jy=d(t),Xt=s(t,"P",{});var Op=i(Xt);kS=a(Op,"Here your physical GPUs 0 and 2 are mapped to "),ug=s(Op,"CODE",{});var Cz=i(ug);xS=a(Cz,"cuda:1"),Cz.forEach(o),MS=a(Op," and "),fg=s(Op,"CODE",{});var Fz=i(fg);IS=a(Fz,"cuda:0"),Fz.forEach(o),SS=a(Op," correspondingly."),Op.forEach(o),Cy=d(t),Yt=s(t,"P",{});var Wp=i(Yt);qS=a(Wp,"The above examples were all for "),gg=s(Wp,"CODE",{});var Nz=i(gg);DS=a(Nz,"DistributedDataParallel"),Nz.forEach(o),US=a(Wp," use pattern, but the same method works for "),$i=s(Wp,"A",{href:!0,rel:!0});var zz=i($i);_g=s(zz,"CODE",{});var Oz=i(_g);jS=a(Oz,"DataParallel"),Oz.forEach(o),zz.forEach(o),PS=a(Wp," as well:"),Wp.forEach(o),Fy=d(t),g(ki.$$.fragment,t),Ny=d(t),Ld=s(t,"P",{});var Wz=i(Ld);JS=a(Wz,"To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),Wz.forEach(o),zy=d(t),g(xi.$$.fragment,t),Oy=d(t),Bd=s(t,"P",{});var Rz=i(Bd);CS=a(Rz,"As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),Rz.forEach(o),Wy=d(t),g(Mi.$$.fragment,t),Ry=d(t),Gd=s(t,"P",{});var Lz=i(Gd);FS=a(Lz,"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."),Lz.forEach(o),Ly=d(t),Zd=s(t,"P",{});var Bz=i(Zd);bg=s(Bz,"STRONG",{});var Gz=i(bg);vg=s(Gz,"CODE",{});var Zz=i(vg);NS=a(Zz,"CUDA_DEVICE_ORDER"),Zz.forEach(o),Gz.forEach(o),Bz.forEach(o),By=d(t),wa=s(t,"P",{});var P2=i(wa);zS=a(P2,"There is an additional environment variable "),yg=s(P2,"CODE",{});var Vz=i(yg);OS=a(Vz,"CUDA_DEVICE_ORDER"),Vz.forEach(o),WS=a(P2," that controls how the physical devices are ordered. The two choices are:"),P2.forEach(o),Gy=d(t),Vd=s(t,"OL",{});var Xz=i(Vd);Ii=s(Xz,"LI",{});var J2=i(Ii);RS=a(J2,"ordered by PCIe bus IDs (matches "),wg=s(J2,"CODE",{});var Yz=i(wg);LS=a(Yz,"nvidia-smi"),Yz.forEach(o),BS=a(J2,"\u2019s order) - this is the default."),J2.forEach(o),Xz.forEach(o),Zy=d(t),g(Si.$$.fragment,t),Vy=d(t),qi=s(t,"OL",{start:!0});var Hz=i(qi);Tg=s(Hz,"LI",{});var Qz=i(Tg);GS=a(Qz,"ordered by GPU compute capabilities"),Qz.forEach(o),Hz.forEach(o),Xy=d(t),g(Di.$$.fragment,t),Yy=d(t),Ht=s(t,"P",{});var Rp=i(Ht);ZS=a(Rp,"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 "),Eg=s(Rp,"CODE",{});var Kz=i(Eg);VS=a(Kz,"CUDA_DEVICE_ORDER=FASTEST_FIRST"),Kz.forEach(o),XS=a(Rp," will always put the newer faster card first. It\u2019ll be somewhat confusing though since "),Ag=s(Rp,"CODE",{});var eO=i(Ag);YS=a(eO,"nvidia-smi"),eO.forEach(o),HS=a(Rp," will still report them in the PCIe order."),Rp.forEach(o),Hy=d(t),Xd=s(t,"P",{});var tO=i(Xd);QS=a(tO,"The other solution to swapping the order is to use:"),tO.forEach(o),Qy=d(t),g(Ui.$$.fragment,t),Ky=d(t),Yd=s(t,"P",{});var oO=i(Yd);KS=a(oO,"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."),oO.forEach(o),e1=d(t),Ta=s(t,"P",{});var C2=i(Ta);eq=a(C2,"Also if you do set this environment variable it\u2019s the best to set it in your "),$g=s(C2,"CODE",{});var rO=i($g);tq=a(rO,"~/.bashrc"),rO.forEach(o),oq=a(C2," file or some other startup config file and forget about it."),C2.forEach(o),t1=d(t),Xo=s(t,"H2",{class:!0});var F2=i(Xo);Ea=s(F2,"A",{id:!0,class:!0,href:!0});var aO=i(Ea);kg=s(aO,"SPAN",{});var nO=i(kg);g(ji.$$.fragment,nO),nO.forEach(o),aO.forEach(o),rq=d(F2),xg=s(F2,"SPAN",{});var sO=i(xg);aq=a(sO,"Trainer Integrations"),sO.forEach(o),F2.forEach(o),o1=d(t),Aa=s(t,"P",{});var N2=i(Aa);nq=a(N2,"The "),Hd=s(N2,"A",{href:!0});var iO=i(Hd);sq=a(iO,"Trainer"),iO.forEach(o),iq=a(N2,` has been extended to support libraries that may dramatically improve your training
time and fit much bigger models.`),N2.forEach(o),r1=d(t),Ve=s(t,"P",{});var cn=i(Ve);lq=a(cn,"Currently it supports third party solutions, "),Pi=s(cn,"A",{href:!0,rel:!0});var lO=i(Pi);dq=a(lO,"DeepSpeed"),lO.forEach(o),cq=a(cn," and "),Ji=s(cn,"A",{href:!0,rel:!0});var dO=i(Ji);pq=a(dO,"PyTorch FSDP"),dO.forEach(o),mq=a(cn,", which implement parts of the paper "),Ci=s(cn,"A",{href:!0,rel:!0});var cO=i(Ci);hq=a(cO,`ZeRO: Memory Optimizations
Toward Training Trillion Parameter Models, by Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, Yuxiong He`),cO.forEach(o),uq=a(cn,"."),cn.forEach(o),a1=d(t),$a=s(t,"P",{});var z2=i($a);fq=a(z2,"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 "),Qd=s(z2,"A",{href:!0});var pO=i(Qd);gq=a(pO,"PyTorch FSDP integration"),pO.forEach(o),_q=a(z2,")"),z2.forEach(o),n1=d(t),Kd=s(t,"A",{id:!0}),i(Kd).forEach(o),s1=d(t),Yo=s(t,"H3",{class:!0});var O2=i(Yo);ka=s(O2,"A",{id:!0,class:!0,href:!0});var mO=i(ka);Mg=s(mO,"SPAN",{});var hO=i(Mg);g(Fi.$$.fragment,hO),hO.forEach(o),mO.forEach(o),bq=d(O2),Ig=s(O2,"SPAN",{});var uO=i(Ig);vq=a(uO,"CUDA Extension Installation Notes"),uO.forEach(o),O2.forEach(o),i1=d(t),ec=s(t,"P",{});var fO=i(ec);yq=a(fO,"As of this writing, Deepspeed require compilation of CUDA C++ code, before it can be used."),fO.forEach(o),l1=d(t),xa=s(t,"P",{});var W2=i(xa);wq=a(W2,"While all installation issues should be dealt with through the corresponding GitHub Issues of "),Ni=s(W2,"A",{href:!0,rel:!0});var gO=i(Ni);Tq=a(gO,"Deepspeed"),gO.forEach(o),Eq=a(W2,`, there are a few common issues that one may encounter while building
any PyTorch extension that needs to build CUDA extensions.`),W2.forEach(o),d1=d(t),tc=s(t,"P",{});var _O=i(tc);Aq=a(_O,"Therefore, if you encounter a CUDA-related build issue while doing the following:"),_O.forEach(o),c1=d(t),g(zi.$$.fragment,t),p1=d(t),oc=s(t,"P",{});var bO=i(oc);$q=a(bO,"please, read the following notes first."),bO.forEach(o),m1=d(t),Qt=s(t,"P",{});var Lp=i(Qt);kq=a(Lp,"In these notes we give examples for what to do when "),Sg=s(Lp,"CODE",{});var vO=i(Sg);xq=a(vO,"pytorch"),vO.forEach(o),Mq=a(Lp," has been built with CUDA "),qg=s(Lp,"CODE",{});var yO=i(qg);Iq=a(yO,"10.2"),yO.forEach(o),Sq=a(Lp,`. If your situation is
different remember to adjust the version number to the one you are after.`),Lp.forEach(o),h1=d(t),Ho=s(t,"H4",{class:!0});var R2=i(Ho);Ma=s(R2,"A",{id:!0,class:!0,href:!0});var wO=i(Ma);Dg=s(wO,"SPAN",{});var TO=i(Dg);g(Oi.$$.fragment,TO),TO.forEach(o),wO.forEach(o),qq=d(R2),Ug=s(R2,"SPAN",{});var EO=i(Ug);Dq=a(EO,"Possible problem #1"),EO.forEach(o),R2.forEach(o),u1=d(t),rc=s(t,"P",{});var AO=i(rc);Uq=a(AO,`While, Pytorch comes with its own CUDA toolkit, to build these two projects you must have an identical version of CUDA
installed system-wide.`),AO.forEach(o),f1=d(t),Xe=s(t,"P",{});var pn=i(Xe);jq=a(pn,"For example, if you installed "),jg=s(pn,"CODE",{});var $O=i(jg);Pq=a($O,"pytorch"),$O.forEach(o),Jq=a(pn," with "),Pg=s(pn,"CODE",{});var kO=i(Pg);Cq=a(kO,"cudatoolkit==10.2"),kO.forEach(o),Fq=a(pn,` in the Python environment, you also need to have
CUDA `),Jg=s(pn,"CODE",{});var xO=i(Jg);Nq=a(xO,"10.2"),xO.forEach(o),zq=a(pn," installed system-wide."),pn.forEach(o),g1=d(t),Kt=s(t,"P",{});var Bp=i(Kt);Oq=a(Bp,"The exact location may vary from system to system, but "),Cg=s(Bp,"CODE",{});var MO=i(Cg);Wq=a(MO,"/usr/local/cuda-10.2"),MO.forEach(o),Rq=a(Bp,` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),Fg=s(Bp,"CODE",{});var IO=i(Fg);Lq=a(IO,"PATH"),IO.forEach(o),Bq=a(Bp,` environment variable, one can find the
installation location by doing:`),Bp.forEach(o),_1=d(t),g(Wi.$$.fragment,t),b1=d(t),Ia=s(t,"P",{});var L2=i(Ia);Gq=a(L2,`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: `),Ri=s(L2,"A",{href:!0,rel:!0});var SO=i(Ri);Zq=a(SO,"ubuntu cuda 10.2 install"),SO.forEach(o),Vq=a(L2,"."),L2.forEach(o),v1=d(t),Qo=s(t,"H4",{class:!0});var B2=i(Qo);Sa=s(B2,"A",{id:!0,class:!0,href:!0});var qO=i(Sa);Ng=s(qO,"SPAN",{});var DO=i(Ng);g(Li.$$.fragment,DO),DO.forEach(o),qO.forEach(o),Xq=d(B2),zg=s(B2,"SPAN",{});var UO=i(zg);Yq=a(UO,"Possible problem #2"),UO.forEach(o),B2.forEach(o),y1=d(t),ac=s(t,"P",{});var jO=i(ac);Hq=a(jO,`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),jO.forEach(o),w1=d(t),g(Bi.$$.fragment,t),T1=d(t),eo=s(t,"P",{});var Gp=i(eo);Qq=a(Gp,"Now, in this situation you need to make sure that your "),Og=s(Gp,"CODE",{});var PO=i(Og);Kq=a(PO,"PATH"),PO.forEach(o),eD=a(Gp," and "),Wg=s(Gp,"CODE",{});var JO=i(Wg);tD=a(JO,"LD_LIBRARY_PATH"),JO.forEach(o),oD=a(Gp,` 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.`),Gp.forEach(o),E1=d(t),nc=s(t,"P",{});var CO=i(nc);rD=a(CO,"First, you may look at their contents:"),CO.forEach(o),A1=d(t),g(Gi.$$.fragment,t),$1=d(t),sc=s(t,"P",{});var FO=i(sc);aD=a(FO,"so you get an idea of what is inside."),FO.forEach(o),k1=d(t),qa=s(t,"P",{});var G2=i(qa);nD=a(G2,"It\u2019s possible that "),Rg=s(G2,"CODE",{});var NO=i(Rg);sD=a(NO,"LD_LIBRARY_PATH"),NO.forEach(o),iD=a(G2," is empty."),G2.forEach(o),x1=d(t),ht=s(t,"P",{});var zl=i(ht);Lg=s(zl,"CODE",{});var zO=i(Lg);lD=a(zO,"PATH"),zO.forEach(o),dD=a(zl," lists the locations of where executables can be found and "),Bg=s(zl,"CODE",{});var OO=i(Bg);cD=a(OO,"LD_LIBRARY_PATH"),OO.forEach(o),pD=a(zl,` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),Gg=s(zl,"CODE",{});var WO=i(Gg);mD=a(WO,":"),WO.forEach(o),hD=a(zl,` is used to separate multiple
entries.`),zl.forEach(o),M1=d(t),ic=s(t,"P",{});var RO=i(ic);uD=a(RO,`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),RO.forEach(o),I1=d(t),g(Zi.$$.fragment,t),S1=d(t),lc=s(t,"P",{});var LO=i(lc);fD=a(LO,"Note that we aren\u2019t overwriting the existing values, but prepending instead."),LO.forEach(o),q1=d(t),Ye=s(t,"P",{});var mn=i(Ye);gD=a(mn,`Of course, adjust the version number, the full path if need be. Check that the directories you assign actually do
exist. `),Zg=s(mn,"CODE",{});var BO=i(Zg);_D=a(BO,"lib64"),BO.forEach(o),bD=a(mn," sub-directory is where the various CUDA "),Vg=s(mn,"CODE",{});var GO=i(Vg);vD=a(GO,".so"),GO.forEach(o),yD=a(mn," objects, like "),Xg=s(mn,"CODE",{});var ZO=i(Xg);wD=a(ZO,"libcudart.so"),ZO.forEach(o),TD=a(mn,` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),mn.forEach(o),D1=d(t),Ko=s(t,"H4",{class:!0});var Z2=i(Ko);Da=s(Z2,"A",{id:!0,class:!0,href:!0});var VO=i(Da);Yg=s(VO,"SPAN",{});var XO=i(Yg);g(Vi.$$.fragment,XO),XO.forEach(o),VO.forEach(o),ED=d(Z2),Hg=s(Z2,"SPAN",{});var YO=i(Hg);AD=a(YO,"Possible problem #3"),YO.forEach(o),Z2.forEach(o),U1=d(t),to=s(t,"P",{});var Zp=i(to);$D=a(Zp,"Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),Qg=s(Zp,"CODE",{});var HO=i(Qg);kD=a(HO,"gcc-9"),HO.forEach(o),xD=a(Zp,` but it wants
`),Kg=s(Zp,"CODE",{});var QO=i(Kg);MD=a(QO,"gcc-7"),QO.forEach(o),ID=a(Zp,"."),Zp.forEach(o),j1=d(t),dc=s(t,"P",{});var KO=i(dc);SD=a(KO,"There are various ways to go about it."),KO.forEach(o),P1=d(t),cc=s(t,"P",{});var eW=i(cc);qD=a(eW,"If you can install the latest CUDA toolkit it typically should support the newer compiler."),eW.forEach(o),J1=d(t),Ua=s(t,"P",{});var V2=i(Ua);DD=a(V2,`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 `),e_=s(V2,"CODE",{});var tW=i(e_);UD=a(tW,"gcc-7"),tW.forEach(o),jD=a(V2,` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),V2.forEach(o),C1=d(t),g(Xi.$$.fragment,t),F1=d(t),te=s(t,"P",{});var Te=i(te);PD=a(Te,"Here, we are making a symlink to "),t_=s(Te,"CODE",{});var oW=i(t_);JD=a(oW,"gcc-7"),oW.forEach(o),CD=a(Te," from "),o_=s(Te,"CODE",{});var rW=i(o_);FD=a(rW,"/usr/local/cuda-10.2/bin/gcc"),rW.forEach(o),ND=a(Te,` and since
`),r_=s(Te,"CODE",{});var aW=i(r_);zD=a(aW,"/usr/local/cuda-10.2/bin/"),aW.forEach(o),OD=a(Te," should be in the "),a_=s(Te,"CODE",{});var nW=i(a_);WD=a(nW,"PATH"),nW.forEach(o),RD=a(Te,` environment variable (see the previous problem\u2019s solution), it
should find `),n_=s(Te,"CODE",{});var sW=i(n_);LD=a(sW,"gcc-7"),sW.forEach(o),BD=a(Te," (and "),s_=s(Te,"CODE",{});var iW=i(s_);GD=a(iW,"g++7"),iW.forEach(o),ZD=a(Te,") and then the build will succeed."),Te.forEach(o),N1=d(t),pc=s(t,"P",{});var lW=i(pc);VD=a(lW,"As always make sure to edit the paths in the example to match your situation."),lW.forEach(o),z1=d(t),er=s(t,"H3",{class:!0});var X2=i(er);ja=s(X2,"A",{id:!0,class:!0,href:!0});var dW=i(ja);i_=s(dW,"SPAN",{});var cW=i(i_);g(Yi.$$.fragment,cW),cW.forEach(o),dW.forEach(o),XD=d(X2),l_=s(X2,"SPAN",{});var pW=i(l_);YD=a(pW,"PyTorch Fully Sharded Data parallel"),pW.forEach(o),X2.forEach(o),O1=d(t),Pa=s(t,"P",{});var Y2=i(Pa);HD=a(Y2,`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 `),Hi=s(Y2,"A",{href:!0,rel:!0});var mW=i(Hi);QD=a(mW,"Fully Sharded Data Parallel blog"),mW.forEach(o),KD=a(Y2,`.
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.`),Y2.forEach(o),W1=d(t),Qi=s(t,"P",{});var x8=i(Qi);d_=s(x8,"STRONG",{});var hW=i(d_);eU=a(hW,"Required PyTorch version for FSDP support"),hW.forEach(o),tU=a(x8,`: 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.`),x8.forEach(o),R1=d(t),Ki=s(t,"P",{});var M8=i(Ki);c_=s(M8,"STRONG",{});var uW=i(c_);oU=a(uW,"Usage"),uW.forEach(o),rU=a(M8,":"),M8.forEach(o),L1=d(t),me=s(t,"UL",{});var nt=i(me);p_=s(nt,"LI",{});var fW=i(p_);el=s(fW,"P",{});var H2=i(el);aU=a(H2,`Make sure you have added the distributed launcher
`),m_=s(H2,"CODE",{});var gW=i(m_);nU=a(gW,"-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE"),gW.forEach(o),sU=a(H2," if you haven\u2019t been using it already."),H2.forEach(o),fW.forEach(o),iU=d(nt),tl=s(nt,"LI",{});var Q2=i(tl);mc=s(Q2,"P",{});var I8=i(mc);h_=s(I8,"STRONG",{});var _W=i(h_);lU=a(_W,"Sharding Strategy"),_W.forEach(o),dU=a(I8,":"),I8.forEach(o),cU=d(Q2),tr=s(Q2,"UL",{});var Vp=i(tr);ol=s(Vp,"LI",{});var K2=i(ol);pU=a(K2,`FULL_SHARD : Shards optimizer states + gradients + model parameters across data parallel workers/GPUs.
For this, add `),u_=s(K2,"CODE",{});var bW=i(u_);mU=a(bW,"--fsdp full_shard"),bW.forEach(o),hU=a(K2," to the command line arguments."),K2.forEach(o),uU=d(Vp),rl=s(Vp,"LI",{});var eT=i(rl);fU=a(eT,`SHARD_GRAD_OP : Shards optimizer states + gradients across data parallel workers/GPUs.
For this, add `),f_=s(eT,"CODE",{});var vW=i(f_);gU=a(vW,"--fsdp shard_grad_op"),vW.forEach(o),_U=a(eT," to the command line arguments."),eT.forEach(o),bU=d(Vp),al=s(Vp,"LI",{});var tT=i(al);vU=a(tT,"NO_SHARD : No sharding. For this, add "),g_=s(tT,"CODE",{});var yW=i(g_);yU=a(yW,"--fsdp no_shard"),yW.forEach(o),wU=a(tT," to the command line arguments."),tT.forEach(o),Vp.forEach(o),Q2.forEach(o),TU=d(nt),__=s(nt,"LI",{});var wW=i(__);or=s(wW,"P",{});var Xp=i(or);EU=a(Xp,`To offload the parameters and gradients to the CPU,
add `),b_=s(Xp,"CODE",{});var TW=i(b_);AU=a(TW,'--fsdp "full_shard offload"'),TW.forEach(o),$U=a(Xp," or "),v_=s(Xp,"CODE",{});var EW=i(v_);kU=a(EW,'--fsdp "shard_grad_op offload"'),EW.forEach(o),xU=a(Xp," to the command line arguments."),Xp.forEach(o),wW.forEach(o),MU=d(nt),y_=s(nt,"LI",{});var AW=i(y_);ut=s(AW,"P",{});var hn=i(ut);IU=a(hn,"To automatically recursively wrap layers with FSDP using "),w_=s(hn,"CODE",{});var $W=i(w_);SU=a($W,"default_auto_wrap_policy"),$W.forEach(o),qU=a(hn,`,
add `),T_=s(hn,"CODE",{});var kW=i(T_);DU=a(kW,'--fsdp "full_shard auto_wrap"'),kW.forEach(o),UU=a(hn," or "),E_=s(hn,"CODE",{});var xW=i(E_);jU=a(xW,'--fsdp "shard_grad_op auto_wrap"'),xW.forEach(o),PU=a(hn," to the command line arguments."),hn.forEach(o),AW.forEach(o),JU=d(nt),A_=s(nt,"LI",{});var MW=i(A_);rr=s(MW,"P",{});var Yp=i(rr);CU=a(Yp,`To enable both CPU offloading and auto wrapping,
add `),$_=s(Yp,"CODE",{});var IW=i($_);FU=a(IW,'--fsdp "full_shard offload auto_wrap"'),IW.forEach(o),NU=a(Yp," or "),k_=s(Yp,"CODE",{});var SW=i(k_);zU=a(SW,'--fsdp "shard_grad_op offload auto_wrap"'),SW.forEach(o),OU=a(Yp," to the command line arguments."),Yp.forEach(o),MW.forEach(o),WU=d(nt),nl=s(nt,"LI",{});var oT=i(nl);ft=s(oT,"P",{});var un=i(ft);RU=a(un,"Remaining FSDP config is passed via "),x_=s(un,"CODE",{});var qW=i(x_);LU=a(qW,"--fsdp_config <path_to_fsdp_config.json>"),qW.forEach(o),BU=a(un,`. It is either a location of
FSDP json config file (e.g., `),M_=s(un,"CODE",{});var DW=i(M_);GU=a(DW,"fsdp_config.json"),DW.forEach(o),ZU=a(un,") or an already loaded json file as "),I_=s(un,"CODE",{});var UW=i(I_);VU=a(UW,"dict"),UW.forEach(o),XU=a(un,"."),un.forEach(o),YU=d(oT),De=s(oT,"UL",{});var go=i(De);hc=s(go,"LI",{});var S8=i(hc);HU=a(S8,"If auto wrapping is enabled, you can either use transformer based auto wrap policy or size based auto wrap policy."),sl=s(S8,"UL",{});var rT=i(sl);ge=s(rT,"LI",{});var st=i(ge);QU=a(st,"For transformer based auto wrap policy, it is recommended to specify "),S_=s(st,"CODE",{});var jW=i(S_);KU=a(jW,"fsdp_transformer_layer_cls_to_wrap"),jW.forEach(o),ej=a(st," in the config file. If not specified, the default value is "),q_=s(st,"CODE",{});var PW=i(q_);tj=a(PW,"model._no_split_modules"),PW.forEach(o),oj=a(st,` when available.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),D_=s(st,"CODE",{});var JW=i(D_);rj=a(JW,"BertLayer"),JW.forEach(o),aj=a(st,", "),U_=s(st,"CODE",{});var CW=i(U_);nj=a(CW,"GPTJBlock"),CW.forEach(o),sj=a(st,", "),j_=s(st,"CODE",{});var FW=i(j_);ij=a(FW,"T5Block"),FW.forEach(o),lj=a(st,` \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.`),st.forEach(o),dj=d(rT),il=s(rT,"LI",{});var aT=i(il);cj=a(aT,"For size based auto wrap policy, please add "),P_=s(aT,"CODE",{});var NW=i(P_);pj=a(NW,"fsdp_min_num_params"),NW.forEach(o),mj=a(aT,` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),aT.forEach(o),rT.forEach(o),S8.forEach(o),hj=d(go),gt=s(go,"LI",{});var fn=i(gt);J_=s(fn,"CODE",{});var zW=i(J_);uj=a(zW,"fsdp_backward_prefetch"),zW.forEach(o),fj=a(fn,` can be specified in the config file. It controls when to prefetch next set of parameters.
`),C_=s(fn,"CODE",{});var OW=i(C_);gj=a(OW,"backward_pre"),OW.forEach(o),_j=a(fn," and "),F_=s(fn,"CODE",{});var WW=i(F_);bj=a(WW,"backward_pos"),WW.forEach(o),vj=a(fn,` are available options.
For more information refer `),N_=s(fn,"CODE",{});var RW=i(N_);yj=a(RW,"torch.distributed.fsdp.fully_sharded_data_parallel.BackwardPrefetch"),RW.forEach(o),fn.forEach(o),wj=d(go),Ja=s(go,"LI",{});var Sv=i(Ja);z_=s(Sv,"CODE",{});var LW=i(z_);Tj=a(LW,"fsdp_forward_prefetch"),LW.forEach(o),Ej=a(Sv,` can be specified in the config file. It controls when to prefetch next set of parameters.
If `),O_=s(Sv,"CODE",{});var BW=i(O_);Aj=a(BW,'"True"'),BW.forEach(o),$j=a(Sv,", FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass."),Sv.forEach(o),kj=d(go),Ca=s(go,"LI",{});var qv=i(Ca);W_=s(qv,"CODE",{});var GW=i(W_);xj=a(GW,"limit_all_gathers"),GW.forEach(o),Mj=a(qv,` can be specified in the config file.
If `),R_=s(qv,"CODE",{});var ZW=i(R_);Ij=a(ZW,'"True"'),ZW.forEach(o),Sj=a(qv,", FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers."),qv.forEach(o),qj=d(go),Fa=s(go,"LI",{});var Dv=i(Fa);L_=s(Dv,"CODE",{});var VW=i(L_);Dj=a(VW,"activation_checkpointing"),VW.forEach(o),Uj=a(Dv,` can be specified in the config file.
If `),B_=s(Dv,"CODE",{});var XW=i(B_);jj=a(XW,'"True"'),XW.forEach(o),Pj=a(Dv,`, FSDP activation checkpointing is a technique to reduce memory usage by clearing activations of
certain layers and recomputing them during a backward pass. Effectively, this trades extra computation time
for reduced memory usage.`),Dv.forEach(o),go.forEach(o),oT.forEach(o),nt.forEach(o),B1=d(t),uc=s(t,"P",{});var YW=i(uc);G_=s(YW,"STRONG",{});var HW=i(G_);Jj=a(HW,"Few caveats to be aware of"),HW.forEach(o),YW.forEach(o),G1=d(t),fc=s(t,"UL",{});var QW=i(fc);He=s(QW,"LI",{});var hr=i(He);Cj=a(hr,"it is incompatible with "),Z_=s(hr,"CODE",{});var KW=i(Z_);Fj=a(KW,"generate"),KW.forEach(o),Nj=a(hr,", thus is incompatible with "),V_=s(hr,"CODE",{});var eR=i(V_);zj=a(eR,"--predict_with_generate"),eR.forEach(o),Oj=a(hr,`
in all seq2seq/clm scripts (translation/summarization/clm etc.).`),Wj=s(hr,"BR",{}),Rj=a(hr,`
Please refer issue `),ll=s(hr,"A",{href:!0,rel:!0});var tR=i(ll);Lj=a(tR,"#21667"),tR.forEach(o),hr.forEach(o),QW.forEach(o),Z1=d(t),ar=s(t,"H3",{class:!0});var nT=i(ar);Na=s(nT,"A",{id:!0,class:!0,href:!0});var oR=i(Na);X_=s(oR,"SPAN",{});var rR=i(X_);g(dl.$$.fragment,rR),rR.forEach(o),oR.forEach(o),Bj=d(nT),Y_=s(nT,"SPAN",{});var aR=i(Y_);Gj=a(aR,"PyTorch/XLA Fully Sharded Data parallel"),aR.forEach(o),nT.forEach(o),V1=d(t),oo=s(t,"P",{});var Hp=i(oo);Zj=a(Hp,`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 `),cl=s(Hp,"A",{href:!0,rel:!0});var nR=i(cl);Vj=a(nR,"Scaling PyTorch models on Cloud TPUs with FSDP"),nR.forEach(o),Xj=a(Hp," and "),pl=s(Hp,"A",{href:!0,rel:!0});var sR=i(pl);Yj=a(sR,"PyTorch/XLA implementation of FSDP"),sR.forEach(o),Hj=a(Hp,`
All you need to do is enable it through the config.`),Hp.forEach(o),X1=d(t),ml=s(t,"P",{});var q8=i(ml);H_=s(q8,"STRONG",{});var iR=i(H_);Qj=a(iR,"Required PyTorch/XLA version for FSDP support"),iR.forEach(o),Kj=a(q8,": >=2.0"),q8.forEach(o),Y1=d(t),hl=s(t,"P",{});var D8=i(hl);Q_=s(D8,"STRONG",{});var lR=i(Q_);eP=a(lR,"Usage"),lR.forEach(o),tP=a(D8,":"),D8.forEach(o),H1=d(t),ro=s(t,"P",{});var Qp=i(ro);oP=a(Qp,"Pass "),K_=s(Qp,"CODE",{});var dR=i(K_);rP=a(dR,'--fsdp "full shard"'),dR.forEach(o),aP=a(Qp," along with following changes to be made in "),eb=s(Qp,"CODE",{});var cR=i(eb);nP=a(cR,"--fsdp_config <path_to_fsdp_config.json>"),cR.forEach(o),sP=a(Qp,":"),Qp.forEach(o),Q1=d(t),Qe=s(t,"UL",{});var gn=i(Qe);za=s(gn,"LI",{});var Uv=i(za);tb=s(Uv,"CODE",{});var pR=i(tb);iP=a(pR,"xla"),pR.forEach(o),lP=a(Uv," should be set to "),ob=s(Uv,"CODE",{});var mR=i(ob);dP=a(mR,"True"),mR.forEach(o),cP=a(Uv," to enable PyTorch/XLA FSDP."),Uv.forEach(o),pP=d(gn),Oa=s(gn,"LI",{});var jv=i(Oa);rb=s(jv,"CODE",{});var hR=i(rb);mP=a(hR,"xla_fsdp_settings"),hR.forEach(o),hP=a(jv,` The value is a dictionary which stores the XLA FSDP wrapping parameters.
For a complete list of options, please see `),ul=s(jv,"A",{href:!0,rel:!0});var uR=i(ul);uP=a(uR,"here"),uR.forEach(o),fP=a(jv,"."),jv.forEach(o),gP=d(gn),Ke=s(gn,"LI",{});var ur=i(Ke);ab=s(ur,"CODE",{});var fR=i(ab);_P=a(fR,"xla_fsdp_grad_ckpt"),fR.forEach(o),bP=a(ur,". When "),nb=s(ur,"CODE",{});var gR=i(nb);vP=a(gR,"True"),gR.forEach(o),yP=a(ur,`, 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
`),sb=s(ur,"CODE",{});var _R=i(sb);wP=a(_R,"fsdp_min_num_params"),_R.forEach(o),TP=a(ur," or "),ib=s(ur,"CODE",{});var bR=i(ib);EP=a(bR,"fsdp_transformer_layer_cls_to_wrap"),bR.forEach(o),AP=a(ur,"."),ur.forEach(o),$P=d(gn),gc=s(gn,"LI",{});var U8=i(gc);kP=a(U8,"You can either use transformer based auto wrap policy or size based auto wrap policy."),fl=s(U8,"UL",{});var sT=i(fl);_e=s(sT,"LI",{});var it=i(_e);xP=a(it,"For transformer based auto wrap policy, it is recommended to specify "),lb=s(it,"CODE",{});var vR=i(lb);MP=a(vR,"fsdp_transformer_layer_cls_to_wrap"),vR.forEach(o),IP=a(it," in the config file. If not specified, the default value is "),db=s(it,"CODE",{});var yR=i(db);SP=a(yR,"model._no_split_modules"),yR.forEach(o),qP=a(it,` when available.
This specifies the list of transformer layer class name (case-sensitive) to wrap ,e.g, `),cb=s(it,"CODE",{});var wR=i(cb);DP=a(wR,"BertLayer"),wR.forEach(o),UP=a(it,", "),pb=s(it,"CODE",{});var TR=i(pb);jP=a(TR,"GPTJBlock"),TR.forEach(o),PP=a(it,", "),mb=s(it,"CODE",{});var ER=i(mb);JP=a(ER,"T5Block"),ER.forEach(o),CP=a(it,` \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.`),it.forEach(o),FP=d(sT),gl=s(sT,"LI",{});var iT=i(gl);NP=a(iT,"For size based auto wrap policy, please add "),hb=s(iT,"CODE",{});var AR=i(hb);zP=a(AR,"fsdp_min_num_params"),AR.forEach(o),OP=a(iT,` in the config file.
It specifies FSDP\u2019s minimum number of parameters for auto wrapping.`),iT.forEach(o),sT.forEach(o),U8.forEach(o),gn.forEach(o),K1=d(t),nr=s(t,"H3",{class:!0});var lT=i(nr);Wa=s(lT,"A",{id:!0,class:!0,href:!0});var $R=i(Wa);ub=s($R,"SPAN",{});var kR=i(ub);g(_l.$$.fragment,kR),kR.forEach(o),$R.forEach(o),WP=d(lT),fb=s(lT,"SPAN",{});var xR=i(fb);RP=a(xR,"Using Trainer for accelerated PyTorch Training on Mac"),xR.forEach(o),lT.forEach(o),ew=d(t),et=s(t,"P",{});var _n=i(et);LP=a(_n,`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 `),gb=s(_n,"CODE",{});var MR=i(gb);BP=a(MR,'"mps"'),MR.forEach(o),GP=a(_n,` 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 `),bl=s(_n,"A",{href:!0,rel:!0});var IR=i(bl);ZP=a(IR,"Introducing Accelerated PyTorch Training on Mac"),IR.forEach(o),VP=a(_n,`
and `),vl=s(_n,"A",{href:!0,rel:!0});var SR=i(vl);XP=a(SR,"MPS BACKEND"),SR.forEach(o),YP=a(_n,"."),_n.forEach(o),tw=d(t),g(Ra.$$.fragment,t),ow=d(t),_c=s(t,"P",{});var qR=i(_c);_b=s(qR,"STRONG",{});var DR=i(_b);HP=a(DR,"Benefits of Training and Inference using Apple Silicon Chips"),DR.forEach(o),qR.forEach(o),rw=d(t),ao=s(t,"OL",{});var Kp=i(ao);bb=s(Kp,"LI",{});var UR=i(bb);QP=a(UR,"Enables users to train larger networks or batch sizes locally"),UR.forEach(o),KP=d(Kp),vb=s(Kp,"LI",{});var jR=i(vb);e6=a(jR,`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.`),jR.forEach(o),t6=d(Kp),yb=s(Kp,"LI",{});var PR=i(yb);o6=a(PR,"Reduces costs associated with cloud-based development or the need for additional local GPUs."),PR.forEach(o),Kp.forEach(o),aw=d(t),sr=s(t,"P",{});var Pv=i(sr);wb=s(Pv,"STRONG",{});var JR=i(wb);r6=a(JR,"Pre-requisites"),JR.forEach(o),a6=a(Pv,`: To install torch with mps support,
please follow this nice medium article `),yl=s(Pv,"A",{href:!0,rel:!0});var CR=i(yl);n6=a(CR,"GPU-Acceleration Comes to PyTorch on M1 Macs"),CR.forEach(o),s6=a(Pv,"."),Pv.forEach(o),nw=d(t),_t=s(t,"P",{});var Ol=i(_t);Tb=s(Ol,"STRONG",{});var FR=i(Tb);i6=a(FR,"Usage"),FR.forEach(o),l6=a(Ol,`:
`),Eb=s(Ol,"CODE",{});var NR=i(Eb);d6=a(NR,"mps"),NR.forEach(o),c6=a(Ol," device will be used by default if available similar to the way "),Ab=s(Ol,"CODE",{});var zR=i(Ab);p6=a(zR,"cuda"),zR.forEach(o),m6=a(Ol,` 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:`),Ol.forEach(o),sw=d(t),g(wl.$$.fragment,t),iw=d(t),bc=s(t,"P",{});var OR=i(bc);$b=s(OR,"STRONG",{});var WR=i($b);h6=a(WR,"A few caveats to be aware of"),WR.forEach(o),OR.forEach(o),lw=d(t),La=s(t,"OL",{});var dT=i(La);Tl=s(dT,"LI",{});var cT=i(Tl);u6=a(cT,`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 `),kb=s(cT,"CODE",{});var RR=i(kb);f6=a(RR,"PYTORCH_ENABLE_MPS_FALLBACK=1"),RR.forEach(o),g6=a(cT,`,
which will fallback to CPU for these operations. It still throws a UserWarning however.`),cT.forEach(o),_6=d(dT),Ue=s(dT,"LI",{});var _o=i(Ue);b6=a(_o,"Distributed setups "),xb=s(_o,"CODE",{});var LR=i(xb);v6=a(LR,"gloo"),LR.forEach(o),y6=a(_o," and "),Mb=s(_o,"CODE",{});var BR=i(Mb);w6=a(BR,"nccl"),BR.forEach(o),T6=a(_o," are not working with "),Ib=s(_o,"CODE",{});var GR=i(Ib);E6=a(GR,"mps"),GR.forEach(o),A6=a(_o,` device.
This means that currently only single GPU of `),Sb=s(_o,"CODE",{});var ZR=i(Sb);$6=a(ZR,"mps"),ZR.forEach(o),k6=a(_o," device type can be used."),_o.forEach(o),dT.forEach(o),dw=d(t),no=s(t,"P",{});var em=i(no);x6=a(em,"Finally, please, remember that, \u{1F917} "),qb=s(em,"CODE",{});var VR=i(qb);M6=a(VR,"Trainer"),VR.forEach(o),I6=a(em,` only integrates MPS backend, therefore if you
have any problems or questions with regards to MPS backend usage, please,
file an issue with `),El=s(em,"A",{href:!0,rel:!0});var XR=i(El);S6=a(XR,"PyTorch GitHub"),XR.forEach(o),q6=a(em,"."),em.forEach(o),cw=d(t),ir=s(t,"H2",{class:!0});var pT=i(ir);Ba=s(pT,"A",{id:!0,class:!0,href:!0});var YR=i(Ba);Db=s(YR,"SPAN",{});var HR=i(Db);g(Al.$$.fragment,HR),HR.forEach(o),YR.forEach(o),D6=d(pT),Ub=s(pT,"SPAN",{});var QR=i(Ub);U6=a(QR,"Using Accelerate Launcher with Trainer"),QR.forEach(o),pT.forEach(o),pw=d(t),vc=s(t,"P",{});var KR=i(vc);j6=a(KR,"Accelerate now powers Trainer. In terms of what users should expect:"),KR.forEach(o),mw=d(t),Ga=s(t,"UL",{});var mT=i(Ga);jb=s(mT,"LI",{});var eL=i(jb);P6=a(eL,"They can keep using the Trainer ingterations such as FSDP, DeepSpeed vis trainer arguments without any changes on their part."),eL.forEach(o),J6=d(mT),Pb=s(mT,"LI",{});var tL=i(Pb);C6=a(tL,"They can now use Accelerate Launcher with Trainer (recommended)."),tL.forEach(o),mT.forEach(o),hw=d(t),yc=s(t,"P",{});var oL=i(yc);F6=a(oL,"Steps to use Accelerate Launcher with Trainer:"),oL.forEach(o),uw=d(t),so=s(t,"OL",{});var tm=i(so);Jb=s(tm,"LI",{});var rL=i(Jb);io=s(rL,"P",{});var Wl=i(io);N6=a(Wl,"Make sure \u{1F917} Accelerate is installed, you can\u2019t use the "),Cb=s(Wl,"CODE",{});var aL=i(Cb);z6=a(aL,"Trainer"),aL.forEach(o),O6=a(Wl," without it anyway. If not "),Fb=s(Wl,"CODE",{});var nL=i(Fb);W6=a(nL,"pip install accelerate"),nL.forEach(o),R6=a(Wl,". You may also need to update your version of Accelerate: "),Nb=s(Wl,"CODE",{});var sL=i(Nb);L6=a(sL,"pip install accelerate --upgrade"),sL.forEach(o),Wl.forEach(o),rL.forEach(o),B6=d(tm),K=s(tm,"LI",{});var he=i(K);$l=s(he,"P",{});var hT=i($l);G6=a(hT,"Run "),zb=s(hT,"CODE",{});var iL=i(zb);Z6=a(iL,"accelerate config"),iL.forEach(o),V6=a(hT,` and fill the questionnaire. Below are example accelerate configs:
a. DDP Multi-node Multi-GPU config:`),hT.forEach(o),X6=d(he),g(kl.$$.fragment,he),Y6=d(he),Ob=s(he,"P",{});var lL=i(Ob);H6=a(lL,"b. FSDP config:"),lL.forEach(o),Q6=d(he),g(xl.$$.fragment,he),K6=d(he),Wb=s(he,"P",{});var dL=i(Wb);eJ=a(dL,"c. DeepSpeed config pointing to a file:"),dL.forEach(o),tJ=d(he),g(Ml.$$.fragment,he),oJ=d(he),Rb=s(he,"P",{});var cL=i(Rb);rJ=a(cL,"d. DeepSpeed config using accelerate plugin:"),cL.forEach(o),aJ=d(he),g(Il.$$.fragment,he),he.forEach(o),nJ=d(tm),Lb=s(tm,"LI",{});var pL=i(Lb);lr=s(pL,"P",{});var om=i(lr);sJ=a(om,`Run the Trainer script with args other than the ones handled above by accelerate config or launcher args.
Below is an example to run `),Bb=s(om,"CODE",{});var mL=i(Bb);iJ=a(mL,"run_glue.py"),mL.forEach(o),lJ=a(om," using "),Gb=s(om,"CODE",{});var hL=i(Gb);dJ=a(hL,"accelerate launcher"),hL.forEach(o),cJ=a(om," with FSDP config from above."),om.forEach(o),pL.forEach(o),tm.forEach(o),fw=d(t),g(Sl.$$.fragment,t),gw=d(t),ql=s(t,"OL",{start:!0});var uL=i(ql);Dl=s(uL,"LI",{});var uT=i(Dl);pJ=a(uT,"You can also directly use the cmd args for "),Zb=s(uT,"CODE",{});var fL=i(Zb);mJ=a(fL,"accelerate launch"),fL.forEach(o),hJ=a(uT,". Above example would map to:"),uT.forEach(o),uL.forEach(o),_w=d(t),g(Ul.$$.fragment,t),bw=d(t),Za=s(t,"P",{});var fT=i(Za);uJ=a(fT,"For more information, please refer the \u{1F917} Accelerate CLI guide: "),jl=s(fT,"A",{href:!0,rel:!0});var gL=i(jl);fJ=a(gL,"Launching your \u{1F917} Accelerate scripts"),gL.forEach(o),gJ=a(fT,"."),fT.forEach(o),vw=d(t),wc=s(t,"P",{});var _L=i(wc);_J=a(_L,"Sections that were moved:"),_L.forEach(o),yw=d(t),M=s(t,"P",{});var I=i(M);bJ=a(I,"[ "),Tc=s(I,"A",{href:!0});var bL=i(Tc);vJ=a(bL,"DeepSpeed"),bL.forEach(o),Vb=s(I,"A",{id:!0}),i(Vb).forEach(o),yJ=a(I,`
| `),Ec=s(I,"A",{href:!0});var vL=i(Ec);wJ=a(vL,"Installation"),vL.forEach(o),Xb=s(I,"A",{id:!0}),i(Xb).forEach(o),TJ=a(I,`
| `),Ac=s(I,"A",{href:!0});var yL=i(Ac);EJ=a(yL,"Deployment with multiple GPUs"),yL.forEach(o),Yb=s(I,"A",{id:!0}),i(Yb).forEach(o),AJ=a(I,`
| `),$c=s(I,"A",{href:!0});var wL=i($c);$J=a(wL,"Deployment with one GPU"),wL.forEach(o),Hb=s(I,"A",{id:!0}),i(Hb).forEach(o),kJ=a(I,`
| `),kc=s(I,"A",{href:!0});var TL=i(kc);xJ=a(TL,"Deployment in Notebooks"),TL.forEach(o),Qb=s(I,"A",{id:!0}),i(Qb).forEach(o),MJ=a(I,`
| `),xc=s(I,"A",{href:!0});var EL=i(xc);IJ=a(EL,"Configuration"),EL.forEach(o),Kb=s(I,"A",{id:!0}),i(Kb).forEach(o),SJ=a(I,`
| `),Mc=s(I,"A",{href:!0});var AL=i(Mc);qJ=a(AL,"Passing Configuration"),AL.forEach(o),ev=s(I,"A",{id:!0}),i(ev).forEach(o),DJ=a(I,`
| `),Ic=s(I,"A",{href:!0});var $L=i(Ic);UJ=a($L,"Shared Configuration"),$L.forEach(o),tv=s(I,"A",{id:!0}),i(tv).forEach(o),jJ=a(I,`
| `),Sc=s(I,"A",{href:!0});var kL=i(Sc);PJ=a(kL,"ZeRO"),kL.forEach(o),ov=s(I,"A",{id:!0}),i(ov).forEach(o),JJ=a(I,`
| `),qc=s(I,"A",{href:!0});var xL=i(qc);CJ=a(xL,"ZeRO-2 Config"),xL.forEach(o),rv=s(I,"A",{id:!0}),i(rv).forEach(o),FJ=a(I,`
| `),Dc=s(I,"A",{href:!0});var ML=i(Dc);NJ=a(ML,"ZeRO-3 Config"),ML.forEach(o),av=s(I,"A",{id:!0}),i(av).forEach(o),zJ=a(I,`
| `),Uc=s(I,"A",{href:!0});var IL=i(Uc);OJ=a(IL,"NVMe Support"),IL.forEach(o),nv=s(I,"A",{id:!0}),i(nv).forEach(o),WJ=a(I,`
| `),jc=s(I,"A",{href:!0});var SL=i(jc);RJ=a(SL,"ZeRO-2 vs ZeRO-3 Performance"),SL.forEach(o),sv=s(I,"A",{id:!0}),i(sv).forEach(o),LJ=a(I,`
| `),Pc=s(I,"A",{href:!0});var qL=i(Pc);BJ=a(qL,"ZeRO-2 Example"),qL.forEach(o),iv=s(I,"A",{id:!0}),i(iv).forEach(o),GJ=a(I,`
| `),Jc=s(I,"A",{href:!0});var DL=i(Jc);ZJ=a(DL,"ZeRO-3 Example"),DL.forEach(o),lv=s(I,"A",{id:!0}),i(lv).forEach(o),VJ=a(I,`
| `),Cc=s(I,"A",{href:!0});var UL=i(Cc);XJ=a(UL,"Optimizer"),UL.forEach(o),dv=s(I,"A",{id:!0}),i(dv).forEach(o),YJ=a(I,`
| `),Fc=s(I,"A",{href:!0});var jL=i(Fc);HJ=a(jL,"Scheduler"),jL.forEach(o),cv=s(I,"A",{id:!0}),i(cv).forEach(o),QJ=a(I,`
| `),Nc=s(I,"A",{href:!0});var PL=i(Nc);KJ=a(PL,"fp32 Precision"),PL.forEach(o),pv=s(I,"A",{id:!0}),i(pv).forEach(o),e8=a(I,`
| `),zc=s(I,"A",{href:!0});var JL=i(zc);t8=a(JL,"Automatic Mixed Precision"),JL.forEach(o),mv=s(I,"A",{id:!0}),i(mv).forEach(o),o8=a(I,`
| `),Oc=s(I,"A",{href:!0});var CL=i(Oc);r8=a(CL,"Batch Size"),CL.forEach(o),hv=s(I,"A",{id:!0}),i(hv).forEach(o),a8=a(I,`
| `),Wc=s(I,"A",{href:!0});var FL=i(Wc);n8=a(FL,"Gradient Accumulation"),FL.forEach(o),uv=s(I,"A",{id:!0}),i(uv).forEach(o),s8=a(I,`
| `),Rc=s(I,"A",{href:!0});var NL=i(Rc);i8=a(NL,"Gradient Clipping"),NL.forEach(o),fv=s(I,"A",{id:!0}),i(fv).forEach(o),l8=a(I,`
| `),Lc=s(I,"A",{href:!0});var zL=i(Lc);d8=a(zL,"Getting The Model Weights Out"),zL.forEach(o),gv=s(I,"A",{id:!0}),i(gv).forEach(o),c8=a(I,`
]`),I.forEach(o),this.h()},h(){m(u,"name","hf:doc:metadata"),m(u,"content",JSON.stringify(mB)),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.33.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.33.0/en/main_classes/trainer#transformers.Trainer"),m(se,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.TrainingArguments"),m($e,"href","https://github.com/NVIDIA/apex"),m($e,"rel","nofollow"),m(ke,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(ad,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(nd,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(sd,"href","callback"),m(yr,"id","transformers.Trainer"),m(yr,"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(yr,"href","#transformers.Trainer"),m(wo,"class","relative group"),m(id,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel"),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(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(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(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($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(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(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(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(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($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(dd,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel"),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(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(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(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(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(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(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(Dr,"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(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(pd,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(ss,"href","https://github.com/pytorch/pytorch/issues/16266"),m(ss,"rel","nofollow"),m(md,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(hd,"href","/docs/transformers/v4.33.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(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(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(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(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(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(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(Fr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Nr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ud,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer.log_metrics"),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(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(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(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(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(Or,"id","transformers.Seq2SeqTrainer"),m(Or,"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(Or,"href","#transformers.Seq2SeqTrainer"),m(Do,"class","relative group"),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(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(mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Rr,"id","transformers.TrainingArguments"),m(Rr,"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(Rr,"href","#transformers.TrainingArguments"),m(Co,"class","relative group"),m(fd,"href","/docs/transformers/v4.33.0/en/internal/trainer_utils#transformers.HfArgumentParser"),m(Ns,"href","https://docs.python.org/3/library/argparse#module-argparse"),m(Ns,"rel","nofollow"),m(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Lr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(Ot,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(Rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(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(aa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(na,"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(sa,"id","transformers.Seq2SeqTrainingArguments"),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","#transformers.Seq2SeqTrainingArguments"),m(Wo,"class","relative group"),m(gd,"href","/docs/transformers/v4.33.0/en/internal/trainer_utils#transformers.HfArgumentParser"),m(si,"href","https://docs.python.org/3/library/argparse#module-argparse"),m(si,"rel","nofollow"),m(ia,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(la,"id","checkpoints"),m(la,"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(la,"href","#checkpoints"),m(Bo,"class","relative group"),m(_d,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(bd,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.TrainingArguments"),m(vd,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer.train"),m(Td,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.TrainingArguments"),m(ha,"id","logging"),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","#logging"),m(Go,"class","relative group"),m(Ad,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m($d,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Md,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.TrainingArguments"),m(Id,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(Sd,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(ga,"id","randomness"),m(ga,"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(ga,"href","#randomness"),m(Zo,"class","relative group"),m(Jd,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(fi,"href","https://pytorch.org/docs/stable/notes/randomness"),m(fi,"rel","nofollow"),m(_a,"id","specific-gpus-selection"),m(_a,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(_a,"href","#specific-gpus-selection"),m(Vo,"class","relative group"),m(_i,"href","https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html"),m(_i,"rel","nofollow"),m(vi,"href","https://github.com/huggingface/accelerate"),m(vi,"rel","nofollow"),m(yi,"href","https://github.com/microsoft/DeepSpeed"),m(yi,"rel","nofollow"),m(Fd,"href","Deepspeed"),m($i,"href","https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html"),m($i,"rel","nofollow"),m(qi,"start","2"),m(Ea,"id","trainer-integrations"),m(Ea,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ea,"href","#trainer-integrations"),m(Xo,"class","relative group"),m(Hd,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),m(Pi,"href","https://github.com/microsoft/DeepSpeed"),m(Pi,"rel","nofollow"),m(Ji,"href","https://pytorch.org/docs/stable/fsdp.html"),m(Ji,"rel","nofollow"),m(Ci,"href","https://arxiv.org/abs/1910.02054"),m(Ci,"rel","nofollow"),m(Qd,"href","#pytorch-fully-sharded-data-parallel"),m(Kd,"id","zero-install-notes"),m(ka,"id","cuda-extension-installation-notes"),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","#cuda-extension-installation-notes"),m(Yo,"class","relative group"),m(Ni,"href","https://github.com/microsoft/DeepSpeed/issues"),m(Ni,"rel","nofollow"),m(Ma,"id","possible-problem-1"),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-1"),m(Ho,"class","relative group"),m(Ri,"href","https://www.google.com/search?q=ubuntu+cuda+10.2+install"),m(Ri,"rel","nofollow"),m(Sa,"id","possible-problem-2"),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","#possible-problem-2"),m(Qo,"class","relative group"),m(Da,"id","possible-problem-3"),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","#possible-problem-3"),m(Ko,"class","relative group"),m(ja,"id","pytorch-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","#pytorch-fully-sharded-data-parallel"),m(er,"class","relative group"),m(Hi,"href","https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/"),m(Hi,"rel","nofollow"),m(ll,"href","https://github.com/huggingface/transformers/issues/21667"),m(ll,"rel","nofollow"),m(Na,"id","pytorchxla-fully-sharded-data-parallel"),m(Na,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Na,"href","#pytorchxla-fully-sharded-data-parallel"),m(ar,"class","relative group"),m(cl,"href","https://pytorch.org/blog/scaling-pytorch-models-on-cloud-tpus-with-fsdp/"),m(cl,"rel","nofollow"),m(pl,"href","https://github.com/pytorch/xla/tree/master/torch_xla/distributed/fsdp"),m(pl,"rel","nofollow"),m(ul,"href","https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py"),m(ul,"rel","nofollow"),m(Wa,"id","using-trainer-for-accelerated-pytorch-training-on-mac"),m(Wa,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Wa,"href","#using-trainer-for-accelerated-pytorch-training-on-mac"),m(nr,"class","relative group"),m(bl,"href","https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/"),m(bl,"rel","nofollow"),m(vl,"href","https://pytorch.org/docs/stable/notes/mps.html"),m(vl,"rel","nofollow"),m(yl,"href","https://medium.com/towards-data-science/gpu-acceleration-comes-to-pytorch-on-m1-macs-195c399efcc1"),m(yl,"rel","nofollow"),m(El,"href","https://github.com/pytorch/pytorch/issues"),m(El,"rel","nofollow"),m(Ba,"id","using-accelerate-launcher-with-trainer"),m(Ba,"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(Ba,"href","#using-accelerate-launcher-with-trainer"),m(ir,"class","relative group"),m(ql,"start","4"),m(jl,"href","https://huggingface.co/docs/accelerate/basic_tutorials/launch"),m(jl,"rel","nofollow"),m(Tc,"href","./deepspeed#deepspeed-trainer-integration"),m(Vb,"id","deepspeed"),m(Ec,"href","./deepspeed#deepspeed-installation"),m(Xb,"id","installation"),m(Ac,"href","./deepspeed#deepspeed-multi-gpu"),m(Yb,"id","deployment-with-multiple-gpus"),m($c,"href","./deepspeed#deepspeed-one-gpu"),m(Hb,"id","deployment-with-one-gpu"),m(kc,"href","./deepspeed#deepspeed-notebook"),m(Qb,"id","deployment-in-notebooks"),m(xc,"href","./deepspeed#deepspeed-config"),m(Kb,"id","configuration"),m(Mc,"href","./deepspeed#deepspeed-config-passing"),m(ev,"id","passing-configuration"),m(Ic,"href","./deepspeed#deepspeed-config-shared"),m(tv,"id","shared-configuration"),m(Sc,"href","./deepspeed#deepspeed-zero"),m(ov,"id","zero"),m(qc,"href","./deepspeed#deepspeed-zero2-config"),m(rv,"id","zero-2-config"),m(Dc,"href","./deepspeed#deepspeed-zero3-config"),m(av,"id","zero-3-config"),m(Uc,"href","./deepspeed#deepspeed-nvme"),m(nv,"id","nvme-support"),m(jc,"href","./deepspeed#deepspeed-zero2-zero3-performance"),m(sv,"id","zero-2-vs-zero-3-performance"),m(Pc,"href","./deepspeed#deepspeed-zero2-example"),m(iv,"id","zero-2-example"),m(Jc,"href","./deepspeed#deepspeed-zero3-example"),m(lv,"id","zero-3-example"),m(Cc,"href","./deepspeed#deepspeed-optimizer"),m(dv,"id","optimizer"),m(Fc,"href","./deepspeed#deepspeed-scheduler"),m(cv,"id","scheduler"),m(Nc,"href","./deepspeed#deepspeed-fp32"),m(pv,"id","fp32-precision"),m(zc,"href","./deepspeed#deepspeed-amp"),m(mv,"id","automatic-mixed-precision"),m(Oc,"href","./deepspeed#deepspeed-bs"),m(hv,"id","batch-size"),m(Wc,"href","./deepspeed#deepspeed-grad-acc"),m(uv,"id","gradient-accumulation"),m(Rc,"href","./deepspeed#deepspeed-grad-clip"),m(fv,"id","gradient-clipping"),m(Lc,"href","./deepspeed#deepspeed-weight-extraction"),m(gv,"id","getting-the-model-weights-out")},m(t,c){e(document.head,u),p(t,$,c),p(t,T,c),e(T,w),e(w,k),_(h,k,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,O,c),e(O,ne),e(O,F),e(F,Ee),e(O,Ae),e(O,se),e(se,bt),e(O,vt),p(t,be,c),p(t,Pe,c),e(Pe,bn),e(Pe,$e),e($e,vn),e(Pe,yn),p(t,ie,c),p(t,re,c),e(re,Rl),e(re,ke),e(ke,gr),e(re,Ll),p(t,yo,c),p(t,W,c),e(W,ae),e(ae,_r),e(_r,Bl),e(ae,Gl),e(W,Zl),e(W,Vl),e(Vl,rm),e(rm,gT),e(Vl,_T),e(W,bT),e(W,Xl),e(Xl,am),e(am,vT),e(Xl,yT),e(W,wT),e(W,Yl),e(Yl,nm),e(nm,TT),e(Yl,ET),e(W,AT),e(W,yt),e(yt,sm),e(sm,$T),e(yt,kT),e(yt,im),e(im,xT),e(yt,MT),e(yt,lm),e(lm,IT),e(yt,ST),e(W,qT),e(W,Hl),e(Hl,dm),e(dm,DT),e(Hl,UT),e(W,jT),e(W,Ql),e(Ql,cm),e(cm,PT),e(Ql,JT),e(W,CT),e(W,Kl),e(Kl,pm),e(pm,FT),e(Kl,NT),e(W,zT),e(W,ed),e(ed,mm),e(mm,OT),e(ed,WT),e(W,RT),e(W,td),e(td,hm),e(hm,LT),e(td,BT),e(W,GT),e(W,od),e(od,um),e(um,ZT),e(od,VT),e(W,XT),e(W,rd),e(rd,fm),e(fm,YT),e(rd,HT),p(t,Jv,c),_(br,t,c),p(t,Cv,c),p(t,vr,c),e(vr,QT),e(vr,ad),e(ad,KT),e(vr,e0),p(t,Fv,c),_(wn,t,c),p(t,Nv,c),p(t,wt,c),e(wt,t0),e(wt,nd),e(nd,o0),e(wt,r0),e(wt,sd),e(sd,a0),e(wt,n0),p(t,zv,c),p(t,wo,c),e(wo,yr),e(yr,gm),_(Tn,gm,null),e(wo,s0),e(wo,_m),e(_m,i0),p(t,Ov,c),p(t,A,c),_(En,A,null),e(A,l0),e(A,bm),e(bm,d0),e(A,c0),e(A,vm),e(vm,p0),e(A,m0),e(A,xe),e(xe,wr),e(wr,ym),e(ym,h0),e(wr,u0),e(wr,id),e(id,f0),e(wr,g0),e(xe,_0),e(xe,le),e(le,wm),e(wm,b0),e(le,v0),e(le,Tm),e(Tm,y0),e(le,w0),e(le,Em),e(Em,T0),e(le,E0),e(le,Am),e(Am,A0),e(le,$0),e(le,$m),e($m,k0),e(le,x0),e(le,km),e(km,M0),e(le,I0),e(xe,S0),e(xe,ld),e(ld,xm),e(xm,q0),e(ld,D0),e(xe,U0),e(xe,Je),e(Je,Mm),e(Mm,j0),e(Je,P0),e(Je,Im),e(Im,J0),e(Je,C0),e(Je,Sm),e(Sm,F0),e(Je,N0),e(Je,qm),e(qm,z0),e(Je,O0),e(xe,W0),e(xe,Ce),e(Ce,Dm),e(Dm,R0),e(Ce,L0),e(Ce,Um),e(Um,B0),e(Ce,G0),e(Ce,jm),e(jm,Z0),e(Ce,V0),e(Ce,Pm),e(Pm,X0),e(Ce,Y0),e(A,H0),e(A,Tr),_(An,Tr,null),e(Tr,Q0),e(Tr,$n),e($n,K0),e($n,Jm),e(Jm,eE),e($n,tE),e(A,oE),e(A,Er),_(kn,Er,null),e(Er,rE),e(Er,xn),e(xn,aE),e(xn,Cm),e(Cm,nE),e(xn,sE),e(A,iE),e(A,Tt),_(Mn,Tt,null),e(Tt,lE),e(Tt,Fm),e(Fm,dE),e(Tt,cE),e(Tt,Nm),e(Nm,pE),e(A,mE),e(A,Ar),_(In,Ar,null),e(Ar,hE),e(Ar,zm),e(zm,uE),e(A,fE),e(A,$r),_(Sn,$r,null),e($r,gE),e($r,qn),e(qn,_E),e(qn,Om),e(Om,bE),e(qn,vE),e(A,yE),e(A,Et),_(Dn,Et,null),e(Et,wE),e(Et,Wm),e(Wm,TE),e(Et,EE),e(Et,Un),e(Un,AE),e(Un,Rm),e(Rm,$E),e(Un,kE),e(A,xE),e(A,At),_(jn,At,null),e(At,ME),e(At,Lm),e(Lm,IE),e(At,SE),e(At,lt),e(lt,qE),e(lt,Bm),e(Bm,DE),e(lt,UE),e(lt,Gm),e(Gm,jE),e(lt,PE),e(lt,Zm),e(Zm,JE),e(lt,CE),e(A,FE),e(A,kr),_(Pn,kr,null),e(kr,NE),e(kr,Vm),e(Vm,zE),e(A,OE),e(A,Fe),_(Jn,Fe,null),e(Fe,WE),e(Fe,Xm),e(Xm,RE),e(Fe,LE),e(Fe,Cn),e(Cn,BE),e(Cn,Ym),e(Ym,GE),e(Cn,ZE),e(Fe,VE),e(Fe,Hm),e(Hm,XE),e(A,YE),e(A,$t),_(Fn,$t,null),e($t,HE),e($t,To),e(To,QE),e(To,Qm),e(Qm,KE),e(To,e3),e(To,Km),e(Km,t3),e(To,o3),e($t,r3),e($t,eh),e(eh,a3),e(A,n3),e(A,xr),_(Nn,xr,null),e(xr,s3),e(xr,zn),e(zn,i3),e(zn,dd),e(dd,l3),e(zn,d3),e(A,c3),e(A,kt),_(On,kt,null),e(kt,p3),e(kt,Wn),e(Wn,m3),e(Wn,th),e(th,h3),e(Wn,u3),e(kt,f3),e(kt,oh),e(oh,g3),e(A,_3),e(A,Mr),_(Rn,Mr,null),e(Mr,b3),e(Mr,rh),e(rh,v3),e(A,y3),e(A,xt),_(Ln,xt,null),e(xt,w3),e(xt,Bn),e(Bn,T3),e(Bn,ah),e(ah,E3),e(Bn,A3),e(xt,$3),e(xt,nh),e(nh,k3),e(A,x3),e(A,Ne),_(Gn,Ne,null),e(Ne,M3),e(Ne,Zn),e(Zn,I3),e(Zn,sh),e(sh,S3),e(Zn,q3),e(Ne,D3),e(Ne,Eo),e(Eo,U3),e(Eo,ih),e(ih,j3),e(Eo,P3),e(Eo,lh),e(lh,J3),e(Eo,C3),e(Ne,F3),e(Ne,dh),e(dh,N3),e(A,z3),e(A,Mt),_(Vn,Mt,null),e(Mt,O3),e(Mt,Me),e(Me,W3),e(Me,ch),e(ch,R3),e(Me,L3),e(Me,ph),e(ph,B3),e(Me,G3),e(Me,mh),e(mh,Z3),e(Me,V3),e(Me,hh),e(hh,X3),e(Me,Y3),e(Mt,H3),_(Ir,Mt,null),e(A,Q3),e(A,It),_(Xn,It,null),e(It,K3),e(It,Yn),e(Yn,e4),e(Yn,uh),e(uh,t4),e(Yn,o4),e(It,r4),_(Sr,It,null),e(A,a4),e(A,qr),_(Hn,qr,null),e(qr,n4),e(qr,Qn),e(Qn,s4),e(Qn,fh),e(fh,i4),e(Qn,l4),e(A,d4),e(A,Dr),_(Kn,Dr,null),e(Dr,c4),e(Dr,gh),e(gh,p4),e(A,m4),e(A,Ur),_(es,Ur,null),e(Ur,h4),e(Ur,ts),e(ts,u4),e(ts,_h),e(_h,f4),e(ts,g4),e(A,_4),e(A,St),_(os,St,null),e(St,b4),e(St,rs),e(rs,v4),e(rs,bh),e(bh,y4),e(rs,w4),e(St,T4),e(St,vh),e(vh,E4),e(A,A4),e(A,P),_(as,P,null),e(P,$4),e(P,yh),e(yh,k4),e(P,x4),e(P,wh),e(wh,M4),e(P,I4),e(P,Th),e(Th,S4),e(P,q4),e(P,Ao),e(Ao,D4),e(Ao,Eh),e(Eh,U4),e(Ao,j4),e(Ao,Ah),e(Ah,P4),e(Ao,J4),e(P,C4),_(jr,P,null),e(P,F4),e(P,$h),e($h,kh),e(kh,N4),e(P,z4),e(P,dt),e(dt,Ie),e(Ie,O4),e(Ie,xh),e(xh,W4),e(Ie,R4),e(Ie,Mh),e(Mh,L4),e(Ie,B4),e(Ie,Ih),e(Ih,G4),e(Ie,Z4),e(Ie,Sh),e(Sh,V4),e(Ie,X4),e(dt,Y4),e(dt,$o),e($o,H4),e($o,qh),e(qh,Q4),e($o,K4),e($o,Dh),e(Dh,eA),e($o,tA),e(dt,oA),e(dt,cd),e(cd,Uh),e(Uh,rA),e(cd,aA),e(dt,nA),e(dt,qt),e(qt,jh),e(jh,sA),e(qt,iA),e(qt,Ph),e(Ph,lA),e(qt,dA),e(qt,Jh),e(Jh,cA),e(qt,pA),e(P,mA),e(P,Ch),e(Ch,hA),e(P,uA),e(P,Fh),e(Fh,fA),e(P,gA),e(P,ns),e(ns,_A),e(ns,Nh),e(Nh,bA),e(ns,vA),e(P,yA),e(P,ct),e(ct,wA),e(ct,zh),e(zh,TA),e(ct,EA),e(ct,Oh),e(Oh,AA),e(ct,$A),e(ct,Wh),e(Wh,kA),e(ct,xA),e(P,MA),e(P,fe),e(fe,IA),e(fe,pd),e(pd,SA),e(fe,qA),e(fe,Rh),e(Rh,DA),e(fe,UA),e(fe,Lh),e(Lh,jA),e(fe,PA),e(fe,Bh),e(Bh,JA),e(fe,CA),e(fe,Gh),e(Gh,FA),e(fe,NA),e(P,zA),e(P,Z),e(Z,OA),e(Z,Zh),e(Zh,WA),e(Z,RA),e(Z,Vh),e(Vh,LA),e(Z,BA),e(Z,Xh),e(Xh,GA),e(Z,ZA),e(Z,Yh),e(Yh,VA),e(Z,XA),e(Z,ss),e(ss,YA),e(Z,HA),e(Z,Hh),e(Hh,QA),e(Z,KA),e(Z,Qh),e(Qh,e$),e(Z,t$),e(Z,Kh),e(Kh,o$),e(Z,r$),e(Z,eu),e(eu,a$),e(Z,n$),e(Z,tu),e(tu,s$),e(Z,i$),e(P,l$),e(P,Se),e(Se,d$),e(Se,md),e(md,c$),e(Se,p$),e(Se,ou),e(ou,m$),e(Se,h$),e(Se,hd),e(hd,u$),e(Se,f$),e(Se,ru),e(ru,g$),e(Se,_$),e(P,b$),e(P,au),e(au,v$),e(A,y$),e(A,Pr),_(is,Pr,null),e(Pr,w$),e(Pr,nu),e(nu,T$),e(A,E$),e(A,Jr),_(ls,Jr,null),e(Jr,A$),e(Jr,ds),e(ds,$$),e(ds,su),e(su,k$),e(ds,x$),e(A,M$),e(A,Dt),_(cs,Dt,null),e(Dt,I$),e(Dt,ps),e(ps,S$),e(ps,iu),e(iu,q$),e(ps,D$),e(Dt,U$),e(Dt,ms),e(ms,j$),e(ms,lu),e(lu,P$),e(ms,J$),e(A,C$),e(A,de),_(hs,de,null),e(de,F$),e(de,du),e(du,N$),e(de,z$),e(de,us),e(us,O$),e(us,cu),e(cu,W$),e(us,R$),e(de,L$),_(Cr,de,null),e(de,B$),e(de,fs),e(fs,G$),e(fs,pu),e(pu,Z$),e(fs,V$),e(de,X$),e(de,ko),e(ko,xo),e(xo,Y$),e(xo,mu),e(mu,H$),e(xo,Q$),e(xo,hu),e(hu,K$),e(xo,ek),e(ko,tk),e(ko,Mo),e(Mo,ok),e(Mo,uu),e(uu,rk),e(Mo,ak),e(Mo,fu),e(fu,nk),e(Mo,sk),e(ko,ik),e(ko,Io),e(Io,lk),e(Io,gu),e(gu,dk),e(Io,ck),e(Io,_u),e(_u,pk),e(Io,mk),e(A,hk),e(A,Ut),_(gs,Ut,null),e(Ut,uk),e(Ut,So),e(So,fk),e(So,bu),e(bu,gk),e(So,_k),e(So,vu),e(vu,bk),e(So,vk),e(Ut,yk),e(Ut,yu),e(yu,wk),e(A,Tk),e(A,jt),_(_s,jt,null),e(jt,Ek),e(jt,qo),e(qo,Ak),e(qo,wu),e(wu,$k),e(qo,kk),e(qo,Tu),e(Tu,xk),e(qo,Mk),e(jt,Ik),e(jt,Eu),e(Eu,Sk),e(A,qk),e(A,Fr),_(bs,Fr,null),e(Fr,Dk),e(Fr,pt),e(pt,Uk),e(pt,Au),e(Au,jk),e(pt,Pk),e(pt,$u),e($u,Jk),e(pt,Ck),e(pt,ku),e(ku,Fk),e(pt,Nk),e(A,zk),e(A,Nr),_(vs,Nr,null),e(Nr,Ok),e(Nr,ys),e(ys,Wk),e(ys,xu),e(xu,Rk),e(ys,Lk),e(A,Bk),e(A,ze),_(ws,ze,null),e(ze,Gk),e(ze,Ts),e(Ts,Zk),e(Ts,Mu),e(Mu,Vk),e(Ts,Xk),e(ze,Yk),e(ze,Iu),e(Iu,Hk),e(ze,Qk),e(ze,Es),e(Es,Kk),e(Es,ud),e(ud,ex),e(Es,tx),e(A,ox),e(A,Pt),_(As,Pt,null),e(Pt,rx),e(Pt,$s),e($s,ax),e($s,Su),e(Su,nx),e($s,sx),e(Pt,ix),e(Pt,qu),e(qu,lx),e(A,dx),e(A,Jt),_(ks,Jt,null),e(Jt,cx),e(Jt,Du),e(Du,px),e(Jt,mx),e(Jt,Uu),e(Uu,hx),e(A,ux),e(A,zr),_(xs,zr,null),e(zr,fx),e(zr,ju),e(ju,gx),e(A,_x),e(A,Ct),_(Ms,Ct,null),e(Ct,bx),e(Ct,Pu),e(Pu,vx),e(Ct,yx),e(Ct,Ju),e(Ju,wx),p(t,Wv,c),p(t,Do,c),e(Do,Or),e(Or,Cu),_(Is,Cu,null),e(Do,Tx),e(Do,Fu),e(Fu,Ex),p(t,Rv,c),p(t,mt,c),_(Ss,mt,null),e(mt,Ax),e(mt,Oe),_(qs,Oe,null),e(Oe,$x),e(Oe,Nu),e(Nu,kx),e(Oe,xx),e(Oe,Ds),e(Ds,Mx),e(Ds,zu),e(zu,Ix),e(Ds,Sx),e(Oe,qx),e(Oe,Ou),e(Ou,Dx),e(mt,Ux),e(mt,ce),_(Us,ce,null),e(ce,jx),e(ce,Wu),e(Wu,Px),e(ce,Jx),e(ce,js),e(js,Cx),e(js,Ru),e(Ru,Fx),e(js,Nx),e(ce,zx),_(Wr,ce,null),e(ce,Ox),e(ce,Ps),e(Ps,Wx),e(Ps,Lu),e(Lu,Rx),e(Ps,Lx),e(ce,Bx),e(ce,Uo),e(Uo,jo),e(jo,Gx),e(jo,Bu),e(Bu,Zx),e(jo,Vx),e(jo,Gu),e(Gu,Xx),e(jo,Yx),e(Uo,Hx),e(Uo,Po),e(Po,Qx),e(Po,Zu),e(Zu,Kx),e(Po,eM),e(Po,Vu),e(Vu,tM),e(Po,oM),e(Uo,rM),e(Uo,Jo),e(Jo,aM),e(Jo,Xu),e(Xu,nM),e(Jo,sM),e(Jo,Yu),e(Yu,iM),e(Jo,lM),p(t,Lv,c),p(t,Co,c),e(Co,Rr),e(Rr,Hu),_(Js,Hu,null),e(Co,dM),e(Co,Qu),e(Qu,cM),p(t,Bv,c),p(t,q,c),_(Cs,q,null),e(q,pM),e(q,Fs),e(Fs,mM),e(Fs,Ku),e(Ku,hM),e(Fs,uM),e(q,fM),e(q,Fo),e(Fo,gM),e(Fo,fd),e(fd,_M),e(Fo,bM),e(Fo,Ns),e(Ns,vM),e(Fo,yM),e(q,wM),e(q,ve),_(zs,ve,null),e(ve,TM),e(ve,ef),e(ef,EM),e(ve,AM),e(ve,No),e(No,$M),e(No,tf),e(tf,kM),e(No,xM),e(No,of),e(of,MM),e(No,IM),e(ve,SM),e(ve,zo),e(zo,qM),e(zo,rf),e(rf,DM),e(zo,UM),e(zo,af),e(af,jM),e(zo,PM),e(ve,JM),e(ve,Os),e(Os,CM),e(Os,nf),e(nf,FM),e(Os,NM),e(q,zM),e(q,Lr),_(Ws,Lr,null),e(Lr,OM),e(Lr,sf),e(sf,WM),e(q,RM),e(q,Ft),_(Rs,Ft,null),e(Ft,LM),e(Ft,lf),e(lf,BM),e(Ft,GM),e(Ft,Oo),e(Oo,ZM),e(Oo,df),e(df,VM),e(Oo,XM),e(Oo,cf),e(cf,YM),e(Oo,HM),e(q,QM),e(q,Nt),_(Ls,Nt,null),e(Nt,KM),e(Nt,pf),e(pf,e5),e(Nt,t5),_(Br,Nt,null),e(q,o5),e(q,zt),_(Bs,zt,null),e(zt,r5),e(zt,mf),e(mf,a5),e(zt,n5),_(Gr,zt,null),e(q,s5),e(q,Ot),_(Gs,Ot,null),e(Ot,i5),e(Ot,hf),e(hf,l5),e(Ot,d5),_(Zr,Ot,null),e(q,c5),e(q,Wt),_(Zs,Wt,null),e(Wt,p5),e(Wt,uf),e(uf,m5),e(Wt,h5),_(Vr,Wt,null),e(q,u5),e(q,Rt),_(Vs,Rt,null),e(Rt,f5),e(Rt,ff),e(ff,g5),e(Rt,_5),_(Xr,Rt,null),e(q,b5),e(q,We),_(Xs,We,null),e(We,v5),e(We,gf),e(gf,y5),e(We,w5),_(Yr,We,null),e(We,T5),_(Hr,We,null),e(q,E5),e(q,Lt),_(Ys,Lt,null),e(Lt,A5),e(Lt,_f),e(_f,$5),e(Lt,k5),_(Qr,Lt,null),e(q,x5),e(q,Re),_(Hs,Re,null),e(Re,M5),e(Re,bf),e(bf,I5),e(Re,S5),_(Kr,Re,null),e(Re,q5),_(ea,Re,null),e(q,D5),e(q,Le),_(Qs,Le,null),e(Le,U5),e(Le,vf),e(vf,j5),e(Le,P5),_(ta,Le,null),e(Le,J5),_(oa,Le,null),e(q,C5),e(q,ra),_(Ks,ra,null),e(ra,F5),e(ra,ei),e(ei,N5),e(ei,yf),e(yf,z5),e(ei,O5),e(q,W5),e(q,aa),_(ti,aa,null),e(aa,R5),e(aa,wf),e(wf,L5),e(q,B5),e(q,na),_(oi,na,null),e(na,G5),e(na,Tf),e(Tf,Z5),p(t,Gv,c),p(t,Wo,c),e(Wo,sa),e(sa,Ef),_(ri,Ef,null),e(Wo,V5),e(Wo,Af),e(Af,X5),p(t,Zv,c),p(t,qe,c),_(ai,qe,null),e(qe,Y5),e(qe,ni),e(ni,H5),e(ni,$f),e($f,Q5),e(ni,K5),e(qe,e9),e(qe,Ro),e(Ro,t9),e(Ro,gd),e(gd,o9),e(Ro,r9),e(Ro,si),e(si,a9),e(Ro,n9),e(qe,s9),e(qe,ia),_(ii,ia,null),e(ia,i9),e(ia,Lo),e(Lo,l9),e(Lo,kf),e(kf,d9),e(Lo,c9),e(Lo,xf),e(xf,p9),e(Lo,m9),p(t,Vv,c),p(t,Bo,c),e(Bo,la),e(la,Mf),_(li,Mf,null),e(Bo,h9),e(Bo,If),e(If,u9),p(t,Xv,c),p(t,ye,c),e(ye,f9),e(ye,_d),e(_d,g9),e(ye,_9),e(ye,Sf),e(Sf,b9),e(ye,v9),e(ye,bd),e(bd,y9),e(ye,w9),e(ye,qf),e(qf,T9),e(ye,E9),p(t,Yv,c),p(t,da,c),e(da,A9),e(da,vd),e(vd,$9),e(da,k9),p(t,Hv,c),p(t,ca,c),e(ca,yd),e(yd,Df),e(Df,x9),e(yd,M9),e(ca,I9),e(ca,wd),e(wd,Uf),e(Uf,S9),e(wd,q9),p(t,Qv,c),p(t,Be,c),e(Be,D9),e(Be,jf),e(jf,U9),e(Be,j9),e(Be,Pf),e(Pf,P9),e(Be,J9),e(Be,Td),e(Td,C9),e(Be,F9),p(t,Kv,c),p(t,pa,c),e(pa,ma),e(ma,Jf),e(Jf,N9),e(ma,z9),e(ma,Cf),e(Cf,O9),e(ma,W9),e(pa,R9),e(pa,Ed),e(Ed,Ff),e(Ff,L9),e(Ed,B9),p(t,ey,c),p(t,Go,c),e(Go,ha),e(ha,Nf),_(di,Nf,null),e(Go,G9),e(Go,zf),e(zf,Z9),p(t,ty,c),p(t,Ge,c),e(Ge,V9),e(Ge,Ad),e(Ad,X9),e(Ge,Y9),e(Ge,Of),e(Of,H9),e(Ge,Q9),e(Ge,Wf),e(Wf,K9),e(Ge,eI),p(t,oy,c),p(t,Bt,c),e(Bt,tI),e(Bt,Rf),e(Rf,oI),e(Bt,rI),e(Bt,$d),e($d,aI),e(Bt,nI),p(t,ry,c),p(t,ua,c),e(ua,kd),e(kd,Lf),e(Lf,sI),e(kd,iI),e(ua,lI),e(ua,xd),e(xd,Bf),e(Bf,dI),e(xd,cI),p(t,ay,c),p(t,Ze,c),e(Ze,pI),e(Ze,Md),e(Md,mI),e(Ze,hI),e(Ze,Gf),e(Gf,uI),e(Ze,fI),e(Ze,Zf),e(Zf,gI),e(Ze,_I),p(t,ny,c),p(t,pe,c),e(pe,bI),e(pe,Id),e(Id,vI),e(pe,yI),e(pe,Vf),e(Vf,wI),e(pe,TI),e(pe,Xf),e(Xf,EI),e(pe,AI),e(pe,Yf),e(Yf,$I),e(pe,kI),e(pe,Sd),e(Sd,xI),e(pe,MI),p(t,sy,c),p(t,qd,c),e(qd,II),p(t,iy,c),_(ci,t,c),p(t,ly,c),p(t,Dd,c),e(Dd,SI),p(t,dy,c),_(pi,t,c),p(t,cy,c),p(t,Ud,c),e(Ud,qI),p(t,py,c),_(mi,t,c),p(t,my,c),p(t,jd,c),e(jd,DI),p(t,hy,c),p(t,Pd,c),e(Pd,UI),p(t,uy,c),_(hi,t,c),p(t,fy,c),p(t,fa,c),e(fa,jI),e(fa,Hf),e(Hf,PI),e(fa,JI),p(t,gy,c),p(t,Zo,c),e(Zo,ga),e(ga,Qf),_(ui,Qf,null),e(Zo,CI),e(Zo,Kf),e(Kf,FI),p(t,_y,c),p(t,we,c),e(we,NI),e(we,Jd),e(Jd,zI),e(we,OI),e(we,eg),e(eg,WI),e(we,RI),e(we,tg),e(tg,LI),e(we,BI),e(we,og),e(og,GI),e(we,ZI),p(t,by,c),p(t,Gt,c),e(Gt,VI),e(Gt,fi),e(fi,XI),e(Gt,YI),e(Gt,rg),e(rg,HI),e(Gt,QI),p(t,vy,c),p(t,Vo,c),e(Vo,_a),e(_a,ag),_(gi,ag,null),e(Vo,KI),e(Vo,ng),e(ng,eS),p(t,yy,c),p(t,Cd,c),e(Cd,tS),p(t,wy,c),p(t,ba,c),e(ba,oS),e(ba,_i),e(_i,sg),e(sg,rS),e(ba,aS),p(t,Ty,c),_(bi,t,c),p(t,Ey,c),p(t,Zt,c),e(Zt,nS),e(Zt,vi),e(vi,ig),e(ig,sS),e(Zt,iS),e(Zt,yi),e(yi,lg),e(lg,lS),e(Zt,dS),p(t,Ay,c),_(wi,t,c),p(t,$y,c),_(Ti,t,c),p(t,ky,c),p(t,va,c),e(va,cS),e(va,Fd),e(Fd,pS),e(va,mS),p(t,xy,c),p(t,Nd,c),e(Nd,hS),p(t,My,c),p(t,zd,c),e(zd,uS),p(t,Iy,c),p(t,Od,c),e(Od,dg),e(dg,cg),e(cg,fS),p(t,Sy,c),p(t,ya,c),e(ya,gS),e(ya,pg),e(pg,_S),e(ya,bS),p(t,qy,c),p(t,Wd,c),e(Wd,vS),p(t,Dy,c),_(Ei,t,c),p(t,Uy,c),p(t,Vt,c),e(Vt,yS),e(Vt,mg),e(mg,wS),e(Vt,TS),e(Vt,hg),e(hg,ES),e(Vt,AS),p(t,jy,c),p(t,Rd,c),e(Rd,$S),p(t,Py,c),_(Ai,t,c),p(t,Jy,c),p(t,Xt,c),e(Xt,kS),e(Xt,ug),e(ug,xS),e(Xt,MS),e(Xt,fg),e(fg,IS),e(Xt,SS),p(t,Cy,c),p(t,Yt,c),e(Yt,qS),e(Yt,gg),e(gg,DS),e(Yt,US),e(Yt,$i),e($i,_g),e(_g,jS),e(Yt,PS),p(t,Fy,c),_(ki,t,c),p(t,Ny,c),p(t,Ld,c),e(Ld,JS),p(t,zy,c),_(xi,t,c),p(t,Oy,c),p(t,Bd,c),e(Bd,CS),p(t,Wy,c),_(Mi,t,c),p(t,Ry,c),p(t,Gd,c),e(Gd,FS),p(t,Ly,c),p(t,Zd,c),e(Zd,bg),e(bg,vg),e(vg,NS),p(t,By,c),p(t,wa,c),e(wa,zS),e(wa,yg),e(yg,OS),e(wa,WS),p(t,Gy,c),p(t,Vd,c),e(Vd,Ii),e(Ii,RS),e(Ii,wg),e(wg,LS),e(Ii,BS),p(t,Zy,c),_(Si,t,c),p(t,Vy,c),p(t,qi,c),e(qi,Tg),e(Tg,GS),p(t,Xy,c),_(Di,t,c),p(t,Yy,c),p(t,Ht,c),e(Ht,ZS),e(Ht,Eg),e(Eg,VS),e(Ht,XS),e(Ht,Ag),e(Ag,YS),e(Ht,HS),p(t,Hy,c),p(t,Xd,c),e(Xd,QS),p(t,Qy,c),_(Ui,t,c),p(t,Ky,c),p(t,Yd,c),e(Yd,KS),p(t,e1,c),p(t,Ta,c),e(Ta,eq),e(Ta,$g),e($g,tq),e(Ta,oq),p(t,t1,c),p(t,Xo,c),e(Xo,Ea),e(Ea,kg),_(ji,kg,null),e(Xo,rq),e(Xo,xg),e(xg,aq),p(t,o1,c),p(t,Aa,c),e(Aa,nq),e(Aa,Hd),e(Hd,sq),e(Aa,iq),p(t,r1,c),p(t,Ve,c),e(Ve,lq),e(Ve,Pi),e(Pi,dq),e(Ve,cq),e(Ve,Ji),e(Ji,pq),e(Ve,mq),e(Ve,Ci),e(Ci,hq),e(Ve,uq),p(t,a1,c),p(t,$a,c),e($a,fq),e($a,Qd),e(Qd,gq),e($a,_q),p(t,n1,c),p(t,Kd,c),p(t,s1,c),p(t,Yo,c),e(Yo,ka),e(ka,Mg),_(Fi,Mg,null),e(Yo,bq),e(Yo,Ig),e(Ig,vq),p(t,i1,c),p(t,ec,c),e(ec,yq),p(t,l1,c),p(t,xa,c),e(xa,wq),e(xa,Ni),e(Ni,Tq),e(xa,Eq),p(t,d1,c),p(t,tc,c),e(tc,Aq),p(t,c1,c),_(zi,t,c),p(t,p1,c),p(t,oc,c),e(oc,$q),p(t,m1,c),p(t,Qt,c),e(Qt,kq),e(Qt,Sg),e(Sg,xq),e(Qt,Mq),e(Qt,qg),e(qg,Iq),e(Qt,Sq),p(t,h1,c),p(t,Ho,c),e(Ho,Ma),e(Ma,Dg),_(Oi,Dg,null),e(Ho,qq),e(Ho,Ug),e(Ug,Dq),p(t,u1,c),p(t,rc,c),e(rc,Uq),p(t,f1,c),p(t,Xe,c),e(Xe,jq),e(Xe,jg),e(jg,Pq),e(Xe,Jq),e(Xe,Pg),e(Pg,Cq),e(Xe,Fq),e(Xe,Jg),e(Jg,Nq),e(Xe,zq),p(t,g1,c),p(t,Kt,c),e(Kt,Oq),e(Kt,Cg),e(Cg,Wq),e(Kt,Rq),e(Kt,Fg),e(Fg,Lq),e(Kt,Bq),p(t,_1,c),_(Wi,t,c),p(t,b1,c),p(t,Ia,c),e(Ia,Gq),e(Ia,Ri),e(Ri,Zq),e(Ia,Vq),p(t,v1,c),p(t,Qo,c),e(Qo,Sa),e(Sa,Ng),_(Li,Ng,null),e(Qo,Xq),e(Qo,zg),e(zg,Yq),p(t,y1,c),p(t,ac,c),e(ac,Hq),p(t,w1,c),_(Bi,t,c),p(t,T1,c),p(t,eo,c),e(eo,Qq),e(eo,Og),e(Og,Kq),e(eo,eD),e(eo,Wg),e(Wg,tD),e(eo,oD),p(t,E1,c),p(t,nc,c),e(nc,rD),p(t,A1,c),_(Gi,t,c),p(t,$1,c),p(t,sc,c),e(sc,aD),p(t,k1,c),p(t,qa,c),e(qa,nD),e(qa,Rg),e(Rg,sD),e(qa,iD),p(t,x1,c),p(t,ht,c),e(ht,Lg),e(Lg,lD),e(ht,dD),e(ht,Bg),e(Bg,cD),e(ht,pD),e(ht,Gg),e(Gg,mD),e(ht,hD),p(t,M1,c),p(t,ic,c),e(ic,uD),p(t,I1,c),_(Zi,t,c),p(t,S1,c),p(t,lc,c),e(lc,fD),p(t,q1,c),p(t,Ye,c),e(Ye,gD),e(Ye,Zg),e(Zg,_D),e(Ye,bD),e(Ye,Vg),e(Vg,vD),e(Ye,yD),e(Ye,Xg),e(Xg,wD),e(Ye,TD),p(t,D1,c),p(t,Ko,c),e(Ko,Da),e(Da,Yg),_(Vi,Yg,null),e(Ko,ED),e(Ko,Hg),e(Hg,AD),p(t,U1,c),p(t,to,c),e(to,$D),e(to,Qg),e(Qg,kD),e(to,xD),e(to,Kg),e(Kg,MD),e(to,ID),p(t,j1,c),p(t,dc,c),e(dc,SD),p(t,P1,c),p(t,cc,c),e(cc,qD),p(t,J1,c),p(t,Ua,c),e(Ua,DD),e(Ua,e_),e(e_,UD),e(Ua,jD),p(t,C1,c),_(Xi,t,c),p(t,F1,c),p(t,te,c),e(te,PD),e(te,t_),e(t_,JD),e(te,CD),e(te,o_),e(o_,FD),e(te,ND),e(te,r_),e(r_,zD),e(te,OD),e(te,a_),e(a_,WD),e(te,RD),e(te,n_),e(n_,LD),e(te,BD),e(te,s_),e(s_,GD),e(te,ZD),p(t,N1,c),p(t,pc,c),e(pc,VD),p(t,z1,c),p(t,er,c),e(er,ja),e(ja,i_),_(Yi,i_,null),e(er,XD),e(er,l_),e(l_,YD),p(t,O1,c),p(t,Pa,c),e(Pa,HD),e(Pa,Hi),e(Hi,QD),e(Pa,KD),p(t,W1,c),p(t,Qi,c),e(Qi,d_),e(d_,eU),e(Qi,tU),p(t,R1,c),p(t,Ki,c),e(Ki,c_),e(c_,oU),e(Ki,rU),p(t,L1,c),p(t,me,c),e(me,p_),e(p_,el),e(el,aU),e(el,m_),e(m_,nU),e(el,sU),e(me,iU),e(me,tl),e(tl,mc),e(mc,h_),e(h_,lU),e(mc,dU),e(tl,cU),e(tl,tr),e(tr,ol),e(ol,pU),e(ol,u_),e(u_,mU),e(ol,hU),e(tr,uU),e(tr,rl),e(rl,fU),e(rl,f_),e(f_,gU),e(rl,_U),e(tr,bU),e(tr,al),e(al,vU),e(al,g_),e(g_,yU),e(al,wU),e(me,TU),e(me,__),e(__,or),e(or,EU),e(or,b_),e(b_,AU),e(or,$U),e(or,v_),e(v_,kU),e(or,xU),e(me,MU),e(me,y_),e(y_,ut),e(ut,IU),e(ut,w_),e(w_,SU),e(ut,qU),e(ut,T_),e(T_,DU),e(ut,UU),e(ut,E_),e(E_,jU),e(ut,PU),e(me,JU),e(me,A_),e(A_,rr),e(rr,CU),e(rr,$_),e($_,FU),e(rr,NU),e(rr,k_),e(k_,zU),e(rr,OU),e(me,WU),e(me,nl),e(nl,ft),e(ft,RU),e(ft,x_),e(x_,LU),e(ft,BU),e(ft,M_),e(M_,GU),e(ft,ZU),e(ft,I_),e(I_,VU),e(ft,XU),e(nl,YU),e(nl,De),e(De,hc),e(hc,HU),e(hc,sl),e(sl,ge),e(ge,QU),e(ge,S_),e(S_,KU),e(ge,ej),e(ge,q_),e(q_,tj),e(ge,oj),e(ge,D_),e(D_,rj),e(ge,aj),e(ge,U_),e(U_,nj),e(ge,sj),e(ge,j_),e(j_,ij),e(ge,lj),e(sl,dj),e(sl,il),e(il,cj),e(il,P_),e(P_,pj),e(il,mj),e(De,hj),e(De,gt),e(gt,J_),e(J_,uj),e(gt,fj),e(gt,C_),e(C_,gj),e(gt,_j),e(gt,F_),e(F_,bj),e(gt,vj),e(gt,N_),e(N_,yj),e(De,wj),e(De,Ja),e(Ja,z_),e(z_,Tj),e(Ja,Ej),e(Ja,O_),e(O_,Aj),e(Ja,$j),e(De,kj),e(De,Ca),e(Ca,W_),e(W_,xj),e(Ca,Mj),e(Ca,R_),e(R_,Ij),e(Ca,Sj),e(De,qj),e(De,Fa),e(Fa,L_),e(L_,Dj),e(Fa,Uj),e(Fa,B_),e(B_,jj),e(Fa,Pj),p(t,B1,c),p(t,uc,c),e(uc,G_),e(G_,Jj),p(t,G1,c),p(t,fc,c),e(fc,He),e(He,Cj),e(He,Z_),e(Z_,Fj),e(He,Nj),e(He,V_),e(V_,zj),e(He,Oj),e(He,Wj),e(He,Rj),e(He,ll),e(ll,Lj),p(t,Z1,c),p(t,ar,c),e(ar,Na),e(Na,X_),_(dl,X_,null),e(ar,Bj),e(ar,Y_),e(Y_,Gj),p(t,V1,c),p(t,oo,c),e(oo,Zj),e(oo,cl),e(cl,Vj),e(oo,Xj),e(oo,pl),e(pl,Yj),e(oo,Hj),p(t,X1,c),p(t,ml,c),e(ml,H_),e(H_,Qj),e(ml,Kj),p(t,Y1,c),p(t,hl,c),e(hl,Q_),e(Q_,eP),e(hl,tP),p(t,H1,c),p(t,ro,c),e(ro,oP),e(ro,K_),e(K_,rP),e(ro,aP),e(ro,eb),e(eb,nP),e(ro,sP),p(t,Q1,c),p(t,Qe,c),e(Qe,za),e(za,tb),e(tb,iP),e(za,lP),e(za,ob),e(ob,dP),e(za,cP),e(Qe,pP),e(Qe,Oa),e(Oa,rb),e(rb,mP),e(Oa,hP),e(Oa,ul),e(ul,uP),e(Oa,fP),e(Qe,gP),e(Qe,Ke),e(Ke,ab),e(ab,_P),e(Ke,bP),e(Ke,nb),e(nb,vP),e(Ke,yP),e(Ke,sb),e(sb,wP),e(Ke,TP),e(Ke,ib),e(ib,EP),e(Ke,AP),e(Qe,$P),e(Qe,gc),e(gc,kP),e(gc,fl),e(fl,_e),e(_e,xP),e(_e,lb),e(lb,MP),e(_e,IP),e(_e,db),e(db,SP),e(_e,qP),e(_e,cb),e(cb,DP),e(_e,UP),e(_e,pb),e(pb,jP),e(_e,PP),e(_e,mb),e(mb,JP),e(_e,CP),e(fl,FP),e(fl,gl),e(gl,NP),e(gl,hb),e(hb,zP),e(gl,OP),p(t,K1,c),p(t,nr,c),e(nr,Wa),e(Wa,ub),_(_l,ub,null),e(nr,WP),e(nr,fb),e(fb,RP),p(t,ew,c),p(t,et,c),e(et,LP),e(et,gb),e(gb,BP),e(et,GP),e(et,bl),e(bl,ZP),e(et,VP),e(et,vl),e(vl,XP),e(et,YP),p(t,tw,c),_(Ra,t,c),p(t,ow,c),p(t,_c,c),e(_c,_b),e(_b,HP),p(t,rw,c),p(t,ao,c),e(ao,bb),e(bb,QP),e(ao,KP),e(ao,vb),e(vb,e6),e(ao,t6),e(ao,yb),e(yb,o6),p(t,aw,c),p(t,sr,c),e(sr,wb),e(wb,r6),e(sr,a6),e(sr,yl),e(yl,n6),e(sr,s6),p(t,nw,c),p(t,_t,c),e(_t,Tb),e(Tb,i6),e(_t,l6),e(_t,Eb),e(Eb,d6),e(_t,c6),e(_t,Ab),e(Ab,p6),e(_t,m6),p(t,sw,c),_(wl,t,c),p(t,iw,c),p(t,bc,c),e(bc,$b),e($b,h6),p(t,lw,c),p(t,La,c),e(La,Tl),e(Tl,u6),e(Tl,kb),e(kb,f6),e(Tl,g6),e(La,_6),e(La,Ue),e(Ue,b6),e(Ue,xb),e(xb,v6),e(Ue,y6),e(Ue,Mb),e(Mb,w6),e(Ue,T6),e(Ue,Ib),e(Ib,E6),e(Ue,A6),e(Ue,Sb),e(Sb,$6),e(Ue,k6),p(t,dw,c),p(t,no,c),e(no,x6),e(no,qb),e(qb,M6),e(no,I6),e(no,El),e(El,S6),e(no,q6),p(t,cw,c),p(t,ir,c),e(ir,Ba),e(Ba,Db),_(Al,Db,null),e(ir,D6),e(ir,Ub),e(Ub,U6),p(t,pw,c),p(t,vc,c),e(vc,j6),p(t,mw,c),p(t,Ga,c),e(Ga,jb),e(jb,P6),e(Ga,J6),e(Ga,Pb),e(Pb,C6),p(t,hw,c),p(t,yc,c),e(yc,F6),p(t,uw,c),p(t,so,c),e(so,Jb),e(Jb,io),e(io,N6),e(io,Cb),e(Cb,z6),e(io,O6),e(io,Fb),e(Fb,W6),e(io,R6),e(io,Nb),e(Nb,L6),e(so,B6),e(so,K),e(K,$l),e($l,G6),e($l,zb),e(zb,Z6),e($l,V6),e(K,X6),_(kl,K,null),e(K,Y6),e(K,Ob),e(Ob,H6),e(K,Q6),_(xl,K,null),e(K,K6),e(K,Wb),e(Wb,eJ),e(K,tJ),_(Ml,K,null),e(K,oJ),e(K,Rb),e(Rb,rJ),e(K,aJ),_(Il,K,null),e(so,nJ),e(so,Lb),e(Lb,lr),e(lr,sJ),e(lr,Bb),e(Bb,iJ),e(lr,lJ),e(lr,Gb),e(Gb,dJ),e(lr,cJ),p(t,fw,c),_(Sl,t,c),p(t,gw,c),p(t,ql,c),e(ql,Dl),e(Dl,pJ),e(Dl,Zb),e(Zb,mJ),e(Dl,hJ),p(t,_w,c),_(Ul,t,c),p(t,bw,c),p(t,Za,c),e(Za,uJ),e(Za,jl),e(jl,fJ),e(Za,gJ),p(t,vw,c),p(t,wc,c),e(wc,_J),p(t,yw,c),p(t,M,c),e(M,bJ),e(M,Tc),e(Tc,vJ),e(M,Vb),e(M,yJ),e(M,Ec),e(Ec,wJ),e(M,Xb),e(M,TJ),e(M,Ac),e(Ac,EJ),e(M,Yb),e(M,AJ),e(M,$c),e($c,$J),e(M,Hb),e(M,kJ),e(M,kc),e(kc,xJ),e(M,Qb),e(M,MJ),e(M,xc),e(xc,IJ),e(M,Kb),e(M,SJ),e(M,Mc),e(Mc,qJ),e(M,ev),e(M,DJ),e(M,Ic),e(Ic,UJ),e(M,tv),e(M,jJ),e(M,Sc),e(Sc,PJ),e(M,ov),e(M,JJ),e(M,qc),e(qc,CJ),e(M,rv),e(M,FJ),e(M,Dc),e(Dc,NJ),e(M,av),e(M,zJ),e(M,Uc),e(Uc,OJ),e(M,nv),e(M,WJ),e(M,jc),e(jc,RJ),e(M,sv),e(M,LJ),e(M,Pc),e(Pc,BJ),e(M,iv),e(M,GJ),e(M,Jc),e(Jc,ZJ),e(M,lv),e(M,VJ),e(M,Cc),e(Cc,XJ),e(M,dv),e(M,YJ),e(M,Fc),e(Fc,HJ),e(M,cv),e(M,QJ),e(M,Nc),e(Nc,KJ),e(M,pv),e(M,e8),e(M,zc),e(zc,t8),e(M,mv),e(M,o8),e(M,Oc),e(Oc,r8),e(M,hv),e(M,a8),e(M,Wc),e(Wc,n8),e(M,uv),e(M,s8),e(M,Rc),e(Rc,i8),e(M,fv),e(M,l8),e(M,Lc),e(Lc,d8),e(M,gv),e(M,c8),ww=!0},p(t,[c]){const Pl={};c&2&&(Pl.$$scope={dirty:c,ctx:t}),br.$set(Pl);const _v={};c&2&&(_v.$$scope={dirty:c,ctx:t}),Ir.$set(_v);const bv={};c&2&&(bv.$$scope={dirty:c,ctx:t}),Sr.$set(bv);const vv={};c&2&&(vv.$$scope={dirty:c,ctx:t}),jr.$set(vv);const dr={};c&2&&(dr.$$scope={dirty:c,ctx:t}),Cr.$set(dr);const yv={};c&2&&(yv.$$scope={dirty:c,ctx:t}),Wr.$set(yv);const wv={};c&2&&(wv.$$scope={dirty:c,ctx:t}),Br.$set(wv);const cr={};c&2&&(cr.$$scope={dirty:c,ctx:t}),Gr.$set(cr);const Tv={};c&2&&(Tv.$$scope={dirty:c,ctx:t}),Zr.$set(Tv);const Ev={};c&2&&(Ev.$$scope={dirty:c,ctx:t}),Vr.$set(Ev);const Jl={};c&2&&(Jl.$$scope={dirty:c,ctx:t}),Xr.$set(Jl);const Av={};c&2&&(Av.$$scope={dirty:c,ctx:t}),Yr.$set(Av);const Cl={};c&2&&(Cl.$$scope={dirty:c,ctx:t}),Hr.$set(Cl);const $v={};c&2&&($v.$$scope={dirty:c,ctx:t}),Qr.$set($v);const B={};c&2&&(B.$$scope={dirty:c,ctx:t}),Kr.$set(B);const Bc={};c&2&&(Bc.$$scope={dirty:c,ctx:t}),ea.$set(Bc);const kv={};c&2&&(kv.$$scope={dirty:c,ctx:t}),ta.$set(kv);const Gc={};c&2&&(Gc.$$scope={dirty:c,ctx:t}),oa.$set(Gc);const xv={};c&2&&(xv.$$scope={dirty:c,ctx:t}),Ra.$set(xv)},i(t){ww||(b(h.$$.fragment,t),b(br.$$.fragment,t),b(wn.$$.fragment,t),b(Tn.$$.fragment,t),b(En.$$.fragment,t),b(An.$$.fragment,t),b(kn.$$.fragment,t),b(Mn.$$.fragment,t),b(In.$$.fragment,t),b(Sn.$$.fragment,t),b(Dn.$$.fragment,t),b(jn.$$.fragment,t),b(Pn.$$.fragment,t),b(Jn.$$.fragment,t),b(Fn.$$.fragment,t),b(Nn.$$.fragment,t),b(On.$$.fragment,t),b(Rn.$$.fragment,t),b(Ln.$$.fragment,t),b(Gn.$$.fragment,t),b(Vn.$$.fragment,t),b(Ir.$$.fragment,t),b(Xn.$$.fragment,t),b(Sr.$$.fragment,t),b(Hn.$$.fragment,t),b(Kn.$$.fragment,t),b(es.$$.fragment,t),b(os.$$.fragment,t),b(as.$$.fragment,t),b(jr.$$.fragment,t),b(is.$$.fragment,t),b(ls.$$.fragment,t),b(cs.$$.fragment,t),b(hs.$$.fragment,t),b(Cr.$$.fragment,t),b(gs.$$.fragment,t),b(_s.$$.fragment,t),b(bs.$$.fragment,t),b(vs.$$.fragment,t),b(ws.$$.fragment,t),b(As.$$.fragment,t),b(ks.$$.fragment,t),b(xs.$$.fragment,t),b(Ms.$$.fragment,t),b(Is.$$.fragment,t),b(Ss.$$.fragment,t),b(qs.$$.fragment,t),b(Us.$$.fragment,t),b(Wr.$$.fragment,t),b(Js.$$.fragment,t),b(Cs.$$.fragment,t),b(zs.$$.fragment,t),b(Ws.$$.fragment,t),b(Rs.$$.fragment,t),b(Ls.$$.fragment,t),b(Br.$$.fragment,t),b(Bs.$$.fragment,t),b(Gr.$$.fragment,t),b(Gs.$$.fragment,t),b(Zr.$$.fragment,t),b(Zs.$$.fragment,t),b(Vr.$$.fragment,t),b(Vs.$$.fragment,t),b(Xr.$$.fragment,t),b(Xs.$$.fragment,t),b(Yr.$$.fragment,t),b(Hr.$$.fragment,t),b(Ys.$$.fragment,t),b(Qr.$$.fragment,t),b(Hs.$$.fragment,t),b(Kr.$$.fragment,t),b(ea.$$.fragment,t),b(Qs.$$.fragment,t),b(ta.$$.fragment,t),b(oa.$$.fragment,t),b(Ks.$$.fragment,t),b(ti.$$.fragment,t),b(oi.$$.fragment,t),b(ri.$$.fragment,t),b(ai.$$.fragment,t),b(ii.$$.fragment,t),b(li.$$.fragment,t),b(di.$$.fragment,t),b(ci.$$.fragment,t),b(pi.$$.fragment,t),b(mi.$$.fragment,t),b(hi.$$.fragment,t),b(ui.$$.fragment,t),b(gi.$$.fragment,t),b(bi.$$.fragment,t),b(wi.$$.fragment,t),b(Ti.$$.fragment,t),b(Ei.$$.fragment,t),b(Ai.$$.fragment,t),b(ki.$$.fragment,t),b(xi.$$.fragment,t),b(Mi.$$.fragment,t),b(Si.$$.fragment,t),b(Di.$$.fragment,t),b(Ui.$$.fragment,t),b(ji.$$.fragment,t),b(Fi.$$.fragment,t),b(zi.$$.fragment,t),b(Oi.$$.fragment,t),b(Wi.$$.fragment,t),b(Li.$$.fragment,t),b(Bi.$$.fragment,t),b(Gi.$$.fragment,t),b(Zi.$$.fragment,t),b(Vi.$$.fragment,t),b(Xi.$$.fragment,t),b(Yi.$$.fragment,t),b(dl.$$.fragment,t),b(_l.$$.fragment,t),b(Ra.$$.fragment,t),b(wl.$$.fragment,t),b(Al.$$.fragment,t),b(kl.$$.fragment,t),b(xl.$$.fragment,t),b(Ml.$$.fragment,t),b(Il.$$.fragment,t),b(Sl.$$.fragment,t),b(Ul.$$.fragment,t),ww=!0)},o(t){v(h.$$.fragment,t),v(br.$$.fragment,t),v(wn.$$.fragment,t),v(Tn.$$.fragment,t),v(En.$$.fragment,t),v(An.$$.fragment,t),v(kn.$$.fragment,t),v(Mn.$$.fragment,t),v(In.$$.fragment,t),v(Sn.$$.fragment,t),v(Dn.$$.fragment,t),v(jn.$$.fragment,t),v(Pn.$$.fragment,t),v(Jn.$$.fragment,t),v(Fn.$$.fragment,t),v(Nn.$$.fragment,t),v(On.$$.fragment,t),v(Rn.$$.fragment,t),v(Ln.$$.fragment,t),v(Gn.$$.fragment,t),v(Vn.$$.fragment,t),v(Ir.$$.fragment,t),v(Xn.$$.fragment,t),v(Sr.$$.fragment,t),v(Hn.$$.fragment,t),v(Kn.$$.fragment,t),v(es.$$.fragment,t),v(os.$$.fragment,t),v(as.$$.fragment,t),v(jr.$$.fragment,t),v(is.$$.fragment,t),v(ls.$$.fragment,t),v(cs.$$.fragment,t),v(hs.$$.fragment,t),v(Cr.$$.fragment,t),v(gs.$$.fragment,t),v(_s.$$.fragment,t),v(bs.$$.fragment,t),v(vs.$$.fragment,t),v(ws.$$.fragment,t),v(As.$$.fragment,t),v(ks.$$.fragment,t),v(xs.$$.fragment,t),v(Ms.$$.fragment,t),v(Is.$$.fragment,t),v(Ss.$$.fragment,t),v(qs.$$.fragment,t),v(Us.$$.fragment,t),v(Wr.$$.fragment,t),v(Js.$$.fragment,t),v(Cs.$$.fragment,t),v(zs.$$.fragment,t),v(Ws.$$.fragment,t),v(Rs.$$.fragment,t),v(Ls.$$.fragment,t),v(Br.$$.fragment,t),v(Bs.$$.fragment,t),v(Gr.$$.fragment,t),v(Gs.$$.fragment,t),v(Zr.$$.fragment,t),v(Zs.$$.fragment,t),v(Vr.$$.fragment,t),v(Vs.$$.fragment,t),v(Xr.$$.fragment,t),v(Xs.$$.fragment,t),v(Yr.$$.fragment,t),v(Hr.$$.fragment,t),v(Ys.$$.fragment,t),v(Qr.$$.fragment,t),v(Hs.$$.fragment,t),v(Kr.$$.fragment,t),v(ea.$$.fragment,t),v(Qs.$$.fragment,t),v(ta.$$.fragment,t),v(oa.$$.fragment,t),v(Ks.$$.fragment,t),v(ti.$$.fragment,t),v(oi.$$.fragment,t),v(ri.$$.fragment,t),v(ai.$$.fragment,t),v(ii.$$.fragment,t),v(li.$$.fragment,t),v(di.$$.fragment,t),v(ci.$$.fragment,t),v(pi.$$.fragment,t),v(mi.$$.fragment,t),v(hi.$$.fragment,t),v(ui.$$.fragment,t),v(gi.$$.fragment,t),v(bi.$$.fragment,t),v(wi.$$.fragment,t),v(Ti.$$.fragment,t),v(Ei.$$.fragment,t),v(Ai.$$.fragment,t),v(ki.$$.fragment,t),v(xi.$$.fragment,t),v(Mi.$$.fragment,t),v(Si.$$.fragment,t),v(Di.$$.fragment,t),v(Ui.$$.fragment,t),v(ji.$$.fragment,t),v(Fi.$$.fragment,t),v(zi.$$.fragment,t),v(Oi.$$.fragment,t),v(Wi.$$.fragment,t),v(Li.$$.fragment,t),v(Bi.$$.fragment,t),v(Gi.$$.fragment,t),v(Zi.$$.fragment,t),v(Vi.$$.fragment,t),v(Xi.$$.fragment,t),v(Yi.$$.fragment,t),v(dl.$$.fragment,t),v(_l.$$.fragment,t),v(Ra.$$.fragment,t),v(wl.$$.fragment,t),v(Al.$$.fragment,t),v(kl.$$.fragment,t),v(xl.$$.fragment,t),v(Ml.$$.fragment,t),v(Il.$$.fragment,t),v(Sl.$$.fragment,t),v(Ul.$$.fragment,t),ww=!1},d(t){o(u),t&&o($),t&&o(T),y(h),t&&o(j),t&&o(R),t&&o(L),t&&o(O),t&&o(be),t&&o(Pe),t&&o(ie),t&&o(re),t&&o(yo),t&&o(W),t&&o(Jv),y(br,t),t&&o(Cv),t&&o(vr),t&&o(Fv),y(wn,t),t&&o(Nv),t&&o(wt),t&&o(zv),t&&o(wo),y(Tn),t&&o(Ov),t&&o(A),y(En),y(An),y(kn),y(Mn),y(In),y(Sn),y(Dn),y(jn),y(Pn),y(Jn),y(Fn),y(Nn),y(On),y(Rn),y(Ln),y(Gn),y(Vn),y(Ir),y(Xn),y(Sr),y(Hn),y(Kn),y(es),y(os),y(as),y(jr),y(is),y(ls),y(cs),y(hs),y(Cr),y(gs),y(_s),y(bs),y(vs),y(ws),y(As),y(ks),y(xs),y(Ms),t&&o(Wv),t&&o(Do),y(Is),t&&o(Rv),t&&o(mt),y(Ss),y(qs),y(Us),y(Wr),t&&o(Lv),t&&o(Co),y(Js),t&&o(Bv),t&&o(q),y(Cs),y(zs),y(Ws),y(Rs),y(Ls),y(Br),y(Bs),y(Gr),y(Gs),y(Zr),y(Zs),y(Vr),y(Vs),y(Xr),y(Xs),y(Yr),y(Hr),y(Ys),y(Qr),y(Hs),y(Kr),y(ea),y(Qs),y(ta),y(oa),y(Ks),y(ti),y(oi),t&&o(Gv),t&&o(Wo),y(ri),t&&o(Zv),t&&o(qe),y(ai),y(ii),t&&o(Vv),t&&o(Bo),y(li),t&&o(Xv),t&&o(ye),t&&o(Yv),t&&o(da),t&&o(Hv),t&&o(ca),t&&o(Qv),t&&o(Be),t&&o(Kv),t&&o(pa),t&&o(ey),t&&o(Go),y(di),t&&o(ty),t&&o(Ge),t&&o(oy),t&&o(Bt),t&&o(ry),t&&o(ua),t&&o(ay),t&&o(Ze),t&&o(ny),t&&o(pe),t&&o(sy),t&&o(qd),t&&o(iy),y(ci,t),t&&o(ly),t&&o(Dd),t&&o(dy),y(pi,t),t&&o(cy),t&&o(Ud),t&&o(py),y(mi,t),t&&o(my),t&&o(jd),t&&o(hy),t&&o(Pd),t&&o(uy),y(hi,t),t&&o(fy),t&&o(fa),t&&o(gy),t&&o(Zo),y(ui),t&&o(_y),t&&o(we),t&&o(by),t&&o(Gt),t&&o(vy),t&&o(Vo),y(gi),t&&o(yy),t&&o(Cd),t&&o(wy),t&&o(ba),t&&o(Ty),y(bi,t),t&&o(Ey),t&&o(Zt),t&&o(Ay),y(wi,t),t&&o($y),y(Ti,t),t&&o(ky),t&&o(va),t&&o(xy),t&&o(Nd),t&&o(My),t&&o(zd),t&&o(Iy),t&&o(Od),t&&o(Sy),t&&o(ya),t&&o(qy),t&&o(Wd),t&&o(Dy),y(Ei,t),t&&o(Uy),t&&o(Vt),t&&o(jy),t&&o(Rd),t&&o(Py),y(Ai,t),t&&o(Jy),t&&o(Xt),t&&o(Cy),t&&o(Yt),t&&o(Fy),y(ki,t),t&&o(Ny),t&&o(Ld),t&&o(zy),y(xi,t),t&&o(Oy),t&&o(Bd),t&&o(Wy),y(Mi,t),t&&o(Ry),t&&o(Gd),t&&o(Ly),t&&o(Zd),t&&o(By),t&&o(wa),t&&o(Gy),t&&o(Vd),t&&o(Zy),y(Si,t),t&&o(Vy),t&&o(qi),t&&o(Xy),y(Di,t),t&&o(Yy),t&&o(Ht),t&&o(Hy),t&&o(Xd),t&&o(Qy),y(Ui,t),t&&o(Ky),t&&o(Yd),t&&o(e1),t&&o(Ta),t&&o(t1),t&&o(Xo),y(ji),t&&o(o1),t&&o(Aa),t&&o(r1),t&&o(Ve),t&&o(a1),t&&o($a),t&&o(n1),t&&o(Kd),t&&o(s1),t&&o(Yo),y(Fi),t&&o(i1),t&&o(ec),t&&o(l1),t&&o(xa),t&&o(d1),t&&o(tc),t&&o(c1),y(zi,t),t&&o(p1),t&&o(oc),t&&o(m1),t&&o(Qt),t&&o(h1),t&&o(Ho),y(Oi),t&&o(u1),t&&o(rc),t&&o(f1),t&&o(Xe),t&&o(g1),t&&o(Kt),t&&o(_1),y(Wi,t),t&&o(b1),t&&o(Ia),t&&o(v1),t&&o(Qo),y(Li),t&&o(y1),t&&o(ac),t&&o(w1),y(Bi,t),t&&o(T1),t&&o(eo),t&&o(E1),t&&o(nc),t&&o(A1),y(Gi,t),t&&o($1),t&&o(sc),t&&o(k1),t&&o(qa),t&&o(x1),t&&o(ht),t&&o(M1),t&&o(ic),t&&o(I1),y(Zi,t),t&&o(S1),t&&o(lc),t&&o(q1),t&&o(Ye),t&&o(D1),t&&o(Ko),y(Vi),t&&o(U1),t&&o(to),t&&o(j1),t&&o(dc),t&&o(P1),t&&o(cc),t&&o(J1),t&&o(Ua),t&&o(C1),y(Xi,t),t&&o(F1),t&&o(te),t&&o(N1),t&&o(pc),t&&o(z1),t&&o(er),y(Yi),t&&o(O1),t&&o(Pa),t&&o(W1),t&&o(Qi),t&&o(R1),t&&o(Ki),t&&o(L1),t&&o(me),t&&o(B1),t&&o(uc),t&&o(G1),t&&o(fc),t&&o(Z1),t&&o(ar),y(dl),t&&o(V1),t&&o(oo),t&&o(X1),t&&o(ml),t&&o(Y1),t&&o(hl),t&&o(H1),t&&o(ro),t&&o(Q1),t&&o(Qe),t&&o(K1),t&&o(nr),y(_l),t&&o(ew),t&&o(et),t&&o(tw),y(Ra,t),t&&o(ow),t&&o(_c),t&&o(rw),t&&o(ao),t&&o(aw),t&&o(sr),t&&o(nw),t&&o(_t),t&&o(sw),y(wl,t),t&&o(iw),t&&o(bc),t&&o(lw),t&&o(La),t&&o(dw),t&&o(no),t&&o(cw),t&&o(ir),y(Al),t&&o(pw),t&&o(vc),t&&o(mw),t&&o(Ga),t&&o(hw),t&&o(yc),t&&o(uw),t&&o(so),y(kl),y(xl),y(Ml),y(Il),t&&o(fw),y(Sl,t),t&&o(gw),t&&o(ql),t&&o(_w),y(Ul,t),t&&o(bw),t&&o(Za),t&&o(vw),t&&o(wc),t&&o(yw),t&&o(M)}}}const mB={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 hB(D){return BL(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class yB extends OL{constructor(u){super();WL(this,u,hB,pB,RL,{})}}export{yB as default,mB as metadata};
