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,q,$,k,L,A,D,W,fe,oe,G,se,ie,re,le,H,Ze,ge,z,I,st,ae,it,lt,_e,Ca,Ia,Ke,Pe,Ua,ve,Na,za;return{c(){T=n("p"),q=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:`),A=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"),Pe=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);q=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),A=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);Pe=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/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(oe,"href","/docs/transformers/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput"),p(_e,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.TrainingArguments"),p(Ke,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer")},m(K,B){m(K,T,B),e(T,q),e(T,$),e($,k),e(T,L),m(K,A,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,Pe),e(I,Ua),e(I,ve),e(ve,Na),e(I,za)},d(K){K&&o(T),K&&o(A),K&&o(D)}}}function KG(Z){let T,q,$,k,L,A,D,W,fe,oe,G,se,ie,re,le,H,Ze;return{c(){T=n("p"),q=r("To use this method, you need to have provided a "),$=n("code"),k=r("model_init"),L=r(" when initializing your "),A=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);q=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 "),A=s(z,"A",{href:!0});var st=i(A);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(A,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(se,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(le,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer.create_optimizer_and_scheduler")},m(ge,z){m(ge,T,z),e(T,q),e(T,$),e($,k),e(T,L),e(T,A),e(A,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,q,$,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"),q=r("Now when this method is run, you will see a report that will include: :"),$=l(),h(k.$$.fragment)},l(A){T=s(A,"P",{});var D=i(T);q=a(D,"Now when this method is run, you will see a report that will include: :"),D.forEach(o),$=d(A),u(k.$$.fragment,A)},m(A,D){m(A,T,D),e(T,q),m(A,$,D),f(k,A,D),L=!0},p:VG,i(A){L||(g(k.$$.fragment,A),L=!0)},o(A){_(k.$$.fragment,A),L=!1},d(A){A&&o(T),A&&o($),v(k,A)}}}function XG(Z){let T,q;return{c(){T=n("p"),q=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);q=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,q)},d($){$&&o(T)}}}function QG(Z){let T,q;return{c(){T=n("p"),q=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);q=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,q)},d($){$&&o(T)}}}function eM(Z){let T,q;return{c(){T=n("p"),q=r("This integration is not supported anymore, we recommend you either use DeepSpeed or PyTorch FSDP.")},l($){T=s($,"P",{});var k=i(T);q=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,q)},d($){$&&o(T)}}}function tM(Z){let T,q,$,k,L;return{c(){T=n("p"),q=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(A){T=s(A,"P",{});var D=i(T);q=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(A,D){m(A,T,D),e(T,q),e(T,$),e($,k),e(T,L)},d(A){A&&o(T)}}}function oM(Z){let T,q,$,k,L,A,D,W,fe,oe,G,se,ie,re,le,H,Ze,ge,z,I,st,ae,it,lt,_e,Ca,Ia,Ke,Pe,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,Aw,Pw,qw,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,Am,La,m0,Pm,p0,wv,b,Ra,h0,qm,u0,f0,Dm,g0,_0,ye,rr,Sm,v0,b0,fl,y0,w0,T0,J,Om,E0,$0,Cm,x0,k0,Im,A0,P0,Um,q0,D0,Nm,S0,O0,zm,C0,I0,U0,gl,Fm,N0,z0,F0,qe,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,AT,PT,Ka,qT,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,AE,fp,PE,qE,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,Ap,u4,f4,g4,vt,vn,_4,bn,v4,Pp,b4,y4,w4,qp,T4,E4,P,yn,$4,Dp,x4,k4,Sp,A4,P4,Op,q4,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,e5,t5,vl,Mp,o5,r5,a5,bt,jp,n5,s5,Hp,i5,l5,Bp,d5,c5,m5,Vp,p5,h5,Yp,u5,f5,wn,g5,Zp,_5,v5,b5,Qe,y5,Kp,w5,T5,Jp,E5,$5,Xp,x5,k5,A5,ne,P5,bl,q5,D5,Qp,S5,O5,eh,C5,I5,th,U5,N5,oh,z5,F5,L5,U,R5,rh,W5,G5,ah,M5,j5,nh,H5,B5,sh,V5,Y5,Tn,Z5,K5,ih,J5,X5,lh,Q5,e$,dh,t$,o$,ch,r$,a$,mh,n$,s$,i$,Ee,l$,yl,d$,c$,ph,m$,p$,wl,h$,u$,hh,f$,g$,_$,uh,v$,b$,gr,En,y$,fh,w$,T$,_r,$n,E$,xn,$$,gh,x$,k$,A$,yt,kn,P$,An,q$,_h,D$,S$,O$,Pn,C$,vh,I$,U$,N$,X,qn,z$,bh,F$,L$,Dn,R$,yh,W$,G$,M$,vr,j$,Sn,H$,wh,B$,V$,Y$,co,mo,Z$,Th,K$,J$,Eh,X$,Q$,e3,po,t3,$h,o3,r3,xh,a3,n3,s3,ho,i3,kh,l3,d3,Ah,c3,m3,p3,wt,On,h3,uo,u3,Ph,f3,g3,qh,_3,v3,b3,Dh,y3,w3,Tt,Cn,T3,fo,E3,Sh,$3,x3,Oh,k3,A3,P3,Ch,q3,D3,br,In,S3,et,O3,Ih,C3,I3,Uh,U3,N3,Nh,z3,F3,L3,yr,Un,R3,Nn,W3,zh,G3,M3,j3,Ce,zn,H3,Fn,B3,Fh,V3,Y3,Z3,Lh,K3,J3,Ln,X3,Tl,Q3,ex,tx,Et,Rn,ox,Wn,rx,Rh,ax,nx,sx,Wh,ix,lx,$t,Gn,dx,Gh,cx,mx,Mh,px,hx,wr,Mn,ux,jh,fx,gx,xt,jn,_x,Hh,vx,bx,Bh,yx,Tv,go,Tr,Vh,Hn,wx,Yh,Tx,Ev,tt,Bn,Ex,Ie,Vn,$x,Zh,xx,kx,Yn,Ax,Kh,Px,qx,Dx,Jh,Sx,Ox,Q,Zn,Cx,Xh,Ix,Ux,Kn,Nx,Qh,zx,Fx,Lx,Er,Rx,Jn,Wx,eu,Gx,Mx,jx,_o,vo,Hx,tu,Bx,Vx,ou,Yx,Zx,Kx,bo,Jx,ru,Xx,Qx,au,ek,tk,ok,yo,rk,nu,ak,nk,su,sk,ik,$v,wo,$r,iu,Xn,lk,lu,dk,xv,F,Qn,ck,es,mk,du,pk,hk,uk,To,fk,El,gk,_k,ts,vk,bk,yk,de,os,wk,cu,Tk,Ek,Eo,$k,mu,xk,kk,pu,Ak,Pk,qk,$o,Dk,hu,Sk,Ok,uu,Ck,Ik,Uk,rs,Nk,fu,zk,Fk,Lk,xr,as,Rk,gu,Wk,Gk,kt,ns,Mk,_u,jk,Hk,xo,Bk,vu,Vk,Yk,bu,Zk,Kk,Jk,kr,ss,Xk,is,Qk,yu,e6,t6,o6,Ar,ls,r6,wu,a6,n6,Pr,ds,s6,Tu,i6,kv,ko,qr,Eu,cs,l6,$u,d6,Av,ot,ms,c6,ps,m6,xu,p6,h6,u6,Ao,f6,$l,g6,_6,hs,v6,b6,Pv,Po,Dr,ku,us,y6,Au,w6,qv,ce,T6,xl,E6,$6,Pu,x6,k6,kl,A6,P6,qu,q6,D6,Dv,Sr,S6,Al,O6,C6,Sv,Or,Pl,Du,I6,U6,N6,ql,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,qo,Ur,zu,fs,Q6,Fu,eA,Uv,Ne,tA,Ol,oA,rA,Lu,aA,nA,Ru,sA,iA,Nv,At,lA,Wu,dA,cA,Cl,mA,pA,zv,Nr,Il,Gu,hA,uA,fA,Ul,Mu,gA,_A,Fv,ze,vA,Nl,bA,yA,ju,wA,TA,Hu,EA,$A,Lv,ee,xA,zl,kA,AA,Bu,PA,qA,Vu,DA,SA,Yu,OA,CA,Fl,IA,UA,Rv,Ll,NA,Wv,gs,Gv,Rl,zA,Mv,_s,jv,Wl,FA,Hv,vs,Bv,Gl,LA,Vv,Ml,RA,Yv,bs,Zv,zr,WA,Zu,GA,MA,Kv,Do,Fr,Ku,ys,jA,Ju,HA,Jv,me,BA,jl,VA,YA,Xu,ZA,KA,Qu,JA,XA,ef,QA,e8,Xv,Pt,t8,ws,o8,r8,tf,a8,n8,Qv,So,Lr,of,Ts,s8,rf,i8,e1,Hl,l8,t1,Rr,d8,Es,af,c8,m8,o1,$s,r1,qt,p8,xs,nf,h8,u8,ks,sf,f8,g8,a1,As,n1,Ps,s1,Wr,_8,Bl,v8,b8,i1,Vl,y8,l1,Yl,w8,d1,Zl,lf,df,T8,c1,Gr,E8,cf,$8,x8,m1,Kl,k8,p1,qs,h1,Dt,A8,mf,P8,q8,pf,D8,S8,u1,Jl,O8,f1,Ds,g1,St,C8,hf,I8,U8,uf,N8,z8,_1,Ot,F8,ff,L8,R8,Ss,gf,W8,G8,v1,Os,b1,Xl,M8,y1,Cs,w1,Ql,j8,T1,Is,E1,ed,H8,$1,td,_f,vf,B8,x1,Mr,V8,bf,Y8,Z8,k1,od,Us,K8,yf,J8,X8,A1,Ns,P1,zs,wf,Q8,q1,Fs,D1,Ct,eP,Tf,tP,oP,Ef,rP,aP,S1,rd,nP,O1,Ls,C1,ad,sP,I1,jr,iP,$f,lP,dP,U1,Oo,Hr,xf,Rs,cP,kf,mP,N1,Br,pP,nd,hP,uP,z1,pe,fP,Ws,gP,_P,Gs,vP,bP,Ms,yP,wP,js,TP,EP,F1,Vr,$P,sd,xP,kP,L1,id,R1,Co,Yr,Af,Hs,AP,Pf,PP,W1,ld,qP,G1,It,DP,Bs,SP,OP,Vs,CP,IP,M1,dd,UP,j1,Ys,H1,cd,NP,B1,Ut,zP,qf,FP,LP,Df,RP,WP,V1,Io,Zr,Sf,Zs,GP,Of,MP,Y1,md,jP,Z1,Fe,HP,Cf,BP,VP,If,YP,ZP,Uf,KP,JP,K1,Nt,XP,Nf,QP,eq,zf,tq,oq,J1,Ks,X1,Kr,rq,Js,aq,nq,Q1,Uo,Jr,Ff,Xs,sq,Lf,iq,eb,pd,lq,tb,Qs,ob,zt,dq,Rf,cq,mq,Wf,pq,hq,rb,hd,uq,ab,ei,nb,ud,fq,sb,Xr,gq,Gf,_q,vq,ib,rt,Mf,bq,yq,jf,wq,Tq,Hf,Eq,$q,lb,fd,xq,db,ti,cb,gd,kq,mb,Le,Aq,Bf,Pq,qq,Vf,Dq,Sq,Yf,Oq,Cq,pb,No,Qr,Zf,oi,Iq,Kf,Uq,hb,Ft,Nq,Jf,zq,Fq,Xf,Lq,Rq,ub,_d,Wq,fb,vd,Gq,gb,ea,Mq,Qf,jq,Hq,_b,ri,vb,M,Bq,eg,Vq,Yq,tg,Zq,Kq,og,Jq,Xq,rg,Qq,eD,ag,tD,oD,ng,rD,aD,bb,bd,nD,yb,zo,ta,sg,ai,sD,ig,iD,wb,oa,Tb,Re,lD,ni,dD,cD,yd,mD,pD,si,hD,uD,Eb,We,lg,fD,gD,dg,_D,vD,cg,bD,yD,mg,wD,$b,wd,TD,xb,ii,pg,ED,$D,kb,Td,xD,Ab,li,Pb,Lt,kD,hg,AD,PD,ug,qD,DD,qb,di,Db,Rt,SD,fg,OD,CD,ci,ID,UD,Sb,ra,ND,Ed,zD,FD,Ob,$d,LD,Cb,mi,gg,RD,WD,Ib,pi,Ub,xd,GD,Nb,hi,zb,ui,_g,MD,jD,Fb,fi,Lb,kd,HD,Rb,gi,Wb,Ad,BD,Gb,aa,VD,_i,YD,ZD,Mb,vi,vg,KD,JD,jb,Wt,XD,bg,QD,e9,yg,t9,o9,Hb,na,r9,wg,a9,n9,Bb,bi,Vb,Pd,s9,Yb,Ge,Tg,i9,l9,Eg,d9,c9,yi,m9,$g,p9,h9,u9,wi,f9,xg,g9,_9,Zb,Ti,at,v9,kg,b9,y9,Ag,w9,T9,Pg,E9,$9,Kb,sa,x9,qg,k9,A9,Jb,Ei,Xb,Fo,Dg,P9,q9,Sg,D9,S9,Qb,Gt,O9,Og,C9,I9,Cg,U9,N9,ey,qd,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,Ai,Yg,yS,wS,iy,Pi,Zg,TS,ES,ly,te,Kg,qi,$S,Jg,xS,kS,AS,Di,Sd,Xg,PS,qS,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,A7,P7,Ho,q7,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,A_,Z7,K7,Mi,J7,X7,_y,Yo,P_,Q7,eO,q_,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_,AO,Fd,PO,L_,qO,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 A=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.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"tokenizer",val:": typing.Optional[transformers.tokenization_utils_base.PreTrainedTokenizerBase] = None"},{name:"model_init",val:": typing.Callable[[], transformers.modeling_utils.PreTrainedModel] = None"},{name:"compute_metrics",val:": typing.Union[typing.Callable[[transformers.trainer_utils.EvalPrediction], typing.Dict], NoneType] = None"},{name:"callbacks",val:": typing.Optional[typing.List[transformers.trainer_callback.TrainerCallback]] = None"},{name:"optimizers",val:": typing.Tuple[torch.optim.optimizer.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None)"},{name:"preprocess_logits_for_metrics",val:": typing.Callable[[torch.Tensor, torch.Tensor], torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.Trainer.model",description:`<strong>model</strong> (<a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a> or <code>torch.nn.Module</code>, <em>optional</em>) &#x2014;
The model to train, evaluate or use for predictions. If not provided, a <code>model_init</code> must be passed.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p><a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a> is optimized to work with the <a href="/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a> provided by the library. You can still use
your own models defined as <code>torch.nn.Module</code> as long as they work the same way as the &#x1F917; Transformers
models.</p>

					</div>`,name:"model"},{anchor:"transformers.Trainer.args",description:`<strong>args</strong> (<a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>, <em>optional</em>) &#x2014;
The arguments to tweak for training. Will default to a basic instance of <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> with the
<code>output_dir</code> set to a directory named <em>tmp_trainer</em> in the current directory if not provided.`,name:"args"},{anchor:"transformers.Trainer.data_collator",description:`<strong>data_collator</strong> (<code>DataCollator</code>, <em>optional</em>) &#x2014;
The function to use to form a batch from a list of elements of <code>train_dataset</code> or <code>eval_dataset</code>. Will
default to <a href="/docs/transformers/v4.25.1/en/main_classes/data_collator#transformers.default_data_collator">default_data_collator()</a> if no <code>tokenizer</code> is provided, an instance of
<a href="/docs/transformers/v4.25.1/en/main_classes/data_collator#transformers.DataCollatorWithPadding">DataCollatorWithPadding</a> otherwise.`,name:"data_collator"},{anchor:"transformers.Trainer.train_dataset",description:`<strong>train_dataset</strong> (<code>torch.utils.data.Dataset</code> or <code>torch.utils.data.IterableDataset</code>, <em>optional</em>) &#x2014;
The dataset to use for training. If it is a <a href="https://huggingface.co/docs/datasets/v2.7.1/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed.</p>
<p>Note that if it&#x2019;s a <code>torch.utils.data.IterableDataset</code> with some randomization and you are training in a
distributed fashion, your iterable dataset should either use a internal attribute <code>generator</code> that is a
<code>torch.Generator</code> for the randomization that must be identical on all processes (and the Trainer will
manually set the seed of this <code>generator</code> at each epoch) or have a <code>set_epoch()</code> method that internally
sets the seed of the RNGs used.`,name:"train_dataset"},{anchor:"transformers.Trainer.eval_dataset",description:`<strong>eval_dataset</strong> (Union[<code>torch.utils.data.Dataset</code>, Dict[str, <code>torch.utils.data.Dataset</code>]), <em>optional</em>) &#x2014;
The dataset to use for evaluation. If it is a <a href="https://huggingface.co/docs/datasets/v2.7.1/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. If it is a dictionary, it will evaluate on each
dataset prepending the dictionary key to the metric name.`,name:"eval_dataset"},{anchor:"transformers.Trainer.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.25.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase">PreTrainedTokenizerBase</a>, <em>optional</em>) &#x2014;
The tokenizer used to preprocess the data. If provided, will be used to automatically pad the inputs the
maximum length when batching inputs, and it will be saved along the model to make it easier to rerun an
interrupted training or reuse the fine-tuned model.`,name:"tokenizer"},{anchor:"transformers.Trainer.model_init",description:`<strong>model_init</strong> (<code>Callable[[], PreTrainedModel]</code>, <em>optional</em>) &#x2014;
A function that instantiates the model to be used. If provided, each call to <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer.train">train()</a> will start
from a new instance of the model as given by this function.</p>
<p>The function may have zero argument, or a single one containing the optuna/Ray Tune/SigOpt trial object, to
be able to choose different architectures according to hyper parameters (such as layer count, sizes of
inner layers, dropout probabilities etc).`,name:"model_init"},{anchor:"transformers.Trainer.compute_metrics",description:`<strong>compute_metrics</strong> (<code>Callable[[EvalPrediction], Dict]</code>, <em>optional</em>) &#x2014;
The function that will be used to compute metrics at evaluation. Must take a <a href="/docs/transformers/v4.25.1/en/internal/trainer_utils#transformers.EvalPrediction">EvalPrediction</a> and return
a dictionary string to metric values.`,name:"compute_metrics"},{anchor:"transformers.Trainer.callbacks",description:`<strong>callbacks</strong> (List of <a href="/docs/transformers/v4.25.1/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a>, <em>optional</em>) &#x2014;
A list of callbacks to customize the training loop. Will add those to the list of default callbacks
detailed in <a href="callback">here</a>.</p>
<p>If you want to remove one of the default callbacks used, use the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer.remove_callback">Trainer.remove_callback()</a> method.`,name:"callbacks"},{anchor:"transformers.Trainer.optimizers",description:`<strong>optimizers</strong> (<code>Tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR]</code>, <em>optional</em>) &#x2014; A tuple
containing the optimizer and the scheduler to use. Will default to an instance of <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> on your model
and a scheduler given by <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.get_linear_schedule_with_warmup">get_linear_schedule_with_warmup()</a> controlled by <code>args</code>.`,name:"optimizers"},{anchor:"transformers.Trainer.preprocess_logits_for_metrics",description:`<strong>preprocess_logits_for_metrics</strong> (<code>Callable[[torch.Tensor, torch.Tensor], torch.Tensor]</code>, <em>optional</em>) &#x2014;
A function that preprocess the logits right before caching them at each evaluation step. Must take two
tensors, the logits and the labels, and return the logits once processed as desired. The modifications made
by this function will be reflected in the predictions received by <code>compute_metrics</code>.</p>
<p>Note that the labels (second parameter) will be <code>None</code> if the dataset does not have them.`,name:"preprocess_logits_for_metrics"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/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/v4.25.1/src/transformers/trainer.py#L642"}}),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/v4.25.1/src/transformers/trainer.py#L2478"}}),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/v4.25.1/src/transformers/trainer.py#L2545"}}),Ba=new x({props:{name:"compute_loss_context_manager",anchor:"transformers.Trainer.compute_loss_context_manager",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L2472"}}),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/v4.25.1/src/transformers/trainer.py#L3339"}}),Za=new x({props:{name:"create_optimizer",anchor:"transformers.Trainer.create_optimizer",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L1002"}}),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/v4.25.1/src/transformers/trainer.py#L986"}}),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/v4.25.1/src/transformers/trainer.py#L1139"}}),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/v2.7.1/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns
not accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Trainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>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/v4.25.1/src/transformers/trainer.py#L2774",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/v4.25.1/src/transformers/trainer.py#L2903"}}),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/v4.25.1/src/transformers/trainer.py#L3270",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/v2.7.1/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted
by the <code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"eval_dataset"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L888"}}),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/v4.25.1/src/transformers/trainer.py#L1050"}}),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/v2.7.1/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. It must implement <code>__len__</code>.`,name:"test_dataset"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L938"}}),cn=new x({props:{name:"get_train_dataloader",anchor:"transformers.Trainer.get_train_dataloader",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L809"}}),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/v4.25.1/src/transformers/trainer.py#L2326",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/v4.25.1/src/transformers/trainer.py#L3288"}}),fn=new x({props:{name:"is_local_process_zero",anchor:"transformers.Trainer.is_local_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L2577"}}),gn=new x({props:{name:"is_world_process_zero",anchor:"transformers.Trainer.is_world_process_zero",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L2584"}}),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/v4.25.1/src/transformers/trainer.py#L2421"}}),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/v4.25.1/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/v4.25.1/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/v4.25.1/src/transformers/trainer.py#L1156"}}),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/v4.25.1/src/transformers/trainer.py#L653",returnDescription:`
<p>The callback removed, if found.</p>
`,returnType:`
<p><code>~transformer.TrainerCallback</code></p>
`}}),qn=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/v4.25.1/src/transformers/trainer.py#L2843"}}),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/v4.25.1/src/transformers/trainer.py#L3497"}}),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/v4.25.1/src/transformers/trainer.py#L3165",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/v4.25.1/en/main_classes/trainer#transformers.Trainer.create_model_card">create_model_card()</a>.`,name:"blocking"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L3437",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/v4.25.1/src/transformers/trainer.py#L669"}}),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/v4.25.1/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/v4.25.1/src/transformers/trainer.py#L2596"}}),Gn=new x({props:{name:"save_state",anchor:"transformers.Trainer.save_state",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/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/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>. If a
<code>bool</code> and equals <code>True</code>, load the last checkpoint in <em>args.output_dir</em> as saved by a previous instance
of <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>. If present, training will resume from the model/optimizer/scheduler states loaded here.`,name:"resume_from_checkpoint"},{anchor:"transformers.Trainer.train.trial",description:`<strong>trial</strong> (<code>optuna.Trial</code> or <code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
The trial run or the hyperparameter dictionary for hyperparameter search.`,name:"trial"},{anchor:"transformers.Trainer.train.ignore_keys_for_eval",description:`<strong>ignore_keys_for_eval</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions for evaluation during the training.
kwargs &#x2014;
Additional keyword arguments used to hide deprecated arguments`,name:"ignore_keys_for_eval"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/trainer.py#L1448"}}),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/v4.25.1/src/transformers/trainer.py#L2497",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.Optional[torch.utils.data.dataset.Dataset] = None"},{name:"tokenizer",val:": typing.Optional[transformers.tokenization_utils_base.PreTrainedTokenizerBase] = None"},{name:"model_init",val:": typing.Callable[[], transformers.modeling_utils.PreTrainedModel] = None"},{name:"compute_metrics",val:": typing.Union[typing.Callable[[transformers.trainer_utils.EvalPrediction], typing.Dict], NoneType] = None"},{name:"callbacks",val:": typing.Optional[typing.List[transformers.trainer_callback.TrainerCallback]] = None"},{name:"optimizers",val:": typing.Tuple[torch.optim.optimizer.Optimizer, torch.optim.lr_scheduler.LambdaLR] = (None, None)"},{name:"preprocess_logits_for_metrics",val:": typing.Callable[[torch.Tensor, torch.Tensor], torch.Tensor] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/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/v2.7.1/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns
not accepted by the <code>model.forward()</code> method are automatically removed. It must implement the <code>__len__</code>
method.`,name:"eval_dataset"},{anchor:"transformers.Seq2SeqTrainer.evaluate.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.evaluate.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.evaluate.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.evaluate.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.
gen_kwargs &#x2014;
Additional <code>generate</code> specific kwargs.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/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/v2.7.1/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, columns not accepted by the
<code>model.forward()</code> method are automatically removed. Has to implement the method <code>__len__</code>`,name:"test_dataset"},{anchor:"transformers.Seq2SeqTrainer.predict.ignore_keys",description:`<strong>ignore_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of keys in the output of your model (if it is a dictionary) that should be ignored when
gathering predictions.`,name:"ignore_keys"},{anchor:"transformers.Seq2SeqTrainer.predict.metric_key_prefix",description:`<strong>metric_key_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;eval&quot;</code>) &#x2014;
An optional prefix to be used as the metrics key prefix. For example the metrics &#x201C;bleu&#x201D; will be named
&#x201C;eval_bleu&#x201D; if the prefix is <code>&quot;eval&quot;</code> (default)`,name:"metric_key_prefix"},{anchor:"transformers.Seq2SeqTrainer.predict.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum target length to use when predicting with the generate method.`,name:"max_length"},{anchor:"transformers.Seq2SeqTrainer.predict.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of beams for beam search that will be used when predicting with the generate method. 1 means no
beam search.
gen_kwargs &#x2014;
Additional <code>generate</code> specific kwargs.`,name:"num_beams"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/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"}],parametersDescription:[{anchor:"transformers.TrainingArguments.output_dir",description:`<strong>output_dir</strong> (<code>str</code>) &#x2014;
The output directory where the model predictions and checkpoints will be written.`,name:"output_dir"},{anchor:"transformers.TrainingArguments.overwrite_output_dir",description:`<strong>overwrite_output_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, overwrite the content of the output directory. Use this to continue training if <code>output_dir</code>
points to a checkpoint directory.`,name:"overwrite_output_dir"},{anchor:"transformers.TrainingArguments.do_train",description:`<strong>do_train</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run training or not. This argument is not directly used by <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used
by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_train"},{anchor:"transformers.TrainingArguments.do_eval",description:`<strong>do_eval</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to run evaluation on the validation set or not. Will be set to <code>True</code> if <code>evaluation_strategy</code> is
different from <code>&quot;no&quot;</code>. This argument is not directly used by <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your
training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_eval"},{anchor:"transformers.TrainingArguments.do_predict",description:`<strong>do_predict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run predictions on the test set or not. This argument is not directly used by <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s
intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_predict"},{anchor:"transformers.TrainingArguments.evaluation_strategy",description:`<strong>evaluation_strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.25.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;no&quot;</code>) &#x2014;
The evaluation strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No evaluation is done during training.</li>
<li><code>&quot;steps&quot;</code>: Evaluation is done (and logged) every <code>eval_steps</code>.</li>
<li><code>&quot;epoch&quot;</code>: Evaluation is done at the end of each epoch.</li>
</ul>`,name:"evaluation_strategy"},{anchor:"transformers.TrainingArguments.prediction_loss_only",description:`<strong>prediction_loss_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When performing evaluation and generating predictions, only returns the loss.`,name:"prediction_loss_only"},{anchor:"transformers.TrainingArguments.per_device_train_batch_size",description:`<strong>per_device_train_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for training.`,name:"per_device_train_batch_size"},{anchor:"transformers.TrainingArguments.per_device_eval_batch_size",description:`<strong>per_device_eval_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for evaluation.`,name:"per_device_eval_batch_size"},{anchor:"transformers.TrainingArguments.gradient_accumulation_steps",description:`<strong>gradient_accumulation_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of updates steps to accumulate the gradients for, before performing a backward/update pass.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>When using gradient accumulation, one step is counted as one step with backward pass. Therefore, logging,
evaluation, save will be conducted every <code>gradient_accumulation_steps * xxx_step</code> training examples.</p>

					</div>`,name:"gradient_accumulation_steps"},{anchor:"transformers.TrainingArguments.eval_accumulation_steps",description:`<strong>eval_accumulation_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If
