import{S as LF,i as FF,s as RF,e as n,k as l,w as h,t as r,M as WF,c as s,d as o,m as d,a as i,x as u,h as a,b as m,G as e,g as p,y as f,q as g,o as _,B as v,v as GF,L as jF}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ky}from"../../chunks/Tip-hf-doc-builder.js";import{D as $}from"../../chunks/Docstring-hf-doc-builder.js";import{C as S}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as ee}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as MF}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function HF($e){let T,U,x,D,R,A,C,M,he,te,W,ne,se,oe,ie,H,Ve,ue,N,O,rt,re,at,nt,fe,ga,_a,Be,xe,va,ge,ba,ya;return{c(){T=n("p"),U=r("The "),x=n("a"),D=r("Trainer"),R=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:`),A=l(),C=n("ul"),M=n("li"),he=r("your model always return tuples or subclasses of "),te=n("a"),W=r("ModelOutput"),ne=r("."),se=l(),oe=n("li"),ie=r("your model can compute the loss if a "),H=n("code"),Ve=r("labels"),ue=r(` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),N=l(),O=n("li"),rt=r("your model can accept multiple label arguments (use the "),re=n("code"),at=r("label_names"),nt=r(" in your "),fe=n("a"),ga=r("TrainingArguments"),_a=r(" to indicate their name to the "),Be=n("a"),xe=r("Trainer"),va=r(") but none of them should be named "),ge=n("code"),ba=r('"label"'),ya=r("."),this.h()},l(Y){T=s(Y,"P",{});var V=i(T);U=a(V,"The "),x=s(V,"A",{href:!0});var $i=i(x);D=a($i,"Trainer"),$i.forEach(o),R=a(V,` 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:`),V.forEach(o),A=d(Y),C=s(Y,"UL",{});var _e=i(C);M=s(_e,"LI",{});var Ro=i(M);he=a(Ro,"your model always return tuples or subclasses of "),te=s(Ro,"A",{href:!0});var xi=i(te);W=a(xi,"ModelOutput"),xi.forEach(o),ne=a(Ro,"."),Ro.forEach(o),se=d(_e),oe=s(_e,"LI",{});var Zt=i(oe);ie=a(Zt,"your model can compute the loss if a "),H=s(Zt,"CODE",{});var P=i(H);Ve=a(P,"labels"),P.forEach(o),ue=a(Zt,` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),Zt.forEach(o),N=d(_e),O=s(_e,"LI",{});var B=i(O);rt=a(B,"your model can accept multiple label arguments (use the "),re=s(B,"CODE",{});var Wo=i(re);at=a(Wo,"label_names"),Wo.forEach(o),nt=a(B," in your "),fe=s(B,"A",{href:!0});var ki=i(fe);ga=a(ki,"TrainingArguments"),ki.forEach(o),_a=a(B," to indicate their name to the "),Be=s(B,"A",{href:!0});var Ai=i(Be);xe=a(Ai,"Trainer"),Ai.forEach(o),va=a(B,") but none of them should be named "),ge=s(B,"CODE",{});var Di=i(ge);ba=a(Di,'"label"'),Di.forEach(o),ya=a(B,"."),B.forEach(o),_e.forEach(o),this.h()},h(){m(x,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Trainer"),m(te,"href","/docs/transformers/pr_17548/en/main_classes/output#transformers.utils.ModelOutput"),m(fe,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.TrainingArguments"),m(Be,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Trainer")},m(Y,V){p(Y,T,V),e(T,U),e(T,x),e(x,D),e(T,R),p(Y,A,V),p(Y,C,V),e(C,M),e(M,he),e(M,te),e(te,W),e(M,ne),e(C,se),e(C,oe),e(oe,ie),e(oe,H),e(H,Ve),e(oe,ue),e(C,N),e(C,O),e(O,rt),e(O,re),e(re,at),e(O,nt),e(O,fe),e(fe,ga),e(O,_a),e(O,Be),e(Be,xe),e(O,va),e(O,ge),e(ge,ba),e(O,ya)},d(Y){Y&&o(T),Y&&o(A),Y&&o(C)}}}function VF($e){let T,U,x,D,R,A,C,M,he,te,W,ne,se,oe,ie,H,Ve;return{c(){T=n("p"),U=r("To use this method, you need to have provided a "),x=n("code"),D=r("model_init"),R=r(" when initializing your "),A=n("a"),C=r("Trainer"),M=r(`: we need to
reinitialize the model at each new run. This is incompatible with the `),he=n("code"),te=r("optimizers"),W=r(` argument, so you need to
subclass `),ne=n("a"),se=r("Trainer"),oe=r(" and override the method "),ie=n("a"),H=r("create_optimizer_and_scheduler()"),Ve=r(` for custom
optimizer/scheduler.`),this.h()},l(ue){T=s(ue,"P",{});var N=i(T);U=a(N,"To use this method, you need to have provided a "),x=s(N,"CODE",{});var O=i(x);D=a(O,"model_init"),O.forEach(o),R=a(N," when initializing your "),A=s(N,"A",{href:!0});var rt=i(A);C=a(rt,"Trainer"),rt.forEach(o),M=a(N,`: we need to
reinitialize the model at each new run. This is incompatible with the `),he=s(N,"CODE",{});var re=i(he);te=a(re,"optimizers"),re.forEach(o),W=a(N,` argument, so you need to
subclass `),ne=s(N,"A",{href:!0});var at=i(ne);se=a(at,"Trainer"),at.forEach(o),oe=a(N," and override the method "),ie=s(N,"A",{href:!0});var nt=i(ie);H=a(nt,"create_optimizer_and_scheduler()"),nt.forEach(o),Ve=a(N,` for custom
optimizer/scheduler.`),N.forEach(o),this.h()},h(){m(A,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Trainer"),m(ne,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Trainer"),m(ie,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Trainer.create_optimizer_and_scheduler")},m(ue,N){p(ue,T,N),e(T,U),e(T,x),e(x,D),e(T,R),e(T,A),e(A,C),e(T,M),e(T,he),e(he,te),e(T,W),e(T,ne),e(ne,se),e(T,oe),e(T,ie),e(ie,H),e(T,Ve)},d(ue){ue&&o(T)}}}function BF($e){let T,U,x,D,R;return D=new S({props:{code:`init_mem_cpu_alloc_delta   =     1301MB
init_mem_cpu_peaked_delta  =      154MB
init_mem_gpu_alloc_delta   =      230MB
init_mem_gpu_peaked_delta  =        0MB
train_mem_cpu_alloc_delta  =     1345MB
train_mem_cpu_peaked_delta =        0MB
train_mem_gpu_alloc_delta  =      693MB
train_mem_gpu_peaked_delta =        7MB`,highlighted:`<span class="hljs-attr">init_mem_cpu_alloc_delta</span>   =     <span class="hljs-number">1301</span>MB
<span class="hljs-attr">init_mem_cpu_peaked_delta</span>  =      <span class="hljs-number">154</span>MB
<span class="hljs-attr">init_mem_gpu_alloc_delta</span>   =      <span class="hljs-number">230</span>MB
<span class="hljs-attr">init_mem_gpu_peaked_delta</span>  =        <span class="hljs-number">0</span>MB
<span class="hljs-attr">train_mem_cpu_alloc_delta</span>  =     <span class="hljs-number">1345</span>MB
<span class="hljs-attr">train_mem_cpu_peaked_delta</span> =        <span class="hljs-number">0</span>MB
<span class="hljs-attr">train_mem_gpu_alloc_delta</span>  =      <span class="hljs-number">693</span>MB
<span class="hljs-attr">train_mem_gpu_peaked_delta</span> =        <span class="hljs-number">7</span>MB`}}),{c(){T=n("p"),U=r("Now when this method is run, you will see a report that will include: :"),x=l(),h(D.$$.fragment)},l(A){T=s(A,"P",{});var C=i(T);U=a(C,"Now when this method is run, you will see a report that will include: :"),C.forEach(o),x=d(A),u(D.$$.fragment,A)},m(A,C){p(A,T,C),e(T,U),p(A,x,C),f(D,A,C),R=!0},p:jF,i(A){R||(g(D.$$.fragment,A),R=!0)},o(A){_(D.$$.fragment,A),R=!1},d(A){A&&o(T),A&&o(x),v(D,A)}}}function YF($e){let T,U;return{c(){T=n("p"),U=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(x){T=s(x,"P",{});var D=i(T);U=a(D,`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.`),D.forEach(o)},m(x,D){p(x,T,D),e(T,U)},d(x){x&&o(T)}}}function ZF($e){let T,U;return{c(){T=n("p"),U=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(x){T=s(x,"P",{});var D=i(T);U=a(D,`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.`),D.forEach(o)},m(x,D){p(x,T,D),e(T,U)},d(x){x&&o(T)}}}function JF($e){let T,U,x,D,R,A,C,M,he,te,W,ne,se,oe,ie,H,Ve,ue,N,O,rt,re,at,nt,fe,ga,_a,Be,xe,va,ge,ba,ya,Y,V,$i,_e,Ro,xi,Zt,P,B,Wo,ki,Ai,Di,qi,Uc,Qy,e2,t2,Pi,zc,o2,r2,a2,Si,Nc,n2,s2,i2,st,Lc,l2,d2,Fc,c2,p2,Rc,m2,h2,u2,Oi,Wc,f2,g2,_2,Ci,Gc,v2,b2,y2,Ii,jc,w2,E2,T2,Ui,Mc,$2,x2,k2,zi,Hc,A2,D2,q2,Ni,Vc,P2,S2,O2,Li,Bc,C2,I2,p_,Go,m_,jo,U2,Fi,z2,N2,h_,wa,u_,it,L2,Ri,F2,R2,Wi,W2,G2,f_,Jt,Mo,Yc,Ea,j2,Zc,M2,g_,b,Ta,H2,Jc,V2,B2,Xc,Y2,Z2,ve,Ho,Kc,J2,X2,Gi,K2,Q2,e0,Z,Qc,t0,o0,ep,r0,a0,tp,n0,s0,op,i0,l0,rp,d0,c0,ap,p0,m0,h0,ji,np,u0,f0,g0,ke,sp,_0,v0,ip,b0,y0,lp,w0,E0,dp,T0,$0,x0,Ae,cp,k0,A0,pp,D0,q0,mp,P0,S0,hp,O0,C0,I0,Vo,$a,U0,xa,z0,up,N0,L0,F0,Bo,ka,R0,Aa,W0,fp,G0,j0,M0,lt,Da,H0,gp,V0,B0,_p,Y0,Z0,Yo,qa,J0,vp,X0,K0,dt,Pa,Q0,bp,ew,tw,Sa,ow,yp,rw,aw,nw,ct,Oa,sw,wp,iw,lw,Ye,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lq,fi,dq,wg,cq,pq,mq,Eg,Io,hq,Tg,uq,fq,$g,gq,_q,vq,xg,ot,bq,kg,yq,wq,Ag,Eq,Tq,Dg,$q,xq,kq,qg,Uo,Aq,Pg,Dq,qq,Sg,Pq,Sq,Oq,Og,gi,Cq,Cg,Iq,Uq,r1,nd,Ig,zq,a1,Jr,_i,Nq,vi,Lq,Fq,Rq,zo,Wq,bi,Gq,jq,Ug,Mq,Hq,n1,sd,Vq,s1,w,Bq,id,Yq,zg,Zq,ld,Jq,Ng,Xq,dd,Kq,Lg,Qq,cd,eP,Fg,tP,pd,oP,Rg,rP,md,aP,Wg,nP,hd,sP,Gg,iP,ud,lP,jg,dP,fd,cP,Mg,pP,gd,mP,Hg,hP,_d,uP,Vg,fP,vd,gP,Bg,_P,bd,vP,Yg,bP,yd,yP,Zg,wP,wd,EP,Jg,TP,Ed,$P,Xg,xP,Td,kP,Kg,AP,$d,DP,Qg,qP,xd,PP,e_,SP,kd,OP,t_,CP,Ad,IP,o_,UP,Dd,zP,r_,NP,qd,LP,a_,FP,i1;return A=new ee({}),Go=new Ky({props:{warning:!0,$$slots:{default:[HF]},$$scope:{ctx:$e}}}),wa=new S({props:{code:`from torch import nn
from transformers import Trainer


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


<span class="hljs-keyword">class</span> <span class="hljs-title class_">CustomTrainer</span>(<span class="hljs-title class_ inherited__">Trainer</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_loss</span>(<span class="hljs-params">self, model, inputs, return_outputs=<span class="hljs-literal">False</span></span>):
        labels = inputs.get(<span class="hljs-string">&quot;labels&quot;</span>)
        <span class="hljs-comment"># forward pass</span>
        outputs = model(**inputs)
        logits = outputs.get(<span class="hljs-string">&quot;logits&quot;</span>)
        <span class="hljs-comment"># compute custom loss (suppose one has 3 labels with different weights)</span>
        loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([<span class="hljs-number">1.0</span>, <span class="hljs-number">2.0</span>, <span class="hljs-number">3.0</span>]))
        loss = loss_fct(logits.view(-<span class="hljs-number">1</span>, self.model.config.num_labels), labels.view(-<span class="hljs-number">1</span>))
        <span class="hljs-keyword">return</span> (loss, outputs) <span class="hljs-keyword">if</span> return_outputs <span class="hljs-keyword">else</span> loss`}}),Ea=new ee({}),Ta=new $({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.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"tokenizer",val:": typing.Optional[transformers.tokenization_utils_base.PreTrainedTokenizerBase] = None"},{name:"model_init",val:": typing.Callable[[], transformers.modeling_utils.PreTrainedModel] = 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.Callable[[torch.Tensor, torch.Tensor], torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.Trainer.model",description:`<strong>model</strong> (<a href="/docs/transformers/pr_17548/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/pr_17548/en/main_classes/trainer#transformers.Trainer">Trainer</a> is optimized to work with the <a href="/docs/transformers/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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 an <code>datasets.Dataset</code>, columns not accepted by the
<code>model.forward()</code> method are automatically removed.</p>
<p>Note that if it&#x2019;s a <code>torch.utils.data.IterableDataset</code> with some randomization and you are training in a
distributed fashion, your iterable dataset should either use a internal attribute <code>generator</code> that is a
<code>torch.Generator</code> for the randomization that must be identical on all processes (and the Trainer will
manually set the seed of this <code>generator</code> at each epoch) or have a <code>set_epoch()</code> method that internally
sets the seed of the RNGs used.`,name:"train_dataset"},{anchor:"transformers.Trainer.eval_dataset",description:`<strong>eval_dataset</strong> (<code>torch.utils.data.Dataset</code>, <em>optional</em>) &#x2014;
The dataset to use for evaluation. If it is an <code>datasets.Dataset</code>, columns not accepted by the
<code>model.forward()</code> method are automatically removed.`,name:"eval_dataset"},{anchor:"transformers.Trainer.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/pr_17548/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 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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> on your model
and a scheduler given by <a href="/docs/transformers/pr_17548/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/vr_17548/src/transformers/trainer.py#L205"}}),$a=new $({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>TrainerCallback</code>) &#x2014;
A <code>TrainerCallback</code> class or an instance of a <code>TrainerCallback</code>. In the
first case, will instantiate a member of that class.`,name:"callback"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L566"}}),ka=new $({props:{name:"autocast_smart_context_manager",anchor:"transformers.Trainer.autocast_smart_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2210"}}),Da=new $({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/vr_17548/src/transformers/trainer.py#L2274"}}),qa=new $({props:{name:"compute_loss_context_manager",anchor:"transformers.Trainer.compute_loss_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2184"}}),Pa=new $({props:{name:"create_optimizer",anchor:"transformers.Trainer.create_optimizer",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L922"}}),Oa=new $({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/vr_17548/src/transformers/trainer.py#L911"}}),Ca=new $({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/vr_17548/src/transformers/trainer.py#L1030"}}),Ia=new $({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 an <code>datasets.Dataset</code>, columns not
accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Trainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>Lst[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Trainer.evaluate.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is &#x201C;eval&#x201D; (default)`,name:"metric_key_prefix"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2491",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>
`}}),za=new $({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/vr_17548/src/transformers/trainer.py#L2619"}}),Na=new $({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/vr_17548/src/transformers/trainer.py#L2974",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),Fa=new $({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 an <code>datasets.Dataset</code>, columns not accepted by
the <code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"eval_dataset"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L814"}}),Wa=new $({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/vr_17548/src/transformers/trainer.py#L970"}}),Ga=new $({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 an <code>datasets.Dataset</code>, columns not accepted by the <code>model.forward()</code>
method are automatically removed. It must implement <code>__len__</code>.`,name:"test_dataset"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L864"}}),Ma=new $({props:{name:"get_train_dataloader",anchor:"transformers.Trainer.get_train_dataloader",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L735"}}),Va=new $({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(str,",description:`<strong>direction(<code>str</code>,</strong> <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(str,"},{anchor:"transformers.Trainer.hyperparameter_search.backend(str",description:`<strong>backend(<code>str</code></strong> or <code>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.
kwargs &#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:"backend(str"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2040",returnDescription:`
<p>All the information about the best run.</p>
`,returnType:`
<p><code>trainer_utils.BestRun</code></p>
`}}),Ko=new Ky({props:{warning:!0,$$slots:{default:[VF]},$$scope:{ctx:$e}}}),Ba=new $({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/vr_17548/src/transformers/trainer.py#L2992"}}),Za=new $({props:{name:"is_local_process_zero",anchor:"transformers.Trainer.is_local_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2298"}}),Ja=new $({props:{name:"is_world_process_zero",anchor:"transformers.Trainer.is_world_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2305"}}),Ka=new $({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/vr_17548/src/transformers/trainer.py#L2133"}}),en=new $({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/vr_17548/src/transformers/trainer_pt_utils.py#L862"}}),or=new MF({props:{anchor:"transformers.Trainer.log_metrics.example",$$slots:{default:[BF]},$$scope:{ctx:$e}}}),rn=new $({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/vr_17548/src/transformers/trainer_pt_utils.py#L836",returnDescription:`
<p>The reformatted metrics</p>
`,returnType:`
<p>metrics (<code>Dict[str, float]</code>)</p>
`}}),an=new $({props:{name:"num_examples",anchor:"transformers.Trainer.num_examples",parameters:[{name:"dataloader",val:": DataLoader"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L1047"}}),sn=new $({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>TrainerCallback</code>) &#x2014;
A <code>TrainerCallback</code> class or an instance of a <code>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/vr_17548/src/transformers/trainer.py#L577",returnDescription:`
<p>The callback removed, if found.</p>
`,returnType:`
<p><code>TrainerCallback</code></p>
`}}),cn=new $({props:{name:"predict",anchor:"transformers.Trainer.predict",parameters:[{name:"test_dataset",val:": Dataset"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'test'"}],parametersDescription:[{anchor:"transformers.Trainer.predict.test_dataset",description:`<strong>test_dataset</strong> (<code>Dataset</code>) &#x2014;
Dataset to run the predictions on. If it is an <code>datasets.Dataset</code>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. Has to implement the method <code>__len__</code>`,name:"test_dataset"},{anchor:"transformers.Trainer.predict.ignore_keys",description:`<strong>ignore_keys</strong> (<code>Lst[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Trainer.predict.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;test&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;test_bleu&#x201D; if the prefix is &#x201C;test&#x201D; (default)`,name:"metric_key_prefix"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2560"}}),nr=new Ky({props:{$$slots:{default:[YF]},$$scope:{ctx:$e}}}),hn=new $({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/vr_17548/src/transformers/trainer.py#L3175"}}),un=new $({props:{name:"prediction_step",anchor:"transformers.Trainer.prediction_step",parameters:[{name:"model",val:": Module"},{name:"inputs",val:": typing.Dict[str, typing.Union[torch.Tensor, typing.Any]]"},{name:"prediction_loss_only",val:": bool"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"}],parametersDescription:[{anchor:"transformers.Trainer.prediction_step.model",description:`<strong>model</strong> (<code>nn.Module</code>) &#x2014;
The model to evaluate.`,name:"model"},{anchor:"transformers.Trainer.prediction_step.inputs",description:`<strong>inputs</strong> (<code>Dict[str, Union[torch.Tensor, Any]]</code>) &#x2014;
The inputs and targets of the model.</p>
<p>The dictionary will be unpacked before being fed to the model. Most models expect the targets under the
argument <code>labels</code>. Check your model&#x2019;s documentation for all accepted arguments.`,name:"inputs"},{anchor:"transformers.Trainer.prediction_step.prediction_loss_only",description:`<strong>prediction_loss_only</strong> (<code>bool</code>) &#x2014;
Whether or not to return the loss only.`,name:"prediction_loss_only"},{anchor:"transformers.Trainer.prediction_step.ignore_keys",description:`<strong>ignore_keys</strong> (<code>Lst[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2877",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>
`}}),fn=new $({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 <code>create_model_card()</code>.`,name:"blocking"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L3116",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>
`}}),gn=new $({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>TrainerCallback</code>) &#x2014;
A <code>TrainerCallback</code> class or an instance of a <code>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/vr_17548/src/transformers/trainer.py#L593"}}),vn=new $({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/vr_17548/src/transformers/trainer_pt_utils.py#L952"}}),wn=new $({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/vr_17548/src/transformers/trainer.py#L2317"}}),Tn=new $({props:{name:"save_state",anchor:"transformers.Trainer.save_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer_pt_utils.py#L990"}}),$n=new $({props:{name:"torchdynamo_smart_context_manager",anchor:"transformers.Trainer.torchdynamo_smart_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer.py#L2195"}}),kn=new $({props:{name:"train",anchor:"transformers.Trainer.train",parameters:[{name:"resume_from_checkpoint",val:": typing.Union[str, bool, NoneType] = None"},{name:"trial",val:": typing.Union[ForwardRef('optuna.Trial'), typing.Dict[str, typing.Any]] = None"},{name:"ignore_keys_for_eval",val:": typing.Optional[typing.List[str]] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Trainer.train.resume_from_checkpoint",description:`<strong>resume_from_checkpoint</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
If a <code>str</code>, local path to a saved checkpoint as saved by a previous instance of <a href="/docs/transformers/pr_17548/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/pr_17548/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/vr_17548/src/transformers/trainer.py#L1245"}}),An=new $({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/vr_17548/src/transformers/trainer.py#L2225",returnDescription:`
<p>The tensor with training loss on this batch.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Dn=new ee({}),qn=new $({props:{name:"class transformers.Seq2SeqTrainer",anchor:"transformers.Seq2SeqTrainer",parameters:[{name:"model",val:": typing.Union[transformers.modeling_utils.PreTrainedModel, torch.nn.modules.module.Module] = None"},{name:"args",val:": TrainingArguments = None"},{name:"data_collator",val:": typing.Optional[DataCollator] = None"},{name:"train_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"tokenizer",val:": typing.Optional[transformers.tokenization_utils_base.PreTrainedTokenizerBase] = None"},{name:"model_init",val:": typing.Callable[[], transformers.modeling_utils.PreTrainedModel] = 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.Callable[[torch.Tensor, torch.Tensor], torch.Tensor] = None"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer_seq2seq.py#L30"}}),Pn=new $({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:"max_length",val:": typing.Optional[int] = None"},{name:"num_beams",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainer.evaluate.eval_dataset",description:`<strong>eval_dataset</strong> (<code>Dataset</code>, <em>optional</em>) &#x2014;
Pass a dataset if you wish to override <code>self.eval_dataset</code>. If it is an <code>datasets.Dataset</code>, columns not
accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Seq2SeqTrainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.evaluate.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.evaluate.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.evaluate.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer_seq2seq.py#L31",returnDescription:`
<p>A dictionary containing the evaluation loss and the potential metrics computed from the predictions. The
dictionary also contains the epoch number which comes from the training state.</p>
`}}),On=new $({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:"max_length",val:": typing.Optional[int] = None"},{name:"num_beams",val:": typing.Optional[int] = None"}],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 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.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.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/trainer_seq2seq.py#L72"}}),pr=new Ky({props:{$$slots:{default:[ZF]},$$scope:{ctx:$e}}}),Un=new ee({}),zn=new $({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:": IntervalStrategy = '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:": SchedulerType = '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] = 'passive'"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_dir",val:": typing.Optional[str] = None"},{name:"logging_strategy",val:": IntervalStrategy = 'steps'"},{name:"logging_first_step",val:": bool = False"},{name:"logging_steps",val:": int = 500"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"save_strategy",val:": IntervalStrategy = 'steps'"},{name:"save_steps",val:": int = 500"},{name:"save_total_limit",val:": typing.Optional[int] = None"},{name:"save_on_each_node",val:": bool = False"},{name:"no_cuda",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": typing.Optional[int] = None"},{name:"bf16",val:": bool = False"},{name:"fp16",val:": bool = False"},{name:"fp16_opt_level",val:": str = 'O1'"},{name:"half_precision_backend",val:": str = 'auto'"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": typing.Optional[bool] = None"},{name:"local_rank",val:": int = -1"},{name:"xpu_backend",val:": typing.Optional[str] = None"},{name:"tpu_num_cores",val:": typing.Optional[int] = None"},{name:"tpu_metrics_debug",val:": bool = False"},{name:"debug",val:": str = ''"},{name:"dataloader_drop_last",val:": bool = False"},{name:"eval_steps",val:": typing.Optional[int] = None"},{name:"dataloader_num_workers",val:": int = 0"},{name:"past_index",val:": int = -1"},{name:"run_name",val:": typing.Optional[str] = None"},{name:"disable_tqdm",val:": typing.Optional[bool] = None"},{name:"remove_unused_columns",val:": typing.Optional[bool] = True"},{name:"label_names",val:": typing.Optional[typing.List[str]] = None"},{name:"load_best_model_at_end",val:": typing.Optional[bool] = False"},{name:"metric_for_best_model",val:": typing.Optional[str] = None"},{name:"greater_is_better",val:": typing.Optional[bool] = None"},{name:"ignore_data_skip",val:": bool = False"},{name:"sharded_ddp",val:": str = ''"},{name:"fsdp",val:": str = ''"},{name:"fsdp_min_num_params",val:": int = 0"},{name:"deepspeed",val:": typing.Optional[str] = None"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"optim",val:": OptimizerNames = 'adamw_hf'"},{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:": HubStrategy = '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"}],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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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 lets the
application set the level.`,name:"log_level"},{anchor:"transformers.TrainingArguments.log_level_replica",description:`<strong>log_level_replica</strong> (<code>str</code>, <em>optional</em>, defaults to <code>passive</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/pr_17548/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The logging strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No logging is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Logging is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Logging is done every <code>logging_steps</code>.</li>
</ul>`,name:"logging_strategy"},{anchor:"transformers.TrainingArguments.logging_first_step",description:`<strong>logging_first_step</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to log and evaluate the first <code>global_step</code> or not.`,name:"logging_first_step"},{anchor:"transformers.TrainingArguments.logging_steps",description:`<strong>logging_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of update steps between two logs if <code>logging_strategy=&quot;steps&quot;</code>.`,name:"logging_steps"},{anchor:"transformers.TrainingArguments.logging_nan_inf_filter",description:`<strong>logging_nan_inf_filter</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to filter <code>nan</code> and <code>inf</code> losses for logging. If set to <code>True</code> the loss of every step that is <code>nan</code>
or <code>inf</code> is filtered and the average loss of the current logging window is taken instead.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p><code>logging_nan_inf_filter</code> only influences the logging of loss values, it does not change the behavior the
gradient is computed or applied to the model.</p>

					</div>`,name:"logging_nan_inf_filter"},{anchor:"transformers.TrainingArguments.save_strategy",description:`<strong>save_strategy</strong> (<code>str</code> or <a href="/docs/transformers/pr_17548/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The checkpoint save strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No save is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Save is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Save is done every <code>save_steps</code>.</li>
</ul>`,name:"save_strategy"},{anchor:"transformers.TrainingArguments.save_steps",description:`<strong>save_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of updates steps before two checkpoint saves if <code>save_strategy=&quot;steps&quot;</code>.`,name:"save_steps"},{anchor:"transformers.TrainingArguments.save_total_limit",description:`<strong>save_total_limit</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in
<code>output_dir</code>.`,name:"save_total_limit"},{anchor:"transformers.TrainingArguments.save_on_each_node",description:`<strong>save_on_each_node</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When doing multi-node distributed training, whether to save models and checkpoints on each node, or only on
the main one.</p>
<p>This should not be activated when the different nodes use the same storage as the files will be saved with
the same names for each node.`,name:"save_on_each_node"},{anchor:"transformers.TrainingArguments.no_cuda",description:`<strong>no_cuda</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to not use CUDA even when it is available or not.`,name:"no_cuda"},{anchor:"transformers.TrainingArguments.seed",description:`<strong>seed</strong> (<code>int</code>, <em>optional</em>, defaults to 42) &#x2014;
Random seed that will be set at the beginning of training. To ensure reproducibility across runs, use the
<code>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.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. 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;</code>, <code>&quot;amp&quot;</code> or <code>&quot;apex&quot;</code>. <code>&quot;auto&quot;</code>
will use AMP or APEX depending on the PyTorch version detected, while the other choices will force the
requested backend.`,name:"half_precision_backend"},{anchor:"transformers.TrainingArguments.bf16_full_eval",description:`<strong>bf16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full bfloat16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values. This is an experimental API and it may change.`,name:"bf16_full_eval"},{anchor:"transformers.TrainingArguments.fp16_full_eval",description:`<strong>fp16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full float16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values.`,name:"fp16_full_eval"},{anchor:"transformers.TrainingArguments.tf32",description:`<strong>tf32</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to enable the TF32 mode, available in Ampere and newer GPU architectures. The default value depends
on PyTorch&#x2019;s version default of <code>torch.backends.cuda.matmul.allow_tf32</code>. For more details please refer to
the <a href="https://huggingface.co/docs/transformers/performance#tf32" rel="nofollow">TF32</a> documentation. This is an
experimental API and it may change.`,name:"tf32"},{anchor:"transformers.TrainingArguments.local_rank",description:`<strong>local_rank</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Rank of the process during distributed training.`,name:"local_rank"},{anchor:"transformers.TrainingArguments.xpu_backend",description:`<strong>xpu_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use for xpu distributed training. Must be one of <code>&quot;mpi&quot;</code> or <code>&quot;ccl&quot;</code>.`,name:"xpu_backend"},{anchor:"transformers.TrainingArguments.tpu_num_cores",description:`<strong>tpu_num_cores</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When training on TPU, the number of TPU cores (automatically passed by launcher script).`,name:"tpu_num_cores"},{anchor:"transformers.TrainingArguments.dataloader_drop_last",description:`<strong>dataloader_drop_last</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch size)
or not.`,name:"dataloader_drop_last"},{anchor:"transformers.TrainingArguments.eval_steps",description:`<strong>eval_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of update steps between two evaluations if <code>evaluation_strategy=&quot;steps&quot;</code>. Will default to the same
value as <code>logging_steps</code> if not set.`,name:"eval_steps"},{anchor:"transformers.TrainingArguments.dataloader_num_workers",description:`<strong>dataloader_num_workers</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in the
main process.`,name:"dataloader_num_workers"},{anchor:"transformers.TrainingArguments.past_index",description:`<strong>past_index</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Some models like <a href="../model_doc/transformerxl">TransformerXL</a> or <a href="../model_doc/xlnet">XLNet</a> can make use of
the past hidden states for their predictions. If this argument is set to a positive int, the <code>Trainer</code> will
use the corresponding output (usually index 2) as the past state and feed it to the model at the next
training step under the keyword argument <code>mems</code>.`,name:"past_index"},{anchor:"transformers.TrainingArguments.run_name",description:`<strong>run_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
A descriptor for the run. Typically used for <a href="https://www.wandb.com/" rel="nofollow">wandb</a> and
<a href="https://www.mlflow.org/" rel="nofollow">mlflow</a> logging.`,name:"run_name"},{anchor:"transformers.TrainingArguments.disable_tqdm",description:`<strong>disable_tqdm</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to disable the tqdm progress bars and table of metrics produced by
<code>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 <code>[&quot;labels&quot;]</code> except if the model used is one of the <code>XxxForQuestionAnswering</code> in
which case it will default to <code>[&quot;start_positions&quot;, &quot;end_positions&quot;]</code>.`,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>eval_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_min_num_params",description:`<strong>fsdp_min_num_params</strong> (<code>int</code>, <em>optional</em>, defaults to <code>0</code>) &#x2014;
FSDP&#x2019;s minimum number of parameters for Default Auto Wrapping. (useful only when <code>fsdp</code> field is passed).`,name:"fsdp_min_num_params"},{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_apex_fused, or adafactor.`,name:"optim"},{anchor:"transformers.TrainingArguments.adafactor",description:`<strong>adafactor</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This argument is deprecated. Use <code>--optim adafactor</code> instead.`,name:"adafactor"},{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;tensorboard&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report to all integrations
installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.TrainingArguments.ddp_find_unused_parameters",description:`<strong>ddp_find_unused_parameters</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>find_unused_parameters</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_find_unused_parameters"},{anchor:"transformers.TrainingArguments.ddp_bucket_cap_mb",description:`<strong>ddp_bucket_cap_mb</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>bucket_cap_mb</code> passed to <code>DistributedDataParallel</code>.`,name:"ddp_bucket_cap_mb"},{anchor:"transformers.TrainingArguments.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 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/pr_17548/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/pr_17548/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/pr_17548/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 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/pr_17548/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/pr_17548/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/pr_17548/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/pr_17548/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/pr_17548/en/internal/trainer_utils#transformers.set_seed">set_seed()</a> to ensure reproducible results in
distributed training`,name:"full_determinism"},{anchor:"transformers.TrainingArguments.torchdynamo",description:`<strong>torchdynamo</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token that is used to set the backend compiler for TorchDynamo. Possible choices are [&#x201C;eager&#x201D;,
&#x201C;nvfuser]. This is an experimental API and subject to change.`,name:"torchdynamo"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/training_args.py#L95"}}),Fn=new $({props:{name:"get_process_log_level",anchor:"transformers.TrainingArguments.get_process_log_level",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/training_args.py#L1379"}}),Wn=new $({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/vr_17548/src/transformers/training_args.py#L1465"}}),Gn=new $({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/vr_17548/src/transformers/training_args.py#L1410"}}),jn=new $({props:{name:"to_dict",anchor:"transformers.TrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/training_args.py#L1474"}}),Hn=new $({props:{name:"to_json_string",anchor:"transformers.TrainingArguments.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/training_args.py#L1489"}}),Vn=new $({props:{name:"to_sanitized_dict",anchor:"transformers.TrainingArguments.to_sanitized_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/training_args.py#L1495"}}),Bn=new ee({}),Yn=new $({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:": IntervalStrategy = '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:": SchedulerType = '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] = 'passive'"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_dir",val:": typing.Optional[str] = None"},{name:"logging_strategy",val:": IntervalStrategy = 'steps'"},{name:"logging_first_step",val:": bool = False"},{name:"logging_steps",val:": int = 500"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"save_strategy",val:": IntervalStrategy = 'steps'"},{name:"save_steps",val:": int = 500"},{name:"save_total_limit",val:": typing.Optional[int] = None"},{name:"save_on_each_node",val:": bool = False"},{name:"no_cuda",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": typing.Optional[int] = None"},{name:"bf16",val:": bool = False"},{name:"fp16",val:": bool = False"},{name:"fp16_opt_level",val:": str = 'O1'"},{name:"half_precision_backend",val:": str = 'auto'"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": typing.Optional[bool] = None"},{name:"local_rank",val:": int = -1"},{name:"xpu_backend",val:": typing.Optional[str] = None"},{name:"tpu_num_cores",val:": typing.Optional[int] = None"},{name:"tpu_metrics_debug",val:": bool = False"},{name:"debug",val:": str = ''"},{name:"dataloader_drop_last",val:": bool = False"},{name:"eval_steps",val:": typing.Optional[int] = None"},{name:"dataloader_num_workers",val:": int = 0"},{name:"past_index",val:": int = -1"},{name:"run_name",val:": typing.Optional[str] = None"},{name:"disable_tqdm",val:": typing.Optional[bool] = None"},{name:"remove_unused_columns",val:": typing.Optional[bool] = True"},{name:"label_names",val:": typing.Optional[typing.List[str]] = None"},{name:"load_best_model_at_end",val:": typing.Optional[bool] = False"},{name:"metric_for_best_model",val:": typing.Optional[str] = None"},{name:"greater_is_better",val:": typing.Optional[bool] = None"},{name:"ignore_data_skip",val:": bool = False"},{name:"sharded_ddp",val:": str = ''"},{name:"fsdp",val:": str = ''"},{name:"fsdp_min_num_params",val:": int = 0"},{name:"deepspeed",val:": typing.Optional[str] = None"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"optim",val:": OptimizerNames = 'adamw_hf'"},{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:": HubStrategy = '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:"sortish_sampler",val:": bool = False"},{name:"predict_with_generate",val:": bool = False"},{name:"generation_max_length",val:": typing.Optional[int] = None"},{name:"generation_num_beams",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainingArguments.output_dir",description:`<strong>output_dir</strong> (<code>str</code>) &#x2014;
The output directory where the model predictions and checkpoints will be written.`,name:"output_dir"},{anchor:"transformers.Seq2SeqTrainingArguments.overwrite_output_dir",description:`<strong>overwrite_output_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, overwrite the content of the output directory. Use this to continue training if <code>output_dir</code>
points to a checkpoint directory.`,name:"overwrite_output_dir"},{anchor:"transformers.Seq2SeqTrainingArguments.do_train",description:`<strong>do_train</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run training or not. This argument is not directly used by <a href="/docs/transformers/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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/pr_17548/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 lets the
application set the level.`,name:"log_level"},{anchor:"transformers.Seq2SeqTrainingArguments.log_level_replica",description:`<strong>log_level_replica</strong> (<code>str</code>, <em>optional</em>, defaults to <code>passive</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/pr_17548/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The logging strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No logging is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Logging is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Logging is done every <code>logging_steps</code>.</li>
</ul>`,name:"logging_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.logging_first_step",description:`<strong>logging_first_step</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to log and evaluate the first <code>global_step</code> or not.`,name:"logging_first_step"},{anchor:"transformers.Seq2SeqTrainingArguments.logging_steps",description:`<strong>logging_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of update steps between two logs if <code>logging_strategy=&quot;steps&quot;</code>.`,name:"logging_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.logging_nan_inf_filter",description:`<strong>logging_nan_inf_filter</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to filter <code>nan</code> and <code>inf</code> losses for logging. If set to <code>True</code> the loss of every step that is <code>nan</code>
or <code>inf</code> is filtered and the average loss of the current logging window is taken instead.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p><code>logging_nan_inf_filter</code> only influences the logging of loss values, it does not change the behavior the
gradient is computed or applied to the model.</p>

					</div>`,name:"logging_nan_inf_filter"},{anchor:"transformers.Seq2SeqTrainingArguments.save_strategy",description:`<strong>save_strategy</strong> (<code>str</code> or <a href="/docs/transformers/pr_17548/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;steps&quot;</code>) &#x2014;
The checkpoint save strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No save is done during training.</li>
<li><code>&quot;epoch&quot;</code>: Save is done at the end of each epoch.</li>
<li><code>&quot;steps&quot;</code>: Save is done every <code>save_steps</code>.</li>
</ul>`,name:"save_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.save_steps",description:`<strong>save_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Number of updates steps before two checkpoint saves if <code>save_strategy=&quot;steps&quot;</code>.`,name:"save_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.save_total_limit",description:`<strong>save_total_limit</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in
<code>output_dir</code>.`,name:"save_total_limit"},{anchor:"transformers.Seq2SeqTrainingArguments.save_on_each_node",description:`<strong>save_on_each_node</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When doing multi-node distributed training, whether to save models and checkpoints on each node, or only on
the main one.</p>
<p>This should not be activated when the different nodes use the same storage as the files will be saved with
the same names for each node.`,name:"save_on_each_node"},{anchor:"transformers.Seq2SeqTrainingArguments.no_cuda",description:`<strong>no_cuda</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to not use CUDA even when it is available or not.`,name:"no_cuda"},{anchor:"transformers.Seq2SeqTrainingArguments.seed",description:`<strong>seed</strong> (<code>int</code>, <em>optional</em>, defaults to 42) &#x2014;
Random seed that will be set at the beginning of training. To ensure reproducibility across runs, use the
<code>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.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. 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;</code>, <code>&quot;amp&quot;</code> or <code>&quot;apex&quot;</code>. <code>&quot;auto&quot;</code>
will use AMP or APEX depending on the PyTorch version detected, while the other choices will force the
requested backend.`,name:"half_precision_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.bf16_full_eval",description:`<strong>bf16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full bfloat16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values. This is an experimental API and it may change.`,name:"bf16_full_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16_full_eval",description:`<strong>fp16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full float16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values.`,name:"fp16_full_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.tf32",description:`<strong>tf32</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to enable the TF32 mode, available in Ampere and newer GPU architectures. The default value depends
on PyTorch&#x2019;s version default of <code>torch.backends.cuda.matmul.allow_tf32</code>. For more details please refer to
the <a href="https://huggingface.co/docs/transformers/performance#tf32" rel="nofollow">TF32</a> documentation. This is an
experimental API and it may change.`,name:"tf32"},{anchor:"transformers.Seq2SeqTrainingArguments.local_rank",description:`<strong>local_rank</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Rank of the process during distributed training.`,name:"local_rank"},{anchor:"transformers.Seq2SeqTrainingArguments.xpu_backend",description:`<strong>xpu_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use for xpu distributed training. Must be one of <code>&quot;mpi&quot;</code> or <code>&quot;ccl&quot;</code>.`,name:"xpu_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.tpu_num_cores",description:`<strong>tpu_num_cores</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When training on TPU, the number of TPU cores (automatically passed by launcher script).`,name:"tpu_num_cores"},{anchor:"transformers.Seq2SeqTrainingArguments.dataloader_drop_last",description:`<strong>dataloader_drop_last</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch size)
or not.`,name:"dataloader_drop_last"},{anchor:"transformers.Seq2SeqTrainingArguments.eval_steps",description:`<strong>eval_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of update steps between two evaluations if <code>evaluation_strategy=&quot;steps&quot;</code>. Will default to the same
value as <code>logging_steps</code> if not set.`,name:"eval_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.dataloader_num_workers",description:`<strong>dataloader_num_workers</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in the
main process.`,name:"dataloader_num_workers"},{anchor:"transformers.Seq2SeqTrainingArguments.past_index",description:`<strong>past_index</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Some models like <a href="../model_doc/transformerxl">TransformerXL</a> or <a href="../model_doc/xlnet">XLNet</a> can make use of
the past hidden states for their predictions. If this argument is set to a positive int, the <code>Trainer</code> will
use the corresponding output (usually index 2) as the past state and feed it to the model at the next
training step under the keyword argument <code>mems</code>.`,name:"past_index"},{anchor:"transformers.Seq2SeqTrainingArguments.run_name",description:`<strong>run_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
A descriptor for the run. Typically used for <a href="https://www.wandb.com/" rel="nofollow">wandb</a> and
<a href="https://www.mlflow.org/" rel="nofollow">mlflow</a> logging.`,name:"run_name"},{anchor:"transformers.Seq2SeqTrainingArguments.disable_tqdm",description:`<strong>disable_tqdm</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to disable the tqdm progress bars and table of metrics produced by
<code>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 <code>[&quot;labels&quot;]</code> except if the model used is one of the <code>XxxForQuestionAnswering</code> in
which case it will default to <code>[&quot;start_positions&quot;, &quot;end_positions&quot;]</code>.`,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>eval_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_min_num_params",description:`<strong>fsdp_min_num_params</strong> (<code>int</code>, <em>optional</em>, defaults to <code>0</code>) &#x2014;
FSDP&#x2019;s minimum number of parameters for Default Auto Wrapping. (useful only when <code>fsdp</code> field is passed).`,name:"fsdp_min_num_params"},{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_apex_fused, or adafactor.`,name:"optim"},{anchor:"transformers.Seq2SeqTrainingArguments.adafactor",description:`<strong>adafactor</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This argument is deprecated. Use <code>--optim adafactor</code> instead.`,name:"adafactor"},{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;tensorboard&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report to all integrations
installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_find_unused_parameters",description:`<strong>ddp_find_unused_parameters</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>find_unused_parameters</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_find_unused_parameters"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_bucket_cap_mb",description:`<strong>ddp_bucket_cap_mb</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>bucket_cap_mb</code> passed to <code>DistributedDataParallel</code>.`,name:"ddp_bucket_cap_mb"},{anchor:"transformers.Seq2SeqTrainingArguments.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 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/pr_17548/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/pr_17548/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/pr_17548/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 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/pr_17548/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/pr_17548/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/pr_17548/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/pr_17548/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/pr_17548/en/internal/trainer_utils#transformers.set_seed">set_seed()</a> to ensure reproducible results in
distributed training`,name:"full_determinism"},{anchor:"transformers.Seq2SeqTrainingArguments.torchdynamo",description:`<strong>torchdynamo</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token that is used to set the backend compiler for TorchDynamo. Possible choices are [&#x201C;eager&#x201D;,
&#x201C;nvfuser]. This is an experimental API and subject to change.`,name:"torchdynamo"},{anchor:"transformers.Seq2SeqTrainingArguments.sortish_sampler",description:`<strong>sortish_sampler</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a <em>sortish sampler</em> or not. Only possible if the underlying datasets are <em>Seq2SeqDataset</em>
for now but will become generally available in the near future.</p>
<p>It sorts the inputs according to lengths in order to minimize the padding size, with a bit of randomness
for the training set.`,name:"sortish_sampler"},{anchor:"transformers.Seq2SeqTrainingArguments.predict_with_generate",description:`<strong>predict_with_generate</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use generate to calculate generative metrics (ROUGE, BLEU).`,name:"predict_with_generate"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_max_length",description:`<strong>generation_max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The <code>max_length</code> to use on each evaluation loop when <code>predict_with_generate=True</code>. Will default to the
<code>max_length</code> value of the model configuration.`,name:"generation_max_length"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_num_beams",description:`<strong>generation_num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The <code>num_beams</code> to use on each evaluation loop when <code>predict_with_generate=True</code>. Will default to the
<code>num_beams</code> value of the model configuration.`,name:"generation_num_beams"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/training_args_seq2seq.py#L28"}}),Xn=new ee({}),Kn=new ee({}),Qn=new S({props:{code:`[...]
logger = logging.getLogger(__name__)

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

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

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

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

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

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