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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>args = TrainingArguments(<span class="hljs-string">&quot;working_dir&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args = args.set_training(learning_rate=<span class="hljs-number">1e-4</span>, batch_size=<span class="hljs-number">32</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>args.learning_rate
<span class="hljs-number">1e-4</span>`}}),{c(){u=n("p"),k=r("Example:"),T=l(),f(w.$$.fragment)},l(h){u=s(h,"P",{});var E=i(u);k=a(E,"Example:"),E.forEach(o),T=d(h),g(w.$$.fragment,h)},m(h,E){m(h,u,E),e(u,k),m(h,T,E),_(w,h,E),x=!0},p:xo,i(h){x||(v(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&o(u),h&&o(T),y(w,h)}}}function IZ(C){let u,k;return{c(){u=n("p"),k=r("This integration is not supported anymore, we recommend you either use DeepSpeed or PyTorch FSDP.")},l(T){u=s(T,"P",{});var w=i(u);k=a(w,"This integration is not supported anymore, we recommend you either use DeepSpeed or PyTorch FSDP."),w.forEach(o)},m(T,w){m(T,u,w),e(u,k)},d(T){T&&o(u)}}}function MZ(C){let u,k,T,w,x;return{c(){u=n("p"),k=r(`We strongly recommend to install PyTorch >= 1.13 (nightly version at the time of writing) on your MacOS machine.
It has major fixes related to model correctness and performance improvements for transformer based models.
Please refer to `),T=n("a"),w=r("https://github.com/pytorch/pytorch/issues/82707"),x=r(" for more details."),this.h()},l(h){u=s(h,"P",{});var E=i(u);k=a(E,`We strongly recommend to install PyTorch >= 1.13 (nightly version at the time of writing) on your MacOS machine.
It has major fixes related to model correctness and performance improvements for transformer based models.
Please refer to `),T=s(E,"A",{href:!0,rel:!0});var O=i(T);w=a(O,"https://github.com/pytorch/pytorch/issues/82707"),O.forEach(o),x=a(E," for more details."),E.forEach(o),this.h()},h(){p(T,"href","https://github.com/pytorch/pytorch/issues/82707"),p(T,"rel","nofollow")},m(h,E){m(h,u,E),e(u,k),e(u,T),e(T,w),e(u,x)},d(h){h&&o(u)}}}function FZ(C){let u,k,T,w,x,h,E,O,J,I,R,B,K,Q,Y,X,pe,H,L,W,ae,z,we,Te,ne,bt,yt,ue,Me,Cn,Ee,In,Mn,se,oe,pd,$e,xr,hd,Ao,j,re,Ar,ud,fd,gd,_d,Np,ZT,XT,YT,vd,Jp,HT,QT,KT,bd,Wp,eE,tE,oE,wt,jp,rE,aE,Rp,nE,sE,Lp,iE,lE,dE,yd,Gp,cE,mE,pE,wd,Bp,hE,uE,fE,Td,Vp,gE,_E,vE,Ed,Zp,bE,yE,wE,$d,Xp,TE,EE,$E,kd,Yp,kE,xE,AE,xd,Hp,qE,SE,Oy,qr,zy,Sr,PE,Ad,DE,UE,Ny,Fn,Jy,Tt,CE,qd,IE,ME,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G9naXRzLnZpZXcoLTElMkMlMjBzZWxmLm1vZGVsLmNvbmZpZy5udW1fbGFiZWxzKSUyQyUyMGxhYmVscy52aWV3KC0xKSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAobG9zcyUyQyUyMG91dHB1dHMpJTIwaWYlMjByZXR1cm5fb3V0cHV0cyUyMGVsc2UlMjBsb3Nz",highlighted:`<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Trainer


<span class="hljs-keyword">class</span> <span class="hljs-title class_">CustomTrainer</span>(<span class="hljs-title class_ inherited__">Trainer</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_loss</span>(<span class="hljs-params">self, model, inputs, return_outputs=<span class="hljs-literal">False</span></span>):
        labels = inputs.get(<span class="hljs-string">&quot;labels&quot;</span>)
        <span class="hljs-comment"># forward pass</span>
        outputs = model(**inputs)
        logits = outputs.get(<span class="hljs-string">&quot;logits&quot;</span>)
        <span class="hljs-comment"># compute custom loss (suppose one has 3 labels with different weights)</span>
        loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([<span class="hljs-number">1.0</span>, <span class="hljs-number">2.0</span>, <span class="hljs-number">3.0</span>], device=model.device))
        loss = loss_fct(logits.view(-<span class="hljs-number">1</span>, self.model.config.num_labels), labels.view(-<span class="hljs-number">1</span>))
        <span class="hljs-keyword">return</span> (loss, outputs) <span class="hljs-keyword">if</span> return_outputs <span class="hljs-keyword">else</span> loss`}}),On=new te({}),zn=new P({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.30.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.30.0/en/main_classes/trainer#transformers.Trainer">Trainer</a> is optimized to work with the <a href="/docs/transformers/v4.30.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.30.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.30.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.30.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.30.0/en/main_classes/data_collator#transformers.DataCollatorWithPadding">DataCollatorWithPadding</a> otherwise.`,name:"data_collator"},{anchor:"transformers.Trainer.train_dataset",description:`<strong>train_dataset</strong> (<code>torch.utils.data.Dataset</code> or <code>torch.utils.data.IterableDataset</code>, <em>optional</em>) &#x2014;
The dataset to use for training. If it is a <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed.</p>
<p>Note that if it&#x2019;s a <code>torch.utils.data.IterableDataset</code> with some randomization and you are training in a
distributed fashion, your iterable dataset should either use a internal attribute <code>generator</code> that is a
<code>torch.Generator</code> for the randomization that must be identical on all processes (and the Trainer will
manually set the seed of this <code>generator</code> at each epoch) or have a <code>set_epoch()</code> method that internally
sets the seed of the RNGs used.`,name:"train_dataset"},{anchor:"transformers.Trainer.eval_dataset",description:`<strong>eval_dataset</strong> (Union[<code>torch.utils.data.Dataset</code>, Dict[str, <code>torch.utils.data.Dataset</code>]), <em>optional</em>) &#x2014;
The dataset to use for evaluation. If it is a <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. If it is a dictionary, it will evaluate on each
dataset prepending the dictionary key to the metric name.`,name:"eval_dataset"},{anchor:"transformers.Trainer.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.30.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.30.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.30.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.30.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.30.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.30.0/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> on your model
and a scheduler given by <a href="/docs/transformers/v4.30.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.30.0/src/transformers/trainer.py#L240"}}),Nn=new P({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.30.0/src/transformers/trainer.py#L715"}}),Wn=new P({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.30.0/src/transformers/trainer.py#L2714"}}),Rn=new P({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.30.0/src/transformers/trainer.py#L2774"}}),Ln=new P({props:{name:"compute_loss_context_manager",anchor:"transformers.Trainer.compute_loss_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L2708"}}),Gn=new P({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.30.0/src/transformers/trainer.py#L3596"}}),Vn=new P({props:{name:"create_optimizer",anchor:"transformers.Trainer.create_optimizer",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L1075"}}),Xn=new P({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.30.0/src/transformers/trainer.py#L1059"}}),Yn=new P({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.30.0/src/transformers/trainer.py#L1254"}}),Hn=new P({props:{name:"evaluate",anchor:"transformers.Trainer.evaluate",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'eval'"}],parametersDescription:[{anchor:"transformers.Trainer.evaluate.eval_dataset",description:`<strong>eval_dataset</strong> (<code>Dataset</code>, <em>optional</em>) &#x2014;
Pass a dataset if you wish to override <code>self.eval_dataset</code>. If it is a <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns
not accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Trainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Trainer.evaluate.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is &#x201C;eval&#x201D; (default)`,name:"metric_key_prefix"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L3016",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>
`}}),Kn=new P({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.30.0/src/transformers/trainer.py#L3149"}}),es=new P({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.30.0/src/transformers/trainer.py#L3531",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),os=new P({props:{name:"get_eval_dataloader",anchor:"transformers.Trainer.get_eval_dataloader",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"}],parametersDescription:[{anchor:"transformers.Trainer.get_eval_dataloader.eval_dataset",description:`<strong>eval_dataset</strong> (<code>torch.utils.data.Dataset</code>, <em>optional</em>) &#x2014;
If provided, will override <code>self.eval_dataset</code>. If it is a <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted
by the <code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"eval_dataset"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L961"}}),as=new P({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.30.0/src/transformers/trainer.py#L1131"}}),ns=new P({props:{name:"get_test_dataloader",anchor:"transformers.Trainer.get_test_dataloader",parameters:[{name:"test_dataset",val:": Dataset"}],parametersDescription:[{anchor:"transformers.Trainer.get_test_dataloader.test_dataset",description:`<strong>test_dataset</strong> (<code>torch.utils.data.Dataset</code>, <em>optional</em>) &#x2014;
The test dataset to use. If it is a <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"test_dataset"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L1011"}}),is=new P({props:{name:"get_train_dataloader",anchor:"transformers.Trainer.get_train_dataloader",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L882"}}),ds=new P({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.30.0/src/transformers/trainer.py#L2561",returnDescription:`
<p>All the information about the best run. Experiment summary can be found in
<code>run_summary</code> attribute for Ray backend.</p>
`,returnType:`
<p><code>trainer_utils.BestRun</code></p>
`}}),Nr=new kr({props:{warning:!0,$$slots:{default:[vZ]},$$scope:{ctx:C}}}),cs=new P({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.30.0/src/transformers/trainer.py#L3549"}}),ps=new P({props:{name:"is_local_process_zero",anchor:"transformers.Trainer.is_local_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L2806"}}),hs=new P({props:{name:"is_world_process_zero",anchor:"transformers.Trainer.is_world_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L2813"}}),fs=new P({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.30.0/src/transformers/trainer.py#L2657"}}),_s=new P({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.30.0/src/transformers/trainer_pt_utils.py#L898"}}),Rr=new ko({props:{anchor:"transformers.Trainer.log_metrics.example",$$slots:{default:[bZ]},$$scope:{ctx:C}}}),ys=new P({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.30.0/src/transformers/trainer_pt_utils.py#L872",returnDescription:`
<p>The reformatted metrics</p>
`,returnType:`
<p>metrics (<code>Dict[str, float]</code>)</p>
`}}),ws=new P({props:{name:"num_examples",anchor:"transformers.Trainer.num_examples",parameters:[{name:"dataloader",val:": DataLoader"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L1271"}}),Es=new P({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.30.0/src/transformers/trainer.py#L726",returnDescription:`
<p>The callback removed, if found.</p>
`,returnType:`
<p><code>~transformer.TrainerCallback</code></p>
`}}),xs=new P({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.30.0/src/transformers/trainer.py#L3087"}}),Br=new kr({props:{$$slots:{default:[yZ]},$$scope:{ctx:C}}}),Ss=new P({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.30.0/src/transformers/trainer.py#L3757"}}),Ps=new P({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.30.0/src/transformers/trainer.py#L3426",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>
`}}),Ds=new P({props:{name:"push_to_hub",anchor:"transformers.Trainer.push_to_hub",parameters:[{name:"commit_message",val:": typing.Optional[str] = 'End of training'"},{name:"blocking",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Trainer.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;End of training&quot;</code>) &#x2014;
Message to commit while pushing.`,name:"commit_message"},{anchor:"transformers.Trainer.push_to_hub.blocking",description:`<strong>blocking</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the function should return only when the <code>git push</code> has finished.
kwargs &#x2014;
Additional keyword arguments passed along to <a href="/docs/transformers/v4.30.0/en/main_classes/trainer#transformers.Trainer.create_model_card">create_model_card()</a>.`,name:"blocking"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L3697",returnDescription:`
<p>The url of the commit of your model in the given repository if <code>blocking=False</code>, a tuple with the url of
the commit and an object to track the progress of the commit if <code>blocking=True</code></p>
`}}),Us=new P({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.30.0/src/transformers/trainer.py#L742"}}),Is=new P({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.30.0/src/transformers/trainer_pt_utils.py#L988"}}),Os=new P({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.30.0/src/transformers/trainer.py#L2825"}}),Ns=new P({props:{name:"save_state",anchor:"transformers.Trainer.save_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer_pt_utils.py#L1026"}}),Js=new P({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.30.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.30.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>. If present, training will resume from the model/optimizer/scheduler states loaded here.`,name:"resume_from_checkpoint"},{anchor:"transformers.Trainer.train.trial",description:`<strong>trial</strong> (<code>optuna.Trial</code> or <code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
The trial run or the hyperparameter dictionary for hyperparameter search.`,name:"trial"},{anchor:"transformers.Trainer.train.ignore_keys_for_eval",description:`<strong>ignore_keys_for_eval</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions for evaluation during the training.
kwargs &#x2014;
Additional keyword arguments used to hide deprecated arguments`,name:"ignore_keys_for_eval"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer.py#L1566"}}),Ws=new P({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.30.0/src/transformers/trainer.py#L2733",returnDescription:`
<p>The tensor with training loss on this batch.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),js=new te({}),Rs=new P({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.30.0/src/transformers/trainer_seq2seq.py#L41"}}),Ls=new P({props:{name:"evaluate",anchor:"transformers.Seq2SeqTrainer.evaluate",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'eval'"},{name:"**gen_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainer.evaluate.eval_dataset",description:`<strong>eval_dataset</strong> (<code>Dataset</code>, <em>optional</em>) &#x2014;
Pass a dataset if you wish to override <code>self.eval_dataset</code>. If it is an <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns
not accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Seq2SeqTrainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.evaluate.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.evaluate.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.evaluate.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.
gen_kwargs &#x2014;
Additional <code>generate</code> specific kwargs.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer_seq2seq.py#L112",returnDescription:`
<p>A dictionary containing the evaluation loss and the potential metrics computed from the predictions. The
dictionary also contains the epoch number which comes from the training state.</p>
`}}),Bs=new P({props:{name:"predict",anchor:"transformers.Seq2SeqTrainer.predict",parameters:[{name:"test_dataset",val:": Dataset"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'test'"},{name:"**gen_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainer.predict.test_dataset",description:`<strong>test_dataset</strong> (<code>Dataset</code>) &#x2014;
Dataset to run the predictions on. If it is a <a href="https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. Has to implement the method <code>__len__</code>`,name:"test_dataset"},{anchor:"transformers.Seq2SeqTrainer.predict.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.predict.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.predict.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.predict.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.
gen_kwargs &#x2014;
Additional <code>generate</code> specific kwargs.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/trainer_seq2seq.py#L161"}}),Hr=new kr({props:{$$slots:{default:[wZ]},$$scope:{ctx:C}}}),Xs=new te({}),Ys=new P({props:{name:"class transformers.TrainingArguments",anchor:"transformers.TrainingArguments",parameters:[{name:"output_dir",val:": str"},{name:"overwrite_output_dir",val:": bool = False"},{name:"do_train",val:": bool = False"},{name:"do_eval",val:": bool = False"},{name:"do_predict",val:": bool = False"},{name:"evaluation_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'no'"},{name:"prediction_loss_only",val:": bool = False"},{name:"per_device_train_batch_size",val:": int = 8"},{name:"per_device_eval_batch_size",val:": int = 8"},{name:"per_gpu_train_batch_size",val:": typing.Optional[int] = None"},{name:"per_gpu_eval_batch_size",val:": typing.Optional[int] = None"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"eval_accumulation_steps",val:": typing.Optional[int] = None"},{name:"eval_delay",val:": typing.Optional[float] = 0"},{name:"learning_rate",val:": float = 5e-05"},{name:"weight_decay",val:": float = 0.0"},{name:"adam_beta1",val:": float = 0.9"},{name:"adam_beta2",val:": float = 0.999"},{name:"adam_epsilon",val:": float = 1e-08"},{name:"max_grad_norm",val:": float = 1.0"},{name:"num_train_epochs",val:": float = 3.0"},{name:"max_steps",val:": int = -1"},{name:"lr_scheduler_type",val:": typing.Union[transformers.trainer_utils.SchedulerType, str] = 'linear'"},{name:"warmup_ratio",val:": float = 0.0"},{name:"warmup_steps",val:": int = 0"},{name:"log_level",val:": typing.Optional[str] = 'passive'"},{name:"log_level_replica",val:": typing.Optional[str] = 'warning'"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_dir",val:": typing.Optional[str] = None"},{name:"logging_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"logging_first_step",val:": bool = False"},{name:"logging_steps",val:": float = 500"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"save_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"save_steps",val:": float = 500"},{name:"save_total_limit",val:": typing.Optional[int] = None"},{name:"save_safetensors",val:": typing.Optional[bool] = False"},{name:"save_on_each_node",val:": bool = False"},{name:"no_cuda",val:": bool = False"},{name:"use_mps_device",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": typing.Optional[int] = None"},{name:"jit_mode_eval",val:": bool = False"},{name:"use_ipex",val:": bool = False"},{name:"bf16",val:": bool = False"},{name:"fp16",val:": bool = False"},{name:"fp16_opt_level",val:": str = 'O1'"},{name:"half_precision_backend",val:": str = 'auto'"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": typing.Optional[bool] = None"},{name:"local_rank",val:": int = -1"},{name:"ddp_backend",val:": typing.Optional[str] = None"},{name:"tpu_num_cores",val:": typing.Optional[int] = None"},{name:"tpu_metrics_debug",val:": bool = False"},{name:"debug",val:": str = ''"},{name:"dataloader_drop_last",val:": bool = False"},{name:"eval_steps",val:": typing.Optional[float] = None"},{name:"dataloader_num_workers",val:": int = 0"},{name:"past_index",val:": int = -1"},{name:"run_name",val:": typing.Optional[str] = None"},{name:"disable_tqdm",val:": typing.Optional[bool] = None"},{name:"remove_unused_columns",val:": typing.Optional[bool] = True"},{name:"label_names",val:": typing.Optional[typing.List[str]] = None"},{name:"load_best_model_at_end",val:": typing.Optional[bool] = False"},{name:"metric_for_best_model",val:": typing.Optional[str] = None"},{name:"greater_is_better",val:": typing.Optional[bool] = None"},{name:"ignore_data_skip",val:": bool = False"},{name:"sharded_ddp",val:": str = ''"},{name:"fsdp",val:": str = ''"},{name:"fsdp_min_num_params",val:": int = 0"},{name:"fsdp_config",val:": typing.Optional[str] = None"},{name:"fsdp_transformer_layer_cls_to_wrap",val:": typing.Optional[str] = None"},{name:"deepspeed",val:": typing.Optional[str] = None"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"optim",val:": typing.Union[transformers.training_args.OptimizerNames, str] = 'adamw_hf'"},{name:"optim_args",val:": typing.Optional[str] = None"},{name:"adafactor",val:": bool = False"},{name:"group_by_length",val:": bool = False"},{name:"length_column_name",val:": typing.Optional[str] = 'length'"},{name:"report_to",val:": typing.Optional[typing.List[str]] = None"},{name:"ddp_find_unused_parameters",val:": typing.Optional[bool] = None"},{name:"ddp_bucket_cap_mb",val:": typing.Optional[int] = None"},{name:"dataloader_pin_memory",val:": bool = True"},{name:"skip_memory_metrics",val:": bool = True"},{name:"use_legacy_prediction_loop",val:": bool = False"},{name:"push_to_hub",val:": bool = False"},{name:"resume_from_checkpoint",val:": typing.Optional[str] = None"},{name:"hub_model_id",val:": typing.Optional[str] = None"},{name:"hub_strategy",val:": typing.Union[transformers.trainer_utils.HubStrategy, str] = 'every_save'"},{name:"hub_token",val:": typing.Optional[str] = None"},{name:"hub_private_repo",val:": bool = False"},{name:"gradient_checkpointing",val:": bool = False"},{name:"include_inputs_for_metrics",val:": bool = False"},{name:"fp16_backend",val:": str = 'auto'"},{name:"push_to_hub_model_id",val:": typing.Optional[str] = None"},{name:"push_to_hub_organization",val:": typing.Optional[str] = None"},{name:"push_to_hub_token",val:": typing.Optional[str] = None"},{name:"mp_parameters",val:": str = ''"},{name:"auto_find_batch_size",val:": bool = False"},{name:"full_determinism",val:": bool = False"},{name:"torchdynamo",val:": typing.Optional[str] = None"},{name:"ray_scope",val:": typing.Optional[str] = 'last'"},{name:"ddp_timeout",val:": typing.Optional[int] = 1800"},{name:"torch_compile",val:": bool = False"},{name:"torch_compile_backend",val:": typing.Optional[str] = None"},{name:"torch_compile_mode",val:": typing.Optional[str] = None"},{name:"xpu_backend",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"transformers.TrainingArguments.output_dir",description:`<strong>output_dir</strong> (<code>str</code>) &#x2014;
The output directory where the model predictions and checkpoints will be written.`,name:"output_dir"},{anchor:"transformers.TrainingArguments.overwrite_output_dir",description:`<strong>overwrite_output_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, overwrite the content of the output directory. Use this to continue training if <code>output_dir</code>
points to a checkpoint directory.`,name:"overwrite_output_dir"},{anchor:"transformers.TrainingArguments.do_train",description:`<strong>do_train</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run training or not. This argument is not directly used by <a href="/docs/transformers/v4.30.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.30.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.30.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.30.0/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;no&quot;</code>) &#x2014;
The evaluation strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No evaluation is done during training.</li>
<li><code>&quot;steps&quot;</code>: Evaluation is done (and logged) every <code>eval_steps</code>.</li>
<li><code>&quot;epoch&quot;</code>: Evaluation is done at the end of each epoch.</li>
</ul>`,name:"evaluation_strategy"},{anchor:"transformers.TrainingArguments.prediction_loss_only",description:`<strong>prediction_loss_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When performing evaluation and generating predictions, only returns the loss.`,name:"prediction_loss_only"},{anchor:"transformers.TrainingArguments.per_device_train_batch_size",description:`<strong>per_device_train_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for training.`,name:"per_device_train_batch_size"},{anchor:"transformers.TrainingArguments.per_device_eval_batch_size",description:`<strong>per_device_eval_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for evaluation.`,name:"per_device_eval_batch_size"},{anchor:"transformers.TrainingArguments.gradient_accumulation_steps",description:`<strong>gradient_accumulation_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of updates steps to accumulate the gradients for, before performing a backward/update pass.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>When using gradient accumulation, one step is counted as one step with backward pass. Therefore, logging,
evaluation, save will be conducted every <code>gradient_accumulation_steps * xxx_step</code> training examples.</p>

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

					</div>`,name:"load_best_model_at_end"},{anchor:"transformers.TrainingArguments.metric_for_best_model",description:`<strong>metric_for_best_model</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> to specify the metric to use to compare two different
models. Must be the name of a metric returned by the evaluation with or without the prefix <code>&quot;eval_&quot;</code>. Will
default to <code>&quot;loss&quot;</code> if unspecified and <code>load_best_model_at_end=True</code> (to use the evaluation loss).</p>
<p>If you set this value, <code>greater_is_better</code> will default to <code>True</code>. Don&#x2019;t forget to set it to <code>False</code> if
your metric is better when lower.`,name:"metric_for_best_model"},{anchor:"transformers.TrainingArguments.greater_is_better",description:`<strong>greater_is_better</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> and <code>metric_for_best_model</code> to specify if better models
should have a greater metric or not. Will default to:</p>
<ul>
<li><code>True</code> if <code>metric_for_best_model</code> is set to a value that isn&#x2019;t <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
<li><code>False</code> if <code>metric_for_best_model</code> is not set, or set to <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
</ul>`,name:"greater_is_better"},{anchor:"transformers.TrainingArguments.ignore_data_skip",description:`<strong>ignore_data_skip</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When resuming training, whether or not to skip the epochs and batches to get the data loading at the same
stage as in the previous training. If set to <code>True</code>, the training will begin faster (as that skipping step
can take a long time) but will not yield the same results as the interrupted training would have.`,name:"ignore_data_skip"},{anchor:"transformers.TrainingArguments.sharded_ddp",description:`<strong>sharded_ddp</strong> (<code>bool</code>, <code>str</code> or list of <code>ShardedDDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Sharded DDP training from <a href="https://github.com/facebookresearch/fairscale" rel="nofollow">FairScale</a> (in distributed
training only). This is an experimental feature.</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;simple&quot;</code>: to use first instance of sharded DDP released by fairscale (<code>ShardedDDP</code>) similar to ZeRO-2.</li>
<li><code>&quot;zero_dp_2&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-2 mode (with <code>reshard_after_forward=False</code>).</li>
<li><code>&quot;zero_dp_3&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-3 mode (with <code>reshard_after_forward=True</code>).</li>
<li><code>&quot;offload&quot;</code>: to add ZeRO-offload (only compatible with <code>&quot;zero_dp_2&quot;</code> and <code>&quot;zero_dp_3&quot;</code>).</li>
</ul>
<p>If a string is passed, it will be split on space. If a bool is passed, it will be converted to an empty
list for <code>False</code> and <code>[&quot;simple&quot;]</code> for <code>True</code>.`,name:"sharded_ddp"},{anchor:"transformers.TrainingArguments.fsdp",description:`<strong>fsdp</strong> (<code>bool</code>, <code>str</code> or list of <code>FSDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use PyTorch Distributed Parallel Training (in distributed training only).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;full_shard&quot;</code>: Shard parameters, gradients and optimizer states.</li>
<li><code>&quot;shard_grad_op&quot;</code>: Shard optimizer states and gradients.</li>
<li><code>&quot;offload&quot;</code>: Offload parameters and gradients to CPUs (only compatible with <code>&quot;full_shard&quot;</code> and
<code>&quot;shard_grad_op&quot;</code>).</li>
<li><code>&quot;auto_wrap&quot;</code>: Automatically recursively wrap layers with FSDP using <code>default_auto_wrap_policy</code>.</li>
</ul>`,name:"fsdp"},{anchor:"transformers.TrainingArguments.fsdp_config",description:`<strong>fsdp_config</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
Config to be used with fsdp (Pytorch Distributed Parallel Training). The value is either a location of
deepspeed json config file (e.g., <code>ds_config.json</code>) or an already loaded json file as <code>dict</code>.</p>
<p>A List of config and its options:</p>
<ul>
<li>
<p>fsdp_min_num_params (<code>int</code>, <em>optional</em>, defaults to <code>0</code>):
FSDP&#x2019;s minimum number of parameters for Default Auto Wrapping. (useful only when <code>fsdp</code> field is
passed).</p>
</li>
<li>
<p>fsdp_transformer_layer_cls_to_wrap (<code>List[str]</code>, <em>optional</em>):
List of transformer layer class names (case-sensitive) to wrap, e.g, <code>BertLayer</code>, <code>GPTJBlock</code>,
<code>T5Block</code> &#x2026; (useful only when <code>fsdp</code> flag is passed).</p>
</li>
<li>
<p>fsdp_backward_prefetch (<code>str</code>, <em>optional</em>)
FSDP&#x2019;s backward prefetch mode. Controls when to prefetch next set of parameters (useful only when
<code>fsdp</code> field is passed).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;backward_pre&quot;</code> : Prefetches the next set of parameters before the current set of parameter&#x2019;s
gradient
computation.</li>
<li><code>&quot;backward_post&quot;</code> : This prefetches the next set of parameters after the current set of
parameter&#x2019;s
gradient computation.</li>
</ul>
</li>
<li>
<p>fsdp_forward_prefetch (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
FSDP&#x2019;s forward prefetch mode (useful only when <code>fsdp</code> field is passed).
If <code>&quot;True&quot;</code>, then FSDP explicitly prefetches the next upcoming all-gather while executing in the
forward pass.</p>
</li>
<li>
<p>limit_all_gathers (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
FSDP&#x2019;s limit_all_gathers (useful only when <code>fsdp</code> field is passed).
If <code>&quot;True&quot;</code>, FSDP explicitly synchronizes the CPU thread to prevent too many in-flight
all-gathers.</p>
</li>
<li>
<p>xla (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether to use PyTorch/XLA Fully Sharded Data Parallel Training. This is an experimental feature
and its API may evolve in the future.</p>
</li>
<li>
<p>xla_fsdp_settings (<code>dict</code>, <em>optional</em>)
The value is a dictionary which stores the XLA FSDP wrapping parameters.</p>
<p>For a complete list of options, please see <a href="https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py" rel="nofollow">here</a>.</p>
</li>
<li>
<p>xla_fsdp_grad_ckpt (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Will use gradient checkpointing over each nested XLA FSDP wrapped layer. This setting can only be
used when the xla flag is set to true, and an auto wrapping policy is specified through
fsdp_min_num_params or fsdp_transformer_layer_cls_to_wrap.</p>
</li>
</ul>`,name:"fsdp_config"},{anchor:"transformers.TrainingArguments.deepspeed",description:`<strong>deepspeed</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
Use <a href="https://github.com/microsoft/deepspeed" rel="nofollow">Deepspeed</a>. This is an experimental feature and its API may
evolve in the future. The value is either the location of DeepSpeed json config file (e.g.,
<code>ds_config.json</code>) or an already loaded json file as a <code>dict</code>&#x201D;`,name:"deepspeed"},{anchor:"transformers.TrainingArguments.label_smoothing_factor",description:`<strong>label_smoothing_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The label smoothing factor to use. Zero means no label smoothing, otherwise the underlying onehot-encoded
labels are changed from 0s and 1s to <code>label_smoothing_factor/num_labels</code> and <code>1 - label_smoothing_factor + label_smoothing_factor/num_labels</code> respectively.`,name:"label_smoothing_factor"},{anchor:"transformers.TrainingArguments.debug",description:`<strong>debug</strong> (<code>str</code> or list of <code>DebugOption</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
Enable one or more debug features. This is an experimental feature.</p>
<p>Possible options are:</p>
<ul>
<li><code>&quot;underflow_overflow&quot;</code>: detects overflow in model&#x2019;s input/outputs and reports the last frames that led to
the event</li>
<li><code>&quot;tpu_metrics_debug&quot;</code>: print debug metrics on TPU</li>
</ul>
<p>The options should be separated by whitespaces.`,name:"debug"},{anchor:"transformers.TrainingArguments.optim",description:`<strong>optim</strong> (<code>str</code> or <code>training_args.OptimizerNames</code>, <em>optional</em>, defaults to <code>&quot;adamw_hf&quot;</code>) &#x2014;
The optimizer to use: adamw_hf, adamw_torch, adamw_torch_fused, adamw_apex_fused, adamw_anyprecision or
adafactor.`,name:"optim"},{anchor:"transformers.TrainingArguments.optim_args",description:`<strong>optim_args</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional arguments that are supplied to AnyPrecisionAdamW.`,name:"optim_args"},{anchor:"transformers.TrainingArguments.group_by_length",description:`<strong>group_by_length</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to group together samples of roughly the same length in the training dataset (to minimize
padding applied and be more efficient). Only useful if applying dynamic padding.`,name:"group_by_length"},{anchor:"transformers.TrainingArguments.length_column_name",description:`<strong>length_column_name</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;length&quot;</code>) &#x2014;
Column name for precomputed lengths. If the column exists, grouping by length will use these values rather
than computing them on train startup. Ignored unless <code>group_by_length</code> is <code>True</code> and the dataset is an
instance of <code>Dataset</code>.`,name:"length_column_name"},{anchor:"transformers.TrainingArguments.report_to",description:`<strong>report_to</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>, defaults to <code>&quot;all&quot;</code>) &#x2014;
The list of integrations to report the results and logs to. Supported platforms are <code>&quot;azure_ml&quot;</code>,
<code>&quot;comet_ml&quot;</code>, <code>&quot;mlflow&quot;</code>, <code>&quot;neptune&quot;</code>, <code>&quot;tensorboard&quot;</code>,<code>&quot;clearml&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report to
all integrations installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.TrainingArguments.ddp_find_unused_parameters",description:`<strong>ddp_find_unused_parameters</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>find_unused_parameters</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_find_unused_parameters"},{anchor:"transformers.TrainingArguments.ddp_bucket_cap_mb",description:`<strong>ddp_bucket_cap_mb</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>bucket_cap_mb</code> passed to <code>DistributedDataParallel</code>.`,name:"ddp_bucket_cap_mb"},{anchor:"transformers.TrainingArguments.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.30.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.30.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.30.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.30.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.30.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.30.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and
a draft of a model card each time there is a model save. The pushes are asynchronous to not block
training, and in case the save are very frequent, a new push is only attempted if the previous one is
finished. A last push is made with the final model at the end of training.</li>
<li><code>&quot;checkpoint&quot;</code>: like <code>&quot;every_save&quot;</code> but the latest checkpoint is also pushed in a subfolder named
last-checkpoint, allowing you to resume training easily with
<code>trainer.train(resume_from_checkpoint=&quot;last-checkpoint&quot;)</code>.</li>
<li><code>&quot;all_checkpoints&quot;</code>: like <code>&quot;checkpoint&quot;</code> but all checkpoints are pushed like they appear in the output
folder (so you will get one checkpoint folder per folder in your final repository)</li>
</ul>`,name:"hub_strategy"},{anchor:"transformers.TrainingArguments.hub_token",description:`<strong>hub_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with
<code>huggingface-cli login</code>.`,name:"hub_token"},{anchor:"transformers.TrainingArguments.hub_private_repo",description:`<strong>hub_private_repo</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, the Hub repo will be set to private.`,name:"hub_private_repo"},{anchor:"transformers.TrainingArguments.gradient_checkpointing",description:`<strong>gradient_checkpointing</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, use gradient checkpointing to save memory at the expense of slower backward pass.`,name:"gradient_checkpointing"},{anchor:"transformers.TrainingArguments.include_inputs_for_metrics",description:`<strong>include_inputs_for_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the inputs will be passed to the <code>compute_metrics</code> function. This is intended for metrics
that need inputs, predictions and references for scoring calculation in Metric class.`,name:"include_inputs_for_metrics"},{anchor:"transformers.TrainingArguments.auto_find_batch_size",description:`<strong>auto_find_batch_size</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding
CUDA Out-of-Memory errors. Requires accelerate to be installed (<code>pip install accelerate</code>)`,name:"auto_find_batch_size"},{anchor:"transformers.TrainingArguments.full_determinism",description:`<strong>full_determinism</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, <a href="/docs/transformers/v4.30.0/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.30.0/en/internal/trainer_utils#transformers.set_seed">set_seed()</a> to ensure reproducible results in
distributed training. Important: this will negatively impact the performance, so only use it for debugging.`,name:"full_determinism"},{anchor:"transformers.TrainingArguments.torchdynamo",description:`<strong>torchdynamo</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If set, the backend compiler for TorchDynamo. Possible choices are <code>&quot;eager&quot;</code>, <code>&quot;aot_eager&quot;</code>, <code>&quot;inductor&quot;</code>,
<code>&quot;nvfuser&quot;</code>, <code>&quot;aot_nvfuser&quot;</code>, <code>&quot;aot_cudagraphs&quot;</code>, <code>&quot;ofi&quot;</code>, <code>&quot;fx2trt&quot;</code>, <code>&quot;onnxrt&quot;</code> and <code>&quot;ipex&quot;</code>.`,name:"torchdynamo"},{anchor:"transformers.TrainingArguments.ray_scope",description:`<strong>ray_scope</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;last&quot;</code>) &#x2014;
The scope to use when doing hyperparameter search with Ray. By default, <code>&quot;last&quot;</code> will be used. Ray will
then use the last checkpoint of all trials, compare those, and select the best one. However, other options
are also available. See the <a href="https://docs.ray.io/en/latest/tune/api_docs/analysis.html#ray.tune.ExperimentAnalysis.get_best_trial" rel="nofollow">Ray documentation</a> for
more options.`,name:"ray_scope"},{anchor:"transformers.TrainingArguments.ddp_timeout",description:`<strong>ddp_timeout</strong> (<code>int</code>, <em>optional</em>, defaults to 1800) &#x2014;
The timeout for <code>torch.distributed.init_process_group</code> calls, used to avoid GPU socket timeouts when
performing slow operations in distributed runnings. Please refer the [PyTorch documentation]
(<a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group" rel="nofollow">https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group</a>) for more
information.`,name:"ddp_timeout"},{anchor:"transformers.TrainingArguments.use_mps_device",description:`<strong>use_mps_device</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use Apple Silicon chip based <code>mps</code> device.`,name:"use_mps_device"},{anchor:"transformers.TrainingArguments.torch_compile",description:`<strong>torch_compile</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to compile the model using PyTorch 2.0
<a href="https://pytorch.org/get-started/pytorch-2.0/" rel="nofollow"><code>torch.compile</code></a>.</p>
<p>This will use the best defaults for the <a href="https://pytorch.org/docs/stable/generated/torch.compile.html?highlight=torch+compile#torch.compile" rel="nofollow"><code>torch.compile</code>
API</a>.
You can customize the defaults with the argument <code>torch_compile_backend</code> and <code>torch_compile_mode</code> but we
don&#x2019;t guarantee any of them will work as the support is progressively rolled in in PyTorch.</p>
<p>This flag and the whole compile API is experimental and subject to change in future releases.`,name:"torch_compile"},{anchor:"transformers.TrainingArguments.torch_compile_backend",description:`<strong>torch_compile_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Refer to the PyTorch doc for possible values and note that they may change across PyTorch versions.</p>
<p>This flag is experimental and subject to change in future releases.`,name:"torch_compile_backend"},{anchor:"transformers.TrainingArguments.torch_compile_mode",description:`<strong>torch_compile_mode</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The mode to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Refer to the PyTorch doc for possible values and note that they may change across PyTorch versions.</p>
<p>This flag is experimental and subject to change in future releases.`,name:"torch_compile_mode"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args.py#L156"}}),Ks=new P({props:{name:"get_process_log_level",anchor:"transformers.TrainingArguments.get_process_log_level",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args.py#L1883"}}),ti=new P({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.30.0/src/transformers/training_args.py#L1976"}}),oi=new P({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.30.0/src/transformers/training_args.py#L1921"}}),ri=new P({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.30.0/src/transformers/training_args.py#L2482"}}),ea=new ko({props:{anchor:"transformers.TrainingArguments.set_dataloader.example",$$slots:{default:[TZ]},$$scope:{ctx:C}}}),ai=new P({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.30.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.30.0/src/transformers/training_args.py#L2097"}}),ta=new ko({props:{anchor:"transformers.TrainingArguments.set_evaluate.example",$$slots:{default:[EZ]},$$scope:{ctx:C}}}),ni=new P({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.30.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.30.0/src/transformers/training_args.py#L2247"}}),oa=new ko({props:{anchor:"transformers.TrainingArguments.set_logging.example",$$slots:{default:[$Z]},$$scope:{ctx:C}}}),si=new P({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.30.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.30.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.30.0/src/transformers/training_args.py#L2437"}}),ra=new ko({props:{anchor:"transformers.TrainingArguments.set_lr_scheduler.example",$$slots:{default:[kZ]},$$scope:{ctx:C}}}),ii=new P({props:{name:"set_optimizer",anchor:"transformers.TrainingArguments.set_optimizer",parameters:[{name:"name",val:": typing.Union[str, transformers.training_args.OptimizerNames] = 'adamw_hf'"},{name:"learning_rate",val:": float = 5e-05"},{name:"weight_decay",val:": float = 0"},{name:"beta1",val:": float = 0.9"},{name:"beta2",val:": float = 0.999"},{name:"epsilon",val:": float = 1e-08"},{name:"args",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_optimizer.name",description:`<strong>name</strong> (<code>str</code> or <code>training_args.OptimizerNames</code>, <em>optional</em>, defaults to <code>&quot;adamw_hf&quot;</code>) &#x2014;
The optimizer to use: <code>&quot;adamw_hf&quot;</code>, <code>&quot;adamw_torch&quot;</code>, <code>&quot;adamw_torch_fused&quot;</code>, <code>&quot;adamw_apex_fused&quot;</code>,
<code>&quot;adamw_anyprecision&quot;</code> or <code>&quot;adafactor&quot;</code>.`,name:"name"},{anchor:"transformers.TrainingArguments.set_optimizer.learning_rate",description:`<strong>learning_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 5e-5) &#x2014;
The initial learning rate.`,name:"learning_rate"},{anchor:"transformers.TrainingArguments.set_optimizer.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights.`,name:"weight_decay"},{anchor:"transformers.TrainingArguments.set_optimizer.beta1",description:`<strong>beta1</strong> (<code>float</code>, <em>optional</em>, defaults to 0.9) &#x2014;
The beta1 hyperparameter for the adam optimizer or its variants.`,name:"beta1"},{anchor:"transformers.TrainingArguments.set_optimizer.beta2",description:`<strong>beta2</strong> (<code>float</code>, <em>optional</em>, defaults to 0.999) &#x2014;
The beta2 hyperparameter for the adam optimizer or its variants.`,name:"beta2"},{anchor:"transformers.TrainingArguments.set_optimizer.epsilon",description:`<strong>epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-8) &#x2014;
The epsilon hyperparameter for the adam optimizer or its variants.`,name:"epsilon"},{anchor:"transformers.TrainingArguments.set_optimizer.args",description:`<strong>args</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional arguments that are supplied to AnyPrecisionAdamW (only useful when
<code>optim=&quot;adamw_anyprecision&quot;</code>).`,name:"args"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args.py#L2386"}}),aa=new ko({props:{anchor:"transformers.TrainingArguments.set_optimizer.example",$$slots:{default:[xZ]},$$scope:{ctx:C}}}),li=new P({props:{name:"set_push_to_hub",anchor:"transformers.TrainingArguments.set_push_to_hub",parameters:[{name:"model_id",val:": str"},{name:"strategy",val:": typing.Union[str, transformers.trainer_utils.HubStrategy] = 'every_save'"},{name:"token",val:": typing.Optional[str] = None"},{name:"private_repo",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TrainingArguments.set_push_to_hub.model_id",description:`<strong>model_id</strong> (<code>str</code>) &#x2014;
The name of the repository to keep in sync with the local <em>output_dir</em>. It can be a simple model ID in
which case the model will be pushed in your namespace. Otherwise it should be the whole repository
name, for instance <code>&quot;user_name/model&quot;</code>, which allows you to push to an organization you are a member of
with <code>&quot;organization_name/model&quot;</code>.`,name:"model_id"},{anchor:"transformers.TrainingArguments.set_push_to_hub.strategy",description:`<strong>strategy</strong> (<code>str</code> or <code>HubStrategy</code>, <em>optional</em>, defaults to <code>&quot;every_save&quot;</code>) &#x2014;
Defines the scope of what is pushed to the Hub and when. Possible values are:</p>
<ul>
<li><code>&quot;end&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.30.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.30.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.30.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>)
and
a draft of a model card each time there is a model save. The pushes are asynchronous to not block
training, and in case the save are very frequent, a new push is only attempted if the previous one is
finished. A last push is made with the final model at the end of training.</li>
<li><code>&quot;checkpoint&quot;</code>: like <code>&quot;every_save&quot;</code> but the latest checkpoint is also pushed in a subfolder named
last-checkpoint, allowing you to resume training easily with
<code>trainer.train(resume_from_checkpoint=&quot;last-checkpoint&quot;)</code>.</li>
<li><code>&quot;all_checkpoints&quot;</code>: like <code>&quot;checkpoint&quot;</code> but all checkpoints are pushed like they appear in the
output
folder (so you will get one checkpoint folder per folder in your final repository)</li>
</ul>`,name:"strategy"},{anchor:"transformers.TrainingArguments.set_push_to_hub.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained
with <code>huggingface-cli login</code>.`,name:"token"},{anchor:"transformers.TrainingArguments.set_push_to_hub.private_repo",description:`<strong>private_repo</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, the Hub repo will be set to private.`,name:"private_repo"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args.py#L2321"}}),na=new kr({props:{$$slots:{default:[AZ]},$$scope:{ctx:C}}}),sa=new ko({props:{anchor:"transformers.TrainingArguments.set_push_to_hub.example",$$slots:{default:[qZ]},$$scope:{ctx:C}}}),di=new P({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.30.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.30.0/src/transformers/training_args.py#L2198"}}),ia=new ko({props:{anchor:"transformers.TrainingArguments.set_save.example",$$slots:{default:[SZ]},$$scope:{ctx:C}}}),ci=new P({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.30.0/src/transformers/training_args.py#L2158"}}),la=new kr({props:{$$slots:{default:[PZ]},$$scope:{ctx:C}}}),da=new ko({props:{anchor:"transformers.TrainingArguments.set_testing.example",$$slots:{default:[DZ]},$$scope:{ctx:C}}}),mi=new P({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.30.0/src/transformers/training_args.py#L2022"}}),ca=new kr({props:{$$slots:{default:[UZ]},$$scope:{ctx:C}}}),ma=new ko({props:{anchor:"transformers.TrainingArguments.set_training.example",$$slots:{default:[CZ]},$$scope:{ctx:C}}}),pi=new P({props:{name:"to_dict",anchor:"transformers.TrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args.py#L1985"}}),ui=new P({props:{name:"to_json_string",anchor:"transformers.TrainingArguments.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args.py#L2002"}}),fi=new P({props:{name:"to_sanitized_dict",anchor:"transformers.TrainingArguments.to_sanitized_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args.py#L2008"}}),gi=new te({}),_i=new P({props:{name:"class transformers.Seq2SeqTrainingArguments",anchor:"transformers.Seq2SeqTrainingArguments",parameters:[{name:"output_dir",val:": str"},{name:"overwrite_output_dir",val:": bool = False"},{name:"do_train",val:": bool = False"},{name:"do_eval",val:": bool = False"},{name:"do_predict",val:": bool = False"},{name:"evaluation_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'no'"},{name:"prediction_loss_only",val:": bool = False"},{name:"per_device_train_batch_size",val:": int = 8"},{name:"per_device_eval_batch_size",val:": int = 8"},{name:"per_gpu_train_batch_size",val:": typing.Optional[int] = None"},{name:"per_gpu_eval_batch_size",val:": typing.Optional[int] = None"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"eval_accumulation_steps",val:": typing.Optional[int] = None"},{name:"eval_delay",val:": typing.Optional[float] = 0"},{name:"learning_rate",val:": float = 5e-05"},{name:"weight_decay",val:": float = 0.0"},{name:"adam_beta1",val:": float = 0.9"},{name:"adam_beta2",val:": float = 0.999"},{name:"adam_epsilon",val:": float = 1e-08"},{name:"max_grad_norm",val:": float = 1.0"},{name:"num_train_epochs",val:": float = 3.0"},{name:"max_steps",val:": int = -1"},{name:"lr_scheduler_type",val:": typing.Union[transformers.trainer_utils.SchedulerType, str] = 'linear'"},{name:"warmup_ratio",val:": float = 0.0"},{name:"warmup_steps",val:": int = 0"},{name:"log_level",val:": typing.Optional[str] = 'passive'"},{name:"log_level_replica",val:": typing.Optional[str] = 'warning'"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_dir",val:": typing.Optional[str] = None"},{name:"logging_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"logging_first_step",val:": bool = False"},{name:"logging_steps",val:": float = 500"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"save_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"save_steps",val:": float = 500"},{name:"save_total_limit",val:": typing.Optional[int] = None"},{name:"save_safetensors",val:": typing.Optional[bool] = False"},{name:"save_on_each_node",val:": bool = False"},{name:"no_cuda",val:": bool = False"},{name:"use_mps_device",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": typing.Optional[int] = None"},{name:"jit_mode_eval",val:": bool = False"},{name:"use_ipex",val:": bool = False"},{name:"bf16",val:": bool = False"},{name:"fp16",val:": bool = False"},{name:"fp16_opt_level",val:": str = 'O1'"},{name:"half_precision_backend",val:": str = 'auto'"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": typing.Optional[bool] = None"},{name:"local_rank",val:": int = -1"},{name:"ddp_backend",val:": typing.Optional[str] = None"},{name:"tpu_num_cores",val:": typing.Optional[int] = None"},{name:"tpu_metrics_debug",val:": bool = False"},{name:"debug",val:": str = ''"},{name:"dataloader_drop_last",val:": bool = False"},{name:"eval_steps",val:": typing.Optional[float] = None"},{name:"dataloader_num_workers",val:": int = 0"},{name:"past_index",val:": int = -1"},{name:"run_name",val:": typing.Optional[str] = None"},{name:"disable_tqdm",val:": typing.Optional[bool] = None"},{name:"remove_unused_columns",val:": typing.Optional[bool] = True"},{name:"label_names",val:": typing.Optional[typing.List[str]] = None"},{name:"load_best_model_at_end",val:": typing.Optional[bool] = False"},{name:"metric_for_best_model",val:": typing.Optional[str] = None"},{name:"greater_is_better",val:": typing.Optional[bool] = None"},{name:"ignore_data_skip",val:": bool = False"},{name:"sharded_ddp",val:": str = ''"},{name:"fsdp",val:": str = ''"},{name:"fsdp_min_num_params",val:": int = 0"},{name:"fsdp_config",val:": typing.Optional[str] = None"},{name:"fsdp_transformer_layer_cls_to_wrap",val:": typing.Optional[str] = None"},{name:"deepspeed",val:": typing.Optional[str] = None"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"optim",val:": typing.Union[transformers.training_args.OptimizerNames, str] = 'adamw_hf'"},{name:"optim_args",val:": typing.Optional[str] = None"},{name:"adafactor",val:": bool = False"},{name:"group_by_length",val:": bool = False"},{name:"length_column_name",val:": typing.Optional[str] = 'length'"},{name:"report_to",val:": typing.Optional[typing.List[str]] = None"},{name:"ddp_find_unused_parameters",val:": typing.Optional[bool] = None"},{name:"ddp_bucket_cap_mb",val:": typing.Optional[int] = None"},{name:"dataloader_pin_memory",val:": bool = True"},{name:"skip_memory_metrics",val:": bool = True"},{name:"use_legacy_prediction_loop",val:": bool = False"},{name:"push_to_hub",val:": bool = False"},{name:"resume_from_checkpoint",val:": typing.Optional[str] = None"},{name:"hub_model_id",val:": typing.Optional[str] = None"},{name:"hub_strategy",val:": typing.Union[transformers.trainer_utils.HubStrategy, str] = 'every_save'"},{name:"hub_token",val:": typing.Optional[str] = None"},{name:"hub_private_repo",val:": bool = False"},{name:"gradient_checkpointing",val:": bool = False"},{name:"include_inputs_for_metrics",val:": bool = False"},{name:"fp16_backend",val:": str = 'auto'"},{name:"push_to_hub_model_id",val:": typing.Optional[str] = None"},{name:"push_to_hub_organization",val:": typing.Optional[str] = None"},{name:"push_to_hub_token",val:": typing.Optional[str] = None"},{name:"mp_parameters",val:": str = ''"},{name:"auto_find_batch_size",val:": bool = False"},{name:"full_determinism",val:": bool = False"},{name:"torchdynamo",val:": typing.Optional[str] = None"},{name:"ray_scope",val:": typing.Optional[str] = 'last'"},{name:"ddp_timeout",val:": typing.Optional[int] = 1800"},{name:"torch_compile",val:": bool = False"},{name:"torch_compile_backend",val:": typing.Optional[str] = None"},{name:"torch_compile_mode",val:": typing.Optional[str] = None"},{name:"xpu_backend",val:": typing.Optional[str] = None"},{name:"sortish_sampler",val:": bool = False"},{name:"predict_with_generate",val:": bool = False"},{name:"generation_max_length",val:": typing.Optional[int] = None"},{name:"generation_num_beams",val:": typing.Optional[int] = None"},{name:"generation_config",val:": typing.Union[str, pathlib.Path, transformers.generation.configuration_utils.GenerationConfig, NoneType] = None"}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainingArguments.output_dir",description:`<strong>output_dir</strong> (<code>str</code>) &#x2014;
The output directory where the model predictions and checkpoints will be written.`,name:"output_dir"},{anchor:"transformers.Seq2SeqTrainingArguments.overwrite_output_dir",description:`<strong>overwrite_output_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, overwrite the content of the output directory. Use this to continue training if <code>output_dir</code>
points to a checkpoint directory.`,name:"overwrite_output_dir"},{anchor:"transformers.Seq2SeqTrainingArguments.do_train",description:`<strong>do_train</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run training or not. This argument is not directly used by <a href="/docs/transformers/v4.30.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.30.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.30.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.30.0/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;no&quot;</code>) &#x2014;
The evaluation strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No evaluation is done during training.</li>
<li><code>&quot;steps&quot;</code>: Evaluation is done (and logged) every <code>eval_steps</code>.</li>
<li><code>&quot;epoch&quot;</code>: Evaluation is done at the end of each epoch.</li>
</ul>`,name:"evaluation_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.prediction_loss_only",description:`<strong>prediction_loss_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When performing evaluation and generating predictions, only returns the loss.`,name:"prediction_loss_only"},{anchor:"transformers.Seq2SeqTrainingArguments.per_device_train_batch_size",description:`<strong>per_device_train_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for training.`,name:"per_device_train_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.per_device_eval_batch_size",description:`<strong>per_device_eval_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for evaluation.`,name:"per_device_eval_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.gradient_accumulation_steps",description:`<strong>gradient_accumulation_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of updates steps to accumulate the gradients for, before performing a backward/update pass.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>When using gradient accumulation, one step is counted as one step with backward pass. Therefore, logging,
evaluation, save will be conducted every <code>gradient_accumulation_steps * xxx_step</code> training examples.</p>

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

					</div>`,name:"load_best_model_at_end"},{anchor:"transformers.Seq2SeqTrainingArguments.metric_for_best_model",description:`<strong>metric_for_best_model</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> to specify the metric to use to compare two different
models. Must be the name of a metric returned by the evaluation with or without the prefix <code>&quot;eval_&quot;</code>. Will
default to <code>&quot;loss&quot;</code> if unspecified and <code>load_best_model_at_end=True</code> (to use the evaluation loss).</p>
<p>If you set this value, <code>greater_is_better</code> will default to <code>True</code>. Don&#x2019;t forget to set it to <code>False</code> if
your metric is better when lower.`,name:"metric_for_best_model"},{anchor:"transformers.Seq2SeqTrainingArguments.greater_is_better",description:`<strong>greater_is_better</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> and <code>metric_for_best_model</code> to specify if better models
should have a greater metric or not. Will default to:</p>
<ul>
<li><code>True</code> if <code>metric_for_best_model</code> is set to a value that isn&#x2019;t <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
<li><code>False</code> if <code>metric_for_best_model</code> is not set, or set to <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
</ul>`,name:"greater_is_better"},{anchor:"transformers.Seq2SeqTrainingArguments.ignore_data_skip",description:`<strong>ignore_data_skip</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When resuming training, whether or not to skip the epochs and batches to get the data loading at the same
stage as in the previous training. If set to <code>True</code>, the training will begin faster (as that skipping step
can take a long time) but will not yield the same results as the interrupted training would have.`,name:"ignore_data_skip"},{anchor:"transformers.Seq2SeqTrainingArguments.sharded_ddp",description:`<strong>sharded_ddp</strong> (<code>bool</code>, <code>str</code> or list of <code>ShardedDDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Sharded DDP training from <a href="https://github.com/facebookresearch/fairscale" rel="nofollow">FairScale</a> (in distributed
training only). This is an experimental feature.</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;simple&quot;</code>: to use first instance of sharded DDP released by fairscale (<code>ShardedDDP</code>) similar to ZeRO-2.</li>
<li><code>&quot;zero_dp_2&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-2 mode (with <code>reshard_after_forward=False</code>).</li>
<li><code>&quot;zero_dp_3&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-3 mode (with <code>reshard_after_forward=True</code>).</li>
<li><code>&quot;offload&quot;</code>: to add ZeRO-offload (only compatible with <code>&quot;zero_dp_2&quot;</code> and <code>&quot;zero_dp_3&quot;</code>).</li>
</ul>
<p>If a string is passed, it will be split on space. If a bool is passed, it will be converted to an empty
list for <code>False</code> and <code>[&quot;simple&quot;]</code> for <code>True</code>.`,name:"sharded_ddp"},{anchor:"transformers.Seq2SeqTrainingArguments.fsdp",description:`<strong>fsdp</strong> (<code>bool</code>, <code>str</code> or list of <code>FSDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use PyTorch Distributed Parallel Training (in distributed training only).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;full_shard&quot;</code>: Shard parameters, gradients and optimizer states.</li>
<li><code>&quot;shard_grad_op&quot;</code>: Shard optimizer states and gradients.</li>
<li><code>&quot;offload&quot;</code>: Offload parameters and gradients to CPUs (only compatible with <code>&quot;full_shard&quot;</code> and
<code>&quot;shard_grad_op&quot;</code>).</li>
<li><code>&quot;auto_wrap&quot;</code>: Automatically recursively wrap layers with FSDP using <code>default_auto_wrap_policy</code>.</li>
</ul>`,name:"fsdp"},{anchor:"transformers.Seq2SeqTrainingArguments.fsdp_config",description:`<strong>fsdp_config</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
Config to be used with fsdp (Pytorch Distributed Parallel Training). The value is either a location of
deepspeed json config file (e.g., <code>ds_config.json</code>) or an already loaded json file as <code>dict</code>.</p>
<p>A List of config and its options:</p>
<ul>
<li>
<p>fsdp_min_num_params (<code>int</code>, <em>optional</em>, defaults to <code>0</code>):
FSDP&#x2019;s minimum number of parameters for Default Auto Wrapping. (useful only when <code>fsdp</code> field is
passed).</p>
</li>
<li>
<p>fsdp_transformer_layer_cls_to_wrap (<code>List[str]</code>, <em>optional</em>):
List of transformer layer class names (case-sensitive) to wrap, e.g, <code>BertLayer</code>, <code>GPTJBlock</code>,
<code>T5Block</code> &#x2026; (useful only when <code>fsdp</code> flag is passed).</p>
</li>
<li>
<p>fsdp_backward_prefetch (<code>str</code>, <em>optional</em>)
FSDP&#x2019;s backward prefetch mode. Controls when to prefetch next set of parameters (useful only when
<code>fsdp</code> field is passed).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;backward_pre&quot;</code> : Prefetches the next set of parameters before the current set of parameter&#x2019;s
gradient
computation.</li>
<li><code>&quot;backward_post&quot;</code> : This prefetches the next set of parameters after the current set of
parameter&#x2019;s
gradient computation.</li>
</ul>
</li>
<li>
<p>fsdp_forward_prefetch (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
FSDP&#x2019;s forward prefetch mode (useful only when <code>fsdp</code> field is passed).
If <code>&quot;True&quot;</code>, then FSDP explicitly prefetches the next upcoming all-gather while executing in the
forward pass.</p>
</li>
<li>
<p>limit_all_gathers (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>)
FSDP&#x2019;s limit_all_gathers (useful only when <code>fsdp</code> field is passed).
If <code>&quot;True&quot;</code>, FSDP explicitly synchronizes the CPU thread to prevent too many in-flight
all-gathers.</p>
</li>
<li>
<p>xla (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether to use PyTorch/XLA Fully Sharded Data Parallel Training. This is an experimental feature
and its API may evolve in the future.</p>
</li>
<li>
<p>xla_fsdp_settings (<code>dict</code>, <em>optional</em>)
The value is a dictionary which stores the XLA FSDP wrapping parameters.</p>
<p>For a complete list of options, please see <a href="https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py" rel="nofollow">here</a>.</p>
</li>
<li>
<p>xla_fsdp_grad_ckpt (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Will use gradient checkpointing over each nested XLA FSDP wrapped layer. This setting can only be
used when the xla flag is set to true, and an auto wrapping policy is specified through
fsdp_min_num_params or fsdp_transformer_layer_cls_to_wrap.</p>
</li>
</ul>`,name:"fsdp_config"},{anchor:"transformers.Seq2SeqTrainingArguments.deepspeed",description:`<strong>deepspeed</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
Use <a href="https://github.com/microsoft/deepspeed" rel="nofollow">Deepspeed</a>. This is an experimental feature and its API may
evolve in the future. The value is either the location of DeepSpeed json config file (e.g.,
<code>ds_config.json</code>) or an already loaded json file as a <code>dict</code>&#x201D;`,name:"deepspeed"},{anchor:"transformers.Seq2SeqTrainingArguments.label_smoothing_factor",description:`<strong>label_smoothing_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The label smoothing factor to use. Zero means no label smoothing, otherwise the underlying onehot-encoded
labels are changed from 0s and 1s to <code>label_smoothing_factor/num_labels</code> and <code>1 - label_smoothing_factor + label_smoothing_factor/num_labels</code> respectively.`,name:"label_smoothing_factor"},{anchor:"transformers.Seq2SeqTrainingArguments.debug",description:`<strong>debug</strong> (<code>str</code> or list of <code>DebugOption</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
Enable one or more debug features. This is an experimental feature.</p>
<p>Possible options are:</p>
<ul>
<li><code>&quot;underflow_overflow&quot;</code>: detects overflow in model&#x2019;s input/outputs and reports the last frames that led to
the event</li>
<li><code>&quot;tpu_metrics_debug&quot;</code>: print debug metrics on TPU</li>
</ul>
<p>The options should be separated by whitespaces.`,name:"debug"},{anchor:"transformers.Seq2SeqTrainingArguments.optim",description:`<strong>optim</strong> (<code>str</code> or <code>training_args.OptimizerNames</code>, <em>optional</em>, defaults to <code>&quot;adamw_hf&quot;</code>) &#x2014;
The optimizer to use: adamw_hf, adamw_torch, adamw_torch_fused, adamw_apex_fused, adamw_anyprecision or
adafactor.`,name:"optim"},{anchor:"transformers.Seq2SeqTrainingArguments.optim_args",description:`<strong>optim_args</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional arguments that are supplied to AnyPrecisionAdamW.`,name:"optim_args"},{anchor:"transformers.Seq2SeqTrainingArguments.group_by_length",description:`<strong>group_by_length</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to group together samples of roughly the same length in the training dataset (to minimize
padding applied and be more efficient). Only useful if applying dynamic padding.`,name:"group_by_length"},{anchor:"transformers.Seq2SeqTrainingArguments.length_column_name",description:`<strong>length_column_name</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;length&quot;</code>) &#x2014;
Column name for precomputed lengths. If the column exists, grouping by length will use these values rather
than computing them on train startup. Ignored unless <code>group_by_length</code> is <code>True</code> and the dataset is an
instance of <code>Dataset</code>.`,name:"length_column_name"},{anchor:"transformers.Seq2SeqTrainingArguments.report_to",description:`<strong>report_to</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>, defaults to <code>&quot;all&quot;</code>) &#x2014;
The list of integrations to report the results and logs to. Supported platforms are <code>&quot;azure_ml&quot;</code>,
<code>&quot;comet_ml&quot;</code>, <code>&quot;mlflow&quot;</code>, <code>&quot;neptune&quot;</code>, <code>&quot;tensorboard&quot;</code>,<code>&quot;clearml&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report to
all integrations installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_find_unused_parameters",description:`<strong>ddp_find_unused_parameters</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>find_unused_parameters</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_find_unused_parameters"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_bucket_cap_mb",description:`<strong>ddp_bucket_cap_mb</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>bucket_cap_mb</code> passed to <code>DistributedDataParallel</code>.`,name:"ddp_bucket_cap_mb"},{anchor:"transformers.Seq2SeqTrainingArguments.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.30.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.30.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.30.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.30.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.30.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.30.0/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and
a draft of a model card each time there is a model save. The pushes are asynchronous to not block
training, and in case the save are very frequent, a new push is only attempted if the previous one is
finished. A last push is made with the final model at the end of training.</li>
<li><code>&quot;checkpoint&quot;</code>: like <code>&quot;every_save&quot;</code> but the latest checkpoint is also pushed in a subfolder named
last-checkpoint, allowing you to resume training easily with
<code>trainer.train(resume_from_checkpoint=&quot;last-checkpoint&quot;)</code>.</li>
<li><code>&quot;all_checkpoints&quot;</code>: like <code>&quot;checkpoint&quot;</code> but all checkpoints are pushed like they appear in the output
folder (so you will get one checkpoint folder per folder in your final repository)</li>
</ul>`,name:"hub_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_token",description:`<strong>hub_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with
<code>huggingface-cli login</code>.`,name:"hub_token"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_private_repo",description:`<strong>hub_private_repo</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, the Hub repo will be set to private.`,name:"hub_private_repo"},{anchor:"transformers.Seq2SeqTrainingArguments.gradient_checkpointing",description:`<strong>gradient_checkpointing</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, use gradient checkpointing to save memory at the expense of slower backward pass.`,name:"gradient_checkpointing"},{anchor:"transformers.Seq2SeqTrainingArguments.include_inputs_for_metrics",description:`<strong>include_inputs_for_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the inputs will be passed to the <code>compute_metrics</code> function. This is intended for metrics
that need inputs, predictions and references for scoring calculation in Metric class.`,name:"include_inputs_for_metrics"},{anchor:"transformers.Seq2SeqTrainingArguments.auto_find_batch_size",description:`<strong>auto_find_batch_size</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding
CUDA Out-of-Memory errors. Requires accelerate to be installed (<code>pip install accelerate</code>)`,name:"auto_find_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.full_determinism",description:`<strong>full_determinism</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, <a href="/docs/transformers/v4.30.0/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.30.0/en/internal/trainer_utils#transformers.set_seed">set_seed()</a> to ensure reproducible results in
distributed training. Important: this will negatively impact the performance, so only use it for debugging.`,name:"full_determinism"},{anchor:"transformers.Seq2SeqTrainingArguments.torchdynamo",description:`<strong>torchdynamo</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If set, the backend compiler for TorchDynamo. Possible choices are <code>&quot;eager&quot;</code>, <code>&quot;aot_eager&quot;</code>, <code>&quot;inductor&quot;</code>,
<code>&quot;nvfuser&quot;</code>, <code>&quot;aot_nvfuser&quot;</code>, <code>&quot;aot_cudagraphs&quot;</code>, <code>&quot;ofi&quot;</code>, <code>&quot;fx2trt&quot;</code>, <code>&quot;onnxrt&quot;</code> and <code>&quot;ipex&quot;</code>.`,name:"torchdynamo"},{anchor:"transformers.Seq2SeqTrainingArguments.ray_scope",description:`<strong>ray_scope</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;last&quot;</code>) &#x2014;
The scope to use when doing hyperparameter search with Ray. By default, <code>&quot;last&quot;</code> will be used. Ray will
then use the last checkpoint of all trials, compare those, and select the best one. However, other options
are also available. See the <a href="https://docs.ray.io/en/latest/tune/api_docs/analysis.html#ray.tune.ExperimentAnalysis.get_best_trial" rel="nofollow">Ray documentation</a> for
more options.`,name:"ray_scope"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_timeout",description:`<strong>ddp_timeout</strong> (<code>int</code>, <em>optional</em>, defaults to 1800) &#x2014;
The timeout for <code>torch.distributed.init_process_group</code> calls, used to avoid GPU socket timeouts when
performing slow operations in distributed runnings. Please refer the [PyTorch documentation]
(<a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group" rel="nofollow">https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group</a>) for more
information.`,name:"ddp_timeout"},{anchor:"transformers.Seq2SeqTrainingArguments.use_mps_device",description:`<strong>use_mps_device</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use Apple Silicon chip based <code>mps</code> device.`,name:"use_mps_device"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile",description:`<strong>torch_compile</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to compile the model using PyTorch 2.0
<a href="https://pytorch.org/get-started/pytorch-2.0/" rel="nofollow"><code>torch.compile</code></a>.</p>
<p>This will use the best defaults for the <a href="https://pytorch.org/docs/stable/generated/torch.compile.html?highlight=torch+compile#torch.compile" rel="nofollow"><code>torch.compile</code>
API</a>.
You can customize the defaults with the argument <code>torch_compile_backend</code> and <code>torch_compile_mode</code> but we
don&#x2019;t guarantee any of them will work as the support is progressively rolled in in PyTorch.</p>
<p>This flag and the whole compile API is experimental and subject to change in future releases.`,name:"torch_compile"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile_backend",description:`<strong>torch_compile_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Refer to the PyTorch doc for possible values and note that they may change across PyTorch versions.</p>
<p>This flag is experimental and subject to change in future releases.`,name:"torch_compile_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile_mode",description:`<strong>torch_compile_mode</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The mode to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Refer to the PyTorch doc for possible values and note that they may change across PyTorch versions.</p>
<p>This flag is experimental and subject to change in future releases.`,name:"torch_compile_mode"},{anchor:"transformers.Seq2SeqTrainingArguments.sortish_sampler",description:`<strong>sortish_sampler</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a <em>sortish sampler</em> or not. Only possible if the underlying datasets are <em>Seq2SeqDataset</em>
for now but will become generally available in the near future.</p>
<p>It sorts the inputs according to lengths in order to minimize the padding size, with a bit of randomness
for the training set.`,name:"sortish_sampler"},{anchor:"transformers.Seq2SeqTrainingArguments.predict_with_generate",description:`<strong>predict_with_generate</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use generate to calculate generative metrics (ROUGE, BLEU).`,name:"predict_with_generate"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_max_length",description:`<strong>generation_max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The <code>max_length</code> to use on each evaluation loop when <code>predict_with_generate=True</code>. Will default to the
<code>max_length</code> value of the model configuration.`,name:"generation_max_length"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_num_beams",description:`<strong>generation_num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The <code>num_beams</code> to use on each evaluation loop when <code>predict_with_generate=True</code>. Will default to the
<code>num_beams</code> value of the model configuration.`,name:"generation_num_beams"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_config",description:`<strong>generation_config</strong> (<code>str</code> or <code>Path</code> or <a href="/docs/transformers/v4.30.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a>, <em>optional</em>) &#x2014;
Allows to load a <a href="/docs/transformers/v4.30.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.30.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.30.0/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a> object.</li>
</ul>`,name:"generation_config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args_seq2seq.py#L30"}}),yi=new P({props:{name:"to_dict",anchor:"transformers.Seq2SeqTrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/training_args_seq2seq.py#L87"}}),wi=new te({}),Ti=new te({}),Ei=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(...)`}}),$i=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9y",highlighted:"my_app.py ... --log_level warning --log_level_replica error"}}),ki=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9yJTIwLS1sb2dfb25fZWFjaF9ub2RlJTIwMA==",highlighted:"my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0"}}),xi=new U({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjBlcnJvciUyMC0tbG9nX2xldmVsX3JlcGxpY2ElMjBlcnJvciUyMC0tbG9nX29uX2VhY2hfbm9kZSUyMDA=",highlighted:"my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0"}}),Ai=new te({}),Si=new te({}),Di=new U({props:{code:"cHl0aG9uJTIwLW0lMjB0b3JjaC5kaXN0cmlidXRlZC5sYXVuY2glMjAtLW5wcm9jX3Blcl9ub2RlJTNEMiUyMCUyMHRyYWluZXItcHJvZ3JhbS5weSUyMC4uLg==",highlighted:"python -m torch.distributed.launch --nproc_per_node=2  trainer-program.py ..."}}),Ii=new U({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbnVtX3Byb2Nlc3NlcyUyMDIlMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"accelerate launch --num_processes 2 trainer-program.py ..."}}),Mi=new U({props:{code:"ZGVlcHNwZWVkJTIwLS1udW1fZ3B1cyUyMDIlMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"deepspeed --num_gpus 2 trainer-program.py ..."}}),Fi=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QwJTJDMiUyMHB5dGhvbiUyMC1tJTIwdG9yY2guZGlzdHJpYnV0ZWQubGF1bmNoJTIwdHJhaW5lci1wcm9ncmFtLnB5JTIwLi4u",highlighted:"CUDA_VISIBLE_DEVICES=0,2 python -m torch.distributed.launch trainer-program.py ..."}}),Oi=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QyJTJDMCUyMHB5dGhvbiUyMC1tJTIwdG9yY2guZGlzdHJpYnV0ZWQubGF1bmNoJTIwdHJhaW5lci1wcm9ncmFtLnB5JTIwLi4u",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python -m torch.distributed.launch trainer-program.py ..."}}),Ni=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QyJTJDMCUyMHB5dGhvbiUyMHRyYWluZXItcHJvZ3JhbS5weSUyMC4uLg==",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ..."}}),Ji=new U({props:{code:"Q1VEQV9WSVNJQkxFX0RFVklDRVMlM0QlMjBweXRob24lMjB0cmFpbmVyLXByb2dyYW0ucHklMjAuLi4=",highlighted:"CUDA_VISIBLE_DEVICES= python trainer-program.py ..."}}),Wi=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 ...`}}),Ri=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9ERVZJQ0VfT1JERVIlM0RQQ0lfQlVTX0lE",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=PCI_BUS_ID'}}),Gi=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9ERVZJQ0VfT1JERVIlM0RGQVNURVNUX0ZJUlNU",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=FASTEST_FIRST'}}),Bi=new U({props:{code:"ZXhwb3J0JTIwQ1VEQV9WSVNJQkxFX0RFVklDRVMlM0QxJTJDMA==",highlighted:'<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=1,0'}}),Vi=new te({}),Qi=new te({}),tl=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMGZhaXJzY2FsZSUwQXBpcCUyMGluc3RhbGwlMjBkZWVwc3BlZWQ=",highlighted:`pip install fairscale
pip install deepspeed`}}),ol=new te({}),rl=new U({props:{code:"d2hpY2glMjBudmNj",highlighted:'<span class="hljs-built_in">which</span> nvcc'}}),nl=new te({}),sl=new U({props:{code:"JTJGdXNyJTJGbG9jYWwlMkZjdWRhLTEwLjIlMEElMkZ1c3IlMkZsb2NhbCUyRmN1ZGEtMTEuMA==",highlighted:`/usr/local/cuda-10.2
/usr/local/cuda-11.0`}}),il=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>`}}),ll=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>`}}),dl=new te({}),cl=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++`}}),ml=new te({}),Ra=new kr({props:{warning:!0,$$slots:{default:[IZ]},$$scope:{ctx:C}}}),fl=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMGZhaXJzY2FsZQ==",highlighted:"pip install fairscale"}}),gl=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyU1QmZhaXJzY2FsZSU1RA==",highlighted:"pip install transformers[fairscale]"}}),bl=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMGZhaXJzY2FsZSUyMC0tbm8tYnVpbGQtaXNvbGF0aW9uJTIwLg==",highlighted:"pip install fairscale --no-build-isolation ."}}),yl=new U({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZmYWNlYm9va3Jlc2VhcmNoJTJGZmFpcnNjYWxlJTJGJTBBY2QlMjBmYWlyc2NhbGUlMEFybSUyMC1yJTIwZGlzdCUyMGJ1aWxkJTBBcHl0aG9uJTIwc2V0dXAucHklMjBiZGlzdF93aGVlbCUwQXBpcCUyMHVuaW5zdGFsbCUyMC15JTIwZmFpcnNjYWxlJTBBcGlwJTIwaW5zdGFsbCUyMGRpc3QlMkZmYWlyc2NhbGUtKi53aGw=",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/facebookresearch/fairscale/
<span class="hljs-built_in">cd</span> fairscale
<span class="hljs-built_in">rm</span> -r dist build
python setup.py bdist_wheel
pip uninstall -y fairscale
pip install dist/fairscale-*.whl`}}),Tl=new U({props:{code:"cGlwJTIwdW5pbnN0YWxsJTIwLXklMjBmYWlyc2NhbGUlM0IlMjBwaXAlMjBpbnN0YWxsJTIwZmFpcnNjYWxlJTIwLS1wcmUlMjAlNUMlMEEtZiUyMGh0dHBzJTNBJTJGJTJGZG93bmxvYWQucHl0b3JjaC5vcmclMkZ3aGwlMkZuaWdodGx5JTJGY3UxMTAlMkZ0b3JjaF9uaWdodGx5JTIwJTVDJTBBLS1uby1jYWNoZSUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:`pip uninstall -y fairscale; pip install fairscale --pre \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly \\
--no-cache --no-build-isolation`}}),El=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMC12JTIwLS1kaXNhYmxlLXBpcC12ZXJzaW9uLWNoZWNrJTIwLiUyMCU1QyUwQS1mJTIwaHR0cHMlM0ElMkYlMkZkb3dubG9hZC5weXRvcmNoLm9yZyUyRndobCUyRm5pZ2h0bHklMkZjdTExMCUyRnRvcmNoX25pZ2h0bHklMjAtLXByZQ==",highlighted:`pip install -v --disable-pip-version-check . \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly --pre`}}),xl=new U({props:{code:"cHl0aG9uJTIwLW0lMjB0b3JjaC5kaXN0cmlidXRlZC5sYXVuY2glMjAtLW5wcm9jX3Blcl9ub2RlJTNEMiUyMGV4YW1wbGVzJTJGcHl0b3JjaCUyRnRyYW5zbGF0aW9uJTJGcnVuX3RyYW5zbGF0aW9uLnB5JTIwJTVDJTBBLS1tb2RlbF9uYW1lX29yX3BhdGglMjB0NS1zbWFsbCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwMSUyMCUyMCUyMCU1QyUwQS0tb3V0cHV0X2RpciUyMG91dHB1dF9kaXIlMjAtLW92ZXJ3cml0ZV9vdXRwdXRfZGlyJTIwJTVDJTBBLS1kb190cmFpbiUyMC0tbWF4X3RyYWluX3NhbXBsZXMlMjA1MDAlMjAtLW51bV90cmFpbl9lcG9jaHMlMjAxJTIwJTVDJTBBLS1kYXRhc2V0X25hbWUlMjB3bXQxNiUyMC0tZGF0YXNldF9jb25maWclMjAlMjJyby1lbiUyMiUyMCU1QyUwQS0tc291cmNlX2xhbmclMjBlbiUyMC0tdGFyZ2V0X2xhbmclMjBybyUyMCU1QyUwQS0tZnAxNiUyMC0tc2hhcmRlZF9kZHAlMjBzaW1wbGU=",highlighted:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config <span class="hljs-string">&quot;ro-en&quot;</span> \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp simple`}}),Pl=new U({props:{code:"cHl0aG9uJTIwLW0lMjB0b3JjaC5kaXN0cmlidXRlZC5sYXVuY2glMjAtLW5wcm9jX3Blcl9ub2RlJTNEMiUyMGV4YW1wbGVzJTJGcHl0b3JjaCUyRnRyYW5zbGF0aW9uJTJGcnVuX3RyYW5zbGF0aW9uLnB5JTIwJTVDJTBBLS1tb2RlbF9uYW1lX29yX3BhdGglMjB0NS1zbWFsbCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwMSUyMCUyMCUyMCU1QyUwQS0tb3V0cHV0X2RpciUyMG91dHB1dF9kaXIlMjAtLW92ZXJ3cml0ZV9vdXRwdXRfZGlyJTIwJTVDJTBBLS1kb190cmFpbiUyMC0tbWF4X3RyYWluX3NhbXBsZXMlMjA1MDAlMjAtLW51bV90cmFpbl9lcG9jaHMlMjAxJTIwJTVDJTBBLS1kYXRhc2V0X25hbWUlMjB3bXQxNiUyMC0tZGF0YXNldF9jb25maWclMjAlMjJyby1lbiUyMiUyMCU1QyUwQS0tc291cmNlX2xhbmclMjBlbiUyMC0tdGFyZ2V0X2xhbmclMjBybyUyMCU1QyUwQS0tZnAxNiUyMC0tc2hhcmRlZF9kZHAlMjB6ZXJvX2RwXzI=",highlighted:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config <span class="hljs-string">&quot;ro-en&quot;</span> \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp zero_dp_2`}}),Ul=new te({}),Gl=new te({}),Kl=new te({}),rn=new kr({props:{warning:!1,$$slots:{default:[MZ]},$$scope:{ctx:C}}}),rd=new U({props:{code:"ZXhwb3J0JTIwVEFTS19OQU1FJTNEbXJwYyUwQSUwQXB5dGhvbiUyMGV4YW1wbGVzJTJGcHl0b3JjaCUyRnRleHQtY2xhc3NpZmljYXRpb24lMkZydW5fZ2x1ZS5weSUyMCU1QyUwQSUyMCUyMC0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwYmVydC1iYXNlLWNhc2VkJTIwJTVDJTBBJTIwJTIwLS10YXNrX25hbWUlMjAlMjRUQVNLX05BTUUlMjAlNUMlMEElMjAlMjAtLWRvX3RyYWluJTIwJTVDJTBBJTIwJTIwLS1kb19ldmFsJTIwJTVDJTBBJTIwJTIwLS1tYXhfc2VxX2xlbmd0aCUyMDEyOCUyMCU1QyUwQSUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwMzIlMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlMjAyZS01JTIwJTVDJTBBJTIwJTIwLS1udW1fdHJhaW5fZXBvY2hzJTIwMyUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUyMCUyRnRtcCUyRiUyNFRBU0tfTkFNRSUyRiUyMCU1QyUwQSUyMCUyMC0tdXNlX21wc19kZXZpY2UlMjAlNUMlMEElMjAlMjAtLW92ZXJ3cml0ZV9vdXRwdXRfZGly",highlighted:`<span class="hljs-built_in">export</span> TASK_NAME=mrpc

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