import{S as GG,i as MG,s as jG,e as n,k as l,w as h,t as r,M as HG,c as s,d as o,m as d,a as i,x as u,h as a,b as p,G as e,g as m,y as f,q as g,o as _,B as v,v as BG,L as VG}from"../../chunks/vendor-hf-doc-builder.js";import{T as hm}from"../../chunks/Tip-hf-doc-builder.js";import{D as x}from"../../chunks/Docstring-hf-doc-builder.js";import{C as O}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Y}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as YG}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ZG(Z){let T,P,$,k,L,q,D,W,fe,oe,G,se,ie,re,le,H,Ze,ge,z,I,st,ae,it,lt,_e,Ca,Ia,Ke,Ae,Ua,ve,Na,za;return{c(){T=n("p"),P=r("The "),$=n("a"),k=r("Trainer"),L=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:`),q=l(),D=n("ul"),W=n("li"),fe=r("your model always return tuples or subclasses of "),oe=n("a"),G=r("ModelOutput"),se=r("."),ie=l(),re=n("li"),le=r("your model can compute the loss if a "),H=n("code"),Ze=r("labels"),ge=r(` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),z=l(),I=n("li"),st=r("your model can accept multiple label arguments (use the "),ae=n("code"),it=r("label_names"),lt=r(" in your "),_e=n("a"),Ca=r("TrainingArguments"),Ia=r(" to indicate their name to the "),Ke=n("a"),Ae=r("Trainer"),Ua=r(") but none of them should be named "),ve=n("code"),Na=r('"label"'),za=r("."),this.h()},l(K){T=s(K,"P",{});var B=i(T);P=a(B,"The "),$=s(B,"A",{href:!0});var Ji=i($);k=a(Ji,"Trainer"),Ji.forEach(o),L=a(B,` 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:`),B.forEach(o),q=d(K),D=s(K,"UL",{});var be=i(D);W=s(be,"LI",{});var Xo=i(W);fe=a(Xo,"your model always return tuples or subclasses of "),oe=s(Xo,"A",{href:!0});var Xi=i(oe);G=a(Xi,"ModelOutput"),Xi.forEach(o),se=a(Xo,"."),Xo.forEach(o),ie=d(be),re=s(be,"LI",{});var ro=i(re);le=a(ro,"your model can compute the loss if a "),H=s(ro,"CODE",{});var C=i(H);Ze=a(C,"labels"),C.forEach(o),ge=a(ro,` argument is provided and that loss is returned as the first
element of the tuple (if your model returns tuples)`),ro.forEach(o),z=d(be),I=s(be,"LI",{});var V=i(I);st=a(V,"your model can accept multiple label arguments (use the "),ae=s(V,"CODE",{});var Qo=i(ae);it=a(Qo,"label_names"),Qo.forEach(o),lt=a(V," in your "),_e=s(V,"A",{href:!0});var Qi=i(_e);Ca=a(Qi,"TrainingArguments"),Qi.forEach(o),Ia=a(V," to indicate their name to the "),Ke=s(V,"A",{href:!0});var el=i(Ke);Ae=a(el,"Trainer"),el.forEach(o),Ua=a(V,") but none of them should be named "),ve=s(V,"CODE",{});var tl=i(ve);Na=a(tl,'"label"'),tl.forEach(o),za=a(V,"."),V.forEach(o),be.forEach(o),this.h()},h(){p($,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),p(oe,"href","/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput"),p(_e,"href","/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments"),p(Ke,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer")},m(K,B){m(K,T,B),e(T,P),e(T,$),e($,k),e(T,L),m(K,q,B),m(K,D,B),e(D,W),e(W,fe),e(W,oe),e(oe,G),e(W,se),e(D,ie),e(D,re),e(re,le),e(re,H),e(H,Ze),e(re,ge),e(D,z),e(D,I),e(I,st),e(I,ae),e(ae,it),e(I,lt),e(I,_e),e(_e,Ca),e(I,Ia),e(I,Ke),e(Ke,Ae),e(I,Ua),e(I,ve),e(ve,Na),e(I,za)},d(K){K&&o(T),K&&o(q),K&&o(D)}}}function KG(Z){let T,P,$,k,L,q,D,W,fe,oe,G,se,ie,re,le,H,Ze;return{c(){T=n("p"),P=r("To use this method, you need to have provided a "),$=n("code"),k=r("model_init"),L=r(" when initializing your "),q=n("a"),D=r("Trainer"),W=r(`: we need to
reinitialize the model at each new run. This is incompatible with the `),fe=n("code"),oe=r("optimizers"),G=r(` argument, so you need to
subclass `),se=n("a"),ie=r("Trainer"),re=r(" and override the method "),le=n("a"),H=r("create_optimizer_and_scheduler()"),Ze=r(` for custom
optimizer/scheduler.`),this.h()},l(ge){T=s(ge,"P",{});var z=i(T);P=a(z,"To use this method, you need to have provided a "),$=s(z,"CODE",{});var I=i($);k=a(I,"model_init"),I.forEach(o),L=a(z," when initializing your "),q=s(z,"A",{href:!0});var st=i(q);D=a(st,"Trainer"),st.forEach(o),W=a(z,`: we need to
reinitialize the model at each new run. This is incompatible with the `),fe=s(z,"CODE",{});var ae=i(fe);oe=a(ae,"optimizers"),ae.forEach(o),G=a(z,` argument, so you need to
subclass `),se=s(z,"A",{href:!0});var it=i(se);ie=a(it,"Trainer"),it.forEach(o),re=a(z," and override the method "),le=s(z,"A",{href:!0});var lt=i(le);H=a(lt,"create_optimizer_and_scheduler()"),lt.forEach(o),Ze=a(z,` for custom
optimizer/scheduler.`),z.forEach(o),this.h()},h(){p(q,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),p(se,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),p(le,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.create_optimizer_and_scheduler")},m(ge,z){m(ge,T,z),e(T,P),e(T,$),e($,k),e(T,L),e(T,q),e(q,D),e(T,W),e(T,fe),e(fe,oe),e(T,G),e(T,se),e(se,ie),e(T,re),e(T,le),e(le,H),e(T,Ze)},d(ge){ge&&o(T)}}}function JG(Z){let T,P,$,k,L;return k=new O({props:{code:`init_mem_cpu_alloc_delta   =     1301MB
init_mem_cpu_peaked_delta  =      154MB
init_mem_gpu_alloc_delta   =      230MB
init_mem_gpu_peaked_delta  =        0MB
train_mem_cpu_alloc_delta  =     1345MB
train_mem_cpu_peaked_delta =        0MB
train_mem_gpu_alloc_delta  =      693MB
train_mem_gpu_peaked_delta =        7MB`,highlighted:`<span class="hljs-attr">init_mem_cpu_alloc_delta</span>   =     <span class="hljs-number">1301</span>MB
<span class="hljs-attr">init_mem_cpu_peaked_delta</span>  =      <span class="hljs-number">154</span>MB
<span class="hljs-attr">init_mem_gpu_alloc_delta</span>   =      <span class="hljs-number">230</span>MB
<span class="hljs-attr">init_mem_gpu_peaked_delta</span>  =        <span class="hljs-number">0</span>MB
<span class="hljs-attr">train_mem_cpu_alloc_delta</span>  =     <span class="hljs-number">1345</span>MB
<span class="hljs-attr">train_mem_cpu_peaked_delta</span> =        <span class="hljs-number">0</span>MB
<span class="hljs-attr">train_mem_gpu_alloc_delta</span>  =      <span class="hljs-number">693</span>MB
<span class="hljs-attr">train_mem_gpu_peaked_delta</span> =        <span class="hljs-number">7</span>MB`}}),{c(){T=n("p"),P=r("Now when this method is run, you will see a report that will include: :"),$=l(),h(k.$$.fragment)},l(q){T=s(q,"P",{});var D=i(T);P=a(D,"Now when this method is run, you will see a report that will include: :"),D.forEach(o),$=d(q),u(k.$$.fragment,q)},m(q,D){m(q,T,D),e(T,P),m(q,$,D),f(k,q,D),L=!0},p:VG,i(q){L||(g(k.$$.fragment,q),L=!0)},o(q){_(k.$$.fragment,q),L=!1},d(q){q&&o(T),q&&o($),v(k,q)}}}function XG(Z){let T,P;return{c(){T=n("p"),P=r(`If your predictions or labels have different sequence length (for instance because you\u2019re doing dynamic padding
in a token classification task) the predictions will be padded (on the right) to allow for concatenation into
one array. The padding index is -100.`)},l($){T=s($,"P",{});var k=i(T);P=a(k,`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.`),k.forEach(o)},m($,k){m($,T,k),e(T,P)},d($){$&&o(T)}}}function QG(Z){let T,P;return{c(){T=n("p"),P=r(`If your predictions or labels have different sequence lengths (for instance because you\u2019re doing dynamic
padding in a token classification task) the predictions will be padded (on the right) to allow for
concatenation into one array. The padding index is -100.`)},l($){T=s($,"P",{});var k=i(T);P=a(k,`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.`),k.forEach(o)},m($,k){m($,T,k),e(T,P)},d($){$&&o(T)}}}function eM(Z){let T,P;return{c(){T=n("p"),P=r("This integration is not supported anymore, we recommend you either use DeepSpeed or PyTorch FSDP.")},l($){T=s($,"P",{});var k=i(T);P=a(k,"This integration is not supported anymore, we recommend you either use DeepSpeed or PyTorch FSDP."),k.forEach(o)},m($,k){m($,T,k),e(T,P)},d($){$&&o(T)}}}function tM(Z){let T,P,$,k,L;return{c(){T=n("p"),P=r(`We strongly recommend to install PyTorch >= 1.13 (nightly version at the time of writing) on your MacOS machine.
It has major fixes related to model correctness and performance improvements for transformer based models.
Please refer to `),$=n("a"),k=r("https://github.com/pytorch/pytorch/issues/82707"),L=r(" for more details."),this.h()},l(q){T=s(q,"P",{});var D=i(T);P=a(D,`We strongly recommend to install PyTorch >= 1.13 (nightly version at the time of writing) on your MacOS machine.
It has major fixes related to model correctness and performance improvements for transformer based models.
Please refer to `),$=s(D,"A",{href:!0,rel:!0});var W=i($);k=a(W,"https://github.com/pytorch/pytorch/issues/82707"),W.forEach(o),L=a(D," for more details."),D.forEach(o),this.h()},h(){p($,"href","https://github.com/pytorch/pytorch/issues/82707"),p($,"rel","nofollow")},m(q,D){m(q,T,D),e(T,P),e(T,$),e($,k),e(T,L)},d(q){q&&o(T)}}}function oM(Z){let T,P,$,k,L,q,D,W,fe,oe,G,se,ie,re,le,H,Ze,ge,z,I,st,ae,it,lt,_e,Ca,Ia,Ke,Ae,Ua,ve,Na,za,K,B,Ji,be,Xo,Xi,ro,C,V,Qo,Qi,el,tl,ol,um,ww,Tw,Ew,rl,fm,$w,xw,kw,al,gm,qw,Aw,Pw,dt,_m,Dw,Sw,vm,Ow,Cw,bm,Iw,Uw,Nw,nl,ym,zw,Fw,Lw,sl,wm,Rw,Ww,Gw,il,Tm,Mw,jw,Hw,ll,Em,Bw,Vw,Yw,dl,$m,Zw,Kw,Jw,cl,xm,Xw,Qw,e0,ml,km,t0,o0,gv,er,_v,tr,r0,pl,a0,n0,vv,Fa,bv,ct,s0,hl,i0,l0,ul,d0,c0,yv,ao,or,qm,La,m0,Am,p0,wv,b,Ra,h0,Pm,u0,f0,Dm,g0,_0,ye,rr,Sm,v0,b0,fl,y0,w0,T0,J,Om,E0,$0,Cm,x0,k0,Im,q0,A0,Um,P0,D0,Nm,S0,O0,zm,C0,I0,U0,gl,Fm,N0,z0,F0,Pe,Lm,L0,R0,Rm,W0,G0,Wm,M0,j0,Gm,H0,B0,V0,De,Mm,Y0,Z0,jm,K0,J0,Hm,X0,Q0,Bm,eT,tT,oT,ar,Wa,rT,Ga,aT,Vm,nT,sT,iT,nr,Ma,lT,ja,dT,Ym,cT,mT,pT,mt,Ha,hT,Zm,uT,fT,Km,gT,_T,sr,Ba,vT,Jm,bT,yT,ir,Va,wT,Ya,TT,Xm,ET,$T,xT,pt,Za,kT,Qm,qT,AT,Ka,PT,ep,DT,ST,OT,ht,Ja,CT,tp,IT,UT,Je,NT,op,zT,FT,rp,LT,RT,ap,WT,GT,MT,lr,Xa,jT,np,HT,BT,Se,Qa,VT,sp,YT,ZT,en,KT,ip,JT,XT,QT,lp,eE,tE,ut,tn,oE,no,rE,dp,aE,nE,cp,sE,iE,lE,mp,dE,cE,dr,on,mE,rn,pE,_l,hE,uE,fE,ft,an,gE,nn,_E,pp,vE,bE,yE,hp,wE,TE,cr,sn,EE,up,$E,xE,gt,ln,kE,dn,qE,fp,AE,PE,DE,gp,SE,OE,Oe,cn,CE,mn,IE,_p,UE,NE,zE,so,FE,vp,LE,RE,bp,WE,GE,ME,yp,jE,HE,_t,pn,BE,we,VE,wp,YE,ZE,Tp,KE,JE,Ep,XE,QE,$p,e4,t4,o4,mr,r4,pr,hn,a4,un,n4,xp,s4,i4,l4,hr,fn,d4,kp,c4,m4,ur,gn,p4,_n,h4,qp,u4,f4,g4,vt,vn,_4,bn,v4,Ap,b4,y4,w4,Pp,T4,E4,A,yn,$4,Dp,x4,k4,Sp,q4,A4,Op,P4,D4,io,S4,Cp,O4,C4,Ip,I4,U4,N4,fr,z4,Up,Np,F4,L4,Xe,Te,R4,zp,W4,G4,Fp,M4,j4,Lp,H4,B4,Rp,V4,Y4,Z4,lo,K4,Wp,J4,X4,Gp,Q4,e$,t$,vl,Mp,o$,r$,a$,bt,jp,n$,s$,Hp,i$,l$,Bp,d$,c$,m$,Vp,p$,h$,Yp,u$,f$,wn,g$,Zp,_$,v$,b$,Qe,y$,Kp,w$,T$,Jp,E$,$$,Xp,x$,k$,q$,ne,A$,bl,P$,D$,Qp,S$,O$,eh,C$,I$,th,U$,N$,oh,z$,F$,L$,U,R$,rh,W$,G$,ah,M$,j$,nh,H$,B$,sh,V$,Y$,Tn,Z$,K$,ih,J$,X$,lh,Q$,e3,dh,t3,o3,ch,r3,a3,mh,n3,s3,i3,Ee,l3,yl,d3,c3,ph,m3,p3,wl,h3,u3,hh,f3,g3,_3,uh,v3,b3,gr,En,y3,fh,w3,T3,_r,$n,E3,xn,$3,gh,x3,k3,q3,yt,kn,A3,qn,P3,_h,D3,S3,O3,An,C3,vh,I3,U3,N3,X,Pn,z3,bh,F3,L3,Dn,R3,yh,W3,G3,M3,vr,j3,Sn,H3,wh,B3,V3,Y3,co,mo,Z3,Th,K3,J3,Eh,X3,Q3,ex,po,tx,$h,ox,rx,xh,ax,nx,sx,ho,ix,kh,lx,dx,qh,cx,mx,px,wt,On,hx,uo,ux,Ah,fx,gx,Ph,_x,vx,bx,Dh,yx,wx,Tt,Cn,Tx,fo,Ex,Sh,$x,xx,Oh,kx,qx,Ax,Ch,Px,Dx,br,In,Sx,et,Ox,Ih,Cx,Ix,Uh,Ux,Nx,Nh,zx,Fx,Lx,yr,Un,Rx,Nn,Wx,zh,Gx,Mx,jx,Ce,zn,Hx,Fn,Bx,Fh,Vx,Yx,Zx,Lh,Kx,Jx,Ln,Xx,Tl,Qx,ek,tk,Et,Rn,ok,Wn,rk,Rh,ak,nk,sk,Wh,ik,lk,$t,Gn,dk,Gh,ck,mk,Mh,pk,hk,wr,Mn,uk,jh,fk,gk,xt,jn,_k,Hh,vk,bk,Bh,yk,Tv,go,Tr,Vh,Hn,wk,Yh,Tk,Ev,tt,Bn,Ek,Ie,Vn,$k,Zh,xk,kk,Yn,qk,Kh,Ak,Pk,Dk,Jh,Sk,Ok,Q,Zn,Ck,Xh,Ik,Uk,Kn,Nk,Qh,zk,Fk,Lk,Er,Rk,Jn,Wk,eu,Gk,Mk,jk,_o,vo,Hk,tu,Bk,Vk,ou,Yk,Zk,Kk,bo,Jk,ru,Xk,Qk,au,e5,t5,o5,yo,r5,nu,a5,n5,su,s5,i5,$v,wo,$r,iu,Xn,l5,lu,d5,xv,F,Qn,c5,es,m5,du,p5,h5,u5,To,f5,El,g5,_5,ts,v5,b5,y5,de,os,w5,cu,T5,E5,Eo,$5,mu,x5,k5,pu,q5,A5,P5,$o,D5,hu,S5,O5,uu,C5,I5,U5,rs,N5,fu,z5,F5,L5,xr,as,R5,gu,W5,G5,kt,ns,M5,_u,j5,H5,xo,B5,vu,V5,Y5,bu,Z5,K5,J5,kr,ss,X5,is,Q5,yu,e6,t6,o6,qr,ls,r6,wu,a6,n6,Ar,ds,s6,Tu,i6,kv,ko,Pr,Eu,cs,l6,$u,d6,qv,ot,ms,c6,ps,m6,xu,p6,h6,u6,qo,f6,$l,g6,_6,hs,v6,b6,Av,Ao,Dr,ku,us,y6,qu,w6,Pv,ce,T6,xl,E6,$6,Au,x6,k6,kl,q6,A6,Pu,P6,D6,Dv,Sr,S6,ql,O6,C6,Sv,Or,Al,Du,I6,U6,N6,Pl,Su,z6,F6,Ov,Ue,L6,Ou,R6,W6,Cu,G6,M6,Dl,j6,H6,Cv,Cr,Ir,Iu,B6,V6,Uu,Y6,Z6,K6,Sl,Nu,J6,X6,Iv,Po,Ur,zu,fs,Q6,Fu,eq,Uv,Ne,tq,Ol,oq,rq,Lu,aq,nq,Ru,sq,iq,Nv,qt,lq,Wu,dq,cq,Cl,mq,pq,zv,Nr,Il,Gu,hq,uq,fq,Ul,Mu,gq,_q,Fv,ze,vq,Nl,bq,yq,ju,wq,Tq,Hu,Eq,$q,Lv,ee,xq,zl,kq,qq,Bu,Aq,Pq,Vu,Dq,Sq,Yu,Oq,Cq,Fl,Iq,Uq,Rv,Ll,Nq,Wv,gs,Gv,Rl,zq,Mv,_s,jv,Wl,Fq,Hv,vs,Bv,Gl,Lq,Vv,Ml,Rq,Yv,bs,Zv,zr,Wq,Zu,Gq,Mq,Kv,Do,Fr,Ku,ys,jq,Ju,Hq,Jv,me,Bq,jl,Vq,Yq,Xu,Zq,Kq,Qu,Jq,Xq,ef,Qq,eA,Xv,At,tA,ws,oA,rA,tf,aA,nA,Qv,So,Lr,of,Ts,sA,rf,iA,eb,Hl,lA,tb,Rr,dA,Es,af,cA,mA,ob,$s,rb,Pt,pA,xs,nf,hA,uA,ks,sf,fA,gA,ab,qs,nb,As,sb,Wr,_A,Bl,vA,bA,ib,Vl,yA,lb,Yl,wA,db,Zl,lf,df,TA,cb,Gr,EA,cf,$A,xA,mb,Kl,kA,pb,Ps,hb,Dt,qA,mf,AA,PA,pf,DA,SA,ub,Jl,OA,fb,Ds,gb,St,CA,hf,IA,UA,uf,NA,zA,_b,Ot,FA,ff,LA,RA,Ss,gf,WA,GA,vb,Os,bb,Xl,MA,yb,Cs,wb,Ql,jA,Tb,Is,Eb,ed,HA,$b,td,_f,vf,BA,xb,Mr,VA,bf,YA,ZA,kb,od,Us,KA,yf,JA,XA,qb,Ns,Ab,zs,wf,QA,Pb,Fs,Db,Ct,eP,Tf,tP,oP,Ef,rP,aP,Sb,rd,nP,Ob,Ls,Cb,ad,sP,Ib,jr,iP,$f,lP,dP,Ub,Oo,Hr,xf,Rs,cP,kf,mP,Nb,Br,pP,nd,hP,uP,zb,pe,fP,Ws,gP,_P,Gs,vP,bP,Ms,yP,wP,js,TP,EP,Fb,Vr,$P,sd,xP,kP,Lb,id,Rb,Co,Yr,qf,Hs,qP,Af,AP,Wb,ld,PP,Gb,It,DP,Bs,SP,OP,Vs,CP,IP,Mb,dd,UP,jb,Ys,Hb,cd,NP,Bb,Ut,zP,Pf,FP,LP,Df,RP,WP,Vb,Io,Zr,Sf,Zs,GP,Of,MP,Yb,md,jP,Zb,Fe,HP,Cf,BP,VP,If,YP,ZP,Uf,KP,JP,Kb,Nt,XP,Nf,QP,e8,zf,t8,o8,Jb,Ks,Xb,Kr,r8,Js,a8,n8,Qb,Uo,Jr,Ff,Xs,s8,Lf,i8,e1,pd,l8,t1,Qs,o1,zt,d8,Rf,c8,m8,Wf,p8,h8,r1,hd,u8,a1,ei,n1,ud,f8,s1,Xr,g8,Gf,_8,v8,i1,rt,Mf,b8,y8,jf,w8,T8,Hf,E8,$8,l1,fd,x8,d1,ti,c1,gd,k8,m1,Le,q8,Bf,A8,P8,Vf,D8,S8,Yf,O8,C8,p1,No,Qr,Zf,oi,I8,Kf,U8,h1,Ft,N8,Jf,z8,F8,Xf,L8,R8,u1,_d,W8,f1,vd,G8,g1,ea,M8,Qf,j8,H8,_1,ri,v1,M,B8,eg,V8,Y8,tg,Z8,K8,og,J8,X8,rg,Q8,eD,ag,tD,oD,ng,rD,aD,b1,bd,nD,y1,zo,ta,sg,ai,sD,ig,iD,w1,oa,T1,Re,lD,ni,dD,cD,yd,mD,pD,si,hD,uD,E1,We,lg,fD,gD,dg,_D,vD,cg,bD,yD,mg,wD,$1,wd,TD,x1,ii,pg,ED,$D,k1,Td,xD,q1,li,A1,Lt,kD,hg,qD,AD,ug,PD,DD,P1,di,D1,Rt,SD,fg,OD,CD,ci,ID,UD,S1,ra,ND,Ed,zD,FD,O1,$d,LD,C1,mi,gg,RD,WD,I1,pi,U1,xd,GD,N1,hi,z1,ui,_g,MD,jD,F1,fi,L1,kd,HD,R1,gi,W1,qd,BD,G1,aa,VD,_i,YD,ZD,M1,vi,vg,KD,JD,j1,Wt,XD,bg,QD,e9,yg,t9,o9,H1,na,r9,wg,a9,n9,B1,bi,V1,Ad,s9,Y1,Ge,Tg,i9,l9,Eg,d9,c9,yi,m9,$g,p9,h9,u9,wi,f9,xg,g9,_9,Z1,Ti,at,v9,kg,b9,y9,qg,w9,T9,Ag,E9,$9,K1,sa,x9,Pg,k9,q9,J1,Ei,X1,Fo,Dg,A9,P9,Sg,D9,S9,Q1,Gt,O9,Og,C9,I9,Cg,U9,N9,ey,Pd,z9,ty,he,Ig,F9,L9,Ug,R9,W9,$i,G9,Ng,M9,j9,H9,Lo,B9,zg,V9,Y9,Fg,Z9,K9,J9,Lg,X9,oy,Dd,Q9,ry,ia,Ro,eS,Rg,tS,oS,Wg,rS,aS,nS,$e,sS,Gg,iS,lS,Mg,dS,cS,jg,mS,pS,Hg,hS,uS,ay,Wo,la,Bg,xi,fS,Vg,gS,ny,da,_S,ki,vS,bS,sy,qi,Yg,yS,wS,iy,Ai,Zg,TS,ES,ly,te,Kg,Pi,$S,Jg,xS,kS,qS,Di,Sd,Xg,AS,PS,DS,Go,Si,SS,Qg,OS,CS,IS,Oi,US,e_,NS,zS,FS,Ci,LS,t_,RS,WS,GS,o_,Mo,MS,r_,jS,HS,a_,BS,VS,YS,n_,nt,ZS,s_,KS,JS,i_,XS,QS,l_,e7,t7,o7,d_,jo,r7,c_,a7,n7,m_,s7,i7,l7,Ii,p_,d7,c7,Ui,xe,m7,h_,p7,h7,u_,u7,f7,f_,g7,_7,g_,v7,b7,y7,Ni,w7,__,T7,E7,dy,Od,v_,$7,cy,ca,zi,x7,Fi,k7,q7,A7,Ho,P7,Li,D7,S7,b_,O7,C7,my,Bo,ma,y_,Ri,I7,w_,U7,py,Me,N7,T_,z7,F7,Wi,L7,R7,Gi,W7,G7,hy,pa,uy,Cd,E_,M7,fy,Mt,$_,j7,H7,x_,B7,V7,k_,Y7,gy,Vo,q_,Z7,K7,Mi,J7,X7,_y,Yo,A_,Q7,eO,P_,tO,oO,vy,ji,by,Id,D_,rO,yy,ha,Hi,aO,S_,nO,sO,iO,ke,lO,O_,dO,cO,C_,mO,pO,I_,hO,uO,U_,fO,gO,wy,jt,_O,N_,vO,bO,Bi,yO,wO,Ty,Ud,TO,Ey,w,EO,Nd,$O,z_,xO,zd,kO,F_,qO,Fd,AO,L_,PO,Ld,DO,R_,SO,Rd,OO,W_,CO,Wd,IO,G_,UO,Gd,NO,M_,zO,Md,FO,j_,LO,jd,RO,H_,WO,Hd,GO,B_,MO,Bd,jO,V_,HO,Vd,BO,Y_,VO,Yd,YO,Z_,ZO,Zd,KO,K_,JO,Kd,XO,J_,QO,Jd,eC,X_,tC,Xd,oC,Q_,rC,Qd,aC,ev,nC,ec,sC,tv,iC,tc,lC,ov,dC,oc,cC,rv,mC,rc,pC,av,hC,ac,uC,nv,fC,$y;return q=new Y({}),er=new hm({props:{warning:!0,$$slots:{default:[ZG]},$$scope:{ctx:Z}}}),Fa=new O({props:{code:`from torch import nn
from transformers import Trainer


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


<span class="hljs-keyword">class</span> <span class="hljs-title class_">CustomTrainer</span>(<span class="hljs-title class_ inherited__">Trainer</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_loss</span>(<span class="hljs-params">self, model, inputs, return_outputs=<span class="hljs-literal">False</span></span>):
        labels = inputs.get(<span class="hljs-string">&quot;labels&quot;</span>)
        <span class="hljs-comment"># forward pass</span>
        outputs = model(**inputs)
        logits = outputs.get(<span class="hljs-string">&quot;logits&quot;</span>)
        <span class="hljs-comment"># compute custom loss (suppose one has 3 labels with different weights)</span>
        loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([<span class="hljs-number">1.0</span>, <span class="hljs-number">2.0</span>, <span class="hljs-number">3.0</span>]))
        loss = loss_fct(logits.view(-<span class="hljs-number">1</span>, self.model.config.num_labels), labels.view(-<span class="hljs-number">1</span>))
        <span class="hljs-keyword">return</span> (loss, outputs) <span class="hljs-keyword">if</span> return_outputs <span class="hljs-keyword">else</span> loss`}}),La=new Y({}),Ra=new x({props:{name:"class transformers.Trainer",anchor:"transformers.Trainer",parameters:[{name:"model",val:": typing.Union[transformers.modeling_utils.PreTrainedModel, torch.nn.modules.module.Module] = None"},{name:"args",val:": TrainingArguments = None"},{name:"data_collator",val:": typing.Optional[DataCollator] = None"},{name:"train_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"eval_dataset",val:": typing.Union[torch.utils.data.dataset.Dataset, typing.Dict[str, torch.utils.data.dataset.Dataset], NoneType] = None"},{name:"tokenizer",val:": typing.Optional[transformers.tokenization_utils_base.PreTrainedTokenizerBase] = None"},{name:"model_init",val:": typing.Union[typing.Callable[[], transformers.modeling_utils.PreTrainedModel], NoneType] = None"},{name:"compute_metrics",val:": typing.Union[typing.Callable[[transformers.trainer_utils.EvalPrediction], typing.Dict], NoneType] = None"},{name:"callbacks",val:": typing.Optional[typing.List[transformers.trainer_callback.TrainerCallback]] = None"},{name:"optimizers",val:": typing.Tuple[torch.optim.optimizer.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None)"},{name:"preprocess_logits_for_metrics",val:": typing.Union[typing.Callable[[torch.Tensor, torch.Tensor], torch.Tensor], NoneType] = None"}],parametersDescription:[{anchor:"transformers.Trainer.model",description:`<strong>model</strong> (<a href="/docs/transformers/main/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/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> is optimized to work with the <a href="/docs/transformers/main/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/main/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/main/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/main/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/main/en/main_classes/data_collator#transformers.DataCollatorWithPadding">DataCollatorWithPadding</a> otherwise.`,name:"data_collator"},{anchor:"transformers.Trainer.train_dataset",description:`<strong>train_dataset</strong> (<code>torch.utils.data.Dataset</code> or <code>torch.utils.data.IterableDataset</code>, <em>optional</em>) &#x2014;
The dataset to use for training. If it is a <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed.</p>
<p>Note that if it&#x2019;s a <code>torch.utils.data.IterableDataset</code> with some randomization and you are training in a
distributed fashion, your iterable dataset should either use a internal attribute <code>generator</code> that is a
<code>torch.Generator</code> for the randomization that must be identical on all processes (and the Trainer will
manually set the seed of this <code>generator</code> at each epoch) or have a <code>set_epoch()</code> method that internally
sets the seed of the RNGs used.`,name:"train_dataset"},{anchor:"transformers.Trainer.eval_dataset",description:`<strong>eval_dataset</strong> (Union[<code>torch.utils.data.Dataset</code>, Dict[str, <code>torch.utils.data.Dataset</code>]), <em>optional</em>) &#x2014;
The dataset to use for evaluation. If it is a <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. If it is a dictionary, it will evaluate on each
dataset prepending the dictionary key to the metric name.`,name:"eval_dataset"},{anchor:"transformers.Trainer.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase">PreTrainedTokenizerBase</a>, <em>optional</em>) &#x2014;
The tokenizer used to preprocess the data. If provided, will be used to automatically pad the inputs to the
maximum length when batching inputs, and it will be saved along the model to make it easier to rerun an
interrupted training or reuse the fine-tuned model.`,name:"tokenizer"},{anchor:"transformers.Trainer.model_init",description:`<strong>model_init</strong> (<code>Callable[[], PreTrainedModel]</code>, <em>optional</em>) &#x2014;
A function that instantiates the model to be used. If provided, each call to <a href="/docs/transformers/main/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/main/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/main/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/main/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/main/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> on your model
and a scheduler given by <a href="/docs/transformers/main/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/main/src/transformers/trainer.py#L210"}}),Wa=new x({props:{name:"add_callback",anchor:"transformers.Trainer.add_callback",parameters:[{name:"callback",val:""}],parametersDescription:[{anchor:"transformers.Trainer.add_callback.callback",description:`<strong>callback</strong> (<code>type</code> or <code>~transformer.TrainerCallback</code>) &#x2014;
A <code>~transformer.TrainerCallback</code> class or an instance of a <code>~transformer.TrainerCallback</code>. In the
first case, will instantiate a member of that class.`,name:"callback"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L649"}}),Ma=new x({props:{name:"autocast_smart_context_manager",anchor:"transformers.Trainer.autocast_smart_context_manager",parameters:[{name:"cache_enabled",val:": typing.Optional[bool] = True"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L2494"}}),Ha=new x({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/main/src/transformers/trainer.py#L2561"}}),Ba=new x({props:{name:"compute_loss_context_manager",anchor:"transformers.Trainer.compute_loss_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L2488"}}),Va=new x({props:{name:"create_model_card",anchor:"transformers.Trainer.create_model_card",parameters:[{name:"language",val:": typing.Optional[str] = None"},{name:"license",val:": typing.Optional[str] = None"},{name:"tags",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"model_name",val:": typing.Optional[str] = None"},{name:"finetuned_from",val:": typing.Optional[str] = None"},{name:"tasks",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset_tags",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"dataset_args",val:": typing.Union[str, typing.List[str], NoneType] = None"}],parametersDescription:[{anchor:"transformers.Trainer.create_model_card.language",description:`<strong>language</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language of the model (if applicable)`,name:"language"},{anchor:"transformers.Trainer.create_model_card.license",description:`<strong>license</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The license of the model. Will default to the license of the pretrained model used, if the original
model given to the <code>Trainer</code> comes from a repo on the Hub.`,name:"license"},{anchor:"transformers.Trainer.create_model_card.tags",description:`<strong>tags</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
Some tags to be included in the metadata of the model card.`,name:"tags"},{anchor:"transformers.Trainer.create_model_card.model_name",description:`<strong>model_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the model.`,name:"model_name"},{anchor:"transformers.Trainer.create_model_card.finetuned_from",description:`<strong>finetuned_from</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo
of the original model given to the <code>Trainer</code> (if it comes from the Hub).`,name:"finetuned_from"},{anchor:"transformers.Trainer.create_model_card.tasks",description:`<strong>tasks</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several task identifiers, to be included in the metadata of the model card.`,name:"tasks"},{anchor:"transformers.Trainer.create_model_card.dataset_tags",description:`<strong>dataset_tags</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset tags, to be included in the metadata of the model card.`,name:"dataset_tags"},{anchor:"transformers.Trainer.create_model_card.dataset",description:`<strong>dataset</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset identifiers, to be included in the metadata of the model card.`,name:"dataset"},{anchor:"transformers.Trainer.create_model_card.dataset_args",description:`<strong>dataset_args</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
One or several dataset arguments, to be included in the metadata of the model card.`,name:"dataset_args"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L3353"}}),Za=new x({props:{name:"create_optimizer",anchor:"transformers.Trainer.create_optimizer",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L1009"}}),Ja=new x({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/main/src/transformers/trainer.py#L993"}}),Xa=new x({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/main/src/transformers/trainer.py#L1154"}}),Qa=new x({props:{name:"evaluate",anchor:"transformers.Trainer.evaluate",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'eval'"}],parametersDescription:[{anchor:"transformers.Trainer.evaluate.eval_dataset",description:`<strong>eval_dataset</strong> (<code>Dataset</code>, <em>optional</em>) &#x2014;
Pass a dataset if you wish to override <code>self.eval_dataset</code>. If it is a <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns
not accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Trainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>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/main/src/transformers/trainer.py#L2790",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>
`}}),tn=new x({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/main/src/transformers/trainer.py#L2923"}}),on=new x({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/main/src/transformers/trainer.py#L3292",returnDescription:`
<p>The number of floating-point operations.</p>
`,returnType:`
<p><code>int</code></p>
`}}),an=new x({props:{name:"get_eval_dataloader",anchor:"transformers.Trainer.get_eval_dataloader",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"}],parametersDescription:[{anchor:"transformers.Trainer.get_eval_dataloader.eval_dataset",description:`<strong>eval_dataset</strong> (<code>torch.utils.data.Dataset</code>, <em>optional</em>) &#x2014;
If provided, will override <code>self.eval_dataset</code>. If it is a <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted
by the <code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"eval_dataset"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L895"}}),sn=new x({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/main/src/transformers/trainer.py#L1065"}}),ln=new x({props:{name:"get_test_dataloader",anchor:"transformers.Trainer.get_test_dataloader",parameters:[{name:"test_dataset",val:": Dataset"}],parametersDescription:[{anchor:"transformers.Trainer.get_test_dataloader.test_dataset",description:`<strong>test_dataset</strong> (<code>torch.utils.data.Dataset</code>, <em>optional</em>) &#x2014;
The test dataset to use. If it is a <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"test_dataset"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L945"}}),cn=new x({props:{name:"get_train_dataloader",anchor:"transformers.Trainer.get_train_dataloader",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L816"}}),pn=new x({props:{name:"hyperparameter_search",anchor:"transformers.Trainer.hyperparameter_search",parameters:[{name:"hp_space",val:": typing.Union[typing.Callable[[ForwardRef('optuna.Trial')], typing.Dict[str, float]], NoneType] = None"},{name:"compute_objective",val:": typing.Union[typing.Callable[[typing.Dict[str, float]], float], NoneType] = None"},{name:"n_trials",val:": int = 20"},{name:"direction",val:": str = 'minimize'"},{name:"backend",val:": typing.Union[ForwardRef('str'), transformers.trainer_utils.HPSearchBackend, NoneType] = None"},{name:"hp_name",val:": typing.Union[typing.Callable[[ForwardRef('optuna.Trial')], str], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Trainer.hyperparameter_search.hp_space",description:`<strong>hp_space</strong> (<code>Callable[[&quot;optuna.Trial&quot;], Dict[str, float]]</code>, <em>optional</em>) &#x2014;
A function that defines the hyperparameter search space. Will default to
<code>default_hp_space_optuna()</code> or <code>default_hp_space_ray()</code> or
<code>default_hp_space_sigopt()</code> depending on your backend.`,name:"hp_space"},{anchor:"transformers.Trainer.hyperparameter_search.compute_objective",description:`<strong>compute_objective</strong> (<code>Callable[[Dict[str, float]], float]</code>, <em>optional</em>) &#x2014;
A function computing the objective to minimize or maximize from the metrics returned by the <code>evaluate</code>
method. Will default to <code>default_compute_objective()</code>.`,name:"compute_objective"},{anchor:"transformers.Trainer.hyperparameter_search.n_trials",description:`<strong>n_trials</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of trial runs to test.`,name:"n_trials"},{anchor:"transformers.Trainer.hyperparameter_search.direction",description:`<strong>direction</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;minimize&quot;</code>) &#x2014;
Whether to optimize greater or lower objects. Can be <code>&quot;minimize&quot;</code> or <code>&quot;maximize&quot;</code>, you should pick
<code>&quot;minimize&quot;</code> when optimizing the validation loss, <code>&quot;maximize&quot;</code> when optimizing one or several metrics.`,name:"direction"},{anchor:"transformers.Trainer.hyperparameter_search.backend",description:`<strong>backend</strong> (<code>str</code> or <code>~training_utils.HPSearchBackend</code>, <em>optional</em>) &#x2014;
The backend to use for hyperparameter search. Will default to optuna or Ray Tune or SigOpt, depending
on which one is installed. If all are installed, will default to optuna.`,name:"backend"},{anchor:"transformers.Trainer.hyperparameter_search.hp_name",description:`<strong>hp_name</strong> (<code>Callable[[&quot;optuna.Trial&quot;], str]]</code>, <em>optional</em>) &#x2014;
A function that defines the trial/run name. Will default to None.`,name:"hp_name"},{anchor:"transformers.Trainer.hyperparameter_search.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments passed along to <code>optuna.create_study</code> or <code>ray.tune.run</code>. For more
information see:</p>
<ul>
<li>the documentation of
<a href="https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.create_study.html" rel="nofollow">optuna.create_study</a></li>
<li>the documentation of <a href="https://docs.ray.io/en/latest/tune/api_docs/execution.html#tune-run" rel="nofollow">tune.run</a></li>
<li>the documentation of <a href="https://app.sigopt.com/docs/endpoints/experiments/create" rel="nofollow">sigopt</a></li>
</ul>`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L2342",returnDescription:`
<p>All the information about the best run.</p>
`,returnType:`
<p><code>trainer_utils.BestRun</code></p>
`}}),mr=new hm({props:{warning:!0,$$slots:{default:[KG]},$$scope:{ctx:Z}}}),hn=new x({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/main/src/transformers/trainer.py#L3310"}}),fn=new x({props:{name:"is_local_process_zero",anchor:"transformers.Trainer.is_local_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L2593"}}),gn=new x({props:{name:"is_world_process_zero",anchor:"transformers.Trainer.is_world_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L2600"}}),vn=new x({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/main/src/transformers/trainer.py#L2437"}}),yn=new x({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/main/src/transformers/trainer_pt_utils.py#L891"}}),fr=new YG({props:{anchor:"transformers.Trainer.log_metrics.example",$$slots:{default:[JG]},$$scope:{ctx:Z}}}),En=new x({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/main/src/transformers/trainer_pt_utils.py#L865",returnDescription:`
<p>The reformatted metrics</p>
`,returnType:`
<p>metrics (<code>Dict[str, float]</code>)</p>
`}}),$n=new x({props:{name:"num_examples",anchor:"transformers.Trainer.num_examples",parameters:[{name:"dataloader",val:": DataLoader"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L1171"}}),kn=new x({props:{name:"pop_callback",anchor:"transformers.Trainer.pop_callback",parameters:[{name:"callback",val:""}],parametersDescription:[{anchor:"transformers.Trainer.pop_callback.callback",description:`<strong>callback</strong> (<code>type</code> or <code>~transformer.TrainerCallback</code>) &#x2014;
A <code>~transformer.TrainerCallback</code> class or an instance of a <code>~transformer.TrainerCallback</code>. In the
first case, will pop the first member of that class found in the list of callbacks.`,name:"callback"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L660",returnDescription:`
<p>The callback removed, if found.</p>
`,returnType:`
<p><code>~transformer.TrainerCallback</code></p>
`}}),Pn=new x({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/main/src/transformers/trainer.py#L2861"}}),vr=new hm({props:{$$slots:{default:[XG]},$$scope:{ctx:Z}}}),On=new x({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/main/src/transformers/trainer.py#L3511"}}),Cn=new x({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/main/src/transformers/trainer.py#L3187",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>
`}}),In=new x({props:{name:"push_to_hub",anchor:"transformers.Trainer.push_to_hub",parameters:[{name:"commit_message",val:": typing.Optional[str] = 'End of training'"},{name:"blocking",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Trainer.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;End of training&quot;</code>) &#x2014;
Message to commit while pushing.`,name:"commit_message"},{anchor:"transformers.Trainer.push_to_hub.blocking",description:`<strong>blocking</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the function should return only when the <code>git push</code> has finished.
kwargs &#x2014;
Additional keyword arguments passed along to <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.create_model_card">create_model_card()</a>.`,name:"blocking"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L3451",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>
`}}),Un=new x({props:{name:"remove_callback",anchor:"transformers.Trainer.remove_callback",parameters:[{name:"callback",val:""}],parametersDescription:[{anchor:"transformers.Trainer.remove_callback.callback",description:`<strong>callback</strong> (<code>type</code> or <code>~transformer.TrainerCallback</code>) &#x2014;
A <code>~transformer.TrainerCallback</code> class or an instance of a <code>~transformer.TrainerCallback</code>. In the
first case, will remove the first member of that class found in the list of callbacks.`,name:"callback"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L676"}}),zn=new x({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/main/src/transformers/trainer_pt_utils.py#L981"}}),Rn=new x({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/main/src/transformers/trainer.py#L2612"}}),Gn=new x({props:{name:"save_state",anchor:"transformers.Trainer.save_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_pt_utils.py#L1019"}}),Mn=new x({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/main/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/main/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/main/src/transformers/trainer.py#L1464"}}),jn=new x({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/main/src/transformers/trainer.py#L2513",returnDescription:`
<p>The tensor with training loss on this batch.</p>
`,returnType:`
<p><code>torch.Tensor</code></p>
`}}),Hn=new Y({}),Bn=new x({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.Union[torch.utils.data.dataset.Dataset, typing.Dict[str, torch.utils.data.dataset.Dataset], NoneType] = None"},{name:"tokenizer",val:": typing.Optional[transformers.tokenization_utils_base.PreTrainedTokenizerBase] = None"},{name:"model_init",val:": typing.Union[typing.Callable[[], transformers.modeling_utils.PreTrainedModel], NoneType] = None"},{name:"compute_metrics",val:": typing.Union[typing.Callable[[transformers.trainer_utils.EvalPrediction], typing.Dict], NoneType] = None"},{name:"callbacks",val:": typing.Optional[typing.List[transformers.trainer_callback.TrainerCallback]] = None"},{name:"optimizers",val:": typing.Tuple[torch.optim.optimizer.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None)"},{name:"preprocess_logits_for_metrics",val:": typing.Union[typing.Callable[[torch.Tensor, torch.Tensor], torch.Tensor], NoneType] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_seq2seq.py#L30"}}),Vn=new x({props:{name:"evaluate",anchor:"transformers.Seq2SeqTrainer.evaluate",parameters:[{name:"eval_dataset",val:": typing.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'eval'"},{name:"**gen_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainer.evaluate.eval_dataset",description:`<strong>eval_dataset</strong> (<code>Dataset</code>, <em>optional</em>) &#x2014;
Pass a dataset if you wish to override <code>self.eval_dataset</code>. If it is an <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns
not accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Seq2SeqTrainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.evaluate.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.evaluate.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.evaluate.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.
gen_kwargs &#x2014;
Additional <code>generate</code> specific kwargs.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/main/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>
`}}),Zn=new x({props:{name:"predict",anchor:"transformers.Seq2SeqTrainer.predict",parameters:[{name:"test_dataset",val:": Dataset"},{name:"ignore_keys",val:": typing.Optional[typing.List[str]] = None"},{name:"metric_key_prefix",val:": str = 'test'"},{name:"**gen_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Seq2SeqTrainer.predict.test_dataset",description:`<strong>test_dataset</strong> (<code>Dataset</code>) &#x2014;
Dataset to run the predictions on. If it is a <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. Has to implement the method <code>__len__</code>`,name:"test_dataset"},{anchor:"transformers.Seq2SeqTrainer.predict.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.predict.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.predict.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.predict.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.
gen_kwargs &#x2014;
Additional <code>generate</code> specific kwargs.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_seq2seq.py#L80"}}),Er=new hm({props:{$$slots:{default:[QG]},$$scope:{ctx:Z}}}),Xn=new Y({}),Qn=new x({props:{name:"class transformers.TrainingArguments",anchor:"transformers.TrainingArguments",parameters:[{name:"output_dir",val:": str"},{name:"overwrite_output_dir",val:": bool = False"},{name:"do_train",val:": bool = False"},{name:"do_eval",val:": bool = False"},{name:"do_predict",val:": bool = False"},{name:"evaluation_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'no'"},{name:"prediction_loss_only",val:": bool = False"},{name:"per_device_train_batch_size",val:": int = 8"},{name:"per_device_eval_batch_size",val:": int = 8"},{name:"per_gpu_train_batch_size",val:": typing.Optional[int] = None"},{name:"per_gpu_eval_batch_size",val:": typing.Optional[int] = None"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"eval_accumulation_steps",val:": typing.Optional[int] = None"},{name:"eval_delay",val:": typing.Optional[float] = 0"},{name:"learning_rate",val:": float = 5e-05"},{name:"weight_decay",val:": float = 0.0"},{name:"adam_beta1",val:": float = 0.9"},{name:"adam_beta2",val:": float = 0.999"},{name:"adam_epsilon",val:": float = 1e-08"},{name:"max_grad_norm",val:": float = 1.0"},{name:"num_train_epochs",val:": float = 3.0"},{name:"max_steps",val:": int = -1"},{name:"lr_scheduler_type",val:": typing.Union[transformers.trainer_utils.SchedulerType, str] = 'linear'"},{name:"warmup_ratio",val:": float = 0.0"},{name:"warmup_steps",val:": int = 0"},{name:"log_level",val:": typing.Optional[str] = 'passive'"},{name:"log_level_replica",val:": typing.Optional[str] = 'passive'"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_dir",val:": typing.Optional[str] = None"},{name:"logging_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"logging_first_step",val:": bool = False"},{name:"logging_steps",val:": int = 500"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"save_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"save_steps",val:": 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:"use_mps_device",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": typing.Optional[int] = None"},{name:"jit_mode_eval",val:": bool = False"},{name:"use_ipex",val:": bool = False"},{name:"bf16",val:": bool = False"},{name:"fp16",val:": bool = False"},{name:"fp16_opt_level",val:": str = 'O1'"},{name:"half_precision_backend",val:": str = 'auto'"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": typing.Optional[bool] = None"},{name:"local_rank",val:": int = -1"},{name:"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:"fsdp_transformer_layer_cls_to_wrap",val:": typing.Optional[str] = None"},{name:"deepspeed",val:": typing.Optional[str] = None"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"optim",val:": typing.Union[transformers.training_args.OptimizerNames, str] = 'adamw_hf'"},{name:"optim_args",val:": typing.Optional[str] = None"},{name:"adafactor",val:": bool = False"},{name:"group_by_length",val:": bool = False"},{name:"length_column_name",val:": typing.Optional[str] = 'length'"},{name:"report_to",val:": typing.Optional[typing.List[str]] = None"},{name:"ddp_find_unused_parameters",val:": typing.Optional[bool] = None"},{name:"ddp_bucket_cap_mb",val:": typing.Optional[int] = None"},{name:"dataloader_pin_memory",val:": bool = True"},{name:"skip_memory_metrics",val:": bool = True"},{name:"use_legacy_prediction_loop",val:": bool = False"},{name:"push_to_hub",val:": bool = False"},{name:"resume_from_checkpoint",val:": typing.Optional[str] = None"},{name:"hub_model_id",val:": typing.Optional[str] = None"},{name:"hub_strategy",val:": typing.Union[transformers.trainer_utils.HubStrategy, str] = 'every_save'"},{name:"hub_token",val:": typing.Optional[str] = None"},{name:"hub_private_repo",val:": bool = False"},{name:"gradient_checkpointing",val:": bool = False"},{name:"include_inputs_for_metrics",val:": bool = False"},{name:"fp16_backend",val:": str = 'auto'"},{name:"push_to_hub_model_id",val:": typing.Optional[str] = None"},{name:"push_to_hub_organization",val:": typing.Optional[str] = None"},{name:"push_to_hub_token",val:": typing.Optional[str] = None"},{name:"mp_parameters",val:": str = ''"},{name:"auto_find_batch_size",val:": bool = False"},{name:"full_determinism",val:": bool = False"},{name:"torchdynamo",val:": typing.Optional[str] = None"},{name:"ray_scope",val:": typing.Optional[str] = 'last'"},{name:"ddp_timeout",val:": typing.Optional[int] = 1800"},{name:"torch_compile",val:": bool = False"},{name:"torch_compile_backend",val:": typing.Optional[str] = None"},{name:"torch_compile_mode",val:": typing.Optional[str] = None"}],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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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>~Trainer.model_init</code> function to instantiate the model if it has some randomly initialized parameters.`,name:"seed"},{anchor:"transformers.TrainingArguments.data_seed",description:`<strong>data_seed</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Random seed to be used with data samplers. If not set, random generators for data sampling will use the
same seed as <code>seed</code>. This can be used to ensure reproducibility of data sampling, independent of the model
seed.`,name:"data_seed"},{anchor:"transformers.TrainingArguments.jit_mode_eval",description:`<strong>jit_mode_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use PyTorch jit trace for inference.`,name:"jit_mode_eval"},{anchor:"transformers.TrainingArguments.use_ipex",description:`<strong>use_ipex</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Intel extension for PyTorch when it is available. <a href="https://github.com/intel/intel-extension-for-pytorch" rel="nofollow">IPEX
installation</a>.`,name:"use_ipex"},{anchor:"transformers.TrainingArguments.bf16",description:`<strong>bf16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use bf16 16-bit (mixed) precision training instead of 32-bit training. Requires Ampere or higher
NVIDIA architecture or using CPU (no_cuda). This is an experimental API and it may change.`,name:"bf16"},{anchor:"transformers.TrainingArguments.fp16",description:`<strong>fp16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use fp16 16-bit (mixed) precision training instead of 32-bit training.`,name:"fp16"},{anchor:"transformers.TrainingArguments.fp16_opt_level",description:`<strong>fp16_opt_level</strong> (<code>str</code>, <em>optional</em>, defaults to &#x2018;O1&#x2019;) &#x2014;
For <code>fp16</code> training, Apex AMP optimization level selected in [&#x2018;O0&#x2019;, &#x2018;O1&#x2019;, &#x2018;O2&#x2019;, and &#x2018;O3&#x2019;]. See details on
the <a href="https://nvidia.github.io/apex/amp" rel="nofollow">Apex documentation</a>.`,name:"fp16_opt_level"},{anchor:"transformers.TrainingArguments.fp16_backend",description:`<strong>fp16_backend</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
This argument is deprecated. Use <code>half_precision_backend</code> instead.`,name:"fp16_backend"},{anchor:"transformers.TrainingArguments.half_precision_backend",description:`<strong>half_precision_backend</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
The backend to use for mixed precision training. Must be one of <code>&quot;auto&quot;, &quot;cuda_amp&quot;, &quot;apex&quot;, &quot;cpu_amp&quot;</code>.
<code>&quot;auto&quot;</code> will use CPU/CUDA AMP or APEX depending on the PyTorch version detected, while the other choices
will force the requested backend.`,name:"half_precision_backend"},{anchor:"transformers.TrainingArguments.bf16_full_eval",description:`<strong>bf16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full bfloat16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values. This is an experimental API and it may change.`,name:"bf16_full_eval"},{anchor:"transformers.TrainingArguments.fp16_full_eval",description:`<strong>fp16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full float16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values.`,name:"fp16_full_eval"},{anchor:"transformers.TrainingArguments.tf32",description:`<strong>tf32</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to enable the TF32 mode, available in Ampere and newer GPU architectures. The default value depends
on PyTorch&#x2019;s version default of <code>torch.backends.cuda.matmul.allow_tf32</code>. For more details please refer to
the <a href="https://huggingface.co/docs/transformers/performance#tf32" rel="nofollow">TF32</a> documentation. This is an
experimental API and it may change.`,name:"tf32"},{anchor:"transformers.TrainingArguments.local_rank",description:`<strong>local_rank</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Rank of the process during distributed training.`,name:"local_rank"},{anchor:"transformers.TrainingArguments.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> or <code>&quot;gloo&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>~notebook.NotebookTrainingTracker</code> in Jupyter Notebooks. Will default to <code>True</code> if the logging level is
set to warn or lower (default), <code>False</code> otherwise.`,name:"disable_tqdm"},{anchor:"transformers.TrainingArguments.remove_unused_columns",description:`<strong>remove_unused_columns</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to automatically remove the columns unused by the model forward method.</p>
<p>(Note that this behavior is not implemented for <code>TFTrainer</code> yet.)`,name:"remove_unused_columns"},{anchor:"transformers.TrainingArguments.label_names",description:`<strong>label_names</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
The list of keys in your dictionary of inputs that correspond to the labels.</p>
<p>Will eventually default to the list of argument names accepted by the model that contain the word &#x201C;label&#x201D;,
except if the model used is one of the <code>XxxForQuestionAnswering</code> in which case it will also include the
<code>[&quot;start_positions&quot;, &quot;end_positions&quot;]</code> keys.`,name:"label_names"},{anchor:"transformers.TrainingArguments.load_best_model_at_end",description:`<strong>load_best_model_at_end</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to load the best model found during training at the end of training.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When set to <code>True</code>, the parameters <code>save_strategy</code> needs to be the same as <code>evaluation_strategy</code>, and in
the case it is &#x201C;steps&#x201D;, <code>save_steps</code> must be a round multiple of <code>eval_steps</code>.</p>

					</div>`,name:"load_best_model_at_end"},{anchor:"transformers.TrainingArguments.metric_for_best_model",description:`<strong>metric_for_best_model</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> to specify the metric to use to compare two different
models. Must be the name of a metric returned by the evaluation with or without the prefix <code>&quot;eval_&quot;</code>. Will
default to <code>&quot;loss&quot;</code> if unspecified and <code>load_best_model_at_end=True</code> (to use the evaluation loss).</p>
<p>If you set this value, <code>greater_is_better</code> will default to <code>True</code>. Don&#x2019;t forget to set it to <code>False</code> if
your metric is better when lower.`,name:"metric_for_best_model"},{anchor:"transformers.TrainingArguments.greater_is_better",description:`<strong>greater_is_better</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> and <code>metric_for_best_model</code> to specify if better models
should have a greater metric or not. Will default to:</p>
<ul>
<li><code>True</code> if <code>metric_for_best_model</code> is set to a value that isn&#x2019;t <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
<li><code>False</code> if <code>metric_for_best_model</code> is not set, or set to <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
</ul>`,name:"greater_is_better"},{anchor:"transformers.TrainingArguments.ignore_data_skip",description:`<strong>ignore_data_skip</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When resuming training, whether or not to skip the epochs and batches to get the data loading at the same
stage as in the previous training. If set to <code>True</code>, the training will begin faster (as that skipping step
can take a long time) but will not yield the same results as the interrupted training would have.`,name:"ignore_data_skip"},{anchor:"transformers.TrainingArguments.sharded_ddp",description:`<strong>sharded_ddp</strong> (<code>bool</code>, <code>str</code> or list of <code>ShardedDDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Sharded DDP training from <a href="https://github.com/facebookresearch/fairscale" rel="nofollow">FairScale</a> (in distributed
training only). This is an experimental feature.</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;simple&quot;</code>: to use first instance of sharded DDP released by fairscale (<code>ShardedDDP</code>) similar to ZeRO-2.</li>
<li><code>&quot;zero_dp_2&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-2 mode (with <code>reshard_after_forward=False</code>).</li>
<li><code>&quot;zero_dp_3&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-3 mode (with <code>reshard_after_forward=True</code>).</li>
<li><code>&quot;offload&quot;</code>: to add ZeRO-offload (only compatible with <code>&quot;zero_dp_2&quot;</code> and <code>&quot;zero_dp_3&quot;</code>).</li>
</ul>
<p>If a string is passed, it will be split on space. If a bool is passed, it will be converted to an empty
list for <code>False</code> and <code>[&quot;simple&quot;]</code> for <code>True</code>.`,name:"sharded_ddp"},{anchor:"transformers.TrainingArguments.fsdp",description:`<strong>fsdp</strong> (<code>bool</code>, <code>str</code> or list of <code>FSDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use PyTorch Distributed Parallel Training (in distributed training only).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;full_shard&quot;</code>: Shard parameters, gradients and optimizer states.</li>
<li><code>&quot;shard_grad_op&quot;</code>: Shard optimizer states and gradients.</li>
<li><code>&quot;offload&quot;</code>: Offload parameters and gradients to CPUs (only compatible with <code>&quot;full_shard&quot;</code> and
<code>&quot;shard_grad_op&quot;</code>).</li>
<li><code>&quot;auto_wrap&quot;</code>: Automatically recursively wrap layers with FSDP using <code>default_auto_wrap_policy</code>.</li>
</ul>`,name:"fsdp"},{anchor:"transformers.TrainingArguments.fsdp_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, adamw_anyprecision or adafactor.`,name:"optim"},{anchor:"transformers.TrainingArguments.optim_args",description:`<strong>optim_args</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional arguments that are supplied to AnyPrecisionAdamW.`,name:"optim_args"},{anchor:"transformers.TrainingArguments.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;neptune&quot;</code>, <code>&quot;tensorboard&quot;</code>,<code>&quot;clearml&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report to
all integrations installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.TrainingArguments.ddp_find_unused_parameters",description:`<strong>ddp_find_unused_parameters</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>find_unused_parameters</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_find_unused_parameters"},{anchor:"transformers.TrainingArguments.ddp_bucket_cap_mb",description:`<strong>ddp_bucket_cap_mb</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>bucket_cap_mb</code> passed to <code>DistributedDataParallel</code>.`,name:"ddp_bucket_cap_mb"},{anchor:"transformers.TrainingArguments.dataloader_pin_memory",description:`<strong>dataloader_pin_memory</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether you want to pin memory in data loaders or not. Will default to <code>True</code>.`,name:"dataloader_pin_memory"},{anchor:"transformers.TrainingArguments.skip_memory_metrics",description:`<strong>skip_memory_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to skip adding of memory profiler reports to metrics. This is skipped by default because it slows
down the training and evaluation speed.`,name:"skip_memory_metrics"},{anchor:"transformers.TrainingArguments.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push the model to the Hub every time the model is saved. If this is activated,
<code>output_dir</code> will begin a git directory synced with the repo (determined by <code>hub_model_id</code>) and the content
will be pushed each time a save is triggered (depending on your <code>save_strategy</code>). Calling
<a href="/docs/transformers/main/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/main/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/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"resume_from_checkpoint"},{anchor:"transformers.TrainingArguments.hub_model_id",description:`<strong>hub_model_id</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the repository to keep in sync with the local <em>output_dir</em>. It can be a simple model ID in
which case the model will be pushed in your namespace. Otherwise it should be the whole repository name,
for instance <code>&quot;user_name/model&quot;</code>, which allows you to push to an organization you are a member of with
<code>&quot;organization_name/model&quot;</code>. Will default to <code>user_name/output_dir_name</code> with <em>output_dir_name</em> being the
name of <code>output_dir</code>.</p>
<p>Will default to the name of <code>output_dir</code>.`,name:"hub_model_id"},{anchor:"transformers.TrainingArguments.hub_strategy",description:`<strong>hub_strategy</strong> (<code>str</code> or <code>HubStrategy</code>, <em>optional</em>, defaults to <code>&quot;every_save&quot;</code>) &#x2014;
Defines the scope of what is pushed to the Hub and when. Possible values are:</p>
<ul>
<li><code>&quot;end&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/main/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/main/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/main/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/main/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;
If set, the backend compiler for TorchDynamo. Possible choices are <code>&quot;eager&quot;</code>, <code>&quot;aot_eager&quot;</code>, <code>&quot;inductor&quot;</code>,
<code>&quot;nvfuser&quot;</code>, <code>&quot;aot_nvfuser&quot;</code>, <code>&quot;aot_cudagraphs&quot;</code>, <code>&quot;ofi&quot;</code>, <code>&quot;fx2trt&quot;</code>, <code>&quot;onnxrt&quot;</code> and <code>&quot;ipex&quot;</code>.`,name:"torchdynamo"},{anchor:"transformers.TrainingArguments.ray_scope",description:`<strong>ray_scope</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;last&quot;</code>) &#x2014;
The scope to use when doing hyperparameter search with Ray. By default, <code>&quot;last&quot;</code> will be used. Ray will
then use the last checkpoint of all trials, compare those, and select the best one. However, other options
are also available. See the <a href="https://docs.ray.io/en/latest/tune/api_docs/analysis.html#ray.tune.ExperimentAnalysis.get_best_trial" rel="nofollow">Ray documentation</a> for
more options.`,name:"ray_scope"},{anchor:"transformers.TrainingArguments.ddp_timeout",description:`<strong>ddp_timeout</strong> (<code>int</code>, <em>optional</em>, defaults to 1800) &#x2014;
The timeout for <code>torch.distributed.init_process_group</code> calls, used to avoid GPU socket timeouts when
performing slow operations in distributed runnings. Please refer the [PyTorch documentation]
(<a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group" rel="nofollow">https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group</a>) for more
information.`,name:"ddp_timeout"},{anchor:"transformers.TrainingArguments.use_mps_device",description:`<strong>use_mps_device</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use Apple Silicon chip based <code>mps</code> device.`,name:"use_mps_device"},{anchor:"transformers.TrainingArguments.torch_compile",description:`<strong>torch_compile</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to compile the model using PyTorch 2.0
<a href="https://pytorch.org/get-started/pytorch-2.0/" rel="nofollow"><code>torch.compile</code></a> (requires a nighlty install of PyTorch).</p>
<p>If set, the backend will default to <code>&quot;inductor&quot;</code> (can be customized with <code>torch_compile_backend</code>) and the
mode will default to <code>&quot;default&quot;</code> (can be customized with <code>torch_compile_mode</code>).`,name:"torch_compile"},{anchor:"transformers.TrainingArguments.torch_compile_backend",description:`<strong>torch_compile_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Possible choices are <code>&quot;eager&quot;</code>, <code>&quot;aot_eager&quot;</code>, <code>&quot;inductor&quot;</code>, <code>&quot;nvfuser&quot;</code>, <code>&quot;aot_nvfuser&quot;</code>,
<code>&quot;aot_cudagraphs&quot;</code>, <code>&quot;ofi&quot;</code>, <code>&quot;fx2trt&quot;</code>, <code>&quot;onnxrt&quot;</code> and <code>&quot;ipex&quot;</code>.`,name:"torch_compile_backend"},{anchor:"transformers.TrainingArguments.torch_compile_mode",description:`<strong>torch_compile_mode</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The mode to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Possible choices are <code>&quot;default&quot;</code>, <code>&quot;reduce-overhead&quot;</code> and <code>&quot;max-autotune&quot;</code>.`,name:"torch_compile_mode"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/training_args.py#L147"}}),os=new x({props:{name:"get_process_log_level",anchor:"transformers.TrainingArguments.get_process_log_level",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/training_args.py#L1673"}}),as=new x({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/main/src/transformers/training_args.py#L1763"}}),ns=new x({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/main/src/transformers/training_args.py#L1708"}}),ss=new x({props:{name:"to_dict",anchor:"transformers.TrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/training_args.py#L1772"}}),ls=new x({props:{name:"to_json_string",anchor:"transformers.TrainingArguments.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/training_args.py#L1789"}}),ds=new x({props:{name:"to_sanitized_dict",anchor:"transformers.TrainingArguments.to_sanitized_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/training_args.py#L1795"}}),cs=new Y({}),ms=new x({props:{name:"class transformers.Seq2SeqTrainingArguments",anchor:"transformers.Seq2SeqTrainingArguments",parameters:[{name:"output_dir",val:": str"},{name:"overwrite_output_dir",val:": bool = False"},{name:"do_train",val:": bool = False"},{name:"do_eval",val:": bool = False"},{name:"do_predict",val:": bool = False"},{name:"evaluation_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'no'"},{name:"prediction_loss_only",val:": bool = False"},{name:"per_device_train_batch_size",val:": int = 8"},{name:"per_device_eval_batch_size",val:": int = 8"},{name:"per_gpu_train_batch_size",val:": typing.Optional[int] = None"},{name:"per_gpu_eval_batch_size",val:": typing.Optional[int] = None"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"eval_accumulation_steps",val:": typing.Optional[int] = None"},{name:"eval_delay",val:": typing.Optional[float] = 0"},{name:"learning_rate",val:": float = 5e-05"},{name:"weight_decay",val:": float = 0.0"},{name:"adam_beta1",val:": float = 0.9"},{name:"adam_beta2",val:": float = 0.999"},{name:"adam_epsilon",val:": float = 1e-08"},{name:"max_grad_norm",val:": float = 1.0"},{name:"num_train_epochs",val:": float = 3.0"},{name:"max_steps",val:": int = -1"},{name:"lr_scheduler_type",val:": typing.Union[transformers.trainer_utils.SchedulerType, str] = 'linear'"},{name:"warmup_ratio",val:": float = 0.0"},{name:"warmup_steps",val:": int = 0"},{name:"log_level",val:": typing.Optional[str] = 'passive'"},{name:"log_level_replica",val:": typing.Optional[str] = 'passive'"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_dir",val:": typing.Optional[str] = None"},{name:"logging_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"logging_first_step",val:": bool = False"},{name:"logging_steps",val:": int = 500"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"save_strategy",val:": typing.Union[transformers.trainer_utils.IntervalStrategy, str] = 'steps'"},{name:"save_steps",val:": 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:"use_mps_device",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": typing.Optional[int] = None"},{name:"jit_mode_eval",val:": bool = False"},{name:"use_ipex",val:": bool = False"},{name:"bf16",val:": bool = False"},{name:"fp16",val:": bool = False"},{name:"fp16_opt_level",val:": str = 'O1'"},{name:"half_precision_backend",val:": str = 'auto'"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": typing.Optional[bool] = None"},{name:"local_rank",val:": int = -1"},{name:"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:"fsdp_transformer_layer_cls_to_wrap",val:": typing.Optional[str] = None"},{name:"deepspeed",val:": typing.Optional[str] = None"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"optim",val:": typing.Union[transformers.training_args.OptimizerNames, str] = 'adamw_hf'"},{name:"optim_args",val:": typing.Optional[str] = None"},{name:"adafactor",val:": bool = False"},{name:"group_by_length",val:": bool = False"},{name:"length_column_name",val:": typing.Optional[str] = 'length'"},{name:"report_to",val:": typing.Optional[typing.List[str]] = None"},{name:"ddp_find_unused_parameters",val:": typing.Optional[bool] = None"},{name:"ddp_bucket_cap_mb",val:": typing.Optional[int] = None"},{name:"dataloader_pin_memory",val:": bool = True"},{name:"skip_memory_metrics",val:": bool = True"},{name:"use_legacy_prediction_loop",val:": bool = False"},{name:"push_to_hub",val:": bool = False"},{name:"resume_from_checkpoint",val:": typing.Optional[str] = None"},{name:"hub_model_id",val:": typing.Optional[str] = None"},{name:"hub_strategy",val:": typing.Union[transformers.trainer_utils.HubStrategy, str] = 'every_save'"},{name:"hub_token",val:": typing.Optional[str] = None"},{name:"hub_private_repo",val:": bool = False"},{name:"gradient_checkpointing",val:": bool = False"},{name:"include_inputs_for_metrics",val:": bool = False"},{name:"fp16_backend",val:": str = 'auto'"},{name:"push_to_hub_model_id",val:": typing.Optional[str] = None"},{name:"push_to_hub_organization",val:": typing.Optional[str] = None"},{name:"push_to_hub_token",val:": typing.Optional[str] = None"},{name:"mp_parameters",val:": str = ''"},{name:"auto_find_batch_size",val:": bool = False"},{name:"full_determinism",val:": bool = False"},{name:"torchdynamo",val:": typing.Optional[str] = None"},{name:"ray_scope",val:": typing.Optional[str] = 'last'"},{name:"ddp_timeout",val:": typing.Optional[int] = 1800"},{name:"torch_compile",val:": bool = False"},{name:"torch_compile_backend",val:": typing.Optional[str] = None"},{name:"torch_compile_mode",val:": typing.Optional[str] = None"},{name:"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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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>~Trainer.model_init</code> function to instantiate the model if it has some randomly initialized parameters.`,name:"seed"},{anchor:"transformers.Seq2SeqTrainingArguments.data_seed",description:`<strong>data_seed</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Random seed to be used with data samplers. If not set, random generators for data sampling will use the
same seed as <code>seed</code>. This can be used to ensure reproducibility of data sampling, independent of the model
seed.`,name:"data_seed"},{anchor:"transformers.Seq2SeqTrainingArguments.jit_mode_eval",description:`<strong>jit_mode_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use PyTorch jit trace for inference.`,name:"jit_mode_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.use_ipex",description:`<strong>use_ipex</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Intel extension for PyTorch when it is available. <a href="https://github.com/intel/intel-extension-for-pytorch" rel="nofollow">IPEX
installation</a>.`,name:"use_ipex"},{anchor:"transformers.Seq2SeqTrainingArguments.bf16",description:`<strong>bf16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use bf16 16-bit (mixed) precision training instead of 32-bit training. Requires Ampere or higher
NVIDIA architecture or using CPU (no_cuda). This is an experimental API and it may change.`,name:"bf16"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16",description:`<strong>fp16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use fp16 16-bit (mixed) precision training instead of 32-bit training.`,name:"fp16"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16_opt_level",description:`<strong>fp16_opt_level</strong> (<code>str</code>, <em>optional</em>, defaults to &#x2018;O1&#x2019;) &#x2014;
For <code>fp16</code> training, Apex AMP optimization level selected in [&#x2018;O0&#x2019;, &#x2018;O1&#x2019;, &#x2018;O2&#x2019;, and &#x2018;O3&#x2019;]. See details on
the <a href="https://nvidia.github.io/apex/amp" rel="nofollow">Apex documentation</a>.`,name:"fp16_opt_level"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16_backend",description:`<strong>fp16_backend</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
This argument is deprecated. Use <code>half_precision_backend</code> instead.`,name:"fp16_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.half_precision_backend",description:`<strong>half_precision_backend</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
The backend to use for mixed precision training. Must be one of <code>&quot;auto&quot;, &quot;cuda_amp&quot;, &quot;apex&quot;, &quot;cpu_amp&quot;</code>.
<code>&quot;auto&quot;</code> will use CPU/CUDA AMP or APEX depending on the PyTorch version detected, while the other choices
will force the requested backend.`,name:"half_precision_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.bf16_full_eval",description:`<strong>bf16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full bfloat16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values. This is an experimental API and it may change.`,name:"bf16_full_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.fp16_full_eval",description:`<strong>fp16_full_eval</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use full float16 evaluation instead of 32-bit. This will be faster and save memory but can harm
metric values.`,name:"fp16_full_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.tf32",description:`<strong>tf32</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to enable the TF32 mode, available in Ampere and newer GPU architectures. The default value depends
on PyTorch&#x2019;s version default of <code>torch.backends.cuda.matmul.allow_tf32</code>. For more details please refer to
the <a href="https://huggingface.co/docs/transformers/performance#tf32" rel="nofollow">TF32</a> documentation. This is an
experimental API and it may change.`,name:"tf32"},{anchor:"transformers.Seq2SeqTrainingArguments.local_rank",description:`<strong>local_rank</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
Rank of the process during distributed training.`,name:"local_rank"},{anchor:"transformers.Seq2SeqTrainingArguments.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> or <code>&quot;gloo&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>~notebook.NotebookTrainingTracker</code> in Jupyter Notebooks. Will default to <code>True</code> if the logging level is
set to warn or lower (default), <code>False</code> otherwise.`,name:"disable_tqdm"},{anchor:"transformers.Seq2SeqTrainingArguments.remove_unused_columns",description:`<strong>remove_unused_columns</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to automatically remove the columns unused by the model forward method.</p>
<p>(Note that this behavior is not implemented for <code>TFTrainer</code> yet.)`,name:"remove_unused_columns"},{anchor:"transformers.Seq2SeqTrainingArguments.label_names",description:`<strong>label_names</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
The list of keys in your dictionary of inputs that correspond to the labels.</p>
<p>Will eventually default to the list of argument names accepted by the model that contain the word &#x201C;label&#x201D;,
except if the model used is one of the <code>XxxForQuestionAnswering</code> in which case it will also include the
<code>[&quot;start_positions&quot;, &quot;end_positions&quot;]</code> keys.`,name:"label_names"},{anchor:"transformers.Seq2SeqTrainingArguments.load_best_model_at_end",description:`<strong>load_best_model_at_end</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to load the best model found during training at the end of training.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When set to <code>True</code>, the parameters <code>save_strategy</code> needs to be the same as <code>evaluation_strategy</code>, and in
the case it is &#x201C;steps&#x201D;, <code>save_steps</code> must be a round multiple of <code>eval_steps</code>.</p>

					</div>`,name:"load_best_model_at_end"},{anchor:"transformers.Seq2SeqTrainingArguments.metric_for_best_model",description:`<strong>metric_for_best_model</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> to specify the metric to use to compare two different
models. Must be the name of a metric returned by the evaluation with or without the prefix <code>&quot;eval_&quot;</code>. Will
default to <code>&quot;loss&quot;</code> if unspecified and <code>load_best_model_at_end=True</code> (to use the evaluation loss).</p>
<p>If you set this value, <code>greater_is_better</code> will default to <code>True</code>. Don&#x2019;t forget to set it to <code>False</code> if
your metric is better when lower.`,name:"metric_for_best_model"},{anchor:"transformers.Seq2SeqTrainingArguments.greater_is_better",description:`<strong>greater_is_better</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Use in conjunction with <code>load_best_model_at_end</code> and <code>metric_for_best_model</code> to specify if better models
should have a greater metric or not. Will default to:</p>
<ul>
<li><code>True</code> if <code>metric_for_best_model</code> is set to a value that isn&#x2019;t <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
<li><code>False</code> if <code>metric_for_best_model</code> is not set, or set to <code>&quot;loss&quot;</code> or <code>&quot;eval_loss&quot;</code>.</li>
</ul>`,name:"greater_is_better"},{anchor:"transformers.Seq2SeqTrainingArguments.ignore_data_skip",description:`<strong>ignore_data_skip</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When resuming training, whether or not to skip the epochs and batches to get the data loading at the same
stage as in the previous training. If set to <code>True</code>, the training will begin faster (as that skipping step
can take a long time) but will not yield the same results as the interrupted training would have.`,name:"ignore_data_skip"},{anchor:"transformers.Seq2SeqTrainingArguments.sharded_ddp",description:`<strong>sharded_ddp</strong> (<code>bool</code>, <code>str</code> or list of <code>ShardedDDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use Sharded DDP training from <a href="https://github.com/facebookresearch/fairscale" rel="nofollow">FairScale</a> (in distributed
training only). This is an experimental feature.</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;simple&quot;</code>: to use first instance of sharded DDP released by fairscale (<code>ShardedDDP</code>) similar to ZeRO-2.</li>
<li><code>&quot;zero_dp_2&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-2 mode (with <code>reshard_after_forward=False</code>).</li>
<li><code>&quot;zero_dp_3&quot;</code>: to use the second instance of sharded DPP released by fairscale (<code>FullyShardedDDP</code>) in
Zero-3 mode (with <code>reshard_after_forward=True</code>).</li>
<li><code>&quot;offload&quot;</code>: to add ZeRO-offload (only compatible with <code>&quot;zero_dp_2&quot;</code> and <code>&quot;zero_dp_3&quot;</code>).</li>
</ul>
<p>If a string is passed, it will be split on space. If a bool is passed, it will be converted to an empty
list for <code>False</code> and <code>[&quot;simple&quot;]</code> for <code>True</code>.`,name:"sharded_ddp"},{anchor:"transformers.Seq2SeqTrainingArguments.fsdp",description:`<strong>fsdp</strong> (<code>bool</code>, <code>str</code> or list of <code>FSDPOption</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Use PyTorch Distributed Parallel Training (in distributed training only).</p>
<p>A list of options along the following:</p>
<ul>
<li><code>&quot;full_shard&quot;</code>: Shard parameters, gradients and optimizer states.</li>
<li><code>&quot;shard_grad_op&quot;</code>: Shard optimizer states and gradients.</li>
<li><code>&quot;offload&quot;</code>: Offload parameters and gradients to CPUs (only compatible with <code>&quot;full_shard&quot;</code> and
<code>&quot;shard_grad_op&quot;</code>).</li>
<li><code>&quot;auto_wrap&quot;</code>: Automatically recursively wrap layers with FSDP using <code>default_auto_wrap_policy</code>.</li>
</ul>`,name:"fsdp"},{anchor:"transformers.Seq2SeqTrainingArguments.fsdp_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, adamw_anyprecision or adafactor.`,name:"optim"},{anchor:"transformers.Seq2SeqTrainingArguments.optim_args",description:`<strong>optim_args</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional arguments that are supplied to AnyPrecisionAdamW.`,name:"optim_args"},{anchor:"transformers.Seq2SeqTrainingArguments.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;neptune&quot;</code>, <code>&quot;tensorboard&quot;</code>,<code>&quot;clearml&quot;</code> and <code>&quot;wandb&quot;</code>. Use <code>&quot;all&quot;</code> to report to
all integrations installed, <code>&quot;none&quot;</code> for no integrations.`,name:"report_to"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_find_unused_parameters",description:`<strong>ddp_find_unused_parameters</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>find_unused_parameters</code> passed to
<code>DistributedDataParallel</code>. Will default to <code>False</code> if gradient checkpointing is used, <code>True</code> otherwise.`,name:"ddp_find_unused_parameters"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_bucket_cap_mb",description:`<strong>ddp_bucket_cap_mb</strong> (<code>int</code>, <em>optional</em>) &#x2014;
When using distributed training, the value of the flag <code>bucket_cap_mb</code> passed to <code>DistributedDataParallel</code>.`,name:"ddp_bucket_cap_mb"},{anchor:"transformers.Seq2SeqTrainingArguments.dataloader_pin_memory",description:`<strong>dataloader_pin_memory</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether you want to pin memory in data loaders or not. Will default to <code>True</code>.`,name:"dataloader_pin_memory"},{anchor:"transformers.Seq2SeqTrainingArguments.skip_memory_metrics",description:`<strong>skip_memory_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to skip adding of memory profiler reports to metrics. This is skipped by default because it slows
down the training and evaluation speed.`,name:"skip_memory_metrics"},{anchor:"transformers.Seq2SeqTrainingArguments.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push the model to the Hub every time the model is saved. If this is activated,
<code>output_dir</code> will begin a git directory synced with the repo (determined by <code>hub_model_id</code>) and the content
will be pushed each time a save is triggered (depending on your <code>save_strategy</code>). Calling
<a href="/docs/transformers/main/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/main/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/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"resume_from_checkpoint"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_model_id",description:`<strong>hub_model_id</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the repository to keep in sync with the local <em>output_dir</em>. It can be a simple model ID in
which case the model will be pushed in your namespace. Otherwise it should be the whole repository name,
for instance <code>&quot;user_name/model&quot;</code>, which allows you to push to an organization you are a member of with
<code>&quot;organization_name/model&quot;</code>. Will default to <code>user_name/output_dir_name</code> with <em>output_dir_name</em> being the
name of <code>output_dir</code>.</p>
<p>Will default to the name of <code>output_dir</code>.`,name:"hub_model_id"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_strategy",description:`<strong>hub_strategy</strong> (<code>str</code> or <code>HubStrategy</code>, <em>optional</em>, defaults to <code>&quot;every_save&quot;</code>) &#x2014;
Defines the scope of what is pushed to the Hub and when. Possible values are:</p>
<ul>
<li><code>&quot;end&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/main/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/main/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/main/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/main/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;
If set, the backend compiler for TorchDynamo. Possible choices are <code>&quot;eager&quot;</code>, <code>&quot;aot_eager&quot;</code>, <code>&quot;inductor&quot;</code>,
<code>&quot;nvfuser&quot;</code>, <code>&quot;aot_nvfuser&quot;</code>, <code>&quot;aot_cudagraphs&quot;</code>, <code>&quot;ofi&quot;</code>, <code>&quot;fx2trt&quot;</code>, <code>&quot;onnxrt&quot;</code> and <code>&quot;ipex&quot;</code>.`,name:"torchdynamo"},{anchor:"transformers.Seq2SeqTrainingArguments.ray_scope",description:`<strong>ray_scope</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;last&quot;</code>) &#x2014;
The scope to use when doing hyperparameter search with Ray. By default, <code>&quot;last&quot;</code> will be used. Ray will
then use the last checkpoint of all trials, compare those, and select the best one. However, other options
are also available. See the <a href="https://docs.ray.io/en/latest/tune/api_docs/analysis.html#ray.tune.ExperimentAnalysis.get_best_trial" rel="nofollow">Ray documentation</a> for
more options.`,name:"ray_scope"},{anchor:"transformers.Seq2SeqTrainingArguments.ddp_timeout",description:`<strong>ddp_timeout</strong> (<code>int</code>, <em>optional</em>, defaults to 1800) &#x2014;
The timeout for <code>torch.distributed.init_process_group</code> calls, used to avoid GPU socket timeouts when
performing slow operations in distributed runnings. Please refer the [PyTorch documentation]
(<a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group" rel="nofollow">https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group</a>) for more
information.`,name:"ddp_timeout"},{anchor:"transformers.Seq2SeqTrainingArguments.use_mps_device",description:`<strong>use_mps_device</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use Apple Silicon chip based <code>mps</code> device.`,name:"use_mps_device"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile",description:`<strong>torch_compile</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to compile the model using PyTorch 2.0
<a href="https://pytorch.org/get-started/pytorch-2.0/" rel="nofollow"><code>torch.compile</code></a> (requires a nighlty install of PyTorch).</p>
<p>If set, the backend will default to <code>&quot;inductor&quot;</code> (can be customized with <code>torch_compile_backend</code>) and the
mode will default to <code>&quot;default&quot;</code> (can be customized with <code>torch_compile_mode</code>).`,name:"torch_compile"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile_backend",description:`<strong>torch_compile_backend</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The backend to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Possible choices are <code>&quot;eager&quot;</code>, <code>&quot;aot_eager&quot;</code>, <code>&quot;inductor&quot;</code>, <code>&quot;nvfuser&quot;</code>, <code>&quot;aot_nvfuser&quot;</code>,
<code>&quot;aot_cudagraphs&quot;</code>, <code>&quot;ofi&quot;</code>, <code>&quot;fx2trt&quot;</code>, <code>&quot;onnxrt&quot;</code> and <code>&quot;ipex&quot;</code>.`,name:"torch_compile_backend"},{anchor:"transformers.Seq2SeqTrainingArguments.torch_compile_mode",description:`<strong>torch_compile_mode</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The mode to use in <code>torch.compile</code>. If set to any value, <code>torch_compile</code> will be set to <code>True</code>.</p>
<p>Possible choices are <code>&quot;default&quot;</code>, <code>&quot;reduce-overhead&quot;</code> and <code>&quot;max-autotune&quot;</code>.`,name:"torch_compile_mode"},{anchor:"transformers.Seq2SeqTrainingArguments.sortish_sampler",description:`<strong>sortish_sampler</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a <em>sortish sampler</em> or not. Only possible if the underlying datasets are <em>Seq2SeqDataset</em>
for now but will become generally available in the near future.</p>
<p>It sorts the inputs according to lengths in order to minimize the padding size, with a bit of randomness
for the training set.`,name:"sortish_sampler"},{anchor:"transformers.Seq2SeqTrainingArguments.predict_with_generate",description:`<strong>predict_with_generate</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use generate to calculate generative metrics (ROUGE, BLEU).`,name:"predict_with_generate"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_max_length",description:`<strong>generation_max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The <code>max_length</code> to use on each evaluation loop when <code>predict_with_generate=True</code>. Will default to the
<code>max_length</code> value of the model configuration.`,name:"generation_max_length"},{anchor:"transformers.Seq2SeqTrainingArguments.generation_num_beams",description:`<strong>generation_num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The <code>num_beams</code> to use on each evaluation loop when <code>predict_with_generate=True</code>. Will default to the
<code>num_beams</code> value of the model configuration.`,name:"generation_num_beams"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/training_args_seq2seq.py#L28"}}),us=new Y({}),fs=new Y({}),gs=new O({props:{code:`[...]
logger = logging.getLogger(__name__)

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

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

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

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

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

trainer = Trainer(...)`}}),_s=new O({props:{code:"my_app.py ... --log_level warning --log_level_replica error",highlighted:"my_app.py ... --log_level warning --log_level_replica error"}}),vs=new O({props:{code:"my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0",highlighted:"my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0"}}),bs=new O({props:{code:"my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0",highlighted:"my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0"}}),ys=new Y({}),Ts=new Y({}),$s=new O({props:{code:"python -m torch.distributed.launch --nproc_per_node=2  trainer-program.py ...",highlighted:"python -m torch.distributed.launch --nproc_per_node=2  trainer-program.py ..."}}),qs=new O({props:{code:"accelerate launch --num_processes 2 trainer-program.py ...",highlighted:"accelerate launch --num_processes 2 trainer-program.py ..."}}),As=new O({props:{code:"deepspeed --num_gpus 2 trainer-program.py ...",highlighted:"deepspeed --num_gpus 2 trainer-program.py ..."}}),Ps=new O({props:{code:"CUDA_VISIBLE_DEVICES=0,2 python -m torch.distributed.launch trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES=0,2 python -m torch.distributed.launch trainer-program.py ..."}}),Ds=new O({props:{code:"CUDA_VISIBLE_DEVICES=2,0 python -m torch.distributed.launch trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python -m torch.distributed.launch trainer-program.py ..."}}),Os=new O({props:{code:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ..."}}),Cs=new O({props:{code:"CUDA_VISIBLE_DEVICES= python trainer-program.py ...",highlighted:"CUDA_VISIBLE_DEVICES= python trainer-program.py ..."}}),Is=new O({props:{code:`export CUDA_VISIBLE_DEVICES=0,2
python -m torch.distributed.launch trainer-program.py ...`,highlighted:`<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=0,2
python -m torch.distributed.launch trainer-program.py ...`}}),Ns=new O({props:{code:"export CUDA_DEVICE_ORDER=PCI_BUS_ID",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=PCI_BUS_ID'}}),Fs=new O({props:{code:"export CUDA_DEVICE_ORDER=FASTEST_FIRST",highlighted:'<span class="hljs-built_in">export</span> CUDA_DEVICE_ORDER=FASTEST_FIRST'}}),Ls=new O({props:{code:"export CUDA_VISIBLE_DEVICES=1,0",highlighted:'<span class="hljs-built_in">export</span> CUDA_VISIBLE_DEVICES=1,0'}}),Rs=new Y({}),Hs=new Y({}),Ys=new O({props:{code:`pip install fairscale
pip install deepspeed`,highlighted:`pip install fairscale
pip install deepspeed`}}),Zs=new Y({}),Ks=new O({props:{code:"which nvcc",highlighted:'<span class="hljs-built_in">which</span> nvcc'}}),Xs=new Y({}),Qs=new O({props:{code:`/usr/local/cuda-10.2
/usr/local/cuda-11.0`,highlighted:`/usr/local/cuda-10.2
/usr/local/cuda-11.0`}}),ei=new O({props:{code:`echo $PATH
echo $LD_LIBRARY_PATH`,highlighted:`<span class="hljs-built_in">echo</span> <span class="hljs-variable">$PATH</span>
<span class="hljs-built_in">echo</span> <span class="hljs-variable">$LD_LIBRARY_PATH</span>`}}),ti=new O({props:{code:`export PATH=/usr/local/cuda-10.2/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH`,highlighted:`<span class="hljs-built_in">export</span> PATH=/usr/local/cuda-10.2/bin:<span class="hljs-variable">$PATH</span>
<span class="hljs-built_in">export</span> LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:<span class="hljs-variable">$LD_LIBRARY_PATH</span>`}}),oi=new Y({}),ri=new O({props:{code:`sudo ln -s /usr/bin/gcc-7  /usr/local/cuda-10.2/bin/gcc
sudo ln -s /usr/bin/g++-7  /usr/local/cuda-10.2/bin/g++`,highlighted:`sudo <span class="hljs-built_in">ln</span> -s /usr/bin/gcc-7  /usr/local/cuda-10.2/bin/gcc
sudo <span class="hljs-built_in">ln</span> -s /usr/bin/g++-7  /usr/local/cuda-10.2/bin/g++`}}),ai=new Y({}),oa=new hm({props:{warning:!0,$$slots:{default:[eM]},$$scope:{ctx:Z}}}),li=new O({props:{code:"pip install fairscale",highlighted:"pip install fairscale"}}),di=new O({props:{code:"pip install transformers[fairscale]",highlighted:"pip install transformers[fairscale]"}}),pi=new O({props:{code:"pip install fairscale --no-build-isolation .",highlighted:"pip install fairscale --no-build-isolation ."}}),hi=new O({props:{code:`git clone https://github.com/facebookresearch/fairscale/
cd fairscale
rm -r dist build
python setup.py bdist_wheel
pip uninstall -y fairscale
pip install dist/fairscale-*.whl`,highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/facebookresearch/fairscale/
<span class="hljs-built_in">cd</span> fairscale
<span class="hljs-built_in">rm</span> -r dist build
python setup.py bdist_wheel
pip uninstall -y fairscale
pip install dist/fairscale-*.whl`}}),fi=new O({props:{code:`pip uninstall -y fairscale; pip install fairscale --pre \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly \\
--no-cache --no-build-isolation`,highlighted:`pip uninstall -y fairscale; pip install fairscale --pre \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly \\
--no-cache --no-build-isolation`}}),gi=new O({props:{code:`pip install -v --disable-pip-version-check . \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly --pre`,highlighted:`pip install -v --disable-pip-version-check . \\
-f https://download.pytorch.org/whl/nightly/cu110/torch_nightly --pre`}}),bi=new O({props:{code:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config "ro-en" \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp simple`,highlighted:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config <span class="hljs-string">&quot;ro-en&quot;</span> \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp simple`}}),Ei=new O({props:{code:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config "ro-en" \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp zero_dp_2`,highlighted:`python -m torch.distributed.launch --nproc_per_node=2 examples/pytorch/translation/run_translation.py \\
--model_name_or_path t5-small --per_device_train_batch_size 1   \\
--output_dir output_dir --overwrite_output_dir \\
--do_train --max_train_samples 500 --num_train_epochs 1 \\
--dataset_name wmt16 --dataset_config <span class="hljs-string">&quot;ro-en&quot;</span> \\
--source_lang en --target_lang ro \\
--fp16 --sharded_ddp zero_dp_2`}}),xi=new Y({}),Ri=new Y({}),pa=new hm({props:{warning:!1,$$slots:{default:[tM]},$$scope:{ctx:Z}}}),ji=new O({props:{code:`export TASK_NAME=mrpc

python examples/pytorch/text-classification/run_glue.py \\
  --model_name_or_path bert-base-cased \\
  --task_name $TASK_NAME \\
  --do_train \\
  --do_eval \\
  --max_seq_length 128 \\
  --per_device_train_batch_size 32 \\
  --learning_rate 2e-5 \\
  --num_train_epochs 3 \\
  --output_dir /tmp/$TASK_NAME/ \\
  --use_mps_device \\
  --overwrite_output_dir`,highlighted:`<span class="hljs-built_in">export</span> TASK_NAME=mrpc

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