left unset, the whole predictions are accumulated on GPU/TPU before being moved to the CPU (faster but
requires more memory).`,name:"eval_accumulation_steps"},{anchor:"transformers.TrainingArguments.eval_delay",description:`<strong>eval_delay</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Number of epochs or steps to wait for before the first evaluation can be performed, depending on the
evaluation_strategy.`,name:"eval_delay"},{anchor:"transformers.TrainingArguments.learning_rate",description:`<strong>learning_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 5e-5) &#x2014;
The initial learning rate for <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"learning_rate"},{anchor:"transformers.TrainingArguments.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights in <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a>
optimizer.`,name:"weight_decay"},{anchor:"transformers.TrainingArguments.adam_beta1",description:`<strong>adam_beta1</strong> (<code>float</code>, <em>optional</em>, defaults to 0.9) &#x2014;
The beta1 hyperparameter for the <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_beta1"},{anchor:"transformers.TrainingArguments.adam_beta2",description:`<strong>adam_beta2</strong> (<code>float</code>, <em>optional</em>, defaults to 0.999) &#x2014;
The beta2 hyperparameter for the <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_beta2"},{anchor:"transformers.TrainingArguments.adam_epsilon",description:`<strong>adam_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-8) &#x2014;
The epsilon hyperparameter for the <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_epsilon"},{anchor:"transformers.TrainingArguments.max_grad_norm",description:`<strong>max_grad_norm</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Maximum gradient norm (for gradient clipping).`,name:"max_grad_norm"},{anchor:"transformers.TrainingArguments.num_train_epochs(float,",description:`<strong>num_train_epochs(<code>float</code>,</strong> <em>optional</em>, defaults to 3.0) &#x2014;
Total number of training epochs to perform (if not an integer, will perform the decimal part percents of
the last epoch before stopping training).`,name:"num_train_epochs(float,"},{anchor:"transformers.TrainingArguments.max_steps",description:`<strong>max_steps</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
If set to a positive number, the total number of training steps to perform. Overrides <code>num_train_epochs</code>.
In case of using a finite iterable dataset the training may stop before reaching the set number of steps
when all data is exhausted`,name:"max_steps"},{anchor:"transformers.TrainingArguments.lr_scheduler_type",description:`<strong>lr_scheduler_type</strong> (<code>str</code> or <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.SchedulerType">SchedulerType</a>, <em>optional</em>, defaults to <code>&quot;linear&quot;</code>) &#x2014;
The scheduler type to use. See the documentation of <a href="/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/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 <code>[&quot;labels&quot;]</code> except if the model used is one of the <code>XxxForQuestionAnswering</code> in
which case it will default to <code>[&quot;start_positions&quot;, &quot;end_positions&quot;]</code>.`,name:"label_names"},{anchor:"transformers.TrainingArguments.load_best_model_at_end",description:`<strong>load_best_model_at_end</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to load the best model found during training at the end of training.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When set to <code>True</code>, the parameters <code>save_strategy</code> needs to be the same as <code>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/v4.25.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> will also trigger a push.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>If <code>output_dir</code> exists, it needs to be a local clone of the repository to which the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a> will be
pushed.</p>

					</div>`,name:"push_to_hub"},{anchor:"transformers.TrainingArguments.resume_from_checkpoint",description:`<strong>resume_from_checkpoint</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The path to a folder with a valid checkpoint for your model. This argument is not directly used by
<a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"resume_from_checkpoint"},{anchor:"transformers.TrainingArguments.hub_model_id",description:`<strong>hub_model_id</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the repository to keep in sync with the local <em>output_dir</em>. It can be a simple model ID in
which case the model will be pushed in your namespace. Otherwise it should be the whole repository name,
for instance <code>&quot;user_name/model&quot;</code>, which allows you to push to an organization you are a member of with
<code>&quot;organization_name/model&quot;</code>. Will default to <code>user_name/output_dir_name</code> with <em>output_dir_name</em> being the
name of <code>output_dir</code>.</p>
<p>Will default to the name of <code>output_dir</code>.`,name:"hub_model_id"},{anchor:"transformers.TrainingArguments.hub_strategy",description:`<strong>hub_strategy</strong> (<code>str</code> or <code>HubStrategy</code>, <em>optional</em>, defaults to <code>&quot;every_save&quot;</code>) &#x2014;
Defines the scope of what is pushed to the Hub and when. Possible values are:</p>
<ul>
<li><code>&quot;end&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> method is called.</li>
<li><code>&quot;every_save&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and
a draft of a model card each time there is a model save. The pushes are asynchronous to not block
training, and in case the save are very frequent, a new push is only attempted if the previous one is
finished. A last push is made with the final model at the end of training.</li>
<li><code>&quot;checkpoint&quot;</code>: like <code>&quot;every_save&quot;</code> but the latest checkpoint is also pushed in a subfolder named
last-checkpoint, allowing you to resume training easily with
<code>trainer.train(resume_from_checkpoint=&quot;last-checkpoint&quot;)</code>.</li>
<li><code>&quot;all_checkpoints&quot;</code>: like <code>&quot;checkpoint&quot;</code> but all checkpoints are pushed like they appear in the output
folder (so you will get one checkpoint folder per folder in your final repository)</li>
</ul>`,name:"hub_strategy"},{anchor:"transformers.TrainingArguments.hub_token",description:`<strong>hub_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with
<code>huggingface-cli login</code>.`,name:"hub_token"},{anchor:"transformers.TrainingArguments.hub_private_repo",description:`<strong>hub_private_repo</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, the Hub repo will be set to private.`,name:"hub_private_repo"},{anchor:"transformers.TrainingArguments.gradient_checkpointing",description:`<strong>gradient_checkpointing</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, use gradient checkpointing to save memory at the expense of slower backward pass.`,name:"gradient_checkpointing"},{anchor:"transformers.TrainingArguments.include_inputs_for_metrics",description:`<strong>include_inputs_for_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the inputs will be passed to the <code>compute_metrics</code> function. This is intended for metrics
that need inputs, predictions and references for scoring calculation in Metric class.`,name:"include_inputs_for_metrics"},{anchor:"transformers.TrainingArguments.auto_find_batch_size",description:`<strong>auto_find_batch_size</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding
CUDA Out-of-Memory errors. Requires accelerate to be installed (<code>pip install accelerate</code>)`,name:"auto_find_batch_size"},{anchor:"transformers.TrainingArguments.full_determinism",description:`<strong>full_determinism</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, <a href="/docs/transformers/v4.25.1/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.25.1/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"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/training_args.py#L136"}}),os=new x({props:{name:"get_process_log_level",anchor:"transformers.TrainingArguments.get_process_log_level",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/training_args.py#L1613"}}),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/v4.25.1/src/transformers/training_args.py#L1703"}}),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/v4.25.1/src/transformers/training_args.py#L1648"}}),ss=new x({props:{name:"to_dict",anchor:"transformers.TrainingArguments.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/training_args.py#L1712"}}),ls=new x({props:{name:"to_json_string",anchor:"transformers.TrainingArguments.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/training_args.py#L1729"}}),ds=new x({props:{name:"to_sanitized_dict",anchor:"transformers.TrainingArguments.to_sanitized_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/training_args.py#L1735"}}),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:"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/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used
by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_train"},{anchor:"transformers.Seq2SeqTrainingArguments.do_eval",description:`<strong>do_eval</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to run evaluation on the validation set or not. Will be set to <code>True</code> if <code>evaluation_strategy</code> is
different from <code>&quot;no&quot;</code>. This argument is not directly used by <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your
training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_eval"},{anchor:"transformers.Seq2SeqTrainingArguments.do_predict",description:`<strong>do_predict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to run predictions on the test set or not. This argument is not directly used by <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s
intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"do_predict"},{anchor:"transformers.Seq2SeqTrainingArguments.evaluation_strategy",description:`<strong>evaluation_strategy</strong> (<code>str</code> or <a href="/docs/transformers/v4.25.1/en/internal/trainer_utils#transformers.IntervalStrategy">IntervalStrategy</a>, <em>optional</em>, defaults to <code>&quot;no&quot;</code>) &#x2014;
The evaluation strategy to adopt during training. Possible values are:</p>
<ul>
<li><code>&quot;no&quot;</code>: No evaluation is done during training.</li>
<li><code>&quot;steps&quot;</code>: Evaluation is done (and logged) every <code>eval_steps</code>.</li>
<li><code>&quot;epoch&quot;</code>: Evaluation is done at the end of each epoch.</li>
</ul>`,name:"evaluation_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.prediction_loss_only",description:`<strong>prediction_loss_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
When performing evaluation and generating predictions, only returns the loss.`,name:"prediction_loss_only"},{anchor:"transformers.Seq2SeqTrainingArguments.per_device_train_batch_size",description:`<strong>per_device_train_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for training.`,name:"per_device_train_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.per_device_eval_batch_size",description:`<strong>per_device_eval_batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The batch size per GPU/TPU core/CPU for evaluation.`,name:"per_device_eval_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.gradient_accumulation_steps",description:`<strong>gradient_accumulation_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of updates steps to accumulate the gradients for, before performing a backward/update pass.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>When using gradient accumulation, one step is counted as one step with backward pass. Therefore, logging,
evaluation, save will be conducted every <code>gradient_accumulation_steps * xxx_step</code> training examples.</p>

					</div>`,name:"gradient_accumulation_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.eval_accumulation_steps",description:`<strong>eval_accumulation_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If
left unset, the whole predictions are accumulated on GPU/TPU before being moved to the CPU (faster but
requires more memory).`,name:"eval_accumulation_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.eval_delay",description:`<strong>eval_delay</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Number of epochs or steps to wait for before the first evaluation can be performed, depending on the
evaluation_strategy.`,name:"eval_delay"},{anchor:"transformers.Seq2SeqTrainingArguments.learning_rate",description:`<strong>learning_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 5e-5) &#x2014;
The initial learning rate for <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"learning_rate"},{anchor:"transformers.Seq2SeqTrainingArguments.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights in <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a>
optimizer.`,name:"weight_decay"},{anchor:"transformers.Seq2SeqTrainingArguments.adam_beta1",description:`<strong>adam_beta1</strong> (<code>float</code>, <em>optional</em>, defaults to 0.9) &#x2014;
The beta1 hyperparameter for the <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_beta1"},{anchor:"transformers.Seq2SeqTrainingArguments.adam_beta2",description:`<strong>adam_beta2</strong> (<code>float</code>, <em>optional</em>, defaults to 0.999) &#x2014;
The beta2 hyperparameter for the <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_beta2"},{anchor:"transformers.Seq2SeqTrainingArguments.adam_epsilon",description:`<strong>adam_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-8) &#x2014;
The epsilon hyperparameter for the <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.AdamW">AdamW</a> optimizer.`,name:"adam_epsilon"},{anchor:"transformers.Seq2SeqTrainingArguments.max_grad_norm",description:`<strong>max_grad_norm</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Maximum gradient norm (for gradient clipping).`,name:"max_grad_norm"},{anchor:"transformers.Seq2SeqTrainingArguments.num_train_epochs(float,",description:`<strong>num_train_epochs(<code>float</code>,</strong> <em>optional</em>, defaults to 3.0) &#x2014;
Total number of training epochs to perform (if not an integer, will perform the decimal part percents of
the last epoch before stopping training).`,name:"num_train_epochs(float,"},{anchor:"transformers.Seq2SeqTrainingArguments.max_steps",description:`<strong>max_steps</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
If set to a positive number, the total number of training steps to perform. Overrides <code>num_train_epochs</code>.
In case of using a finite iterable dataset the training may stop before reaching the set number of steps
when all data is exhausted`,name:"max_steps"},{anchor:"transformers.Seq2SeqTrainingArguments.lr_scheduler_type",description:`<strong>lr_scheduler_type</strong> (<code>str</code> or <a href="/docs/transformers/v4.25.1/en/main_classes/optimizer_schedules#transformers.SchedulerType">SchedulerType</a>, <em>optional</em>, defaults to <code>&quot;linear&quot;</code>) &#x2014;
The scheduler type to use. See the documentation of <a href="/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/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 <code>[&quot;labels&quot;]</code> except if the model used is one of the <code>XxxForQuestionAnswering</code> in
which case it will default to <code>[&quot;start_positions&quot;, &quot;end_positions&quot;]</code>.`,name:"label_names"},{anchor:"transformers.Seq2SeqTrainingArguments.load_best_model_at_end",description:`<strong>load_best_model_at_end</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to load the best model found during training at the end of training.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When set to <code>True</code>, the parameters <code>save_strategy</code> needs to be the same as <code>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/v4.25.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> will also trigger a push.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>If <code>output_dir</code> exists, it needs to be a local clone of the repository to which the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a> will be
pushed.</p>

					</div>`,name:"push_to_hub"},{anchor:"transformers.Seq2SeqTrainingArguments.resume_from_checkpoint",description:`<strong>resume_from_checkpoint</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The path to a folder with a valid checkpoint for your model. This argument is not directly used by
<a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>, it&#x2019;s intended to be used by your training/evaluation scripts instead. See the <a href="https://github.com/huggingface/transformers/tree/main/examples" rel="nofollow">example
scripts</a> for more details.`,name:"resume_from_checkpoint"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_model_id",description:`<strong>hub_model_id</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of the repository to keep in sync with the local <em>output_dir</em>. It can be a simple model ID in
which case the model will be pushed in your namespace. Otherwise it should be the whole repository name,
for instance <code>&quot;user_name/model&quot;</code>, which allows you to push to an organization you are a member of with
<code>&quot;organization_name/model&quot;</code>. Will default to <code>user_name/output_dir_name</code> with <em>output_dir_name</em> being the
name of <code>output_dir</code>.</p>
<p>Will default to the name of <code>output_dir</code>.`,name:"hub_model_id"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_strategy",description:`<strong>hub_strategy</strong> (<code>str</code> or <code>HubStrategy</code>, <em>optional</em>, defaults to <code>&quot;every_save&quot;</code>) &#x2014;
Defines the scope of what is pushed to the Hub and when. Possible values are:</p>
<ul>
<li><code>&quot;end&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and a
draft of a model card when the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer.save_model">save_model()</a> method is called.</li>
<li><code>&quot;every_save&quot;</code>: push the model, its configuration, the tokenizer (if passed along to the <a href="/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer">Trainer</a>) and
a draft of a model card each time there is a model save. The pushes are asynchronous to not block
training, and in case the save are very frequent, a new push is only attempted if the previous one is
finished. A last push is made with the final model at the end of training.</li>
<li><code>&quot;checkpoint&quot;</code>: like <code>&quot;every_save&quot;</code> but the latest checkpoint is also pushed in a subfolder named
last-checkpoint, allowing you to resume training easily with
<code>trainer.train(resume_from_checkpoint=&quot;last-checkpoint&quot;)</code>.</li>
<li><code>&quot;all_checkpoints&quot;</code>: like <code>&quot;checkpoint&quot;</code> but all checkpoints are pushed like they appear in the output
folder (so you will get one checkpoint folder per folder in your final repository)</li>
</ul>`,name:"hub_strategy"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_token",description:`<strong>hub_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with
<code>huggingface-cli login</code>.`,name:"hub_token"},{anchor:"transformers.Seq2SeqTrainingArguments.hub_private_repo",description:`<strong>hub_private_repo</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, the Hub repo will be set to private.`,name:"hub_private_repo"},{anchor:"transformers.Seq2SeqTrainingArguments.gradient_checkpointing",description:`<strong>gradient_checkpointing</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, use gradient checkpointing to save memory at the expense of slower backward pass.`,name:"gradient_checkpointing"},{anchor:"transformers.Seq2SeqTrainingArguments.include_inputs_for_metrics",description:`<strong>include_inputs_for_metrics</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the inputs will be passed to the <code>compute_metrics</code> function. This is intended for metrics
that need inputs, predictions and references for scoring calculation in Metric class.`,name:"include_inputs_for_metrics"},{anchor:"transformers.Seq2SeqTrainingArguments.auto_find_batch_size",description:`<strong>auto_find_batch_size</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding
CUDA Out-of-Memory errors. Requires accelerate to be installed (<code>pip install accelerate</code>)`,name:"auto_find_batch_size"},{anchor:"transformers.Seq2SeqTrainingArguments.full_determinism",description:`<strong>full_determinism</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, <a href="/docs/transformers/v4.25.1/en/internal/trainer_utils#transformers.enable_full_determinism">enable_full_determinism()</a> is called instead of <a href="/docs/transformers/v4.25.1/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.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/v4.25.1/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 ..."}}),As=new O({props:{code:"accelerate launch --num_processes 2 trainer-program.py ...",highlighted:"accelerate launch --num_processes 2 trainer-program.py ..."}}),Ps=new O({props:{code:"deepspeed --num_gpus 2 trainer-program.py ...",highlighted:"deepspeed --num_gpus 2 trainer-program.py ..."}}),qs=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"),q=l(),$=n("h1"),k=n("a"),L=n("span"),h(A.$$.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(),Pe=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"),Aw=r("log"),Pw=r(" \u2014 Logs information on the various objects watching training."),qw=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"),Am=n("span"),h(La.$$.fragment),m0=l(),Pm=n("span"),p0=r("Trainer"),wv=l(),b=n("div"),h(Ra.$$.fragment),h0=l(),qm=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"),A0=r("DeepSpeed"),P0=r(" and then again in "),Um=n("code"),q0=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(),qe=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"),AT=r("Setup the optimizer."),PT=l(),Ka=n("p"),qT=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"),AE=r("Returns the test "),fp=n("code"),PE=r("~torch.utils.data.DataLoader"),qE=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 `),Ap=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 "),Pp=n("code"),b4=r("logs"),y4=r(" on the various objects watching training."),w4=l(),qp=n("p"),T4=r("Subclass and override this method to inject custom behavior."),E4=l(),P=n("div"),h(yn.$$.fragment),$4=l(),Dp=n("p"),x4=r("Log metrics in a specially formatted way"),k4=l(),Sp=n("p"),A4=r("Under distributed environment this is done only for a process with rank 0."),P4=l(),Op=n("p"),q4=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"),e5=r(`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),t5=l(),vl=n("li"),Mp=n("code"),o5=r("*_alloc_delta"),r5=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.`),a5=l(),bt=n("li"),jp=n("code"),n5=r("*_peaked_delta"),s5=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"),i5=r("alloc_delta"),l5=r(` +
`),Bp=n("code"),d5=r("peaked_delta"),c5=r(" and you know how much memory was needed to complete that stage."),m5=l(),Vp=n("p"),p5=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.`),h5=l(),Yp=n("p"),u5=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.`),f5=l(),wn=n("p"),g5=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"),_5=r("tracemalloc"),v5=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.`),b5=l(),Qe=n("p"),y5=r("The GPU allocated and peak memory reporting is done with "),Kp=n("code"),w5=r("torch.cuda.memory_allocated()"),T5=r(` and
`),Jp=n("code"),E5=r("torch.cuda.max_memory_allocated()"),$5=r(`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),Xp=n("code"),x5=r("torch.cuda"),k5=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.`),A5=l(),ne=n("p"),P5=r("Note that this tracker doesn\u2019t account for memory allocations outside of "),bl=n("a"),q5=r("Trainer"),D5=r("\u2019s "),Qp=n("code"),S5=r("__init__"),O5=r(", "),eh=n("code"),C5=r("train"),I5=r(`,
`),th=n("code"),U5=r("evaluate"),N5=r(" and "),oh=n("code"),z5=r("predict"),F5=r(" calls."),L5=l(),U=n("p"),R5=r("Because "),rh=n("code"),W5=r("evaluation"),G5=r(" calls may happen during "),ah=n("code"),M5=r("train"),j5=r(`, we can\u2019t handle nested invocations because
`),nh=n("code"),H5=r("torch.cuda.max_memory_allocated"),B5=r(" is a single counter, so if it gets reset by a nested eval call, "),sh=n("code"),V5=r("train"),Y5=r(`\u2019s tracker
will report incorrect info. If this `),Tn=n("a"),Z5=r("pytorch issue"),K5=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"),J5=r("train"),X5=r(", "),lh=n("code"),Q5=r("evaluate"),e$=r(" and "),dh=n("code"),t$=r("predict"),o$=r(" methods. Which means that if "),ch=n("code"),r$=r("eval"),a$=r(" is called during "),mh=n("code"),n$=r("train"),s$=r(`, it\u2019s the latter
that will account for its memory usage and that of the former.`),i$=l(),Ee=n("p"),l$=r("This also means that if any other tool that is used along the "),yl=n("a"),d$=r("Trainer"),c$=r(` calls
`),ph=n("code"),m$=r("torch.cuda.reset_peak_memory_stats"),p$=r(", the gpu peak memory stats could be invalid. And the "),wl=n("a"),h$=r("Trainer"),u$=r(` will disrupt
the normal behavior of any such tools that rely on calling `),hh=n("code"),f$=r("torch.cuda.reset_peak_memory_stats"),g$=r(" themselves."),_$=l(),uh=n("p"),v$=r("For best performance you may want to consider turning the memory profiling off for production runs."),b$=l(),gr=n("div"),h(En.$$.fragment),y$=l(),fh=n("p"),w$=r("Reformat Trainer metrics values to a human-readable format"),T$=l(),_r=n("div"),h($n.$$.fragment),E$=l(),xn=n("p"),$$=r("Helper to get number of samples in a "),gh=n("code"),x$=r("~torch.utils.data.DataLoader"),k$=r(` by accessing its dataset. When
dataloader.dataset does not exist or has no length, estimates as best it can`),A$=l(),yt=n("div"),h(kn.$$.fragment),P$=l(),An=n("p"),q$=r("Remove a callback from the current list of "),_h=n("code"),D$=r("~transformer.TrainerCallback"),S$=r(" and returns it."),O$=l(),Pn=n("p"),C$=r("If the callback is not found, returns "),vh=n("code"),I$=r("None"),U$=r(" (and no error is raised)."),N$=l(),X=n("div"),h(qn.$$.fragment),z$=l(),bh=n("p"),F$=r("Run prediction and returns predictions and potential metrics."),L$=l(),Dn=n("p"),R$=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"),W$=r("evaluate()"),G$=r("."),M$=l(),h(vr.$$.fragment),j$=l(),Sn=n("p"),H$=r("Returns: "),wh=n("em"),B$=r("NamedTuple"),V$=r(" A namedtuple with the following keys:"),Y$=l(),co=n("ul"),mo=n("li"),Z$=r("predictions ("),Th=n("code"),K$=r("np.ndarray"),J$=r("): The predictions on "),Eh=n("code"),X$=r("test_dataset"),Q$=r("."),e3=l(),po=n("li"),t3=r("label_ids ("),$h=n("code"),o3=r("np.ndarray"),r3=r(", "),xh=n("em"),a3=r("optional"),n3=r("): The labels (if the dataset contained some)."),s3=l(),ho=n("li"),i3=r("metrics ("),kh=n("code"),l3=r("Dict[str, float]"),d3=r(", "),Ah=n("em"),c3=r("optional"),m3=r(`): The potential dictionary of metrics (if the dataset contained
labels).`),p3=l(),wt=n("div"),h(On.$$.fragment),h3=l(),uo=n("p"),u3=r("Prediction/evaluation loop, shared by "),Ph=n("code"),f3=r("Trainer.evaluate()"),g3=r(" and "),qh=n("code"),_3=r("Trainer.predict()"),v3=r("."),b3=l(),Dh=n("p"),y3=r("Works both with or without labels."),w3=l(),Tt=n("div"),h(Cn.$$.fragment),T3=l(),fo=n("p"),E3=r("Perform an evaluation step on "),Sh=n("code"),$3=r("model"),x3=r(" using "),Oh=n("code"),k3=r("inputs"),A3=r("."),P3=l(),Ch=n("p"),q3=r("Subclass and override to inject custom behavior."),D3=l(),br=n("div"),h(In.$$.fragment),S3=l(),et=n("p"),O3=r("Upload "),Ih=n("em"),C3=r("self.model"),I3=r(" and "),Uh=n("em"),U3=r("self.tokenizer"),N3=r(" to the \u{1F917} model hub on the repo "),Nh=n("em"),z3=r("self.args.hub_model_id"),F3=r("."),L3=l(),yr=n("div"),h(Un.$$.fragment),R3=l(),Nn=n("p"),W3=r("Remove a callback from the current list of "),zh=n("code"),G3=r("~transformer.TrainerCallback"),M3=r("."),j3=l(),Ce=n("div"),h(zn.$$.fragment),H3=l(),Fn=n("p"),B3=r("Save metrics into a json file for that split, e.g. "),Fh=n("code"),V3=r("train_results.json"),Y3=r("."),Z3=l(),Lh=n("p"),K3=r("Under distributed environment this is done only for a process with rank 0."),J3=l(),Ln=n("p"),X3=r("To understand the metrics please read the docstring of "),Tl=n("a"),Q3=r("log_metrics()"),ex=r(`. The only difference is that raw
unformatted numbers are saved in the current method.`),tx=l(),Et=n("div"),h(Rn.$$.fragment),ox=l(),Wn=n("p"),rx=r("Will save the model, so you can reload it using "),Rh=n("code"),ax=r("from_pretrained()"),nx=r("."),sx=l(),Wh=n("p"),ix=r("Will only save from the main process."),lx=l(),$t=n("div"),h(Gn.$$.fragment),dx=l(),Gh=n("p"),cx=r("Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),mx=l(),Mh=n("p"),px=r("Under distributed environment this is done only for a process with rank 0."),hx=l(),wr=n("div"),h(Mn.$$.fragment),ux=l(),jh=n("p"),fx=r("Main training entry point."),gx=l(),xt=n("div"),h(jn.$$.fragment),_x=l(),Hh=n("p"),vx=r("Perform a training step on a batch of inputs."),bx=l(),Bh=n("p"),yx=r("Subclass and override to inject custom behavior."),Tv=l(),go=n("h2"),Tr=n("a"),Vh=n("span"),h(Hn.$$.fragment),wx=l(),Yh=n("span"),Tx=r("Seq2SeqTrainer"),Ev=l(),tt=n("div"),h(Bn.$$.fragment),Ex=l(),Ie=n("div"),h(Vn.$$.fragment),$x=l(),Zh=n("p"),xx=r("Run evaluation and returns metrics."),kx=l(),Yn=n("p"),Ax=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"),Px=r("compute_metrics"),qx=r(" argument)."),Dx=l(),Jh=n("p"),Sx=r("You can also subclass and override this method to inject custom behavior."),Ox=l(),Q=n("div"),h(Zn.$$.fragment),Cx=l(),Xh=n("p"),Ix=r("Run prediction and returns predictions and potential metrics."),Ux=l(),Kn=n("p"),Nx=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"),zx=r("evaluate()"),Fx=r("."),Lx=l(),h(Er.$$.fragment),Rx=l(),Jn=n("p"),Wx=r("Returns: "),eu=n("em"),Gx=r("NamedTuple"),Mx=r(" A namedtuple with the following keys:"),jx=l(),_o=n("ul"),vo=n("li"),Hx=r("predictions ("),tu=n("code"),Bx=r("np.ndarray"),Vx=r("): The predictions on "),ou=n("code"),Yx=r("test_dataset"),Zx=r("."),Kx=l(),bo=n("li"),Jx=r("label_ids ("),ru=n("code"),Xx=r("np.ndarray"),Qx=r(", "),au=n("em"),ek=r("optional"),tk=r("): The labels (if the dataset contained some)."),ok=l(),yo=n("li"),rk=r("metrics ("),nu=n("code"),ak=r("Dict[str, float]"),nk=r(", "),su=n("em"),sk=r("optional"),ik=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),lk=l(),lu=n("span"),dk=r("TrainingArguments"),xv=l(),F=n("div"),h(Qn.$$.fragment),ck=l(),es=n("p"),mk=r("TrainingArguments is the subset of the arguments we use in our example scripts "),du=n("strong"),pk=r(`which relate to the training loop
itself`),hk=r("."),uk=l(),To=n("p"),fk=r("Using "),El=n("a"),gk=r("HfArgumentParser"),_k=r(` we can turn this class into
`),ts=n("a"),vk=r("argparse"),bk=r(` arguments that can be specified on the
command line.`),yk=l(),de=n("div"),h(os.$$.fragment),wk=l(),cu=n("p"),Tk=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.`),Ek=l(),Eo=n("p"),$k=r("For the main process the log level defaults to "),mu=n("code"),xk=r("logging.INFO"),kk=r(" unless overridden by "),pu=n("code"),Ak=r("log_level"),Pk=r(" argument."),qk=l(),$o=n("p"),Dk=r("For the replica processes the log level defaults to "),hu=n("code"),Sk=r("logging.WARNING"),Ok=r(" unless overridden by "),uu=n("code"),Ck=r("log_level_replica"),Ik=r(`
argument.`),Uk=l(),rs=n("p"),Nk=r("The choice between the main and replica process settings is made according to the return value of "),fu=n("code"),zk=r("should_log"),Fk=r("."),Lk=l(),xr=n("div"),h(as.$$.fragment),Rk=l(),gu=n("p"),Wk=r("Get number of steps used for a linear warmup."),Gk=l(),kt=n("div"),h(ns.$$.fragment),Mk=l(),_u=n("p"),jk=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.`),Hk=l(),xo=n("p"),Bk=r("One such use is for "),vu=n("code"),Vk=r("datasets"),Yk=r("\u2019s "),bu=n("code"),Zk=r("map"),Kk=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.`),Jk=l(),kr=n("div"),h(ss.$$.fragment),Xk=l(),is=n("p"),Qk=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(),Ar=n("div"),h(ls.$$.fragment),r6=l(),wu=n("p"),a6=r("Serializes this instance to a JSON string."),n6=l(),Pr=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"),qr=n("a"),Eu=n("span"),h(cs.$$.fragment),l6=l(),$u=n("span"),d6=r("Seq2SeqTrainingArguments"),Av=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(),Ao=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.`),Pv=l(),Po=n("h2"),Dr=n("a"),ku=n("span"),h(us.$$.fragment),y6=l(),Au=n("span"),w6=r("Checkpoints"),qv=l(),ce=n("p"),T6=r("By default, "),xl=n("a"),E6=r("Trainer"),$6=r(" will save all checkpoints in the "),Pu=n("code"),x6=r("output_dir"),k6=r(` you set in the
`),kl=n("a"),A6=r("TrainingArguments"),P6=r(" you are using. Those will go in subfolder named "),qu=n("code"),q6=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 "),Al=n("a"),O6=r("Trainer.train()"),C6=r(" with either:"),Sv=l(),Or=n("ul"),Pl=n("li"),Du=n("code"),I6=r("resume_from_checkpoint=True"),U6=r(" which will resume training from the latest checkpoint"),N6=l(),ql=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(),qo=n("h2"),Ur=n("a"),zu=n("span"),h(fs.$$.fragment),Q6=l(),Fu=n("span"),eA=r("Logging"),Uv=l(),Ne=n("p"),tA=r("By default "),Ol=n("a"),oA=r("Trainer"),rA=r(" will use "),Lu=n("code"),aA=r("logging.INFO"),nA=r(" for the main process and "),Ru=n("code"),sA=r("logging.WARNING"),iA=r(" for the replicas if any."),Nv=l(),At=n("p"),lA=r("These defaults can be overridden to use any of the 5 "),Wu=n("code"),dA=r("logging"),cA=r(" levels with "),Cl=n("a"),mA=r("TrainingArguments"),pA=r(`\u2019s
arguments:`),zv=l(),Nr=n("ul"),Il=n("li"),Gu=n("code"),hA=r("log_level"),uA=r(" - for the main process"),fA=l(),Ul=n("li"),Mu=n("code"),gA=r("log_level_replica"),_A=r(" - for the replicas"),Fv=l(),ze=n("p"),vA=r("Further, if "),Nl=n("a"),bA=r("TrainingArguments"),yA=r("\u2019s "),ju=n("code"),wA=r("log_on_each_node"),TA=r(" is set to "),Hu=n("code"),EA=r("False"),$A=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"),xA=r("Note that "),zl=n("a"),kA=r("Trainer"),AA=r(" is going to set "),Bu=n("code"),PA=r("transformers"),qA=r(`\u2019s log level separately for each node in its
`),Vu=n("code"),DA=r("Trainer.__init__()"),SA=r(`. So you may want to set this sooner (see the next example) if you tap into other
`),Yu=n("code"),OA=r("transformers"),CA=r(" functionality before creating the "),Fl=n("a"),IA=r("Trainer"),UA=r(" object."),Rv=l(),Ll=n("p"),NA=r("Here is an example of how this can be used in an application:"),Wv=l(),h(gs.$$.fragment),Gv=l(),Rl=n("p"),zA=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"),FA=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"),LA=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"),RA=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"),WA=r("(add "),Zu=n("code"),GA=r("--log_on_each_node 0"),MA=r(" if on multi-node environment)"),Kv=l(),Do=n("h2"),Fr=n("a"),Ku=n("span"),h(ys.$$.fragment),jA=l(),Ju=n("span"),HA=r("Randomness"),Jv=l(),me=n("p"),BA=r("When resuming from a checkpoint generated by "),jl=n("a"),VA=r("Trainer"),YA=r(` all efforts are made to restore the
`),Xu=n("em"),ZA=r("python"),KA=r(", "),Qu=n("em"),JA=r("numpy"),XA=r(" and "),ef=n("em"),QA=r("pytorch"),e8=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(),Pt=n("p"),t8=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"),o8=r("Controlling sources of randomness"),r8=r(`. As explained in the document, that some of those settings
that make things deterministic (.e.g., `),tf=n("code"),a8=r("torch.backends.cudnn.deterministic"),n8=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),s8=l(),rf=n("span"),i8=r("Specific GPUs Selection"),e1=l(),Hl=n("p"),l8=r("Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),t1=l(),Rr=n("p"),d8=r("When using "),Es=n("a"),af=n("code"),c8=r("DistributedDataParallel"),m8=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:"),o1=l(),h($s.$$.fragment),r1=l(),qt=n("p"),p8=r("if you have either "),xs=n("a"),nf=n("code"),h8=r("accelerate"),u8=r(" or "),ks=n("a"),sf=n("code"),f8=r("deepspeed"),g8=r(" installed you can also accomplish the same by using one of:"),a1=l(),h(As.$$.fragment),n1=l(),h(Ps.$$.fragment),s1=l(),Wr=n("p"),_8=r("You don\u2019t need to use the Accelerate or "),Bl=n("a"),v8=r("the Deepspeed integration"),b8=r(" features to use these launchers."),i1=l(),Vl=n("p"),y8=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."),l1=l(),Yl=n("p"),w8=r("The following environment variables help you control which GPUs to use and their order."),d1=l(),Zl=n("p"),lf=n("strong"),df=n("code"),T8=r("CUDA_VISIBLE_DEVICES"),c1=l(),Gr=n("p"),E8=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"),$8=r("CUDA_VISIBLE_DEVICES"),x8=r(" to a list of the GPUs to be used."),m1=l(),Kl=n("p"),k8=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:"),p1=l(),h(qs.$$.fragment),h1=l(),Dt=n("p"),A8=r("So now pytorch will see only 2 GPUs, where your physical GPUs 0 and 2 are mapped to "),mf=n("code"),P8=r("cuda:0"),q8=r(" and "),pf=n("code"),D8=r("cuda:1"),S8=r(" correspondingly."),u1=l(),Jl=n("p"),O8=r("You can even change their order:"),f1=l(),h(Ds.$$.fragment),g1=l(),St=n("p"),C8=r("Here your physical GPUs 0 and 2 are mapped to "),hf=n("code"),I8=r("cuda:1"),U8=r(" and "),uf=n("code"),N8=r("cuda:0"),z8=r(" correspondingly."),_1=l(),Ot=n("p"),F8=r("The above examples were all for "),ff=n("code"),L8=r("DistributedDataParallel"),R8=r(" use pattern, but the same method works for "),Ss=n("a"),gf=n("code"),W8=r("DataParallel"),G8=r(" as well:"),v1=l(),h(Os.$$.fragment),b1=l(),Xl=n("p"),M8=r("To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),y1=l(),h(Cs.$$.fragment),w1=l(),Ql=n("p"),j8=r("As with any environment variable you can, of course, export those instead of adding these to the command line, as in:"),T1=l(),h(Is.$$.fragment),E1=l(),ed=n("p"),H8=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."),$1=l(),td=n("p"),_f=n("strong"),vf=n("code"),B8=r("CUDA_DEVICE_ORDER"),x1=l(),Mr=n("p"),V8=r("There is an additional environment variable "),bf=n("code"),Y8=r("CUDA_DEVICE_ORDER"),Z8=r(" that controls how the physical devices are ordered. The two choices are:"),k1=l(),od=n("ol"),Us=n("li"),K8=r("ordered by PCIe bus IDs (matches "),yf=n("code"),J8=r("nvidia-smi"),X8=r("\u2019s order) - this is the default."),A1=l(),h(Ns.$$.fragment),P1=l(),zs=n("ol"),wf=n("li"),Q8=r("ordered by GPU compute capabilities"),q1=l(),h(Fs.$$.fragment),D1=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."),S1=l(),rd=n("p"),nP=r("The other solution to swapping the order is to use:"),O1=l(),h(Ls.$$.fragment),C1=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."),I1=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."),U1=l(),Oo=n("h2"),Hr=n("a"),xf=n("span"),h(Rs.$$.fragment),cP=l(),kf=n("span"),mP=r("Trainer Integrations"),N1=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.`),z1=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("."),F1=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(")"),L1=l(),id=n("a"),R1=l(),Co=n("h3"),Yr=n("a"),Af=n("span"),h(Hs.$$.fragment),AP=l(),Pf=n("span"),PP=r("CUDA Extension Installation Notes"),W1=l(),ld=n("p"),qP=r("As of this writing, both FairScale and Deepspeed require compilation of CUDA C++ code, before they can be used."),G1=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.`),M1=l(),dd=n("p"),UP=r("Therefore, if you encounter a CUDA-related build issue while doing one of the following or both:"),j1=l(),h(Ys.$$.fragment),H1=l(),cd=n("p"),NP=r("please, read the following notes first."),B1=l(),Ut=n("p"),zP=r("In these notes we give examples for what to do when "),qf=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.`),V1=l(),Io=n("h4"),Zr=n("a"),Sf=n("span"),h(Zs.$$.fragment),GP=l(),Of=n("span"),MP=r("Possible problem #1"),Y1=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.`),Z1=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."),K1=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"),eq=r(` is the most common location on many
Unix systems. When CUDA is correctly set up and added to the `),zf=n("code"),tq=r("PATH"),oq=r(` environment variable, one can find the
installation location by doing:`),J1=l(),h(Ks.$$.fragment),X1=l(),Kr=n("p"),rq=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"),aq=r("ubuntu cuda 10.2 install"),nq=r("."),Q1=l(),Uo=n("h4"),Jr=n("a"),Ff=n("span"),h(Xs.$$.fragment),sq=l(),Lf=n("span"),iq=r("Possible problem #2"),eb=l(),pd=n("p"),lq=r(`Another possible common problem is that you may have more than one CUDA toolkit installed system-wide. For example you
may have:`),tb=l(),h(Qs.$$.fragment),ob=l(),zt=n("p"),dq=r("Now, in this situation you need to make sure that your "),Rf=n("code"),cq=r("PATH"),mq=r(" and "),Wf=n("code"),pq=r("LD_LIBRARY_PATH"),hq=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.`),rb=l(),hd=n("p"),uq=r("First, you may look at their contents:"),ab=l(),h(ei.$$.fragment),nb=l(),ud=n("p"),fq=r("so you get an idea of what is inside."),sb=l(),Xr=n("p"),gq=r("It\u2019s possible that "),Gf=n("code"),_q=r("LD_LIBRARY_PATH"),vq=r(" is empty."),ib=l(),rt=n("p"),Mf=n("code"),bq=r("PATH"),yq=r(" lists the locations of where executables can be found and "),jf=n("code"),wq=r("LD_LIBRARY_PATH"),Tq=r(` is for where shared libraries
are to looked for. In both cases, earlier entries have priority over the later ones. `),Hf=n("code"),Eq=r(":"),$q=r(` is used to separate multiple
entries.`),lb=l(),fd=n("p"),xq=r(`Now, to tell the build program where to find the specific CUDA toolkit, insert the desired paths to be listed first by
doing:`),db=l(),h(ti.$$.fragment),cb=l(),gd=n("p"),kq=r("Note that we aren\u2019t overwriting the existing values, but prepending instead."),mb=l(),Le=n("p"),Aq=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"),Pq=r("lib64"),qq=r(" sub-directory is where the various CUDA "),Vf=n("code"),Dq=r(".so"),Sq=r(" objects, like "),Yf=n("code"),Oq=r("libcudart.so"),Cq=r(` reside, it\u2019s unlikely
that your system will have it named differently, but if it is adjust it to reflect your reality.`),pb=l(),No=n("h4"),Qr=n("a"),Zf=n("span"),h(oi.$$.fragment),Iq=l(),Kf=n("span"),Uq=r("Possible problem #3"),hb=l(),Ft=n("p"),Nq=r("Some older CUDA versions may refuse to build with newer compilers. For example, you my have "),Jf=n("code"),zq=r("gcc-9"),Fq=r(` but it wants
`),Xf=n("code"),Lq=r("gcc-7"),Rq=r("."),ub=l(),_d=n("p"),Wq=r("There are various ways to go about it."),fb=l(),vd=n("p"),Gq=r("If you can install the latest CUDA toolkit it typically should support the newer compiler."),gb=l(),ea=n("p"),Mq=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"),jq=r("gcc-7"),Hq=r(` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),_b=l(),h(ri.$$.fragment),vb=l(),M=n("p"),Bq=r("Here, we are making a symlink to "),eg=n("code"),Vq=r("gcc-7"),Yq=r(" from "),tg=n("code"),Zq=r("/usr/local/cuda-10.2/bin/gcc"),Kq=r(` and since
`),og=n("code"),Jq=r("/usr/local/cuda-10.2/bin/"),Xq=r(" should be in the "),rg=n("code"),Qq=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."),bb=l(),bd=n("p"),nD=r("As always make sure to edit the paths in the example to match your situation."),yb=l(),zo=n("h3"),ta=n("a"),sg=n("span"),h(ai.$$.fragment),sD=l(),ig=n("span"),iD=r("FairScale"),wb=l(),h(oa.$$.fragment),Tb=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(":"),Eb=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)"),$b=l(),wd=n("p"),TD=r("You will need at least two GPUs to use this feature."),xb=l(),ii=n("p"),pg=n("strong"),ED=r("Installation"),$D=r(":"),kb=l(),Td=n("p"),xD=r("Install the library via pypi:"),Ab=l(),h(li.$$.fragment),Pb=l(),Lt=n("p"),kD=r("or via "),hg=n("code"),AD=r("transformers"),PD=r("\u2019 "),ug=n("code"),qD=r("extras"),DD=r(":"),qb=l(),h(di.$$.fragment),Db=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("."),Sb=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("."),Ob=l(),$d=n("p"),LD=r("If it\u2019s still not resolved the build issue, here are a few more ideas."),Cb=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:`),Ib=l(),h(pi.$$.fragment),Ub=l(),xd=n("p"),GD=r("or:"),Nb=l(),h(hi.$$.fragment),zb=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:"),Fb=l(),h(fi.$$.fragment),Lb=l(),kd=n("p"),HD=r("or:"),Rb=l(),h(gi.$$.fragment),Wb=l(),Ad=n("p"),BD=r("Of course, adjust the urls to match the cuda version you use."),Gb=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("."),Mb=l(),vi=n("p"),vg=n("strong"),KD=r("Usage"),JD=r(":"),jb=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."),Hb=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:"),Bb=l(),h(bi.$$.fragment),Vb=l(),Pd=n("p"),s9=r("Notes:"),Yb=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.`),Zb=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 "),Ag=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 "),Pg=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."),Kb=l(),sa=n("p"),x9=r("For example here is how you could use it for "),qg=n("code"),k9=r("run_translation.py"),A9=r(" with 2 GPUs:"),Jb=l(),h(Ei.$$.fragment),Xb=l(),Fo=n("p"),Dg=n("code"),P9=r("zero_dp_2"),q9=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.`),Qb=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(),qd=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(),Ai=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(),Pi=n("p"),Zg=n("strong"),TS=r("Usage"),ES=r(":"),ly=l(),te=n("ul"),Kg=n("li"),qi=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."),AS=l(),Di=n("li"),Sd=n("p"),Xg=n("strong"),PS=r("Sharding Strategy"),qS=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"),A7=r("."),P7=l(),Ho=n("li"),q7=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"),A_=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"),P_=n("strong"),Q7=r("Usage"),eO=r(`:
User has to just pass `),q_=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"),AO=r(`
| `),Fd=n("a"),PO=r("Deployment with multiple GPUs"),L_=n("a"),qO=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),q=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(A.$$.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),Pe=s(t,"P",{});var xy=i(Pe);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);Aw=a(YC,"log"),YC.forEach(o),Pw=a(bC," \u2014 Logs information on the various objects watching training."),bC.forEach(o),qw=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 Ay=i(tr);r0=a(Ay,"Here is an example of how to customize "),pl=s(Ay,"A",{href:!0});var nI=i(pl);a0=a(nI,"Trainer"),nI.forEach(o),n0=a(Ay," to use a weighted loss (useful when you have an unbalanced training set):"),Ay.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 Py=i(ao);or=s(Py,"A",{id:!0,class:!0,href:!0});var lI=i(or);Am=s(lI,"SPAN",{});var dI=i(Am);u(La.$$.fragment,dI),dI.forEach(o),lI.forEach(o),m0=d(Py),Pm=s(Py,"SPAN",{});var cI=i(Pm);p0=a(cI,"Trainer"),cI.forEach(o),Py.forEach(o),wv=d(t),b=s(t,"DIV",{class:!0});var y=i(b);u(Ra.$$.fragment,y),h0=d(y),qm=s(y,"P",{});var mI=i(qm);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 Ae=i(J);Om=s(Ae,"STRONG",{});var fI=i(Om);E0=a(fI,"model_wrapped"),fI.forEach(o),$0=a(Ae,` \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(Ae,"CODE",{});var gI=i(Cm);x0=a(gI,"DeepSpeed"),gI.forEach(o),k0=a(Ae,`,
the inner model is wrapped in `),Im=s(Ae,"CODE",{});var _I=i(Im);A0=a(_I,"DeepSpeed"),_I.forEach(o),P0=a(Ae," and then again in "),Um=s(Ae,"CODE",{});var vI=i(Um);q0=a(vI,"torch.nn.DistributedDataParallel"),vI.forEach(o),D0=a(Ae,`. If the inner
model hasn\u2019t been wrapped, then `),Nm=s(Ae,"CODE",{});var bI=i(Nm);S0=a(bI,"self.model_wrapped"),bI.forEach(o),O0=a(Ae," is the same as "),zm=s(Ae,"CODE",{});var yI=i(zm);C0=a(yI,"self.model"),yI.forEach(o),I0=a(Ae,"."),Ae.forEach(o),U0=d(Ht),gl=s(Ht,"LI",{});var AC=i(gl);Fm=s(AC,"STRONG",{});var wI=i(Fm);N0=a(wI,"is_model_parallel"),wI.forEach(o),z0=a(AC,` \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).`),AC.forEach(o),F0=d(Ht),qe=s(Ht,"LI",{});var Ko=i(qe);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 AI=i(jm);K0=a(AI,"train"),AI.forEach(o),J0=a(Jo," (e.g. when "),Hm=s(Jo,"CODE",{});var PI=i(Hm);X0=a(PI,"evaluate"),PI.forEach(o),Q0=a(Jo,` is called while
in `),Bm=s(Jo,"CODE",{});var qI=i(Bm);eT=a(qI,"train"),qI.forEach(o),tT=a(Jo,")"),Jo.forEach(o),Ht.forEach(o),oT=d(y),ar=s(y,"DIV",{class:!0});var qy=i(ar);u(Wa.$$.fragment,qy),rT=d(qy),Ga=s(qy,"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),qy.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);AT=a(NI,"Setup the optimizer."),NI.forEach(o),PT=d(lc),Ka=s(lc,"P",{});var Ny=i(Ka);qT=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);AE=a(My,"Returns the test "),fp=s(My,"CODE",{});var QI=i(fp);PE=a(QI,"~torch.utils.data.DataLoader"),QI.forEach(o),qE=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 `),Ap=s(Zy,"CODE",{});var mU=i(Ap);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 "),Pp=s(Ky,"CODE",{});var pU=i(Pp);b4=a(pU,"logs"),pU.forEach(o),y4=a(Ky," on the various objects watching training."),Ky.forEach(o),w4=d(gc),qp=s(gc,"P",{});var hU=i(qp);T4=a(hU,"Subclass and override this method to inject custom behavior."),hU.forEach(o),gc.forEach(o),E4=d(y),P=s(y,"DIV",{class:!0});var S=i(P);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);A4=a(fU,"Under distributed environment this is done only for a process with rank 0."),fU.forEach(o),P4=d(S),Op=s(S,"P",{});var gU=i(Op);q4=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),e5=a(vc,`, tells you whether it\u2019s the general RAM or the gpu0 memory
metric.`),vc.forEach(o),t5=d(_a),vl=s(_a,"LI",{});var PC=i(vl);Mp=s(PC,"CODE",{});var AU=i(Mp);o5=a(AU,"*_alloc_delta"),AU.forEach(o),r5=a(PC,` - 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.`),PC.forEach(o),a5=d(_a),bt=s(_a,"LI",{});var Zi=i(bt);jp=s(Zi,"CODE",{});var PU=i(jp);n5=a(PU,"*_peaked_delta"),PU.forEach(o),s5=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 qU=i(Hp);i5=a(qU,"alloc_delta"),qU.forEach(o),l5=a(Zi,` +
`),Bp=s(Zi,"CODE",{});var DU=i(Bp);d5=a(DU,"peaked_delta"),DU.forEach(o),c5=a(Zi," and you know how much memory was needed to complete that stage."),Zi.forEach(o),_a.forEach(o),m5=d(S),Vp=s(S,"P",{});var SU=i(Vp);p5=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),h5=d(S),Yp=s(S,"P",{});var OU=i(Yp);u5=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),f5=d(S),wn=s(S,"P",{});var Jy=i(wn);g5=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);_5=a(CU,"tracemalloc"),CU.forEach(o),v5=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),b5=d(S),Qe=s(S,"P",{});var va=i(Qe);y5=a(va,"The GPU allocated and peak memory reporting is done with "),Kp=s(va,"CODE",{});var IU=i(Kp);w5=a(IU,"torch.cuda.memory_allocated()"),IU.forEach(o),T5=a(va,` and
`),Jp=s(va,"CODE",{});var UU=i(Jp);E5=a(UU,"torch.cuda.max_memory_allocated()"),UU.forEach(o),$5=a(va,`. This metric reports only \u201Cdeltas\u201D for pytorch-specific allocations, as
`),Xp=s(va,"CODE",{});var NU=i(Xp);x5=a(NU,"torch.cuda"),NU.forEach(o),k5=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),A5=d(S),ne=s(S,"P",{});var je=i(ne);P5=a(je,"Note that this tracker doesn\u2019t account for memory allocations outside of "),bl=s(je,"A",{href:!0});var zU=i(bl);q5=a(zU,"Trainer"),zU.forEach(o),D5=a(je,"\u2019s "),Qp=s(je,"CODE",{});var FU=i(Qp);S5=a(FU,"__init__"),FU.forEach(o),O5=a(je,", "),eh=s(je,"CODE",{});var LU=i(eh);C5=a(LU,"train"),LU.forEach(o),I5=a(je,`,
`),th=s(je,"CODE",{});var RU=i(th);U5=a(RU,"evaluate"),RU.forEach(o),N5=a(je," and "),oh=s(je,"CODE",{});var WU=i(oh);z5=a(WU,"predict"),WU.forEach(o),F5=a(je," calls."),je.forEach(o),L5=d(S),U=s(S,"P",{});var R=i(U);R5=a(R,"Because "),rh=s(R,"CODE",{});var GU=i(rh);W5=a(GU,"evaluation"),GU.forEach(o),G5=a(R," calls may happen during "),ah=s(R,"CODE",{});var MU=i(ah);M5=a(MU,"train"),MU.forEach(o),j5=a(R,`, we can\u2019t handle nested invocations because
`),nh=s(R,"CODE",{});var jU=i(nh);H5=a(jU,"torch.cuda.max_memory_allocated"),jU.forEach(o),B5=a(R," is a single counter, so if it gets reset by a nested eval call, "),sh=s(R,"CODE",{});var HU=i(sh);V5=a(HU,"train"),HU.forEach(o),Y5=a(R,`\u2019s tracker
will report incorrect info. If this `),Tn=s(R,"A",{href:!0,rel:!0});var BU=i(Tn);Z5=a(BU,"pytorch issue"),BU.forEach(o),K5=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);J5=a(VU,"train"),VU.forEach(o),X5=a(R,", "),lh=s(R,"CODE",{});var YU=i(lh);Q5=a(YU,"evaluate"),YU.forEach(o),e$=a(R," and "),dh=s(R,"CODE",{});var ZU=i(dh);t$=a(ZU,"predict"),ZU.forEach(o),o$=a(R," methods. Which means that if "),ch=s(R,"CODE",{});var KU=i(ch);r$=a(KU,"eval"),KU.forEach(o),a$=a(R," is called during "),mh=s(R,"CODE",{});var JU=i(mh);n$=a(JU,"train"),JU.forEach(o),s$=a(R,`, it\u2019s the latter
that will account for its memory usage and that of the former.`),R.forEach(o),i$=d(S),Ee=s(S,"P",{});var Yt=i(Ee);l$=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);d$=a(XU,"Trainer"),XU.forEach(o),c$=a(Yt,` calls
`),ph=s(Yt,"CODE",{});var QU=i(ph);m$=a(QU,"torch.cuda.reset_peak_memory_stats"),QU.forEach(o),p$=a(Yt,", the gpu peak memory stats could be invalid. And the "),wl=s(Yt,"A",{href:!0});var eN=i(wl);h$=a(eN,"Trainer"),eN.forEach(o),u$=a(Yt,` will disrupt
the normal behavior of any such tools that rely on calling `),hh=s(Yt,"CODE",{});var tN=i(hh);f$=a(tN,"torch.cuda.reset_peak_memory_stats"),tN.forEach(o),g$=a(Yt," themselves."),Yt.forEach(o),_$=d(S),uh=s(S,"P",{});var oN=i(uh);v$=a(oN,"For best performance you may want to consider turning the memory profiling off for production runs."),oN.forEach(o),S.forEach(o),b$=d(y),gr=s(y,"DIV",{class:!0});var Xy=i(gr);u(En.$$.fragment,Xy),y$=d(Xy),fh=s(Xy,"P",{});var rN=i(fh);w$=a(rN,"Reformat Trainer metrics values to a human-readable format"),rN.forEach(o),Xy.forEach(o),T$=d(y),_r=s(y,"DIV",{class:!0});var Qy=i(_r);u($n.$$.fragment,Qy),E$=d(Qy),xn=s(Qy,"P",{});var e2=i(xn);$$=a(e2,"Helper to get number of samples in a "),gh=s(e2,"CODE",{});var aN=i(gh);x$=a(aN,"~torch.utils.data.DataLoader"),aN.forEach(o),k$=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),A$=d(y),yt=s(y,"DIV",{class:!0});var bc=i(yt);u(kn.$$.fragment,bc),P$=d(bc),An=s(bc,"P",{});var t2=i(An);q$=a(t2,"Remove a callback from the current list of "),_h=s(t2,"CODE",{});var nN=i(_h);D$=a(nN,"~transformer.TrainerCallback"),nN.forEach(o),S$=a(t2," and returns it."),t2.forEach(o),O$=d(bc),Pn=s(bc,"P",{});var o2=i(Pn);C$=a(o2,"If the callback is not found, returns "),vh=s(o2,"CODE",{});var sN=i(vh);I$=a(sN,"None"),sN.forEach(o),U$=a(o2," (and no error is raised)."),o2.forEach(o),bc.forEach(o),N$=d(y),X=s(y,"DIV",{class:!0});var He=i(X);u(qn.$$.fragment,He),z$=d(He),bh=s(He,"P",{});var iN=i(bh);F$=a(iN,"Run prediction and returns predictions and potential metrics."),iN.forEach(o),L$=d(He),Dn=s(He,"P",{});var r2=i(Dn);R$=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);W$=a(lN,"evaluate()"),lN.forEach(o),G$=a(r2,"."),r2.forEach(o),M$=d(He),u(vr.$$.fragment,He),j$=d(He),Sn=s(He,"P",{});var a2=i(Sn);H$=a(a2,"Returns: "),wh=s(a2,"EM",{});var dN=i(wh);B$=a(dN,"NamedTuple"),dN.forEach(o),V$=a(a2," A namedtuple with the following keys:"),a2.forEach(o),Y$=d(He),co=s(He,"UL",{});var yc=i(co);mo=s(yc,"LI",{});var wc=i(mo);Z$=a(wc,"predictions ("),Th=s(wc,"CODE",{});var cN=i(Th);K$=a(cN,"np.ndarray"),cN.forEach(o),J$=a(wc,"): The predictions on "),Eh=s(wc,"CODE",{});var mN=i(Eh);X$=a(mN,"test_dataset"),mN.forEach(o),Q$=a(wc,"."),wc.forEach(o),e3=d(yc),po=s(yc,"LI",{});var Tc=i(po);t3=a(Tc,"label_ids ("),$h=s(Tc,"CODE",{});var pN=i($h);o3=a(pN,"np.ndarray"),pN.forEach(o),r3=a(Tc,", "),xh=s(Tc,"EM",{});var hN=i(xh);a3=a(hN,"optional"),hN.forEach(o),n3=a(Tc,"): The labels (if the dataset contained some)."),Tc.forEach(o),s3=d(yc),ho=s(yc,"LI",{});var Ec=i(ho);i3=a(Ec,"metrics ("),kh=s(Ec,"CODE",{});var uN=i(kh);l3=a(uN,"Dict[str, float]"),uN.forEach(o),d3=a(Ec,", "),Ah=s(Ec,"EM",{});var fN=i(Ah);c3=a(fN,"optional"),fN.forEach(o),m3=a(Ec,`): The potential dictionary of metrics (if the dataset contained
labels).`),Ec.forEach(o),yc.forEach(o),He.forEach(o),p3=d(y),wt=s(y,"DIV",{class:!0});var $c=i(wt);u(On.$$.fragment,$c),h3=d($c),uo=s($c,"P",{});var xc=i(uo);u3=a(xc,"Prediction/evaluation loop, shared by "),Ph=s(xc,"CODE",{});var gN=i(Ph);f3=a(gN,"Trainer.evaluate()"),gN.forEach(o),g3=a(xc," and "),qh=s(xc,"CODE",{});var _N=i(qh);_3=a(_N,"Trainer.predict()"),_N.forEach(o),v3=a(xc,"."),xc.forEach(o),b3=d($c),Dh=s($c,"P",{});var vN=i(Dh);y3=a(vN,"Works both with or without labels."),vN.forEach(o),$c.forEach(o),w3=d(y),Tt=s(y,"DIV",{class:!0});var kc=i(Tt);u(Cn.$$.fragment,kc),T3=d(kc),fo=s(kc,"P",{});var Ac=i(fo);E3=a(Ac,"Perform an evaluation step on "),Sh=s(Ac,"CODE",{});var bN=i(Sh);$3=a(bN,"model"),bN.forEach(o),x3=a(Ac," using "),Oh=s(Ac,"CODE",{});var yN=i(Oh);k3=a(yN,"inputs"),yN.forEach(o),A3=a(Ac,"."),Ac.forEach(o),P3=d(kc),Ch=s(kc,"P",{});var wN=i(Ch);q3=a(wN,"Subclass and override to inject custom behavior."),wN.forEach(o),kc.forEach(o),D3=d(y),br=s(y,"DIV",{class:!0});var n2=i(br);u(In.$$.fragment,n2),S3=d(n2),et=s(n2,"P",{});var ba=i(et);O3=a(ba,"Upload "),Ih=s(ba,"EM",{});var TN=i(Ih);C3=a(TN,"self.model"),TN.forEach(o),I3=a(ba," and "),Uh=s(ba,"EM",{});var EN=i(Uh);U3=a(EN,"self.tokenizer"),EN.forEach(o),N3=a(ba," to the \u{1F917} model hub on the repo "),Nh=s(ba,"EM",{});var $N=i(Nh);z3=a($N,"self.args.hub_model_id"),$N.forEach(o),F3=a(ba,"."),ba.forEach(o),n2.forEach(o),L3=d(y),yr=s(y,"DIV",{class:!0});var s2=i(yr);u(Un.$$.fragment,s2),R3=d(s2),Nn=s(s2,"P",{});var i2=i(Nn);W3=a(i2,"Remove a callback from the current list of "),zh=s(i2,"CODE",{});var xN=i(zh);G3=a(xN,"~transformer.TrainerCallback"),xN.forEach(o),M3=a(i2,"."),i2.forEach(o),s2.forEach(o),j3=d(y),Ce=s(y,"DIV",{class:!0});var ya=i(Ce);u(zn.$$.fragment,ya),H3=d(ya),Fn=s(ya,"P",{});var l2=i(Fn);B3=a(l2,"Save metrics into a json file for that split, e.g. "),Fh=s(l2,"CODE",{});var kN=i(Fh);V3=a(kN,"train_results.json"),kN.forEach(o),Y3=a(l2,"."),l2.forEach(o),Z3=d(ya),Lh=s(ya,"P",{});var AN=i(Lh);K3=a(AN,"Under distributed environment this is done only for a process with rank 0."),AN.forEach(o),J3=d(ya),Ln=s(ya,"P",{});var d2=i(Ln);X3=a(d2,"To understand the metrics please read the docstring of "),Tl=s(d2,"A",{href:!0});var PN=i(Tl);Q3=a(PN,"log_metrics()"),PN.forEach(o),ex=a(d2,`. The only difference is that raw
unformatted numbers are saved in the current method.`),d2.forEach(o),ya.forEach(o),tx=d(y),Et=s(y,"DIV",{class:!0});var Pc=i(Et);u(Rn.$$.fragment,Pc),ox=d(Pc),Wn=s(Pc,"P",{});var c2=i(Wn);rx=a(c2,"Will save the model, so you can reload it using "),Rh=s(c2,"CODE",{});var qN=i(Rh);ax=a(qN,"from_pretrained()"),qN.forEach(o),nx=a(c2,"."),c2.forEach(o),sx=d(Pc),Wh=s(Pc,"P",{});var DN=i(Wh);ix=a(DN,"Will only save from the main process."),DN.forEach(o),Pc.forEach(o),lx=d(y),$t=s(y,"DIV",{class:!0});var qc=i($t);u(Gn.$$.fragment,qc),dx=d(qc),Gh=s(qc,"P",{});var SN=i(Gh);cx=a(SN,"Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model"),SN.forEach(o),mx=d(qc),Mh=s(qc,"P",{});var ON=i(Mh);px=a(ON,"Under distributed environment this is done only for a process with rank 0."),ON.forEach(o),qc.forEach(o),hx=d(y),wr=s(y,"DIV",{class:!0});var m2=i(wr);u(Mn.$$.fragment,m2),ux=d(m2),jh=s(m2,"P",{});var CN=i(jh);fx=a(CN,"Main training entry point."),CN.forEach(o),m2.forEach(o),gx=d(y),xt=s(y,"DIV",{class:!0});var Dc=i(xt);u(jn.$$.fragment,Dc),_x=d(Dc),Hh=s(Dc,"P",{});var IN=i(Hh);vx=a(IN,"Perform a training step on a batch of inputs."),IN.forEach(o),bx=d(Dc),Bh=s(Dc,"P",{});var UN=i(Bh);yx=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),wx=d(p2),Yh=s(p2,"SPAN",{});var FN=i(Yh);Tx=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),Ex=d(Sc),Ie=s(Sc,"DIV",{class:!0});var wa=i(Ie);u(Vn.$$.fragment,wa),$x=d(wa),Zh=s(wa,"P",{});var LN=i(Zh);xx=a(LN,"Run evaluation and returns metrics."),LN.forEach(o),kx=d(wa),Yn=s(wa,"P",{});var h2=i(Yn);Ax=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);Px=a(RN,"compute_metrics"),RN.forEach(o),qx=a(h2," argument)."),h2.forEach(o),Dx=d(wa),Jh=s(wa,"P",{});var WN=i(Jh);Sx=a(WN,"You can also subclass and override this method to inject custom behavior."),WN.forEach(o),wa.forEach(o),Ox=d(Sc),Q=s(Sc,"DIV",{class:!0});var Be=i(Q);u(Zn.$$.fragment,Be),Cx=d(Be),Xh=s(Be,"P",{});var GN=i(Xh);Ix=a(GN,"Run prediction and returns predictions and potential metrics."),GN.forEach(o),Ux=d(Be),Kn=s(Be,"P",{});var u2=i(Kn);Nx=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);zx=a(MN,"evaluate()"),MN.forEach(o),Fx=a(u2,"."),u2.forEach(o),Lx=d(Be),u(Er.$$.fragment,Be),Rx=d(Be),Jn=s(Be,"P",{});var f2=i(Jn);Wx=a(f2,"Returns: "),eu=s(f2,"EM",{});var jN=i(eu);Gx=a(jN,"NamedTuple"),jN.forEach(o),Mx=a(f2," A namedtuple with the following keys:"),f2.forEach(o),jx=d(Be),_o=s(Be,"UL",{});var Oc=i(_o);vo=s(Oc,"LI",{});var Cc=i(vo);Hx=a(Cc,"predictions ("),tu=s(Cc,"CODE",{});var HN=i(tu);Bx=a(HN,"np.ndarray"),HN.forEach(o),Vx=a(Cc,"): The predictions on "),ou=s(Cc,"CODE",{});var BN=i(ou);Yx=a(BN,"test_dataset"),BN.forEach(o),Zx=a(Cc,"."),Cc.forEach(o),Kx=d(Oc),bo=s(Oc,"LI",{});var Ic=i(bo);Jx=a(Ic,"label_ids ("),ru=s(Ic,"CODE",{});var VN=i(ru);Xx=a(VN,"np.ndarray"),VN.forEach(o),Qx=a(Ic,", "),au=s(Ic,"EM",{});var YN=i(au);ek=a(YN,"optional"),YN.forEach(o),tk=a(Ic,"): The labels (if the dataset contained some)."),Ic.forEach(o),ok=d(Oc),yo=s(Oc,"LI",{});var Uc=i(yo);rk=a(Uc,"metrics ("),nu=s(Uc,"CODE",{});var ZN=i(nu);ak=a(ZN,"Dict[str, float]"),ZN.forEach(o),nk=a(Uc,", "),su=s(Uc,"EM",{});var KN=i(su);sk=a(KN,"optional"),KN.forEach(o),ik=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),lk=d(g2),lu=s(g2,"SPAN",{});var QN=i(lu);dk=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),ck=d(j),es=s(j,"P",{});var _2=i(es);mk=a(_2,"TrainingArguments is the subset of the arguments we use in our example scripts "),du=s(_2,"STRONG",{});var ez=i(du);pk=a(ez,`which relate to the training loop
itself`),ez.forEach(o),hk=a(_2,"."),_2.forEach(o),uk=d(j),To=s(j,"P",{});var Nc=i(To);fk=a(Nc,"Using "),El=s(Nc,"A",{href:!0});var tz=i(El);gk=a(tz,"HfArgumentParser"),tz.forEach(o),_k=a(Nc,` we can turn this class into
`),ts=s(Nc,"A",{href:!0,rel:!0});var oz=i(ts);vk=a(oz,"argparse"),oz.forEach(o),bk=a(Nc,` arguments that can be specified on the
command line.`),Nc.forEach(o),yk=d(j),de=s(j,"DIV",{class:!0});var Zt=i(de);u(os.$$.fragment,Zt),wk=d(Zt),cu=s(Zt,"P",{});var rz=i(cu);Tk=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),Ek=d(Zt),Eo=s(Zt,"P",{});var zc=i(Eo);$k=a(zc,"For the main process the log level defaults to "),mu=s(zc,"CODE",{});var az=i(mu);xk=a(az,"logging.INFO"),az.forEach(o),kk=a(zc," unless overridden by "),pu=s(zc,"CODE",{});var nz=i(pu);Ak=a(nz,"log_level"),nz.forEach(o),Pk=a(zc," argument."),zc.forEach(o),qk=d(Zt),$o=s(Zt,"P",{});var Fc=i($o);Dk=a(Fc,"For the replica processes the log level defaults to "),hu=s(Fc,"CODE",{});var sz=i(hu);Sk=a(sz,"logging.WARNING"),sz.forEach(o),Ok=a(Fc," unless overridden by "),uu=s(Fc,"CODE",{});var iz=i(uu);Ck=a(iz,"log_level_replica"),iz.forEach(o),Ik=a(Fc,`
argument.`),Fc.forEach(o),Uk=d(Zt),rs=s(Zt,"P",{});var v2=i(rs);Nk=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);zk=a(lz,"should_log"),lz.forEach(o),Fk=a(v2,"."),v2.forEach(o),Zt.forEach(o),Lk=d(j),xr=s(j,"DIV",{class:!0});var b2=i(xr);u(as.$$.fragment,b2),Rk=d(b2),gu=s(b2,"P",{});var dz=i(gu);Wk=a(dz,"Get number of steps used for a linear warmup."),dz.forEach(o),b2.forEach(o),Gk=d(j),kt=s(j,"DIV",{class:!0});var Lc=i(kt);u(ns.$$.fragment,Lc),Mk=d(Lc),_u=s(Lc,"P",{});var cz=i(_u);jk=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),Hk=d(Lc),xo=s(Lc,"P",{});var Rc=i(xo);Bk=a(Rc,"One such use is for "),vu=s(Rc,"CODE",{});var mz=i(vu);Vk=a(mz,"datasets"),mz.forEach(o),Yk=a(Rc,"\u2019s "),bu=s(Rc,"CODE",{});var pz=i(bu);Zk=a(pz,"map"),pz.forEach(o),Kk=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),Jk=d(j),kr=s(j,"DIV",{class:!0});var y2=i(kr);u(ss.$$.fragment,y2),Xk=d(y2),is=s(y2,"P",{});var w2=i(is);Qk=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),Ar=s(j,"DIV",{class:!0});var T2=i(Ar);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),Pr=s(j,"DIV",{class:!0});var E2=i(Pr);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);qr=s($2,"A",{id:!0,class:!0,href:!0});var gz=i(qr);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),Av=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),Ao=s(Wc,"P",{});var Gc=i(Ao);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),Pv=d(t),Po=s(t,"H2",{class:!0});var k2=i(Po);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),Au=s(k2,"SPAN",{});var $z=i(Au);w6=a($z,"Checkpoints"),$z.forEach(o),k2.forEach(o),qv=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 "),Pu=s(Kt,"CODE",{});var kz=i(Pu);x6=a(kz,"output_dir"),kz.forEach(o),k6=a(Kt,` you set in the
`),kl=s(Kt,"A",{href:!0});var Az=i(kl);A6=a(Az,"TrainingArguments"),Az.forEach(o),P6=a(Kt," you are using. Those will go in subfolder named "),qu=s(Kt,"CODE",{});var Pz=i(qu);q6=a(Pz,"checkpoint-xxx"),Pz.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 A2=i(Sr);S6=a(A2,"Resuming training from a checkpoint can be done when calling "),Al=s(A2,"A",{href:!0});var qz=i(Al);O6=a(qz,"Trainer.train()"),qz.forEach(o),C6=a(A2," with either:"),A2.forEach(o),Sv=d(t),Or=s(t,"UL",{});var P2=i(Or);Pl=s(P2,"LI",{});var qC=i(Pl);Du=s(qC,"CODE",{});var Dz=i(Du);I6=a(Dz,"resume_from_checkpoint=True"),Dz.forEach(o),U6=a(qC," which will resume training from the latest checkpoint"),qC.forEach(o),N6=d(P2),ql=s(P2,"LI",{});var DC=i(ql);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),P2.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 q2=i(Cr);Ir=s(q2,"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(q2),Sl=s(q2,"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),q2.forEach(o),Iv=d(t),qo=s(t,"H2",{class:!0});var D2=i(qo);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);eA=a(Rz,"Logging"),Rz.forEach(o),D2.forEach(o),Uv=d(t),Ne=s(t,"P",{});var Ea=i(Ne);tA=a(Ea,"By default "),Ol=s(Ea,"A",{href:!0});var Wz=i(Ol);oA=a(Wz,"Trainer"),Wz.forEach(o),rA=a(Ea," will use "),Lu=s(Ea,"CODE",{});var Gz=i(Lu);aA=a(Gz,"logging.INFO"),Gz.forEach(o),nA=a(Ea," for the main process and "),Ru=s(Ea,"CODE",{});var Mz=i(Ru);sA=a(Mz,"logging.WARNING"),Mz.forEach(o),iA=a(Ea," for the replicas if any."),Ea.forEach(o),Nv=d(t),At=s(t,"P",{});var Mc=i(At);lA=a(Mc,"These defaults can be overridden to use any of the 5 "),Wu=s(Mc,"CODE",{});var jz=i(Wu);dA=a(jz,"logging"),jz.forEach(o),cA=a(Mc," levels with "),Cl=s(Mc,"A",{href:!0});var Hz=i(Cl);mA=a(Hz,"TrainingArguments"),Hz.forEach(o),pA=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);hA=a(Bz,"log_level"),Bz.forEach(o),uA=a(OC," - for the main process"),OC.forEach(o),fA=d(S2),Ul=s(S2,"LI",{});var CC=i(Ul);Mu=s(CC,"CODE",{});var Vz=i(Mu);gA=a(Vz,"log_level_replica"),Vz.forEach(o),_A=a(CC," - for the replicas"),CC.forEach(o),S2.forEach(o),Fv=d(t),ze=s(t,"P",{});var $a=i(ze);vA=a($a,"Further, if "),Nl=s($a,"A",{href:!0});var Yz=i(Nl);bA=a(Yz,"TrainingArguments"),Yz.forEach(o),yA=a($a,"\u2019s "),ju=s($a,"CODE",{});var Zz=i(ju);wA=a(Zz,"log_on_each_node"),Zz.forEach(o),TA=a($a," is set to "),Hu=s($a,"CODE",{});var Kz=i(Hu);EA=a(Kz,"False"),Kz.forEach(o),$A=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);xA=a(Ve,"Note that "),zl=s(Ve,"A",{href:!0});var Jz=i(zl);kA=a(Jz,"Trainer"),Jz.forEach(o),AA=a(Ve," is going to set "),Bu=s(Ve,"CODE",{});var Xz=i(Bu);PA=a(Xz,"transformers"),Xz.forEach(o),qA=a(Ve,`\u2019s log level separately for each node in its
`),Vu=s(Ve,"CODE",{});var Qz=i(Vu);DA=a(Qz,"Trainer.__init__()"),Qz.forEach(o),SA=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);OA=a(eF,"transformers"),eF.forEach(o),CA=a(Ve," functionality before creating the "),Fl=s(Ve,"A",{href:!0});var tF=i(Fl);IA=a(tF,"Trainer"),tF.forEach(o),UA=a(Ve," object."),Ve.forEach(o),Rv=d(t),Ll=s(t,"P",{});var oF=i(Ll);NA=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);zA=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);FA=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);LA=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);RA=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);WA=a(O2,"(add "),Zu=s(O2,"CODE",{});var iF=i(Zu);GA=a(iF,"--log_on_each_node 0"),iF.forEach(o),MA=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),jA=d(C2),Ju=s(C2,"SPAN",{});var cF=i(Ju);HA=a(cF,"Randomness"),cF.forEach(o),C2.forEach(o),Jv=d(t),me=s(t,"P",{});var Jt=i(me);BA=a(Jt,"When resuming from a checkpoint generated by "),jl=s(Jt,"A",{href:!0});var mF=i(jl);VA=a(mF,"Trainer"),mF.forEach(o),YA=a(Jt,` all efforts are made to restore the
`),Xu=s(Jt,"EM",{});var pF=i(Xu);ZA=a(pF,"python"),pF.forEach(o),KA=a(Jt,", "),Qu=s(Jt,"EM",{});var hF=i(Qu);JA=a(hF,"numpy"),hF.forEach(o),XA=a(Jt," and "),ef=s(Jt,"EM",{});var uF=i(ef);QA=a(uF,"pytorch"),uF.forEach(o),e8=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),Pt=s(t,"P",{});var jc=i(Pt);t8=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);o8=a(fF,"Controlling sources of randomness"),fF.forEach(o),r8=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);a8=a(gF,"torch.backends.cudnn.deterministic"),gF.forEach(o),n8=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),s8=d(I2),rf=s(I2,"SPAN",{});var bF=i(rf);i8=a(bF,"Specific GPUs Selection"),bF.forEach(o),I2.forEach(o),e1=d(t),Hl=s(t,"P",{});var yF=i(Hl);l8=a(yF,"Let\u2019s discuss how you can tell your program which GPUs are to be used and in what order."),yF.forEach(o),t1=d(t),Rr=s(t,"P",{});var U2=i(Rr);d8=a(U2,"When using "),Es=s(U2,"A",{href:!0,rel:!0});var wF=i(Es);af=s(wF,"CODE",{});var TF=i(af);c8=a(TF,"DistributedDataParallel"),TF.forEach(o),wF.forEach(o),m8=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),o1=d(t),u($s.$$.fragment,t),r1=d(t),qt=s(t,"P",{});var Hc=i(qt);p8=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);h8=a($F,"accelerate"),$F.forEach(o),EF.forEach(o),u8=a(Hc," or "),ks=s(Hc,"A",{href:!0,rel:!0});var xF=i(ks);sf=s(xF,"CODE",{});var kF=i(sf);f8=a(kF,"deepspeed"),kF.forEach(o),xF.forEach(o),g8=a(Hc," installed you can also accomplish the same by using one of:"),Hc.forEach(o),a1=d(t),u(As.$$.fragment,t),n1=d(t),u(Ps.$$.fragment,t),s1=d(t),Wr=s(t,"P",{});var N2=i(Wr);_8=a(N2,"You don\u2019t need to use the Accelerate or "),Bl=s(N2,"A",{href:!0});var AF=i(Bl);v8=a(AF,"the Deepspeed integration"),AF.forEach(o),b8=a(N2," features to use these launchers."),N2.forEach(o),i1=d(t),Vl=s(t,"P",{});var PF=i(Vl);y8=a(PF,"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."),PF.forEach(o),l1=d(t),Yl=s(t,"P",{});var qF=i(Yl);w8=a(qF,"The following environment variables help you control which GPUs to use and their order."),qF.forEach(o),d1=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);T8=a(OF,"CUDA_VISIBLE_DEVICES"),OF.forEach(o),SF.forEach(o),DF.forEach(o),c1=d(t),Gr=s(t,"P",{});var z2=i(Gr);E8=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);$8=a(CF,"CUDA_VISIBLE_DEVICES"),CF.forEach(o),x8=a(z2," to a list of the GPUs to be used."),z2.forEach(o),m1=d(t),Kl=s(t,"P",{});var IF=i(Kl);k8=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),p1=d(t),u(qs.$$.fragment,t),h1=d(t),Dt=s(t,"P",{});var Bc=i(Dt);A8=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);P8=a(UF,"cuda:0"),UF.forEach(o),q8=a(Bc," and "),pf=s(Bc,"CODE",{});var NF=i(pf);D8=a(NF,"cuda:1"),NF.forEach(o),S8=a(Bc," correspondingly."),Bc.forEach(o),u1=d(t),Jl=s(t,"P",{});var zF=i(Jl);O8=a(zF,"You can even change their order:"),zF.forEach(o),f1=d(t),u(Ds.$$.fragment,t),g1=d(t),St=s(t,"P",{});var Vc=i(St);C8=a(Vc,"Here your physical GPUs 0 and 2 are mapped to "),hf=s(Vc,"CODE",{});var FF=i(hf);I8=a(FF,"cuda:1"),FF.forEach(o),U8=a(Vc," and "),uf=s(Vc,"CODE",{});var LF=i(uf);N8=a(LF,"cuda:0"),LF.forEach(o),z8=a(Vc," correspondingly."),Vc.forEach(o),_1=d(t),Ot=s(t,"P",{});var Yc=i(Ot);F8=a(Yc,"The above examples were all for "),ff=s(Yc,"CODE",{});var RF=i(ff);L8=a(RF,"DistributedDataParallel"),RF.forEach(o),R8=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);W8=a(GF,"DataParallel"),GF.forEach(o),WF.forEach(o),G8=a(Yc," as well:"),Yc.forEach(o),v1=d(t),u(Os.$$.fragment,t),b1=d(t),Xl=s(t,"P",{});var MF=i(Xl);M8=a(MF,"To emulate an environment without GPUs simply set this environment variable to an empty value like so:"),MF.forEach(o),y1=d(t),u(Cs.$$.fragment,t),w1=d(t),Ql=s(t,"P",{});var jF=i(Ql);j8=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),T1=d(t),u(Is.$$.fragment,t),E1=d(t),ed=s(t,"P",{});var HF=i(ed);H8=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),$1=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);B8=a(YF,"CUDA_DEVICE_ORDER"),YF.forEach(o),VF.forEach(o),BF.forEach(o),x1=d(t),Mr=s(t,"P",{});var F2=i(Mr);V8=a(F2,"There is an additional environment variable "),bf=s(F2,"CODE",{});var ZF=i(bf);Y8=a(ZF,"CUDA_DEVICE_ORDER"),ZF.forEach(o),Z8=a(F2," that controls how the physical devices are ordered. The two choices are:"),F2.forEach(o),k1=d(t),od=s(t,"OL",{});var KF=i(od);Us=s(KF,"LI",{});var L2=i(Us);K8=a(L2,"ordered by PCIe bus IDs (matches "),yf=s(L2,"CODE",{});var JF=i(yf);J8=a(JF,"nvidia-smi"),JF.forEach(o),X8=a(L2,"\u2019s order) - this is the default."),L2.forEach(o),KF.forEach(o),A1=d(t),u(Ns.$$.fragment,t),P1=d(t),zs=s(t,"OL",{start:!0});var XF=i(zs);wf=s(XF,"LI",{});var QF=i(wf);Q8=a(QF,"ordered by GPU compute capabilities"),QF.forEach(o),XF.forEach(o),q1=d(t),u(Fs.$$.fragment,t),D1=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),S1=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),O1=d(t),u(Ls.$$.fragment,t),C1=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),I1=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),U1=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),N1=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),z1=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),F1=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),L1=d(t),id=s(t,"A",{id:!0}),i(id).forEach(o),R1=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);Af=s(uL,"SPAN",{});var fL=i(Af);u(Hs.$$.fragment,fL),fL.forEach(o),uL.forEach(o),AP=d(j2),Pf=s(j2,"SPAN",{});var gL=i(Pf);PP=a(gL,"CUDA Extension Installation Notes"),gL.forEach(o),j2.forEach(o),W1=d(t),ld=s(t,"P",{});var _L=i(ld);qP=a(_L,"As of this writing, both FairScale and Deepspeed require compilation of CUDA C++ code, before they can be used."),_L.forEach(o),G1=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),M1=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),j1=d(t),u(Ys.$$.fragment,t),H1=d(t),cd=s(t,"P",{});var wL=i(cd);NP=a(wL,"please, read the following notes first."),wL.forEach(o),B1=d(t),Ut=s(t,"P",{});var Jc=i(Ut);zP=a(Jc,"In these notes we give examples for what to do when "),qf=s(Jc,"CODE",{});var TL=i(qf);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),V1=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),Y1=d(t),md=s(t,"P",{});var AL=i(md);jP=a(AL,`While, Pytorch comes with its own CUDA toolkit, to build these two projects you must have an identical version of CUDA
installed system-wide.`),AL.forEach(o),Z1=d(t),Fe=s(t,"P",{});var xa=i(Fe);HP=a(xa,"For example, if you installed "),Cf=s(xa,"CODE",{});var PL=i(Cf);BP=a(PL,"pytorch"),PL.forEach(o),VP=a(xa," with "),If=s(xa,"CODE",{});var qL=i(If);YP=a(qL,"cudatoolkit==10.2"),qL.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),K1=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),eq=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);tq=a(OL,"PATH"),OL.forEach(o),oq=a(Xc,` environment variable, one can find the
installation location by doing:`),Xc.forEach(o),J1=d(t),u(Ks.$$.fragment,t),X1=d(t),Kr=s(t,"P",{});var B2=i(Kr);rq=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);aq=a(CL,"ubuntu cuda 10.2 install"),CL.forEach(o),nq=a(B2,"."),B2.forEach(o),Q1=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),sq=d(V2),Lf=s(V2,"SPAN",{});var NL=i(Lf);iq=a(NL,"Possible problem #2"),NL.forEach(o),V2.forEach(o),eb=d(t),pd=s(t,"P",{});var zL=i(pd);lq=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),tb=d(t),u(Qs.$$.fragment,t),ob=d(t),zt=s(t,"P",{});var Qc=i(zt);dq=a(Qc,"Now, in this situation you need to make sure that your "),Rf=s(Qc,"CODE",{});var FL=i(Rf);cq=a(FL,"PATH"),FL.forEach(o),mq=a(Qc," and "),Wf=s(Qc,"CODE",{});var LL=i(Wf);pq=a(LL,"LD_LIBRARY_PATH"),LL.forEach(o),hq=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),rb=d(t),hd=s(t,"P",{});var RL=i(hd);uq=a(RL,"First, you may look at their contents:"),RL.forEach(o),ab=d(t),u(ei.$$.fragment,t),nb=d(t),ud=s(t,"P",{});var WL=i(ud);fq=a(WL,"so you get an idea of what is inside."),WL.forEach(o),sb=d(t),Xr=s(t,"P",{});var Y2=i(Xr);gq=a(Y2,"It\u2019s possible that "),Gf=s(Y2,"CODE",{});var GL=i(Gf);_q=a(GL,"LD_LIBRARY_PATH"),GL.forEach(o),vq=a(Y2," is empty."),Y2.forEach(o),ib=d(t),rt=s(t,"P",{});var Ki=i(rt);Mf=s(Ki,"CODE",{});var ML=i(Mf);bq=a(ML,"PATH"),ML.forEach(o),yq=a(Ki," lists the locations of where executables can be found and "),jf=s(Ki,"CODE",{});var jL=i(jf);wq=a(jL,"LD_LIBRARY_PATH"),jL.forEach(o),Tq=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);Eq=a(HL,":"),HL.forEach(o),$q=a(Ki,` is used to separate multiple
entries.`),Ki.forEach(o),lb=d(t),fd=s(t,"P",{});var BL=i(fd);xq=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),db=d(t),u(ti.$$.fragment,t),cb=d(t),gd=s(t,"P",{});var VL=i(gd);kq=a(VL,"Note that we aren\u2019t overwriting the existing values, but prepending instead."),VL.forEach(o),mb=d(t),Le=s(t,"P",{});var ka=i(Le);Aq=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);Pq=a(YL,"lib64"),YL.forEach(o),qq=a(ka," sub-directory is where the various CUDA "),Vf=s(ka,"CODE",{});var ZL=i(Vf);Dq=a(ZL,".so"),ZL.forEach(o),Sq=a(ka," objects, like "),Yf=s(ka,"CODE",{});var KL=i(Yf);Oq=a(KL,"libcudart.so"),KL.forEach(o),Cq=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),pb=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),Iq=d(Z2),Kf=s(Z2,"SPAN",{});var QL=i(Kf);Uq=a(QL,"Possible problem #3"),QL.forEach(o),Z2.forEach(o),hb=d(t),Ft=s(t,"P",{});var em=i(Ft);Nq=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);zq=a(eR,"gcc-9"),eR.forEach(o),Fq=a(em,` but it wants
`),Xf=s(em,"CODE",{});var tR=i(Xf);Lq=a(tR,"gcc-7"),tR.forEach(o),Rq=a(em,"."),em.forEach(o),ub=d(t),_d=s(t,"P",{});var oR=i(_d);Wq=a(oR,"There are various ways to go about it."),oR.forEach(o),fb=d(t),vd=s(t,"P",{});var rR=i(vd);Gq=a(rR,"If you can install the latest CUDA toolkit it typically should support the newer compiler."),rR.forEach(o),gb=d(t),ea=s(t,"P",{});var K2=i(ea);Mq=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);jq=a(aR,"gcc-7"),aR.forEach(o),Hq=a(K2,` installed but the
build system complains it can\u2019t find it, the following might do the trick:`),K2.forEach(o),_b=d(t),u(ri.$$.fragment,t),vb=d(t),M=s(t,"P",{});var ue=i(M);Bq=a(ue,"Here, we are making a symlink to "),eg=s(ue,"CODE",{});var nR=i(eg);Vq=a(nR,"gcc-7"),nR.forEach(o),Yq=a(ue," from "),tg=s(ue,"CODE",{});var sR=i(tg);Zq=a(sR,"/usr/local/cuda-10.2/bin/gcc"),sR.forEach(o),Kq=a(ue,` and since
`),og=s(ue,"CODE",{});var iR=i(og);Jq=a(iR,"/usr/local/cuda-10.2/bin/"),iR.forEach(o),Xq=a(ue," should be in the "),rg=s(ue,"CODE",{});var lR=i(rg);Qq=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),bb=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),yb=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),wb=d(t),u(oa.$$.fragment,t),Tb=d(t),Re=s(t,"P",{});var Aa=i(Re);lD=a(Aa,"By integrating "),ni=s(Aa,"A",{href:!0,rel:!0});var fR=i(ni);dD=a(fR,"FairScale"),fR.forEach(o),cD=a(Aa," the "),yd=s(Aa,"A",{href:!0});var gR=i(yd);mD=a(gR,"Trainer"),gR.forEach(o),pD=a(Aa,`
provides support for the following features from `),si=s(Aa,"A",{href:!0,rel:!0});var _R=i(si);hD=a(_R,"the ZeRO paper"),_R.forEach(o),uD=a(Aa,":"),Aa.forEach(o),Eb=d(t),We=s(t,"OL",{});var Pa=i(We);lg=s(Pa,"LI",{});var vR=i(lg);fD=a(vR,"Optimizer State Sharding"),vR.forEach(o),gD=d(Pa),dg=s(Pa,"LI",{});var bR=i(dg);_D=a(bR,"Gradient Sharding"),bR.forEach(o),vD=d(Pa),cg=s(Pa,"LI",{});var yR=i(cg);bD=a(yR,"Model Parameters Sharding (new and very experimental)"),yR.forEach(o),yD=d(Pa),mg=s(Pa,"LI",{});var wR=i(mg);wD=a(wR,"CPU offload (new and very experimental)"),wR.forEach(o),Pa.forEach(o),$b=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),xb=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),kb=d(t),Td=s(t,"P",{});var $R=i(Td);xD=a($R,"Install the library via pypi:"),$R.forEach(o),Ab=d(t),u(li.$$.fragment,t),Pb=d(t),Lt=s(t,"P",{});var tm=i(Lt);kD=a(tm,"or via "),hg=s(tm,"CODE",{});var xR=i(hg);AD=a(xR,"transformers"),xR.forEach(o),PD=a(tm,"\u2019 "),ug=s(tm,"CODE",{});var kR=i(ug);qD=a(kR,"extras"),kR.forEach(o),DD=a(tm,":"),tm.forEach(o),qb=d(t),u(di.$$.fragment,t),Db=d(t),Rt=s(t,"P",{});var om=i(Rt);SD=a(om,"(available starting from "),fg=s(om,"CODE",{});var AR=i(fg);OD=a(AR,"transformers==4.6.0"),AR.forEach(o),CD=a(om,") or find more details on "),ci=s(om,"A",{href:!0,rel:!0});var PR=i(ci);ID=a(PR,"the FairScale\u2019s GitHub page"),PR.forEach(o),UD=a(om,"."),om.forEach(o),Sb=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 qR=i(Ed);zD=a(qR,"CUDA Extension Installation Notes"),qR.forEach(o),FD=a(X2,"."),X2.forEach(o),Ob=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),Cb=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),Ib=d(t),u(pi.$$.fragment,t),Ub=d(t),xd=s(t,"P",{});var OR=i(xd);GD=a(OR,"or:"),OR.forEach(o),Nb=d(t),u(hi.$$.fragment,t),zb=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),Fb=d(t),u(fi.$$.fragment,t),Lb=d(t),kd=s(t,"P",{});var IR=i(kd);HD=a(IR,"or:"),IR.forEach(o),Rb=d(t),u(gi.$$.fragment,t),Wb=d(t),Ad=s(t,"P",{});var UR=i(Ad);BD=a(UR,"Of course, adjust the urls to match the cuda version you use."),UR.forEach(o),Gb=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),Mb=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),jb=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),Hb=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),Bb=d(t),u(bi.$$.fragment,t),Vb=d(t),Pd=s(t,"P",{});var WR=i(Pd);s9=a(WR,"Notes:"),WR.forEach(o),Yb=d(t),Ge=s(t,"UL",{});var qa=i(Ge);Tg=s(qa,"LI",{});var GR=i(Tg);i9=a(GR,"This feature requires distributed training (so multiple GPUs)."),GR.forEach(o),l9=d(qa),Eg=s(qa,"LI",{});var MR=i(Eg);d9=a(MR,"It is not implemented for TPUs."),MR.forEach(o),c9=d(qa),yi=s(qa,"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(qa),wi=s(qa,"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),qa.forEach(o),Zb=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 "),Ag=s(Da,"CODE",{});var YR=i(Ag);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 "),Pg=s(Da,"CODE",{});var ZR=i(Pg);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),Kb=d(t),sa=s(t,"P",{});var rw=i(sa);x9=a(rw,"For example here is how you could use it for "),qg=s(rw,"CODE",{});var KR=i(qg);k9=a(KR,"run_translation.py"),KR.forEach(o),A9=a(rw," with 2 GPUs:"),rw.forEach(o),Jb=d(t),u(Ei.$$.fragment,t),Xb=d(t),Fo=s(t,"P",{});var hv=i(Fo);Dg=s(hv,"CODE",{});var JR=i(Dg);P9=a(JR,"zero_dp_2"),JR.forEach(o),q9=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),Qb=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),qd=s(t,"P",{});var tW=i(qd);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),Ai=s(t,"P",{});var FC=i(Ai);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),Pi=s(t,"P",{});var LC=i(Pi);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);qi=s(wW,"P",{});var lw=i(qi);$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),AS=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);PS=a(EW,"Sharding Strategy"),EW.forEach(o),qS=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 AW=i(o_);Mo=s(AW,"P",{});var lm=i(Mo);MS=a(lm,`To offload the parameters and gradients to the CPU,
add `),r_=s(lm,"CODE",{});var PW=i(r_);jS=a(PW,'--fsdp "full_shard offload"'),PW.forEach(o),HS=a(lm," or "),a_=s(lm,"CODE",{});var qW=i(a_);BS=a(qW,'--fsdp "shard_grad_op offload"'),qW.forEach(o),VS=a(lm," to the command line arguments."),lm.forEach(o),AW.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),A7=a(_w,"."),_w.forEach(o),P7=d(gw),Ho=s(gw,"LI",{});var cm=i(Ho);q7=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);A_=s(uv,"STRONG",{});var nG=i(A_);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);P_=s(fv,"STRONG",{});var iG=i(P_);Q7=a(iG,"Usage"),iG.forEach(o),eO=a(fv,`:
User has to just pass `),q_=s(fv,"CODE",{});var lG=i(q_);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),AO=a(E,`
| `),Fd=s(E,"A",{href:!0});var wG=i(Fd);PO=a(wG,"Deployment with multiple GPUs"),wG.forEach(o),L_=s(E,"A",{id:!0}),i(L_).forEach(o),qO=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 AG=i(jd);RO=a(AG,"ZeRO"),AG.forEach(o),H_=s(E,"A",{id:!0}),i(H_).forEach(o),WO=a(E,`
| `),Hd=s(E,"A",{href:!0});var PG=i(Hd);GO=a(PG,"ZeRO-2 Config"),PG.forEach(o),B_=s(E,"A",{id:!0}),i(B_).forEach(o),MO=a(E,`
| `),Bd=s(E,"A",{href:!0});var qG=i(Bd);jO=a(qG,"ZeRO-3 Config"),qG.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/v4.25.1/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/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(_e,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.TrainingArguments"),p(ve,"href","https://github.com/NVIDIA/apex"),p(ve,"rel","nofollow"),p(be,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(pl,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(hl,"href","/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/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/v4.25.1/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/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(wl,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(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/v4.25.1/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/v4.25.1/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(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(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(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(qr,"id","transformers.Seq2SeqTrainingArguments"),p(qr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(qr,"href","#transformers.Seq2SeqTrainingArguments"),p(ko,"class","relative group"),p($l,"href","/docs/transformers/v4.25.1/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(Po,"class","relative group"),p(xl,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(kl,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.TrainingArguments"),p(Al,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer.train"),p(Dl,"href","/docs/transformers/v4.25.1/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(qo,"class","relative group"),p(Ol,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(Cl,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.TrainingArguments"),p(Nl,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.TrainingArguments"),p(zl,"href","/docs/transformers/v4.25.1/en/main_classes/trainer#transformers.Trainer"),p(Fl,"href","/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/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/v4.25.1/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,q,c),m(t,$,c),e($,k),e(k,L),f(A,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,Pe,c),e(Pe,Ua),e(Pe,ve),e(ve,Na),e(Pe,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,Aw),e(al,Pw),e(C,qw),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,Am),f(La,Am,null),e(ao,m0),e(ao,Pm),e(Pm,p0),m(t,wv,c),m(t,b,c),f(Ra,b,null),e(b,h0),e(b,qm),e(qm,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,A0),e(J,P0),e(J,Um),e(Um,q0),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,qe),e(qe,Lm),e(Lm,L0),e(qe,R0),e(qe,Rm),e(Rm,W0),e(qe,G0),e(qe,Wm),e(Wm,M0),e(qe,j0),e(qe,Gm),e(Gm,H0),e(qe,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,AT),e(pt,PT),e(pt,Ka),e(Ka,qT),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,AE),e(dn,fp),e(fp,PE),e(dn,qE),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,Ap),e(Ap,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,Pp),e(Pp,b4),e(bn,y4),e(vt,w4),e(vt,qp),e(qp,T4),e(b,E4),e(b,P),f(yn,P,null),e(P,$4),e(P,Dp),e(Dp,x4),e(P,k4),e(P,Sp),e(Sp,A4),e(P,P4),e(P,Op),e(Op,q4),e(P,D4),e(P,io),e(io,S4),e(io,Cp),e(Cp,O4),e(io,C4),e(io,Ip),e(Ip,I4),e(io,U4),e(P,N4),f(fr,P,null),e(P,z4),e(P,Up),e(Up,Np),e(Np,F4),e(P,L4),e(P,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,e5),e(Xe,t5),e(Xe,vl),e(vl,Mp),e(Mp,o5),e(vl,r5),e(Xe,a5),e(Xe,bt),e(bt,jp),e(jp,n5),e(bt,s5),e(bt,Hp),e(Hp,i5),e(bt,l5),e(bt,Bp),e(Bp,d5),e(bt,c5),e(P,m5),e(P,Vp),e(Vp,p5),e(P,h5),e(P,Yp),e(Yp,u5),e(P,f5),e(P,wn),e(wn,g5),e(wn,Zp),e(Zp,_5),e(wn,v5),e(P,b5),e(P,Qe),e(Qe,y5),e(Qe,Kp),e(Kp,w5),e(Qe,T5),e(Qe,Jp),e(Jp,E5),e(Qe,$5),e(Qe,Xp),e(Xp,x5),e(Qe,k5),e(P,A5),e(P,ne),e(ne,P5),e(ne,bl),e(bl,q5),e(ne,D5),e(ne,Qp),e(Qp,S5),e(ne,O5),e(ne,eh),e(eh,C5),e(ne,I5),e(ne,th),e(th,U5),e(ne,N5),e(ne,oh),e(oh,z5),e(ne,F5),e(P,L5),e(P,U),e(U,R5),e(U,rh),e(rh,W5),e(U,G5),e(U,ah),e(ah,M5),e(U,j5),e(U,nh),e(nh,H5),e(U,B5),e(U,sh),e(sh,V5),e(U,Y5),e(U,Tn),e(Tn,Z5),e(U,K5),e(U,ih),e(ih,J5),e(U,X5),e(U,lh),e(lh,Q5),e(U,e$),e(U,dh),e(dh,t$),e(U,o$),e(U,ch),e(ch,r$),e(U,a$),e(U,mh),e(mh,n$),e(U,s$),e(P,i$),e(P,Ee),e(Ee,l$),e(Ee,yl),e(yl,d$),e(Ee,c$),e(Ee,ph),e(ph,m$),e(Ee,p$),e(Ee,wl),e(wl,h$),e(Ee,u$),e(Ee,hh),e(hh,f$),e(Ee,g$),e(P,_$),e(P,uh),e(uh,v$),e(b,b$),e(b,gr),f(En,gr,null),e(gr,y$),e(gr,fh),e(fh,w$),e(b,T$),e(b,_r),f($n,_r,null),e(_r,E$),e(_r,xn),e(xn,$$),e(xn,gh),e(gh,x$),e(xn,k$),e(b,A$),e(b,yt),f(kn,yt,null),e(yt,P$),e(yt,An),e(An,q$),e(An,_h),e(_h,D$),e(An,S$),e(yt,O$),e(yt,Pn),e(Pn,C$),e(Pn,vh),e(vh,I$),e(Pn,U$),e(b,N$),e(b,X),f(qn,X,null),e(X,z$),e(X,bh),e(bh,F$),e(X,L$),e(X,Dn),e(Dn,R$),e(Dn,yh),e(yh,W$),e(Dn,G$),e(X,M$),f(vr,X,null),e(X,j$),e(X,Sn),e(Sn,H$),e(Sn,wh),e(wh,B$),e(Sn,V$),e(X,Y$),e(X,co),e(co,mo),e(mo,Z$),e(mo,Th),e(Th,K$),e(mo,J$),e(mo,Eh),e(Eh,X$),e(mo,Q$),e(co,e3),e(co,po),e(po,t3),e(po,$h),e($h,o3),e(po,r3),e(po,xh),e(xh,a3),e(po,n3),e(co,s3),e(co,ho),e(ho,i3),e(ho,kh),e(kh,l3),e(ho,d3),e(ho,Ah),e(Ah,c3),e(ho,m3),e(b,p3),e(b,wt),f(On,wt,null),e(wt,h3),e(wt,uo),e(uo,u3),e(uo,Ph),e(Ph,f3),e(uo,g3),e(uo,qh),e(qh,_3),e(uo,v3),e(wt,b3),e(wt,Dh),e(Dh,y3),e(b,w3),e(b,Tt),f(Cn,Tt,null),e(Tt,T3),e(Tt,fo),e(fo,E3),e(fo,Sh),e(Sh,$3),e(fo,x3),e(fo,Oh),e(Oh,k3),e(fo,A3),e(Tt,P3),e(Tt,Ch),e(Ch,q3),e(b,D3),e(b,br),f(In,br,null),e(br,S3),e(br,et),e(et,O3),e(et,Ih),e(Ih,C3),e(et,I3),e(et,Uh),e(Uh,U3),e(et,N3),e(et,Nh),e(Nh,z3),e(et,F3),e(b,L3),e(b,yr),f(Un,yr,null),e(yr,R3),e(yr,Nn),e(Nn,W3),e(Nn,zh),e(zh,G3),e(Nn,M3),e(b,j3),e(b,Ce),f(zn,Ce,null),e(Ce,H3),e(Ce,Fn),e(Fn,B3),e(Fn,Fh),e(Fh,V3),e(Fn,Y3),e(Ce,Z3),e(Ce,Lh),e(Lh,K3),e(Ce,J3),e(Ce,Ln),e(Ln,X3),e(Ln,Tl),e(Tl,Q3),e(Ln,ex),e(b,tx),e(b,Et),f(Rn,Et,null),e(Et,ox),e(Et,Wn),e(Wn,rx),e(Wn,Rh),e(Rh,ax),e(Wn,nx),e(Et,sx),e(Et,Wh),e(Wh,ix),e(b,lx),e(b,$t),f(Gn,$t,null),e($t,dx),e($t,Gh),e(Gh,cx),e($t,mx),e($t,Mh),e(Mh,px),e(b,hx),e(b,wr),f(Mn,wr,null),e(wr,ux),e(wr,jh),e(jh,fx),e(b,gx),e(b,xt),f(jn,xt,null),e(xt,_x),e(xt,Hh),e(Hh,vx),e(xt,bx),e(xt,Bh),e(Bh,yx),m(t,Tv,c),m(t,go,c),e(go,Tr),e(Tr,Vh),f(Hn,Vh,null),e(go,wx),e(go,Yh),e(Yh,Tx),m(t,Ev,c),m(t,tt,c),f(Bn,tt,null),e(tt,Ex),e(tt,Ie),f(Vn,Ie,null),e(Ie,$x),e(Ie,Zh),e(Zh,xx),e(Ie,kx),e(Ie,Yn),e(Yn,Ax),e(Yn,Kh),e(Kh,Px),e(Yn,qx),e(Ie,Dx),e(Ie,Jh),e(Jh,Sx),e(tt,Ox),e(tt,Q),f(Zn,Q,null),e(Q,Cx),e(Q,Xh),e(Xh,Ix),e(Q,Ux),e(Q,Kn),e(Kn,Nx),e(Kn,Qh),e(Qh,zx),e(Kn,Fx),e(Q,Lx),f(Er,Q,null),e(Q,Rx),e(Q,Jn),e(Jn,Wx),e(Jn,eu),e(eu,Gx),e(Jn,Mx),e(Q,jx),e(Q,_o),e(_o,vo),e(vo,Hx),e(vo,tu),e(tu,Bx),e(vo,Vx),e(vo,ou),e(ou,Yx),e(vo,Zx),e(_o,Kx),e(_o,bo),e(bo,Jx),e(bo,ru),e(ru,Xx),e(bo,Qx),e(bo,au),e(au,ek),e(bo,tk),e(_o,ok),e(_o,yo),e(yo,rk),e(yo,nu),e(nu,ak),e(yo,nk),e(yo,su),e(su,sk),e(yo,ik),m(t,$v,c),m(t,wo,c),e(wo,$r),e($r,iu),f(Xn,iu,null),e(wo,lk),e(wo,lu),e(lu,dk),m(t,xv,c),m(t,F,c),f(Qn,F,null),e(F,ck),e(F,es),e(es,mk),e(es,du),e(du,pk),e(es,hk),e(F,uk),e(F,To),e(To,fk),e(To,El),e(El,gk),e(To,_k),e(To,ts),e(ts,vk),e(To,bk),e(F,yk),e(F,de),f(os,de,null),e(de,wk),e(de,cu),e(cu,Tk),e(de,Ek),e(de,Eo),e(Eo,$k),e(Eo,mu),e(mu,xk),e(Eo,kk),e(Eo,pu),e(pu,Ak),e(Eo,Pk),e(de,qk),e(de,$o),e($o,Dk),e($o,hu),e(hu,Sk),e($o,Ok),e($o,uu),e(uu,Ck),e($o,Ik),e(de,Uk),e(de,rs),e(rs,Nk),e(rs,fu),e(fu,zk),e(rs,Fk),e(F,Lk),e(F,xr),f(as,xr,null),e(xr,Rk),e(xr,gu),e(gu,Wk),e(F,Gk),e(F,kt),f(ns,kt,null),e(kt,Mk),e(kt,_u),e(_u,jk),e(kt,Hk),e(kt,xo),e(xo,Bk),e(xo,vu),e(vu,Vk),e(xo,Yk),e(xo,bu),e(bu,Zk),e(xo,Kk),e(F,Jk),e(F,kr),f(ss,kr,null),e(kr,Xk),e(kr,is),e(is,Qk),e(is,yu),e(yu,e6),e(is,t6),e(F,o6),e(F,Ar),f(ls,Ar,null),e(Ar,r6),e(Ar,wu),e(wu,a6),e(F,n6),e(F,Pr),f(ds,Pr,null),e(Pr,s6),e(Pr,Tu),e(Tu,i6),m(t,kv,c),m(t,ko,c),e(ko,qr),e(qr,Eu),f(cs,Eu,null),e(ko,l6),e(ko,$u),e($u,d6),m(t,Av,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,Ao),e(Ao,f6),e(Ao,$l),e($l,g6),e(Ao,_6),e(Ao,hs),e(hs,v6),e(Ao,b6),m(t,Pv,c),m(t,Po,c),e(Po,Dr),e(Dr,ku),f(us,ku,null),e(Po,y6),e(Po,Au),e(Au,w6),m(t,qv,c),m(t,ce,c),e(ce,T6),e(ce,xl),e(xl,E6),e(ce,$6),e(ce,Pu),e(Pu,x6),e(ce,k6),e(ce,kl),e(kl,A6),e(ce,P6),e(ce,qu),e(qu,q6),e(ce,D6),m(t,Dv,c),m(t,Sr,c),e(Sr,S6),e(Sr,Al),e(Al,O6),e(Sr,C6),m(t,Sv,c),m(t,Or,c),e(Or,Pl),e(Pl,Du),e(Du,I6),e(Pl,U6),e(Or,N6),e(Or,ql),e(ql,Su),e(Su,z6),e(ql,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,qo,c),e(qo,Ur),e(Ur,zu),f(fs,zu,null),e(qo,Q6),e(qo,Fu),e(Fu,eA),m(t,Uv,c),m(t,Ne,c),e(Ne,tA),e(Ne,Ol),e(Ol,oA),e(Ne,rA),e(Ne,Lu),e(Lu,aA),e(Ne,nA),e(Ne,Ru),e(Ru,sA),e(Ne,iA),m(t,Nv,c),m(t,At,c),e(At,lA),e(At,Wu),e(Wu,dA),e(At,cA),e(At,Cl),e(Cl,mA),e(At,pA),m(t,zv,c),m(t,Nr,c),e(Nr,Il),e(Il,Gu),e(Gu,hA),e(Il,uA),e(Nr,fA),e(Nr,Ul),e(Ul,Mu),e(Mu,gA),e(Ul,_A),m(t,Fv,c),m(t,ze,c),e(ze,vA),e(ze,Nl),e(Nl,bA),e(ze,yA),e(ze,ju),e(ju,wA),e(ze,TA),e(ze,Hu),e(Hu,EA),e(ze,$A),m(t,Lv,c),m(t,ee,c),e(ee,xA),e(ee,zl),e(zl,kA),e(ee,AA),e(ee,Bu),e(Bu,PA),e(ee,qA),e(ee,Vu),e(Vu,DA),e(ee,SA),e(ee,Yu),e(Yu,OA),e(ee,CA),e(ee,Fl),e(Fl,IA),e(ee,UA),m(t,Rv,c),m(t,Ll,c),e(Ll,NA),m(t,Wv,c),f(gs,t,c),m(t,Gv,c),m(t,Rl,c),e(Rl,zA),m(t,Mv,c),f(_s,t,c),m(t,jv,c),m(t,Wl,c),e(Wl,FA),m(t,Hv,c),f(vs,t,c),m(t,Bv,c),m(t,Gl,c),e(Gl,LA),m(t,Vv,c),m(t,Ml,c),e(Ml,RA),m(t,Yv,c),f(bs,t,c),m(t,Zv,c),m(t,zr,c),e(zr,WA),e(zr,Zu),e(Zu,GA),e(zr,MA),m(t,Kv,c),m(t,Do,c),e(Do,Fr),e(Fr,Ku),f(ys,Ku,null),e(Do,jA),e(Do,Ju),e(Ju,HA),m(t,Jv,c),m(t,me,c),e(me,BA),e(me,jl),e(jl,VA),e(me,YA),e(me,Xu),e(Xu,ZA),e(me,KA),e(me,Qu),e(Qu,JA),e(me,XA),e(me,ef),e(ef,QA),e(me,e8),m(t,Xv,c),m(t,Pt,c),e(Pt,t8),e(Pt,ws),e(ws,o8),e(Pt,r8),e(Pt,tf),e(tf,a8),e(Pt,n8),m(t,Qv,c),m(t,So,c),e(So,Lr),e(Lr,of),f(Ts,of,null),e(So,s8),e(So,rf),e(rf,i8),m(t,e1,c),m(t,Hl,c),e(Hl,l8),m(t,t1,c),m(t,Rr,c),e(Rr,d8),e(Rr,Es),e(Es,af),e(af,c8),e(Rr,m8),m(t,o1,c),f($s,t,c),m(t,r1,c),m(t,qt,c),e(qt,p8),e(qt,xs),e(xs,nf),e(nf,h8),e(qt,u8),e(qt,ks),e(ks,sf),e(sf,f8),e(qt,g8),m(t,a1,c),f(As,t,c),m(t,n1,c),f(Ps,t,c),m(t,s1,c),m(t,Wr,c),e(Wr,_8),e(Wr,Bl),e(Bl,v8),e(Wr,b8),m(t,i1,c),m(t,Vl,c),e(Vl,y8),m(t,l1,c),m(t,Yl,c),e(Yl,w8),m(t,d1,c),m(t,Zl,c),e(Zl,lf),e(lf,df),e(df,T8),m(t,c1,c),m(t,Gr,c),e(Gr,E8),e(Gr,cf),e(cf,$8),e(Gr,x8),m(t,m1,c),m(t,Kl,c),e(Kl,k8),m(t,p1,c),f(qs,t,c),m(t,h1,c),m(t,Dt,c),e(Dt,A8),e(Dt,mf),e(mf,P8),e(Dt,q8),e(Dt,pf),e(pf,D8),e(Dt,S8),m(t,u1,c),m(t,Jl,c),e(Jl,O8),m(t,f1,c),f(Ds,t,c),m(t,g1,c),m(t,St,c),e(St,C8),e(St,hf),e(hf,I8),e(St,U8),e(St,uf),e(uf,N8),e(St,z8),m(t,_1,c),m(t,Ot,c),e(Ot,F8),e(Ot,ff),e(ff,L8),e(Ot,R8),e(Ot,Ss),e(Ss,gf),e(gf,W8),e(Ot,G8),m(t,v1,c),f(Os,t,c),m(t,b1,c),m(t,Xl,c),e(Xl,M8),m(t,y1,c),f(Cs,t,c),m(t,w1,c),m(t,Ql,c),e(Ql,j8),m(t,T1,c),f(Is,t,c),m(t,E1,c),m(t,ed,c),e(ed,H8),m(t,$1,c),m(t,td,c),e(td,_f),e(_f,vf),e(vf,B8),m(t,x1,c),m(t,Mr,c),e(Mr,V8),e(Mr,bf),e(bf,Y8),e(Mr,Z8),m(t,k1,c),m(t,od,c),e(od,Us),e(Us,K8),e(Us,yf),e(yf,J8),e(Us,X8),m(t,A1,c),f(Ns,t,c),m(t,P1,c),m(t,zs,c),e(zs,wf),e(wf,Q8),m(t,q1,c),f(Fs,t,c),m(t,D1,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,S1,c),m(t,rd,c),e(rd,nP),m(t,O1,c),f(Ls,t,c),m(t,C1,c),m(t,ad,c),e(ad,sP),m(t,I1,c),m(t,jr,c),e(jr,iP),e(jr,$f),e($f,lP),e(jr,dP),m(t,U1,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,N1,c),m(t,Br,c),e(Br,pP),e(Br,nd),e(nd,hP),e(Br,uP),m(t,z1,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,F1,c),m(t,Vr,c),e(Vr,$P),e(Vr,sd),e(sd,xP),e(Vr,kP),m(t,L1,c),m(t,id,c),m(t,R1,c),m(t,Co,c),e(Co,Yr),e(Yr,Af),f(Hs,Af,null),e(Co,AP),e(Co,Pf),e(Pf,PP),m(t,W1,c),m(t,ld,c),e(ld,qP),m(t,G1,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,M1,c),m(t,dd,c),e(dd,UP),m(t,j1,c),f(Ys,t,c),m(t,H1,c),m(t,cd,c),e(cd,NP),m(t,B1,c),m(t,Ut,c),e(Ut,zP),e(Ut,qf),e(qf,FP),e(Ut,LP),e(Ut,Df),e(Df,RP),e(Ut,WP),m(t,V1,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,Y1,c),m(t,md,c),e(md,jP),m(t,Z1,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,K1,c),m(t,Nt,c),e(Nt,XP),e(Nt,Nf),e(Nf,QP),e(Nt,eq),e(Nt,zf),e(zf,tq),e(Nt,oq),m(t,J1,c),f(Ks,t,c),m(t,X1,c),m(t,Kr,c),e(Kr,rq),e(Kr,Js),e(Js,aq),e(Kr,nq),m(t,Q1,c),m(t,Uo,c),e(Uo,Jr),e(Jr,Ff),f(Xs,Ff,null),e(Uo,sq),e(Uo,Lf),e(Lf,iq),m(t,eb,c),m(t,pd,c),e(pd,lq),m(t,tb,c),f(Qs,t,c),m(t,ob,c),m(t,zt,c),e(zt,dq),e(zt,Rf),e(Rf,cq),e(zt,mq),e(zt,Wf),e(Wf,pq),e(zt,hq),m(t,rb,c),m(t,hd,c),e(hd,uq),m(t,ab,c),f(ei,t,c),m(t,nb,c),m(t,ud,c),e(ud,fq),m(t,sb,c),m(t,Xr,c),e(Xr,gq),e(Xr,Gf),e(Gf,_q),e(Xr,vq),m(t,ib,c),m(t,rt,c),e(rt,Mf),e(Mf,bq),e(rt,yq),e(rt,jf),e(jf,wq),e(rt,Tq),e(rt,Hf),e(Hf,Eq),e(rt,$q),m(t,lb,c),m(t,fd,c),e(fd,xq),m(t,db,c),f(ti,t,c),m(t,cb,c),m(t,gd,c),e(gd,kq),m(t,mb,c),m(t,Le,c),e(Le,Aq),e(Le,Bf),e(Bf,Pq),e(Le,qq),e(Le,Vf),e(Vf,Dq),e(Le,Sq),e(Le,Yf),e(Yf,Oq),e(Le,Cq),m(t,pb,c),m(t,No,c),e(No,Qr),e(Qr,Zf),f(oi,Zf,null),e(No,Iq),e(No,Kf),e(Kf,Uq),m(t,hb,c),m(t,Ft,c),e(Ft,Nq),e(Ft,Jf),e(Jf,zq),e(Ft,Fq),e(Ft,Xf),e(Xf,Lq),e(Ft,Rq),m(t,ub,c),m(t,_d,c),e(_d,Wq),m(t,fb,c),m(t,vd,c),e(vd,Gq),m(t,gb,c),m(t,ea,c),e(ea,Mq),e(ea,Qf),e(Qf,jq),e(ea,Hq),m(t,_b,c),f(ri,t,c),m(t,vb,c),m(t,M,c),e(M,Bq),e(M,eg),e(eg,Vq),e(M,Yq),e(M,tg),e(tg,Zq),e(M,Kq),e(M,og),e(og,Jq),e(M,Xq),e(M,rg),e(rg,Qq),e(M,eD),e(M,ag),e(ag,tD),e(M,oD),e(M,ng),e(ng,rD),e(M,aD),m(t,bb,c),m(t,bd,c),e(bd,nD),m(t,yb,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,wb,c),f(oa,t,c),m(t,Tb,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,Eb,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,$b,c),m(t,wd,c),e(wd,TD),m(t,xb,c),m(t,ii,c),e(ii,pg),e(pg,ED),e(ii,$D),m(t,kb,c),m(t,Td,c),e(Td,xD),m(t,Ab,c),f(li,t,c),m(t,Pb,c),m(t,Lt,c),e(Lt,kD),e(Lt,hg),e(hg,AD),e(Lt,PD),e(Lt,ug),e(ug,qD),e(Lt,DD),m(t,qb,c),f(di,t,c),m(t,Db,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,Sb,c),m(t,ra,c),e(ra,ND),e(ra,Ed),e(Ed,zD),e(ra,FD),m(t,Ob,c),m(t,$d,c),e($d,LD),m(t,Cb,c),m(t,mi,c),e(mi,gg),e(gg,RD),e(mi,WD),m(t,Ib,c),f(pi,t,c),m(t,Ub,c),m(t,xd,c),e(xd,GD),m(t,Nb,c),f(hi,t,c),m(t,zb,c),m(t,ui,c),e(ui,_g),e(_g,MD),e(ui,jD),m(t,Fb,c),f(fi,t,c),m(t,Lb,c),m(t,kd,c),e(kd,HD),m(t,Rb,c),f(gi,t,c),m(t,Wb,c),m(t,Ad,c),e(Ad,BD),m(t,Gb,c),m(t,aa,c),e(aa,VD),e(aa,_i),e(_i,YD),e(aa,ZD),m(t,Mb,c),m(t,vi,c),e(vi,vg),e(vg,KD),e(vi,JD),m(t,jb,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,Hb,c),m(t,na,c),e(na,r9),e(na,wg),e(wg,a9),e(na,n9),m(t,Bb,c),f(bi,t,c),m(t,Vb,c),m(t,Pd,c),e(Pd,s9),m(t,Yb,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,Zb,c),m(t,Ti,c),e(Ti,at),e(at,v9),e(at,kg),e(kg,b9),e(at,y9),e(at,Ag),e(Ag,w9),e(at,T9),e(at,Pg),e(Pg,E9),e(at,$9),m(t,Kb,c),m(t,sa,c),e(sa,x9),e(sa,qg),e(qg,k9),e(sa,A9),m(t,Jb,c),f(Ei,t,c),m(t,Xb,c),m(t,Fo,c),e(Fo,Dg),e(Dg,P9),e(Fo,q9),e(Fo,Sg),e(Sg,D9),e(Fo,S9),m(t,Qb,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,qd,c),e(qd,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,Ai,c),e(Ai,Yg),e(Yg,yS),e(Ai,wS),m(t,iy,c),m(t,Pi,c),e(Pi,Zg),e(Zg,TS),e(Pi,ES),m(t,ly,c),m(t,te,c),e(te,Kg),e(Kg,qi),e(qi,$S),e(qi,Jg),e(Jg,xS),e(qi,kS),e(te,AS),e(te,Di),e(Di,Sd),e(Sd,Xg),e(Xg,PS),e(Sd,qS),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,A7),e(ca,P7),e(ca,Ho),e(Ho,q7),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,A_),e(A_,Z7),e(Vo,K7),e(Vo,Mi),e(Mi,J7),e(Vo,X7),m(t,_y,c),m(t,Yo,c),e(Yo,P_),e(P_,Q7),e(Yo,eO),e(Yo,q_),e(q_,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,AO),e(w,Fd),e(Fd,PO),e(w,L_),e(w,qO),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(A.$$.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(qn.$$.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(As.$$.fragment,t),g(Ps.$$.fragment,t),g(qs.$$.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){_(A.$$.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),_(qn.$$.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),_(As.$$.fragment,t),_(Ps.$$.fragment,t),_(qs.$$.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(q),t&&o($),v(A),t&&o(oe),t&&o(G),t&&o(z),t&&o(I),t&&o(Ke),t&&o(Pe),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(qn),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(Av),t&&o(ot),v(ms),t&&o(Pv),t&&o(Po),v(us),t&&o(qv),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(qo),v(fs),t&&o(Uv),t&&o(Ne),t&&o(Nv),t&&o(At),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(Pt),t&&o(Qv),t&&o(So),v(Ts),t&&o(e1),t&&o(Hl),t&&o(t1),t&&o(Rr),t&&o(o1),v($s,t),t&&o(r1),t&&o(qt),t&&o(a1),v(As,t),t&&o(n1),v(Ps,t),t&&o(s1),t&&o(Wr),t&&o(i1),t&&o(Vl),t&&o(l1),t&&o(Yl),t&&o(d1),t&&o(Zl),t&&o(c1),t&&o(Gr),t&&o(m1),t&&o(Kl),t&&o(p1),v(qs,t),t&&o(h1),t&&o(Dt),t&&o(u1),t&&o(Jl),t&&o(f1),v(Ds,t),t&&o(g1),t&&o(St),t&&o(_1),t&&o(Ot),t&&o(v1),v(Os,t),t&&o(b1),t&&o(Xl),t&&o(y1),v(Cs,t),t&&o(w1),t&&o(Ql),t&&o(T1),v(Is,t),t&&o(E1),t&&o(ed),t&&o($1),t&&o(td),t&&o(x1),t&&o(Mr),t&&o(k1),t&&o(od),t&&o(A1),v(Ns,t),t&&o(P1),t&&o(zs),t&&o(q1),v(Fs,t),t&&o(D1),t&&o(Ct),t&&o(S1),t&&o(rd),t&&o(O1),v(Ls,t),t&&o(C1),t&&o(ad),t&&o(I1),t&&o(jr),t&&o(U1),t&&o(Oo),v(Rs),t&&o(N1),t&&o(Br),t&&o(z1),t&&o(pe),t&&o(F1),t&&o(Vr),t&&o(L1),t&&o(id),t&&o(R1),t&&o(Co),v(Hs),t&&o(W1),t&&o(ld),t&&o(G1),t&&o(It),t&&o(M1),t&&o(dd),t&&o(j1),v(Ys,t),t&&o(H1),t&&o(cd),t&&o(B1),t&&o(Ut),t&&o(V1),t&&o(Io),v(Zs),t&&o(Y1),t&&o(md),t&&o(Z1),t&&o(Fe),t&&o(K1),t&&o(Nt),t&&o(J1),v(Ks,t),t&&o(X1),t&&o(Kr),t&&o(Q1),t&&o(Uo),v(Xs),t&&o(eb),t&&o(pd),t&&o(tb),v(Qs,t),t&&o(ob),t&&o(zt),t&&o(rb),t&&o(hd),t&&o(ab),v(ei,t),t&&o(nb),t&&o(ud),t&&o(sb),t&&o(Xr),t&&o(ib),t&&o(rt),t&&o(lb),t&&o(fd),t&&o(db),v(ti,t),t&&o(cb),t&&o(gd),t&&o(mb),t&&o(Le),t&&o(pb),t&&o(No),v(oi),t&&o(hb),t&&o(Ft),t&&o(ub),t&&o(_d),t&&o(fb),t&&o(vd),t&&o(gb),t&&o(ea),t&&o(_b),v(ri,t),t&&o(vb),t&&o(M),t&&o(bb),t&&o(bd),t&&o(yb),t&&o(zo),v(ai),t&&o(wb),v(oa,t),t&&o(Tb),t&&o(Re),t&&o(Eb),t&&o(We),t&&o($b),t&&o(wd),t&&o(xb),t&&o(ii),t&&o(kb),t&&o(Td),t&&o(Ab),v(li,t),t&&o(Pb),t&&o(Lt),t&&o(qb),v(di,t),t&&o(Db),t&&o(Rt),t&&o(Sb),t&&o(ra),t&&o(Ob),t&&o($d),t&&o(Cb),t&&o(mi),t&&o(Ib),v(pi,t),t&&o(Ub),t&&o(xd),t&&o(Nb),v(hi,t),t&&o(zb),t&&o(ui),t&&o(Fb),v(fi,t),t&&o(Lb),t&&o(kd),t&&o(Rb),v(gi,t),t&&o(Wb),t&&o(Ad),t&&o(Gb),t&&o(aa),t&&o(Mb),t&&o(vi),t&&o(jb),t&&o(Wt),t&&o(Hb),t&&o(na),t&&o(Bb),v(bi,t),t&&o(Vb),t&&o(Pd),t&&o(Yb),t&&o(Ge),t&&o(Zb),t&&o(Ti),t&&o(Kb),t&&o(sa),t&&o(Jb),v(Ei,t),t&&o(Xb),t&&o(Fo),t&&o(Qb),t&&o(Gt),t&&o(ey),t&&o(qd),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(Ai),t&&o(iy),t&&o(Pi),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};
