import{S as K1,i as Q1,s as Z1,w as _,x as b,y as v,q as p,o as g,B as E,F as t2,e as n,t,k as c,c as o,a as s,h as r,d as a,m as d,b as i,g as m,G as e,j as r2,H as a2,I as n2,J as o2,M as s2,v as l2,L as i2}from"../../chunks/vendor-hf-doc-builder.js";import{T as e2}from"../../chunks/Tip-hf-doc-builder.js";import{D as y}from"../../chunks/Docstring-hf-doc-builder.js";import{C as m_}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Qs}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as c2}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function d2(W){let h,D,u,C,A;const k=W[1].default,L=t2(k,W,W[2],null);return{c(){h=n("p"),D=t("Deprecated in "),u=t(W[0]),C=c(),L&&L.c(),this.h()},l(w){h=o(w,"P",{class:!0});var M=s(h);D=r(M,"Deprecated in "),u=r(M,W[0]),M.forEach(a),C=d(w),L&&L.l(w),this.h()},h(){i(h,"class","font-medium")},m(w,M){m(w,h,M),e(h,D),e(h,u),m(w,C,M),L&&L.m(w,M),A=!0},p(w,M){(!A||M&1)&&r2(u,w[0]),L&&L.p&&(!A||M&4)&&a2(L,k,w,w[2],A?o2(k,w[2],M,null):n2(w[2]),null)},i(w){A||(p(L,w),A=!0)},o(w){g(L,w),A=!1},d(w){w&&a(h),w&&a(C),L&&L.d(w)}}}function f2(W){let h,D;return h=new e2({props:{warning:!0,$$slots:{default:[d2]},$$scope:{ctx:W}}}),{c(){_(h.$$.fragment)},l(u){b(h.$$.fragment,u)},m(u,C){v(h,u,C),D=!0},p(u,[C]){const A={};C&5&&(A.$$scope={dirty:C,ctx:u}),h.$set(A)},i(u){D||(p(h.$$.fragment,u),D=!0)},o(u){g(h.$$.fragment,u),D=!1},d(u){E(h,u)}}}function m2(W,h,D){let{$$slots:u={},$$scope:C}=h,{version:A}=h;return W.$$set=k=>{"version"in k&&D(0,A=k.version),"$$scope"in k&&D(2,C=k.$$scope)},[A,u,C]}class h2 extends K1{constructor(h){super();Q1(this,h,m2,f2,Z1,{version:0})}}function p2(W){let h,D,u,C,A,k,L,w;return{c(){h=n("p"),D=t("Setting "),u=n("code"),C=t("WANDB_LOG_MODEL"),A=t(" as "),k=n("code"),L=t("bool"),w=t(" will be deprecated in version 5 of \u{1F917} Transformers.")},l(M){h=o(M,"P",{});var x=s(h);D=r(x,"Setting "),u=o(x,"CODE",{});var Y=s(u);C=r(Y,"WANDB_LOG_MODEL"),Y.forEach(a),A=r(x," as "),k=o(x,"CODE",{});var Se=s(k);L=r(Se,"bool"),Se.forEach(a),w=r(x," will be deprecated in version 5 of \u{1F917} Transformers."),x.forEach(a)},m(M,x){m(M,h,x),e(h,D),e(h,u),e(u,C),e(h,A),e(h,k),e(k,L),e(h,w)},d(M){M&&a(h)}}}function g2(W){let h,D,u,C,A;return C=new m_({props:{code:`class PrinterCallback(TrainerCallback):
    def on_log(self, args, state, control, logs=None, **kwargs):
        _ = logs.pop("total_flos", None)
        if state.is_local_process_zero:
            print(logs)`,highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">PrinterCallback</span>(<span class="hljs-title class_ inherited__">TrainerCallback</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">on_log</span>(<span class="hljs-params">self, args, state, control, logs=<span class="hljs-literal">None</span>, **kwargs</span>):
        _ = logs.pop(<span class="hljs-string">&quot;total_flos&quot;</span>, <span class="hljs-literal">None</span>)
        <span class="hljs-keyword">if</span> state.is_local_process_zero:
            <span class="hljs-built_in">print</span>(logs)`}}),{c(){h=n("p"),D=t("Example:"),u=c(),_(C.$$.fragment)},l(k){h=o(k,"P",{});var L=s(h);D=r(L,"Example:"),L.forEach(a),u=d(k),b(C.$$.fragment,k)},m(k,L){m(k,h,L),e(h,D),m(k,u,L),v(C,k,L),A=!0},p:i2,i(k){A||(p(C.$$.fragment,k),A=!0)},o(k){g(C.$$.fragment,k),A=!1},d(k){k&&a(h),k&&a(u),E(C,k)}}}function u2(W){let h,D,u,C,A,k,L,w;return{c(){h=n("p"),D=t(`In all this class, one step is to be understood as one update step. When using gradient accumulation, one update
step may require several forward and backward passes: if you use `),u=n("code"),C=t("gradient_accumulation_steps=n"),A=t(`, then one update
step requires going through `),k=n("em"),L=t("n"),w=t(" batches.")},l(M){h=o(M,"P",{});var x=s(h);D=r(x,`In all this class, one step is to be understood as one update step. When using gradient accumulation, one update
step may require several forward and backward passes: if you use `),u=o(x,"CODE",{});var Y=s(u);C=r(Y,"gradient_accumulation_steps=n"),Y.forEach(a),A=r(x,`, then one update
step requires going through `),k=o(x,"EM",{});var Se=s(k);L=r(Se,"n"),Se.forEach(a),w=r(x," batches."),x.forEach(a)},m(M,x){m(M,h,x),e(h,D),e(h,u),e(u,C),e(h,A),e(h,k),e(k,L),e(h,w)},d(M){M&&a(h)}}}function _2(W){let h,D,u,C,A,k,L,w,M,x,Y,Se,da,Ei,ki,Zs,oe,$i,fa,Ci,Ti,ma,wi,yi,ha,Ai,Li,el,st,Di,pa,Oi,Mi,tl,S,ga,ua,Ii,Si,xi,Le,_a,Ni,Pi,ba,Fi,Wi,va,ji,Ri,zi,Ea,ka,Bi,Gi,Vi,lt,$a,Ui,qi,qt,Hi,Ji,Yi,it,Ca,Xi,Ki,Ht,Qi,Zi,ec,ct,Ta,tc,rc,Jt,ac,nc,oc,dt,wa,sc,lc,Yt,ic,cc,dc,ft,ya,fc,mc,Xt,hc,pc,gc,mt,Aa,uc,_c,Kt,bc,vc,Ec,ht,La,kc,$c,Qt,Cc,Tc,rl,B,wc,Da,yc,Ac,Oa,Lc,Dc,Ma,Oc,Mc,Ia,Ic,Sc,Sa,xc,Nc,al,xe,pt,pn,Zt,Pc,gn,Fc,nl,gt,Wc,xa,jc,Rc,ol,ue,er,zc,Ne,Bc,Na,Gc,Vc,tr,Uc,qc,Hc,X,rr,Jc,un,Yc,Xc,_n,Kc,Qc,_e,R,bn,Zc,ed,vn,td,rd,En,ad,nd,kn,od,sd,$n,ld,id,Cn,cd,dd,Tn,fd,md,hd,De,wn,pd,gd,yn,ud,_d,An,bd,vd,Ed,K,Ln,kd,$d,Dn,Cd,Td,On,wd,yd,Mn,Ad,Ld,In,Dd,Od,Md,G,Sn,Id,Sd,xn,xd,Nd,Nn,Pd,Fd,Pn,Wd,jd,Fn,Rd,zd,Wn,Bd,Gd,Vd,ar,Ud,nr,qd,Hd,sl,Pe,or,Jd,sr,Yd,Pa,Xd,Kd,ll,Fe,lr,Qd,ir,Zd,Fa,ef,tf,il,We,cr,rf,dr,af,Wa,nf,of,cl,be,fr,sf,mr,lf,ja,cf,df,ff,ve,mf,Ra,hf,pf,jn,gf,uf,za,_f,bf,dl,je,hr,vf,Re,Ef,Ba,kf,$f,pr,Cf,Tf,fl,Ee,gr,wf,ze,yf,Ga,Af,Lf,ur,Df,Of,Mf,Q,_r,If,br,Sf,Rn,xf,Nf,Pf,vr,Ff,Er,Wf,jf,Rf,zn,zf,Bf,ke,kr,O,Bn,Gf,Vf,Gn,Uf,qf,Vn,Hf,Jf,Un,Yf,Xf,qn,Kf,Qf,Hn,Zf,em,Jn,tm,rm,Yn,am,nm,Xn,om,sm,Kn,lm,im,Qn,cm,dm,Zn,fm,mm,hm,ut,pm,eo,N,to,gm,um,ro,_m,bm,ao,vm,Em,no,km,$m,oo,Cm,Tm,so,wm,ym,lo,Am,Lm,io,Dm,Om,co,Mm,Im,Sm,fo,se,mo,xm,Nm,ho,Pm,Fm,po,Wm,jm,go,Rm,zm,Bm,uo,Z,_o,Gm,Vm,bo,Um,qm,vo,Hm,Jm,Eo,Ym,Xm,ko,Km,Qm,ml,$e,$r,Zm,Ce,eh,Va,th,rh,Cr,ah,nh,$o,oh,sh,lh,le,Tr,ih,Co,ch,dh,To,fh,mh,U,P,wo,hh,ph,yo,gh,uh,Ao,_h,bh,Lo,vh,Eh,Do,kh,$h,Oo,Ch,Th,Ua,wh,yh,Mo,Ah,Lh,Dh,V,Io,Oh,Mh,So,Ih,Sh,xo,xh,Nh,No,Ph,Fh,Po,Wh,jh,Fo,Rh,zh,Bh,ie,Wo,Gh,Vh,jo,Uh,qh,Ro,Hh,Jh,zo,Yh,Xh,Kh,ee,Bo,Qh,Zh,Go,ep,tp,Vo,rp,ap,Uo,np,op,qo,sp,lp,ip,te,Ho,cp,dp,Jo,fp,mp,Yo,hp,pp,Xo,gp,up,Ko,_p,bp,vp,ce,Qo,Ep,kp,Zo,$p,Cp,es,Tp,wp,ts,yp,Ap,hl,Be,wr,Lp,Ge,Dp,qa,Op,Mp,yr,Ip,Sp,pl,Ve,Ar,xp,Lr,Np,Ha,Pp,Fp,gl,Ue,Dr,Wp,Or,jp,Mr,Rp,zp,ul,re,Ir,Bp,qe,Gp,Ja,Vp,Up,Sr,qp,Hp,Jp,rs,Yp,Xp,He,de,as,Kp,Qp,ns,Zp,eg,os,tg,rg,ss,ag,ng,og,fe,ls,sg,lg,is,ig,cg,cs,dg,fg,ds,mg,hg,pg,me,fs,gg,ug,ms,_g,bg,hs,vg,Eg,ps,kg,$g,_l,Je,_t,gs,xr,Cg,us,Tg,bl,$,Nr,wg,_s,yg,Ag,Pr,Lg,bs,Dg,Og,Mg,q,Ig,vs,Sg,xg,Es,Ng,Pg,ks,Fg,Wg,$s,jg,Rg,Cs,zg,Bg,Gg,bt,Vg,vt,Fr,Ug,Ts,qg,Hg,Et,Wr,Jg,ws,Yg,Xg,kt,jr,Kg,ys,Qg,Zg,$t,Rr,eu,zr,tu,Ya,ru,au,nu,Ct,Br,ou,As,su,lu,Tt,Gr,iu,Ls,cu,du,wt,Vr,fu,Ds,mu,hu,yt,Ur,pu,Os,gu,uu,At,qr,_u,Ms,bu,vu,Lt,Hr,Eu,Is,ku,$u,Dt,Jr,Cu,Ss,Tu,wu,Ot,Yr,yu,xs,Au,Lu,Mt,Xr,Du,Ns,Ou,vl,It,Mu,Xa,Iu,Su,El,Kr,kl,St,xu,Ps,Nu,Pu,$l,Qr,Cl,Ye,xt,Fs,Zr,Fu,Ws,Wu,Tl,H,ea,ju,Xe,Ru,Ka,zu,Bu,Qa,Gu,Vu,Uu,Nt,qu,Pt,ta,Hu,ra,Ju,js,Yu,Xu,Ku,Ft,aa,Qu,na,Zu,Rs,e_,t_,wl,Ke,Wt,zs,oa,r_,Bs,a_,yl,Qe,sa,n_,Ze,o_,Za,s_,l_,en,i_,c_,Al;return k=new Qs({}),Zt=new Qs({}),er=new y({props:{name:"class transformers.integrations.CometCallback",anchor:"transformers.integrations.CometCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L813"}}),rr=new y({props:{name:"setup",anchor:"transformers.integrations.CometCallback.setup",parameters:[{name:"args",val:""},{name:"state",val:""},{name:"model",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L824"}}),or=new y({props:{name:"class transformers.DefaultFlowCallback",anchor:"transformers.DefaultFlowCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L415"}}),lr=new y({props:{name:"class transformers.PrinterCallback",anchor:"transformers.PrinterCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L513"}}),cr=new y({props:{name:"class transformers.ProgressCallback",anchor:"transformers.ProgressCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L465"}}),fr=new y({props:{name:"class transformers.EarlyStoppingCallback",anchor:"transformers.EarlyStoppingCallback",parameters:[{name:"early_stopping_patience",val:": int = 1"},{name:"early_stopping_threshold",val:": typing.Optional[float] = 0.0"}],parametersDescription:[{anchor:"transformers.EarlyStoppingCallback.early_stopping_patience",description:`<strong>early_stopping_patience</strong> (<code>int</code>) &#x2014;
Use with <code>metric_for_best_model</code> to stop training when the specified metric worsens for
<code>early_stopping_patience</code> evaluation calls.`,name:"early_stopping_patience"},{anchor:"transformers.EarlyStoppingCallback.early_stopping_threshold(float,",description:`<strong>early_stopping_threshold(<code>float</code>,</strong> <em>optional</em>) &#x2014;
Use with TrainingArguments <code>metric_for_best_model</code> and <code>early_stopping_patience</code> to denote how much the
specified metric must improve to satisfy early stopping conditions. \``,name:"early_stopping_threshold(float,"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L524"}}),hr=new y({props:{name:"class transformers.integrations.TensorBoardCallback",anchor:"transformers.integrations.TensorBoardCallback",parameters:[{name:"tb_writer",val:" = None"}],parametersDescription:[{anchor:"transformers.integrations.TensorBoardCallback.tb_writer",description:`<strong>tb_writer</strong> (<code>SummaryWriter</code>, <em>optional</em>) &#x2014;
The writer to use. Will instantiate one if not set.`,name:"tb_writer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L556"}}),gr=new y({props:{name:"class transformers.integrations.WandbCallback",anchor:"transformers.integrations.WandbCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L645"}}),_r=new y({props:{name:"setup",anchor:"transformers.integrations.WandbCallback.setup",parameters:[{name:"args",val:""},{name:"state",val:""},{name:"model",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L670"}}),ut=new h2({props:{version:"5.0",$$slots:{default:[p2]},$$scope:{ctx:W}}}),$r=new y({props:{name:"class transformers.integrations.MLflowCallback",anchor:"transformers.integrations.MLflowCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L913"}}),Tr=new y({props:{name:"setup",anchor:"transformers.integrations.MLflowCallback.setup",parameters:[{name:"args",val:""},{name:"state",val:""},{name:"model",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L932"}}),wr=new y({props:{name:"class transformers.integrations.AzureMLCallback",anchor:"transformers.integrations.AzureMLCallback",parameters:[{name:"azureml_run",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L890"}}),Ar=new y({props:{name:"class transformers.integrations.CodeCarbonCallback",anchor:"transformers.integrations.CodeCarbonCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L1320"}}),Dr=new y({props:{name:"class transformers.integrations.NeptuneCallback",anchor:"transformers.integrations.NeptuneCallback",parameters:[{name:"api_token",val:": typing.Optional[str] = None"},{name:"project",val:": typing.Optional[str] = None"},{name:"name",val:": typing.Optional[str] = None"},{name:"base_namespace",val:": str = 'finetuning'"},{name:"run",val:": typing.Optional[ForwardRef('Run')] = None"},{name:"log_parameters",val:": bool = True"},{name:"log_checkpoints",val:": typing.Optional[str] = None"},{name:"**neptune_run_kwargs",val:""}],parametersDescription:[{anchor:"transformers.integrations.NeptuneCallback.api_token",description:`<strong>api_token</strong> (<code>str</code>, optional) &#x2014;
Neptune API token obtained upon registration. You can leave this argument out if you have saved your token
to the <code>NEPTUNE_API_TOKEN</code> environment variable (strongly recommended). See full setup instructions in the
<a href="https://docs.neptune.ai/getting-started/installation" rel="nofollow">docs</a>.`,name:"api_token"},{anchor:"transformers.integrations.NeptuneCallback.project",description:`<strong>project</strong> (<code>str</code>, optional) &#x2014;
Name of an existing Neptune project, in the form: &#x201C;workspace-name/project-name&#x201D;. You can find and copy the
name from the project Settings -&gt; Properties in Neptune. If None (default), the value of the
<code>NEPTUNE_PROJECT</code> environment variable will be used.`,name:"project"},{anchor:"transformers.integrations.NeptuneCallback.name",description:"<strong>name</strong> (<code>str</code>, optional) &#x2014; Custom name for the run.",name:"name"},{anchor:"transformers.integrations.NeptuneCallback.base_namespace",description:`<strong>base_namespace</strong> (<code>str</code>, optional, defaults to &#x201C;finetuning&#x201D;) &#x2014; In the Neptune run, the root namespace
that will contain all of the logged metadata.`,name:"base_namespace"},{anchor:"transformers.integrations.NeptuneCallback.log_parameters",description:`<strong>log_parameters</strong> (<code>bool</code>, optional, defaults to True) &#x2014;
If True, logs all Trainer arguments and model parameters provided by the Trainer.`,name:"log_parameters"},{anchor:"transformers.integrations.NeptuneCallback.log_checkpoints",description:`<strong>log_checkpoints</strong> (<code>str</code>, optional, defaults to None) &#x2014;
If &#x201C;same&#x201D;, uploads checkpoints whenever they are saved by the Trainer. If &#x201C;last&#x201D;, uploads only the most
recently saved checkpoint. If &#x201C;best&#x201D;, uploads the best checkpoint (among the ones saved by the Trainer). If
None, does not upload checkpoints.`,name:"log_checkpoints"},{anchor:"transformers.integrations.NeptuneCallback.run",description:`<strong>run</strong> (<code>Run</code>, optional) &#x2014;
Pass a Neptune run object if you want to continue logging to an existing run. Read more about resuming runs
in the <a href="https://docs.neptune.ai/how-to-guides/neptune-api/resume-run" rel="nofollow">docs</a>.`,name:"run"},{anchor:"transformers.integrations.NeptuneCallback.*neptune_run_kwargs",description:`*<strong>*neptune_run_kwargs</strong> (optional) &#x2014;
Additional keyword arguments to be passed directly to the
<a href="https://docs.neptune.ai/api-reference/neptune#.init_run" rel="nofollow">neptune.init_run()</a> function when a new run is
created.`,name:"*neptune_run_kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L1059"}}),Ir=new y({props:{name:"class transformers.integrations.ClearMLCallback",anchor:"transformers.integrations.ClearMLCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations.py#L1349"}}),xr=new Qs({}),Nr=new y({props:{name:"class transformers.TrainerCallback",anchor:"transformers.TrainerCallback",parameters:[],parametersDescription:[{anchor:"transformers.TrainerCallback.args",description:`<strong>args</strong> (<a href="/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>) &#x2014;
The training arguments used to instantiate the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>.`,name:"args"},{anchor:"transformers.TrainerCallback.state",description:`<strong>state</strong> (<a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerState">TrainerState</a>) &#x2014;
The current state of the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>.`,name:"state"},{anchor:"transformers.TrainerCallback.control",description:`<strong>control</strong> (<a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerControl">TrainerControl</a>) &#x2014;
The object that is returned to the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> and can be used to make some decisions.`,name:"control"},{anchor:"transformers.TrainerCallback.model",description:`<strong>model</strong> (<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a> or <code>torch.nn.Module</code>) &#x2014;
The model being trained.`,name:"model"},{anchor:"transformers.TrainerCallback.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>) &#x2014;
The tokenizer used for encoding the data.`,name:"tokenizer"},{anchor:"transformers.TrainerCallback.optimizer",description:`<strong>optimizer</strong> (<code>torch.optim.Optimizer</code>) &#x2014;
The optimizer used for the training steps.`,name:"optimizer"},{anchor:"transformers.TrainerCallback.lr_scheduler",description:`<strong>lr_scheduler</strong> (<code>torch.optim.lr_scheduler.LambdaLR</code>) &#x2014;
The scheduler used for setting the learning rate.`,name:"lr_scheduler"},{anchor:"transformers.TrainerCallback.train_dataloader",description:`<strong>train_dataloader</strong> (<code>torch.utils.data.DataLoader</code>, <em>optional</em>) &#x2014;
The current dataloader used for training.`,name:"train_dataloader"},{anchor:"transformers.TrainerCallback.eval_dataloader",description:`<strong>eval_dataloader</strong> (<code>torch.utils.data.DataLoader</code>, <em>optional</em>) &#x2014;
The current dataloader used for training.`,name:"eval_dataloader"},{anchor:"transformers.TrainerCallback.metrics",description:`<strong>metrics</strong> (<code>Dict[str, float]</code>) &#x2014;
The metrics computed by the last evaluation phase.</p>
<p>Those are only accessible in the event <code>on_evaluate</code>.`,name:"metrics"},{anchor:"transformers.TrainerCallback.logs",description:`<strong>logs</strong>  (<code>Dict[str, float]</code>) &#x2014;
The values to log.</p>
<p>Those are only accessible in the event <code>on_log</code>.`,name:"logs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L159"}}),bt=new c2({props:{anchor:"transformers.TrainerCallback.example",$$slots:{default:[g2]},$$scope:{ctx:W}}}),Fr=new y({props:{name:"on_epoch_begin",anchor:"transformers.TrainerCallback.on_epoch_begin",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L227"}}),Wr=new y({props:{name:"on_epoch_end",anchor:"transformers.TrainerCallback.on_epoch_end",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L233"}}),jr=new y({props:{name:"on_evaluate",anchor:"transformers.TrainerCallback.on_evaluate",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L259"}}),Rr=new y({props:{name:"on_init_end",anchor:"transformers.TrainerCallback.on_init_end",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L209"}}),Br=new y({props:{name:"on_log",anchor:"transformers.TrainerCallback.on_log",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L277"}}),Gr=new y({props:{name:"on_predict",anchor:"transformers.TrainerCallback.on_predict",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"metrics",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L265"}}),Vr=new y({props:{name:"on_prediction_step",anchor:"transformers.TrainerCallback.on_prediction_step",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L283"}}),Ur=new y({props:{name:"on_save",anchor:"transformers.TrainerCallback.on_save",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L271"}}),qr=new y({props:{name:"on_step_begin",anchor:"transformers.TrainerCallback.on_step_begin",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L239"}}),Hr=new y({props:{name:"on_step_end",anchor:"transformers.TrainerCallback.on_step_end",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L252"}}),Jr=new y({props:{name:"on_substep_end",anchor:"transformers.TrainerCallback.on_substep_end",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L246"}}),Yr=new y({props:{name:"on_train_begin",anchor:"transformers.TrainerCallback.on_train_begin",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L215"}}),Xr=new y({props:{name:"on_train_end",anchor:"transformers.TrainerCallback.on_train_end",parameters:[{name:"args",val:": TrainingArguments"},{name:"state",val:": TrainerState"},{name:"control",val:": TrainerControl"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L221"}}),Kr=new m_({props:{code:`class MyCallback(TrainerCallback):
    "A callback that prints a message at the beginning of training"

    def on_train_begin(self, args, state, control, **kwargs):
        print("Starting training")


trainer = Trainer(
    model,
    args,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
    callbacks=[MyCallback],  # We can either pass the callback class this way or an instance of it (MyCallback())
)`,highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">MyCallback</span>(<span class="hljs-title class_ inherited__">TrainerCallback</span>):
    <span class="hljs-string">&quot;A callback that prints a message at the beginning of training&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">on_train_begin</span>(<span class="hljs-params">self, args, state, control, **kwargs</span>):
        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Starting training&quot;</span>)


trainer = Trainer(
    model,
    args,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
    callbacks=[MyCallback],  <span class="hljs-comment"># We can either pass the callback class this way or an instance of it (MyCallback())</span>
)`}}),Qr=new m_({props:{code:`trainer = Trainer(...)
trainer.add_callback(MyCallback)
# Alternatively, we can pass an instance of the callback class
trainer.add_callback(MyCallback())`,highlighted:`trainer = Trainer(...)
trainer.add_callback(MyCallback)
<span class="hljs-comment"># Alternatively, we can pass an instance of the callback class</span>
trainer.add_callback(MyCallback())`}}),Zr=new Qs({}),ea=new y({props:{name:"class transformers.TrainerState",anchor:"transformers.TrainerState",parameters:[{name:"epoch",val:": typing.Optional[float] = None"},{name:"global_step",val:": int = 0"},{name:"max_steps",val:": int = 0"},{name:"num_train_epochs",val:": int = 0"},{name:"total_flos",val:": float = 0"},{name:"log_history",val:": typing.List[typing.Dict[str, float]] = None"},{name:"best_metric",val:": typing.Optional[float] = None"},{name:"best_model_checkpoint",val:": typing.Optional[str] = None"},{name:"is_local_process_zero",val:": bool = True"},{name:"is_world_process_zero",val:": bool = True"},{name:"is_hyper_param_search",val:": bool = False"},{name:"trial_name",val:": str = None"},{name:"trial_params",val:": typing.Dict[str, typing.Union[str, float, int, bool]] = None"}],parametersDescription:[{anchor:"transformers.TrainerState.epoch",description:`<strong>epoch</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Only set during training, will represent the epoch the training is at (the decimal part being the
percentage of the current epoch completed).`,name:"epoch"},{anchor:"transformers.TrainerState.global_step",description:`<strong>global_step</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
During training, represents the number of update steps completed.`,name:"global_step"},{anchor:"transformers.TrainerState.max_steps",description:`<strong>max_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The number of update steps to do during the current training.`,name:"max_steps"},{anchor:"transformers.TrainerState.total_flos",description:`<strong>total_flos</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The total number of floating operations done by the model since the beginning of training (stored as floats
to avoid overflow).`,name:"total_flos"},{anchor:"transformers.TrainerState.log_history",description:`<strong>log_history</strong> (<code>List[Dict[str, float]]</code>, <em>optional</em>) &#x2014;
The list of logs done since the beginning of training.`,name:"log_history"},{anchor:"transformers.TrainerState.best_metric",description:`<strong>best_metric</strong> (<code>float</code>, <em>optional</em>) &#x2014;
When tracking the best model, the value of the best metric encountered so far.`,name:"best_metric"},{anchor:"transformers.TrainerState.best_model_checkpoint",description:`<strong>best_model_checkpoint</strong> (<code>str</code>, <em>optional</em>) &#x2014;
When tracking the best model, the value of the name of the checkpoint for the best model encountered so
far.`,name:"best_model_checkpoint"},{anchor:"transformers.TrainerState.is_local_process_zero",description:`<strong>is_local_process_zero</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not this process is the local (e.g., on one machine if training in a distributed fashion on
several machines) main process.`,name:"is_local_process_zero"},{anchor:"transformers.TrainerState.is_world_process_zero",description:`<strong>is_world_process_zero</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
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 <code>True</code> for one process).`,name:"is_world_process_zero"},{anchor:"transformers.TrainerState.is_hyper_param_search",description:`<strong>is_hyper_param_search</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether we are in the process of a hyper parameter search using Trainer.hyperparameter_search. This will
impact the way data will be logged in TensorBoard.`,name:"is_hyper_param_search"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L35"}}),Nt=new e2({props:{$$slots:{default:[u2]},$$scope:{ctx:W}}}),ta=new y({props:{name:"load_from_json",anchor:"transformers.TrainerState.load_from_json",parameters:[{name:"json_path",val:": str"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L101"}}),aa=new y({props:{name:"save_to_json",anchor:"transformers.TrainerState.save_to_json",parameters:[{name:"json_path",val:": str"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L95"}}),oa=new Qs({}),sa=new y({props:{name:"class transformers.TrainerControl",anchor:"transformers.TrainerControl",parameters:[{name:"should_training_stop",val:": bool = False"},{name:"should_epoch_stop",val:": bool = False"},{name:"should_save",val:": bool = False"},{name:"should_evaluate",val:": bool = False"},{name:"should_log",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TrainerControl.should_training_stop",description:`<strong>should_training_stop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the training should be interrupted.</p>
<p>If <code>True</code>, this variable will not be set back to <code>False</code>. The training will just stop.`,name:"should_training_stop"},{anchor:"transformers.TrainerControl.should_epoch_stop",description:`<strong>should_epoch_stop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the current epoch should be interrupted.</p>
<p>If <code>True</code>, this variable will be set back to <code>False</code> at the beginning of the next epoch.`,name:"should_epoch_stop"},{anchor:"transformers.TrainerControl.should_save",description:`<strong>should_save</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should be saved at this step.</p>
<p>If <code>True</code>, this variable will be set back to <code>False</code> at the beginning of the next step.`,name:"should_save"},{anchor:"transformers.TrainerControl.should_evaluate",description:`<strong>should_evaluate</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should be evaluated at this step.</p>
<p>If <code>True</code>, this variable will be set back to <code>False</code> at the beginning of the next step.`,name:"should_evaluate"},{anchor:"transformers.TrainerControl.should_log",description:`<strong>should_log</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the logs should be reported at this step.</p>
<p>If <code>True</code>, this variable will be set back to <code>False</code> at the beginning of the next step.`,name:"should_log"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L110"}}),{c(){h=n("meta"),D=c(),u=n("h1"),C=n("a"),A=n("span"),_(k.$$.fragment),L=c(),w=n("span"),M=t("Callbacks"),x=c(),Y=n("p"),Se=t(`Callbacks are objects that can customize the behavior of the training loop in the PyTorch
`),da=n("a"),Ei=t("Trainer"),ki=t(` (this feature is not yet implemented in TensorFlow) that can inspect the training loop
state (for progress reporting, logging on TensorBoard or other ML platforms\u2026) and take decisions (like early
stopping).`),Zs=c(),oe=n("p"),$i=t("Callbacks are \u201Cread only\u201D pieces of code, apart from the "),fa=n("a"),Ci=t("TrainerControl"),Ti=t(` object they return, they
cannot change anything in the training loop. For customizations that require changes in the training loop, you should
subclass `),ma=n("a"),wi=t("Trainer"),yi=t(" and override the methods you need (see "),ha=n("a"),Ai=t("trainer"),Li=t(" for examples)."),el=c(),st=n("p"),Di=t("By default a "),pa=n("a"),Oi=t("Trainer"),Mi=t(" will use the following callbacks:"),tl=c(),S=n("ul"),ga=n("li"),ua=n("a"),Ii=t("DefaultFlowCallback"),Si=t(" which handles the default behavior for logging, saving and evaluation."),xi=c(),Le=n("li"),_a=n("a"),Ni=t("PrinterCallback"),Pi=t(" or "),ba=n("a"),Fi=t("ProgressCallback"),Wi=t(` to display progress and print the
logs (the first one is used if you deactivate tqdm through the `),va=n("a"),ji=t("TrainingArguments"),Ri=t(`, otherwise
it\u2019s the second one).`),zi=c(),Ea=n("li"),ka=n("a"),Bi=t("TensorBoardCallback"),Gi=t(` if tensorboard is accessible (either through PyTorch >= 1.4
or tensorboardX).`),Vi=c(),lt=n("li"),$a=n("a"),Ui=t("WandbCallback"),qi=t(" if "),qt=n("a"),Hi=t("wandb"),Ji=t(" is installed."),Yi=c(),it=n("li"),Ca=n("a"),Xi=t("CometCallback"),Ki=t(" if "),Ht=n("a"),Qi=t("comet_ml"),Zi=t(" is installed."),ec=c(),ct=n("li"),Ta=n("a"),tc=t("MLflowCallback"),rc=t(" if "),Jt=n("a"),ac=t("mlflow"),nc=t(" is installed."),oc=c(),dt=n("li"),wa=n("a"),sc=t("NeptuneCallback"),lc=t(" if "),Yt=n("a"),ic=t("neptune"),cc=t(" is installed."),dc=c(),ft=n("li"),ya=n("a"),fc=t("AzureMLCallback"),mc=t(" if "),Xt=n("a"),hc=t("azureml-sdk"),pc=t(` is
installed.`),gc=c(),mt=n("li"),Aa=n("a"),uc=t("CodeCarbonCallback"),_c=t(" if "),Kt=n("a"),bc=t("codecarbon"),vc=t(` is
installed.`),Ec=c(),ht=n("li"),La=n("a"),kc=t("ClearMLCallback"),$c=t(" if "),Qt=n("a"),Cc=t("clearml"),Tc=t(" is installed."),rl=c(),B=n("p"),wc=t("The main class that implements callbacks is "),Da=n("a"),yc=t("TrainerCallback"),Ac=t(`. It gets the
`),Oa=n("a"),Lc=t("TrainingArguments"),Dc=t(" used to instantiate the "),Ma=n("a"),Oc=t("Trainer"),Mc=t(`, can access that
Trainer\u2019s internal state via `),Ia=n("a"),Ic=t("TrainerState"),Sc=t(`, and can take some actions on the training loop via
`),Sa=n("a"),xc=t("TrainerControl"),Nc=t("."),al=c(),xe=n("h2"),pt=n("a"),pn=n("span"),_(Zt.$$.fragment),Pc=c(),gn=n("span"),Fc=t("Available Callbacks"),nl=c(),gt=n("p"),Wc=t("Here is the list of the available "),xa=n("a"),jc=t("TrainerCallback"),Rc=t(" in the library:"),ol=c(),ue=n("div"),_(er.$$.fragment),zc=c(),Ne=n("p"),Bc=t("A "),Na=n("a"),Gc=t("TrainerCallback"),Vc=t(" that sends the logs to "),tr=n("a"),Uc=t("Comet ML"),qc=t("."),Hc=c(),X=n("div"),_(rr.$$.fragment),Jc=c(),un=n("p"),Yc=t("Setup the optional Comet.ml integration."),Xc=c(),_n=n("p"),Kc=t("Environment:"),Qc=c(),_e=n("ul"),R=n("li"),bn=n("strong"),Zc=t("COMET_MODE"),ed=t(" ("),vn=n("code"),td=t("str"),rd=t(", "),En=n("em"),ad=t("optional"),nd=t(", defaults to "),kn=n("code"),od=t("ONLINE"),sd=t(`):
Whether to create an online, offline experiment or disable Comet logging. Can be `),$n=n("code"),ld=t("OFFLINE"),id=t(", "),Cn=n("code"),cd=t("ONLINE"),dd=t(`, or
`),Tn=n("code"),fd=t("DISABLED"),md=t("."),hd=c(),De=n("li"),wn=n("strong"),pd=t("COMET_PROJECT_NAME"),gd=t(" ("),yn=n("code"),ud=t("str"),_d=t(", "),An=n("em"),bd=t("optional"),vd=t(`):
Comet project name for experiments.`),Ed=c(),K=n("li"),Ln=n("strong"),kd=t("COMET_OFFLINE_DIRECTORY"),$d=t(" ("),Dn=n("code"),Cd=t("str"),Td=t(", "),On=n("em"),wd=t("optional"),yd=t(`):
Folder to use for saving offline experiments when `),Mn=n("code"),Ad=t("COMET_MODE"),Ld=t(" is "),In=n("code"),Dd=t("OFFLINE"),Od=t("."),Md=c(),G=n("li"),Sn=n("strong"),Id=t("COMET_LOG_ASSETS"),Sd=t(" ("),xn=n("code"),xd=t("str"),Nd=t(", "),Nn=n("em"),Pd=t("optional"),Fd=t(", defaults to "),Pn=n("code"),Wd=t("TRUE"),jd=t(`):
Whether or not to log training assets (tf event logs, checkpoints, etc), to Comet. Can be `),Fn=n("code"),Rd=t("TRUE"),zd=t(`, or
`),Wn=n("code"),Bd=t("FALSE"),Gd=t("."),Vd=c(),ar=n("p"),Ud=t(`For a number of configurable items in the environment, see
`),nr=n("a"),qd=t("here"),Hd=t("."),sl=c(),Pe=n("div"),_(or.$$.fragment),Jd=c(),sr=n("p"),Yd=t("A "),Pa=n("a"),Xd=t("TrainerCallback"),Kd=t(" that handles the default flow of the training loop for logs, evaluation and checkpoints."),ll=c(),Fe=n("div"),_(lr.$$.fragment),Qd=c(),ir=n("p"),Zd=t("A bare "),Fa=n("a"),ef=t("TrainerCallback"),tf=t(" that just prints the logs."),il=c(),We=n("div"),_(cr.$$.fragment),rf=c(),dr=n("p"),af=t("A "),Wa=n("a"),nf=t("TrainerCallback"),of=t(" that displays the progress of training or evaluation."),cl=c(),be=n("div"),_(fr.$$.fragment),sf=c(),mr=n("p"),lf=t("A "),ja=n("a"),cf=t("TrainerCallback"),df=t(" that handles early stopping."),ff=c(),ve=n("p"),mf=t("This callback depends on "),Ra=n("a"),hf=t("TrainingArguments"),pf=t(" argument "),jn=n("em"),gf=t("load_best_model_at_end"),uf=t(` functionality to set best_metric
in `),za=n("a"),_f=t("TrainerState"),bf=t("."),dl=c(),je=n("div"),_(hr.$$.fragment),vf=c(),Re=n("p"),Ef=t("A "),Ba=n("a"),kf=t("TrainerCallback"),$f=t(" that sends the logs to "),pr=n("a"),Cf=t("TensorBoard"),Tf=t("."),fl=c(),Ee=n("div"),_(gr.$$.fragment),wf=c(),ze=n("p"),yf=t("A "),Ga=n("a"),Af=t("TrainerCallback"),Lf=t(" that logs metrics, media, model checkpoints to "),ur=n("a"),Df=t("Weight and Biases"),Of=t("."),Mf=c(),Q=n("div"),_(_r.$$.fragment),If=c(),br=n("p"),Sf=t("Setup the optional Weights & Biases ("),Rn=n("em"),xf=t("wandb"),Nf=t(") integration."),Pf=c(),vr=n("p"),Ff=t(`One can subclass and override this method to customize the setup if needed. Find more information
`),Er=n("a"),Wf=t("here"),jf=t(`. You can also override the following environment
variables:`),Rf=c(),zn=n("p"),zf=t("Environment:"),Bf=c(),ke=n("ul"),kr=n("li"),O=n("p"),Bn=n("strong"),Gf=t("WANDB_LOG_MODEL"),Vf=t(" ("),Gn=n("code"),Uf=t("str"),qf=t(", "),Vn=n("em"),Hf=t("optional"),Jf=t(", defaults to "),Un=n("code"),Yf=t('"false"'),Xf=t(`):
Whether to log model and checkpoints during training. Can be `),qn=n("code"),Kf=t('"end"'),Qf=t(", "),Hn=n("code"),Zf=t('"checkpoint"'),em=t(" or "),Jn=n("code"),tm=t('"false"'),rm=t(`. If set
to `),Yn=n("code"),am=t('"end"'),nm=t(", the model will be uploaded at the end of training. If set to "),Xn=n("code"),om=t('"checkpoint"'),sm=t(`, the checkpoint
will be uploaded every `),Kn=n("code"),lm=t("args.save_steps"),im=t(" . If set to "),Qn=n("code"),cm=t('"false"'),dm=t(`, the model will not be uploaded. Use along
with `),Zn=n("code"),fm=t("load_best_model_at_end()"),mm=t(" to upload best model."),hm=c(),_(ut.$$.fragment),pm=c(),eo=n("li"),N=n("p"),to=n("strong"),gm=t("WANDB_WATCH"),um=t(" ("),ro=n("code"),_m=t("str"),bm=t(", "),ao=n("em"),vm=t("optional"),Em=t(" defaults to "),no=n("code"),km=t('"false"'),$m=t(`):
Can be `),oo=n("code"),Cm=t('"gradients"'),Tm=t(", "),so=n("code"),wm=t('"all"'),ym=t(", "),lo=n("code"),Am=t('"parameters"'),Lm=t(", or "),io=n("code"),Dm=t('"false"'),Om=t(". Set to "),co=n("code"),Mm=t('"all"'),Im=t(` to log gradients and
parameters.`),Sm=c(),fo=n("li"),se=n("p"),mo=n("strong"),xm=t("WANDB_PROJECT"),Nm=t(" ("),ho=n("code"),Pm=t("str"),Fm=t(", "),po=n("em"),Wm=t("optional"),jm=t(", defaults to "),go=n("code"),Rm=t('"huggingface"'),zm=t(`):
Set this to a custom string to store results in a different project.`),Bm=c(),uo=n("li"),Z=n("p"),_o=n("strong"),Gm=t("WANDB_DISABLED"),Vm=t(" ("),bo=n("code"),Um=t("bool"),qm=t(", "),vo=n("em"),Hm=t("optional"),Jm=t(", defaults to "),Eo=n("code"),Ym=t("False"),Xm=t(`):
Whether to disable wandb entirely. Set `),ko=n("code"),Km=t("WANDB_DISABLED=true"),Qm=t(" to disable."),ml=c(),$e=n("div"),_($r.$$.fragment),Zm=c(),Ce=n("p"),eh=t("A "),Va=n("a"),th=t("TrainerCallback"),rh=t(" that sends the logs to "),Cr=n("a"),ah=t("MLflow"),nh=t(`. Can be disabled by setting
environment variable `),$o=n("code"),oh=t("DISABLE_MLFLOW_INTEGRATION = TRUE"),sh=t("."),lh=c(),le=n("div"),_(Tr.$$.fragment),ih=c(),Co=n("p"),ch=t("Setup the optional MLflow integration."),dh=c(),To=n("p"),fh=t("Environment:"),mh=c(),U=n("ul"),P=n("li"),wo=n("strong"),hh=t("HF_MLFLOW_LOG_ARTIFACTS"),ph=t(" ("),yo=n("code"),gh=t("str"),uh=t(", "),Ao=n("em"),_h=t("optional"),bh=t(`):
Whether to use MLflow `),Lo=n("code"),vh=t(".log_artifact()"),Eh=t(` facility to log artifacts. This only makes sense if logging to a
remote server, e.g. s3 or GCS. If set to `),Do=n("code"),kh=t("True"),$h=t(" or "),Oo=n("em"),Ch=t("1"),Th=t(`, will copy each saved checkpoint on each save in
`),Ua=n("a"),wh=t("TrainingArguments"),yh=t("\u2019s "),Mo=n("code"),Ah=t("output_dir"),Lh=t(` to the local or remote artifact storage. Using it without a remote
storage will just copy the files to your artifact location.`),Dh=c(),V=n("li"),Io=n("strong"),Oh=t("MLFLOW_EXPERIMENT_NAME"),Mh=t(" ("),So=n("code"),Ih=t("str"),Sh=t(", "),xo=n("em"),xh=t("optional"),Nh=t(", defaults to "),No=n("code"),Ph=t("None"),Fh=t(`):
Whether to use an MLflow experiment_name under which to launch the run. Default to `),Po=n("code"),Wh=t("None"),jh=t(` which will point
to the `),Fo=n("code"),Rh=t("Default"),zh=t(` experiment in MLflow. Otherwise, it is a case sensitive name of the experiment to be
activated. If an experiment with this name does not exist, a new experiment with this name is created.`),Bh=c(),ie=n("li"),Wo=n("strong"),Gh=t("MLFLOW_TAGS"),Vh=t(" ("),jo=n("code"),Uh=t("str"),qh=t(", "),Ro=n("em"),Hh=t("optional"),Jh=t(`):
A string dump of a dictionary of key/value pair to be added to the MLflow run as tags. Example:
`),zo=n("code"),Yh=t(`os.environ['MLFLOW_TAGS']='{"release.candidate": "RC1", "release.version": "2.2.0"}'`),Xh=t("."),Kh=c(),ee=n("li"),Bo=n("strong"),Qh=t("MLFLOW_NESTED_RUN"),Zh=t(" ("),Go=n("code"),ep=t("str"),tp=t(", "),Vo=n("em"),rp=t("optional"),ap=t(`):
Whether to use MLflow nested runs. If set to `),Uo=n("code"),np=t("True"),op=t(" or "),qo=n("em"),sp=t("1"),lp=t(`, will create a nested run inside the current
run.`),ip=c(),te=n("li"),Ho=n("strong"),cp=t("MLFLOW_RUN_ID"),dp=t(" ("),Jo=n("code"),fp=t("str"),mp=t(", "),Yo=n("em"),hp=t("optional"),pp=t(`):
Allow to reattach to an existing run which can be usefull when resuming training from a checkpoint. When
`),Xo=n("code"),gp=t("MLFLOW_RUN_ID"),up=t(" environment variable is set, "),Ko=n("code"),_p=t("start_run"),bp=t(` attempts to resume a run with the specified run ID
and other parameters are ignored.`),vp=c(),ce=n("li"),Qo=n("strong"),Ep=t("MLFLOW_FLATTEN_PARAMS"),kp=t(" ("),Zo=n("code"),$p=t("str"),Cp=t(", "),es=n("em"),Tp=t("optional"),wp=t(", defaults to "),ts=n("code"),yp=t("False"),Ap=t(`):
Whether to flatten the parameters dictionary before logging.`),hl=c(),Be=n("div"),_(wr.$$.fragment),Lp=c(),Ge=n("p"),Dp=t("A "),qa=n("a"),Op=t("TrainerCallback"),Mp=t(" that sends the logs to "),yr=n("a"),Ip=t("AzureML"),Sp=t("."),pl=c(),Ve=n("div"),_(Ar.$$.fragment),xp=c(),Lr=n("p"),Np=t("A "),Ha=n("a"),Pp=t("TrainerCallback"),Fp=t(" that tracks the CO2 emission of training."),gl=c(),Ue=n("div"),_(Dr.$$.fragment),Wp=c(),Or=n("p"),jp=t("TrainerCallback that sends the logs to "),Mr=n("a"),Rp=t("Neptune"),zp=t("."),ul=c(),re=n("div"),_(Ir.$$.fragment),Bp=c(),qe=n("p"),Gp=t("A "),Ja=n("a"),Vp=t("TrainerCallback"),Up=t(" that sends the logs to "),Sr=n("a"),qp=t("ClearML"),Hp=t("."),Jp=c(),rs=n("p"),Yp=t("Environment:"),Xp=c(),He=n("ul"),de=n("li"),as=n("strong"),Kp=t("CLEARML_PROJECT"),Qp=t(" ("),ns=n("code"),Zp=t("str"),eg=t(", "),os=n("em"),tg=t("optional"),rg=t(", defaults to "),ss=n("code"),ag=t("HuggingFace Transformers"),ng=t(`):
ClearML project name.`),og=c(),fe=n("li"),ls=n("strong"),sg=t("CLEARML_TASK"),lg=t(" ("),is=n("code"),ig=t("str"),cg=t(", "),cs=n("em"),dg=t("optional"),fg=t(", defaults to "),ds=n("code"),mg=t("Trainer"),hg=t(`):
ClearML task name.`),pg=c(),me=n("li"),fs=n("strong"),gg=t("CLEARML_LOG_MODEL"),ug=t(" ("),ms=n("code"),_g=t("bool"),bg=t(", "),hs=n("em"),vg=t("optional"),Eg=t(", defaults to "),ps=n("code"),kg=t("False"),$g=t(`):
Whether to log models as artifacts during training.`),_l=c(),Je=n("h2"),_t=n("a"),gs=n("span"),_(xr.$$.fragment),Cg=c(),us=n("span"),Tg=t("TrainerCallback"),bl=c(),$=n("div"),_(Nr.$$.fragment),wg=c(),_s=n("p"),yg=t(`A class for objects that will inspect the state of the training loop at some events and take some decisions. At
each of those events the following arguments are available:`),Ag=c(),Pr=n("p"),Lg=t("The "),bs=n("code"),Dg=t("control"),Og=t(` object is the only one that can be changed by the callback, in which case the event that changes it
should return the modified version.`),Mg=c(),q=n("p"),Ig=t("The argument "),vs=n("code"),Sg=t("args"),xg=t(", "),Es=n("code"),Ng=t("state"),Pg=t(" and "),ks=n("code"),Fg=t("control"),Wg=t(" are positionals for all events, all the others are grouped in "),$s=n("code"),jg=t("kwargs"),Rg=t(`.
You can unpack the ones you need in the signature of the event using them. As an example, see the code of the
simple `),Cs=n("code"),zg=t("~transformer.PrinterCallback"),Bg=t("."),Gg=c(),_(bt.$$.fragment),Vg=c(),vt=n("div"),_(Fr.$$.fragment),Ug=c(),Ts=n("p"),qg=t("Event called at the beginning of an epoch."),Hg=c(),Et=n("div"),_(Wr.$$.fragment),Jg=c(),ws=n("p"),Yg=t("Event called at the end of an epoch."),Xg=c(),kt=n("div"),_(jr.$$.fragment),Kg=c(),ys=n("p"),Qg=t("Event called after an evaluation phase."),Zg=c(),$t=n("div"),_(Rr.$$.fragment),eu=c(),zr=n("p"),tu=t("Event called at the end of the initialization of the "),Ya=n("a"),ru=t("Trainer"),au=t("."),nu=c(),Ct=n("div"),_(Br.$$.fragment),ou=c(),As=n("p"),su=t("Event called after logging the last logs."),lu=c(),Tt=n("div"),_(Gr.$$.fragment),iu=c(),Ls=n("p"),cu=t("Event called after a successful prediction."),du=c(),wt=n("div"),_(Vr.$$.fragment),fu=c(),Ds=n("p"),mu=t("Event called after a prediction step."),hu=c(),yt=n("div"),_(Ur.$$.fragment),pu=c(),Os=n("p"),gu=t("Event called after a checkpoint save."),uu=c(),At=n("div"),_(qr.$$.fragment),_u=c(),Ms=n("p"),bu=t(`Event called at the beginning of a training step. If using gradient accumulation, one training step might take
several inputs.`),vu=c(),Lt=n("div"),_(Hr.$$.fragment),Eu=c(),Is=n("p"),ku=t(`Event called at the end of a training step. If using gradient accumulation, one training step might take
several inputs.`),$u=c(),Dt=n("div"),_(Jr.$$.fragment),Cu=c(),Ss=n("p"),Tu=t("Event called at the end of an substep during gradient accumulation."),wu=c(),Ot=n("div"),_(Yr.$$.fragment),yu=c(),xs=n("p"),Au=t("Event called at the beginning of training."),Lu=c(),Mt=n("div"),_(Xr.$$.fragment),Du=c(),Ns=n("p"),Ou=t("Event called at the end of training."),vl=c(),It=n("p"),Mu=t("Here is an example of how to register a custom callback with the PyTorch "),Xa=n("a"),Iu=t("Trainer"),Su=t(":"),El=c(),_(Kr.$$.fragment),kl=c(),St=n("p"),xu=t("Another way to register a callback is to call "),Ps=n("code"),Nu=t("trainer.add_callback()"),Pu=t(" as follows:"),$l=c(),_(Qr.$$.fragment),Cl=c(),Ye=n("h2"),xt=n("a"),Fs=n("span"),_(Zr.$$.fragment),Fu=c(),Ws=n("span"),Wu=t("TrainerState"),Tl=c(),H=n("div"),_(ea.$$.fragment),ju=c(),Xe=n("p"),Ru=t("A class containing the "),Ka=n("a"),zu=t("Trainer"),Bu=t(` inner state that will be saved along the model and optimizer when checkpointing
and passed to the `),Qa=n("a"),Gu=t("TrainerCallback"),Vu=t("."),Uu=c(),_(Nt.$$.fragment),qu=c(),Pt=n("div"),_(ta.$$.fragment),Hu=c(),ra=n("p"),Ju=t("Create an instance from the content of "),js=n("code"),Yu=t("json_path"),Xu=t("."),Ku=c(),Ft=n("div"),_(aa.$$.fragment),Qu=c(),na=n("p"),Zu=t("Save the content of this instance in JSON format inside "),Rs=n("code"),e_=t("json_path"),t_=t("."),wl=c(),Ke=n("h2"),Wt=n("a"),zs=n("span"),_(oa.$$.fragment),r_=c(),Bs=n("span"),a_=t("TrainerControl"),yl=c(),Qe=n("div"),_(sa.$$.fragment),n_=c(),Ze=n("p"),o_=t("A class that handles the "),Za=n("a"),s_=t("Trainer"),l_=t(" control flow. This class is used by the "),en=n("a"),i_=t("TrainerCallback"),c_=t(` to activate some
switches in the training loop.`),this.h()},l(l){const f=s2('[data-svelte="svelte-1phssyn"]',document.head);h=o(f,"META",{name:!0,content:!0}),f.forEach(a),D=d(l),u=o(l,"H1",{class:!0});var la=s(u);C=o(la,"A",{id:!0,class:!0,href:!0});var Gs=s(C);A=o(Gs,"SPAN",{});var Vs=s(A);b(k.$$.fragment,Vs),Vs.forEach(a),Gs.forEach(a),L=d(la),w=o(la,"SPAN",{});var h_=s(w);M=r(h_,"Callbacks"),h_.forEach(a),la.forEach(a),x=d(l),Y=o(l,"P",{});var Ll=s(Y);Se=r(Ll,`Callbacks are objects that can customize the behavior of the training loop in the PyTorch
`),da=o(Ll,"A",{href:!0});var p_=s(da);Ei=r(p_,"Trainer"),p_.forEach(a),ki=r(Ll,` (this feature is not yet implemented in TensorFlow) that can inspect the training loop
state (for progress reporting, logging on TensorBoard or other ML platforms\u2026) and take decisions (like early
stopping).`),Ll.forEach(a),Zs=d(l),oe=o(l,"P",{});var jt=s(oe);$i=r(jt,"Callbacks are \u201Cread only\u201D pieces of code, apart from the "),fa=o(jt,"A",{href:!0});var g_=s(fa);Ci=r(g_,"TrainerControl"),g_.forEach(a),Ti=r(jt,` object they return, they
cannot change anything in the training loop. For customizations that require changes in the training loop, you should
subclass `),ma=o(jt,"A",{href:!0});var u_=s(ma);wi=r(u_,"Trainer"),u_.forEach(a),yi=r(jt," and override the methods you need (see "),ha=o(jt,"A",{href:!0});var __=s(ha);Ai=r(__,"trainer"),__.forEach(a),Li=r(jt," for examples)."),jt.forEach(a),el=d(l),st=o(l,"P",{});var Dl=s(st);Di=r(Dl,"By default a "),pa=o(Dl,"A",{href:!0});var b_=s(pa);Oi=r(b_,"Trainer"),b_.forEach(a),Mi=r(Dl," will use the following callbacks:"),Dl.forEach(a),tl=d(l),S=o(l,"UL",{});var F=s(S);ga=o(F,"LI",{});var d_=s(ga);ua=o(d_,"A",{href:!0});var v_=s(ua);Ii=r(v_,"DefaultFlowCallback"),v_.forEach(a),Si=r(d_," which handles the default behavior for logging, saving and evaluation."),d_.forEach(a),xi=d(F),Le=o(F,"LI",{});var ia=s(Le);_a=o(ia,"A",{href:!0});var E_=s(_a);Ni=r(E_,"PrinterCallback"),E_.forEach(a),Pi=r(ia," or "),ba=o(ia,"A",{href:!0});var k_=s(ba);Fi=r(k_,"ProgressCallback"),k_.forEach(a),Wi=r(ia,` to display progress and print the
logs (the first one is used if you deactivate tqdm through the `),va=o(ia,"A",{href:!0});var $_=s(va);ji=r($_,"TrainingArguments"),$_.forEach(a),Ri=r(ia,`, otherwise
it\u2019s the second one).`),ia.forEach(a),zi=d(F),Ea=o(F,"LI",{});var f_=s(Ea);ka=o(f_,"A",{href:!0});var C_=s(ka);Bi=r(C_,"TensorBoardCallback"),C_.forEach(a),Gi=r(f_,` if tensorboard is accessible (either through PyTorch >= 1.4
or tensorboardX).`),f_.forEach(a),Vi=d(F),lt=o(F,"LI",{});var Us=s(lt);$a=o(Us,"A",{href:!0});var T_=s($a);Ui=r(T_,"WandbCallback"),T_.forEach(a),qi=r(Us," if "),qt=o(Us,"A",{href:!0,rel:!0});var w_=s(qt);Hi=r(w_,"wandb"),w_.forEach(a),Ji=r(Us," is installed."),Us.forEach(a),Yi=d(F),it=o(F,"LI",{});var qs=s(it);Ca=o(qs,"A",{href:!0});var y_=s(Ca);Xi=r(y_,"CometCallback"),y_.forEach(a),Ki=r(qs," if "),Ht=o(qs,"A",{href:!0,rel:!0});var A_=s(Ht);Qi=r(A_,"comet_ml"),A_.forEach(a),Zi=r(qs," is installed."),qs.forEach(a),ec=d(F),ct=o(F,"LI",{});var Hs=s(ct);Ta=o(Hs,"A",{href:!0});var L_=s(Ta);tc=r(L_,"MLflowCallback"),L_.forEach(a),rc=r(Hs," if "),Jt=o(Hs,"A",{href:!0,rel:!0});var D_=s(Jt);ac=r(D_,"mlflow"),D_.forEach(a),nc=r(Hs," is installed."),Hs.forEach(a),oc=d(F),dt=o(F,"LI",{});var Js=s(dt);wa=o(Js,"A",{href:!0});var O_=s(wa);sc=r(O_,"NeptuneCallback"),O_.forEach(a),lc=r(Js," if "),Yt=o(Js,"A",{href:!0,rel:!0});var M_=s(Yt);ic=r(M_,"neptune"),M_.forEach(a),cc=r(Js," is installed."),Js.forEach(a),dc=d(F),ft=o(F,"LI",{});var Ys=s(ft);ya=o(Ys,"A",{href:!0});var I_=s(ya);fc=r(I_,"AzureMLCallback"),I_.forEach(a),mc=r(Ys," if "),Xt=o(Ys,"A",{href:!0,rel:!0});var S_=s(Xt);hc=r(S_,"azureml-sdk"),S_.forEach(a),pc=r(Ys,` is
installed.`),Ys.forEach(a),gc=d(F),mt=o(F,"LI",{});var Xs=s(mt);Aa=o(Xs,"A",{href:!0});var x_=s(Aa);uc=r(x_,"CodeCarbonCallback"),x_.forEach(a),_c=r(Xs," if "),Kt=o(Xs,"A",{href:!0,rel:!0});var N_=s(Kt);bc=r(N_,"codecarbon"),N_.forEach(a),vc=r(Xs,` is
installed.`),Xs.forEach(a),Ec=d(F),ht=o(F,"LI",{});var Ks=s(ht);La=o(Ks,"A",{href:!0});var P_=s(La);kc=r(P_,"ClearMLCallback"),P_.forEach(a),$c=r(Ks," if "),Qt=o(Ks,"A",{href:!0,rel:!0});var F_=s(Qt);Cc=r(F_,"clearml"),F_.forEach(a),Tc=r(Ks," is installed."),Ks.forEach(a),F.forEach(a),rl=d(l),B=o(l,"P",{});var he=s(B);wc=r(he,"The main class that implements callbacks is "),Da=o(he,"A",{href:!0});var W_=s(Da);yc=r(W_,"TrainerCallback"),W_.forEach(a),Ac=r(he,`. It gets the
`),Oa=o(he,"A",{href:!0});var j_=s(Oa);Lc=r(j_,"TrainingArguments"),j_.forEach(a),Dc=r(he," used to instantiate the "),Ma=o(he,"A",{href:!0});var R_=s(Ma);Oc=r(R_,"Trainer"),R_.forEach(a),Mc=r(he,`, can access that
Trainer\u2019s internal state via `),Ia=o(he,"A",{href:!0});var z_=s(Ia);Ic=r(z_,"TrainerState"),z_.forEach(a),Sc=r(he,`, and can take some actions on the training loop via
`),Sa=o(he,"A",{href:!0});var B_=s(Sa);xc=r(B_,"TrainerControl"),B_.forEach(a),Nc=r(he,"."),he.forEach(a),al=d(l),xe=o(l,"H2",{class:!0});var Ol=s(xe);pt=o(Ol,"A",{id:!0,class:!0,href:!0});var G_=s(pt);pn=o(G_,"SPAN",{});var V_=s(pn);b(Zt.$$.fragment,V_),V_.forEach(a),G_.forEach(a),Pc=d(Ol),gn=o(Ol,"SPAN",{});var U_=s(gn);Fc=r(U_,"Available Callbacks"),U_.forEach(a),Ol.forEach(a),nl=d(l),gt=o(l,"P",{});var Ml=s(gt);Wc=r(Ml,"Here is the list of the available "),xa=o(Ml,"A",{href:!0});var q_=s(xa);jc=r(q_,"TrainerCallback"),q_.forEach(a),Rc=r(Ml," in the library:"),Ml.forEach(a),ol=d(l),ue=o(l,"DIV",{class:!0});var tn=s(ue);b(er.$$.fragment,tn),zc=d(tn),Ne=o(tn,"P",{});var rn=s(Ne);Bc=r(rn,"A "),Na=o(rn,"A",{href:!0});var H_=s(Na);Gc=r(H_,"TrainerCallback"),H_.forEach(a),Vc=r(rn," that sends the logs to "),tr=o(rn,"A",{href:!0,rel:!0});var J_=s(tr);Uc=r(J_,"Comet ML"),J_.forEach(a),qc=r(rn,"."),rn.forEach(a),Hc=d(tn),X=o(tn,"DIV",{class:!0});var Oe=s(X);b(rr.$$.fragment,Oe),Jc=d(Oe),un=o(Oe,"P",{});var Y_=s(un);Yc=r(Y_,"Setup the optional Comet.ml integration."),Y_.forEach(a),Xc=d(Oe),_n=o(Oe,"P",{});var X_=s(_n);Kc=r(X_,"Environment:"),X_.forEach(a),Qc=d(Oe),_e=o(Oe,"UL",{});var Rt=s(_e);R=o(Rt,"LI",{});var J=s(R);bn=o(J,"STRONG",{});var K_=s(bn);Zc=r(K_,"COMET_MODE"),K_.forEach(a),ed=r(J," ("),vn=o(J,"CODE",{});var Q_=s(vn);td=r(Q_,"str"),Q_.forEach(a),rd=r(J,", "),En=o(J,"EM",{});var Z_=s(En);ad=r(Z_,"optional"),Z_.forEach(a),nd=r(J,", defaults to "),kn=o(J,"CODE",{});var eb=s(kn);od=r(eb,"ONLINE"),eb.forEach(a),sd=r(J,`):
Whether to create an online, offline experiment or disable Comet logging. Can be `),$n=o(J,"CODE",{});var tb=s($n);ld=r(tb,"OFFLINE"),tb.forEach(a),id=r(J,", "),Cn=o(J,"CODE",{});var rb=s(Cn);cd=r(rb,"ONLINE"),rb.forEach(a),dd=r(J,`, or
`),Tn=o(J,"CODE",{});var ab=s(Tn);fd=r(ab,"DISABLED"),ab.forEach(a),md=r(J,"."),J.forEach(a),hd=d(Rt),De=o(Rt,"LI",{});var ca=s(De);wn=o(ca,"STRONG",{});var nb=s(wn);pd=r(nb,"COMET_PROJECT_NAME"),nb.forEach(a),gd=r(ca," ("),yn=o(ca,"CODE",{});var ob=s(yn);ud=r(ob,"str"),ob.forEach(a),_d=r(ca,", "),An=o(ca,"EM",{});var sb=s(An);bd=r(sb,"optional"),sb.forEach(a),vd=r(ca,`):
Comet project name for experiments.`),ca.forEach(a),Ed=d(Rt),K=o(Rt,"LI",{});var Te=s(K);Ln=o(Te,"STRONG",{});var lb=s(Ln);kd=r(lb,"COMET_OFFLINE_DIRECTORY"),lb.forEach(a),$d=r(Te," ("),Dn=o(Te,"CODE",{});var ib=s(Dn);Cd=r(ib,"str"),ib.forEach(a),Td=r(Te,", "),On=o(Te,"EM",{});var cb=s(On);wd=r(cb,"optional"),cb.forEach(a),yd=r(Te,`):
Folder to use for saving offline experiments when `),Mn=o(Te,"CODE",{});var db=s(Mn);Ad=r(db,"COMET_MODE"),db.forEach(a),Ld=r(Te," is "),In=o(Te,"CODE",{});var fb=s(In);Dd=r(fb,"OFFLINE"),fb.forEach(a),Od=r(Te,"."),Te.forEach(a),Md=d(Rt),G=o(Rt,"LI",{});var ae=s(G);Sn=o(ae,"STRONG",{});var mb=s(Sn);Id=r(mb,"COMET_LOG_ASSETS"),mb.forEach(a),Sd=r(ae," ("),xn=o(ae,"CODE",{});var hb=s(xn);xd=r(hb,"str"),hb.forEach(a),Nd=r(ae,", "),Nn=o(ae,"EM",{});var pb=s(Nn);Pd=r(pb,"optional"),pb.forEach(a),Fd=r(ae,", defaults to "),Pn=o(ae,"CODE",{});var gb=s(Pn);Wd=r(gb,"TRUE"),gb.forEach(a),jd=r(ae,`):
Whether or not to log training assets (tf event logs, checkpoints, etc), to Comet. Can be `),Fn=o(ae,"CODE",{});var ub=s(Fn);Rd=r(ub,"TRUE"),ub.forEach(a),zd=r(ae,`, or
`),Wn=o(ae,"CODE",{});var _b=s(Wn);Bd=r(_b,"FALSE"),_b.forEach(a),Gd=r(ae,"."),ae.forEach(a),Rt.forEach(a),Vd=d(Oe),ar=o(Oe,"P",{});var Il=s(ar);Ud=r(Il,`For a number of configurable items in the environment, see
`),nr=o(Il,"A",{href:!0,rel:!0});var bb=s(nr);qd=r(bb,"here"),bb.forEach(a),Hd=r(Il,"."),Il.forEach(a),Oe.forEach(a),tn.forEach(a),sl=d(l),Pe=o(l,"DIV",{class:!0});var Sl=s(Pe);b(or.$$.fragment,Sl),Jd=d(Sl),sr=o(Sl,"P",{});var xl=s(sr);Yd=r(xl,"A "),Pa=o(xl,"A",{href:!0});var vb=s(Pa);Xd=r(vb,"TrainerCallback"),vb.forEach(a),Kd=r(xl," that handles the default flow of the training loop for logs, evaluation and checkpoints."),xl.forEach(a),Sl.forEach(a),ll=d(l),Fe=o(l,"DIV",{class:!0});var Nl=s(Fe);b(lr.$$.fragment,Nl),Qd=d(Nl),ir=o(Nl,"P",{});var Pl=s(ir);Zd=r(Pl,"A bare "),Fa=o(Pl,"A",{href:!0});var Eb=s(Fa);ef=r(Eb,"TrainerCallback"),Eb.forEach(a),tf=r(Pl," that just prints the logs."),Pl.forEach(a),Nl.forEach(a),il=d(l),We=o(l,"DIV",{class:!0});var Fl=s(We);b(cr.$$.fragment,Fl),rf=d(Fl),dr=o(Fl,"P",{});var Wl=s(dr);af=r(Wl,"A "),Wa=o(Wl,"A",{href:!0});var kb=s(Wa);nf=r(kb,"TrainerCallback"),kb.forEach(a),of=r(Wl," that displays the progress of training or evaluation."),Wl.forEach(a),Fl.forEach(a),cl=d(l),be=o(l,"DIV",{class:!0});var an=s(be);b(fr.$$.fragment,an),sf=d(an),mr=o(an,"P",{});var jl=s(mr);lf=r(jl,"A "),ja=o(jl,"A",{href:!0});var $b=s(ja);cf=r($b,"TrainerCallback"),$b.forEach(a),df=r(jl," that handles early stopping."),jl.forEach(a),ff=d(an),ve=o(an,"P",{});var zt=s(ve);mf=r(zt,"This callback depends on "),Ra=o(zt,"A",{href:!0});var Cb=s(Ra);hf=r(Cb,"TrainingArguments"),Cb.forEach(a),pf=r(zt," argument "),jn=o(zt,"EM",{});var Tb=s(jn);gf=r(Tb,"load_best_model_at_end"),Tb.forEach(a),uf=r(zt,` functionality to set best_metric
in `),za=o(zt,"A",{href:!0});var wb=s(za);_f=r(wb,"TrainerState"),wb.forEach(a),bf=r(zt,"."),zt.forEach(a),an.forEach(a),dl=d(l),je=o(l,"DIV",{class:!0});var Rl=s(je);b(hr.$$.fragment,Rl),vf=d(Rl),Re=o(Rl,"P",{});var nn=s(Re);Ef=r(nn,"A "),Ba=o(nn,"A",{href:!0});var yb=s(Ba);kf=r(yb,"TrainerCallback"),yb.forEach(a),$f=r(nn," that sends the logs to "),pr=o(nn,"A",{href:!0,rel:!0});var Ab=s(pr);Cf=r(Ab,"TensorBoard"),Ab.forEach(a),Tf=r(nn,"."),nn.forEach(a),Rl.forEach(a),fl=d(l),Ee=o(l,"DIV",{class:!0});var on=s(Ee);b(gr.$$.fragment,on),wf=d(on),ze=o(on,"P",{});var sn=s(ze);yf=r(sn,"A "),Ga=o(sn,"A",{href:!0});var Lb=s(Ga);Af=r(Lb,"TrainerCallback"),Lb.forEach(a),Lf=r(sn," that logs metrics, media, model checkpoints to "),ur=o(sn,"A",{href:!0,rel:!0});var Db=s(ur);Df=r(Db,"Weight and Biases"),Db.forEach(a),Of=r(sn,"."),sn.forEach(a),Mf=d(on),Q=o(on,"DIV",{class:!0});var Me=s(Q);b(_r.$$.fragment,Me),If=d(Me),br=o(Me,"P",{});var zl=s(br);Sf=r(zl,"Setup the optional Weights & Biases ("),Rn=o(zl,"EM",{});var Ob=s(Rn);xf=r(Ob,"wandb"),Ob.forEach(a),Nf=r(zl,") integration."),zl.forEach(a),Pf=d(Me),vr=o(Me,"P",{});var Bl=s(vr);Ff=r(Bl,`One can subclass and override this method to customize the setup if needed. Find more information
`),Er=o(Bl,"A",{href:!0,rel:!0});var Mb=s(Er);Wf=r(Mb,"here"),Mb.forEach(a),jf=r(Bl,`. You can also override the following environment
variables:`),Bl.forEach(a),Rf=d(Me),zn=o(Me,"P",{});var Ib=s(zn);zf=r(Ib,"Environment:"),Ib.forEach(a),Bf=d(Me),ke=o(Me,"UL",{});var Bt=s(ke);kr=o(Bt,"LI",{});var Gl=s(kr);O=o(Gl,"P",{});var I=s(O);Bn=o(I,"STRONG",{});var Sb=s(Bn);Gf=r(Sb,"WANDB_LOG_MODEL"),Sb.forEach(a),Vf=r(I," ("),Gn=o(I,"CODE",{});var xb=s(Gn);Uf=r(xb,"str"),xb.forEach(a),qf=r(I,", "),Vn=o(I,"EM",{});var Nb=s(Vn);Hf=r(Nb,"optional"),Nb.forEach(a),Jf=r(I,", defaults to "),Un=o(I,"CODE",{});var Pb=s(Un);Yf=r(Pb,'"false"'),Pb.forEach(a),Xf=r(I,`):
Whether to log model and checkpoints during training. Can be `),qn=o(I,"CODE",{});var Fb=s(qn);Kf=r(Fb,'"end"'),Fb.forEach(a),Qf=r(I,", "),Hn=o(I,"CODE",{});var Wb=s(Hn);Zf=r(Wb,'"checkpoint"'),Wb.forEach(a),em=r(I," or "),Jn=o(I,"CODE",{});var jb=s(Jn);tm=r(jb,'"false"'),jb.forEach(a),rm=r(I,`. If set
to `),Yn=o(I,"CODE",{});var Rb=s(Yn);am=r(Rb,'"end"'),Rb.forEach(a),nm=r(I,", the model will be uploaded at the end of training. If set to "),Xn=o(I,"CODE",{});var zb=s(Xn);om=r(zb,'"checkpoint"'),zb.forEach(a),sm=r(I,`, the checkpoint
will be uploaded every `),Kn=o(I,"CODE",{});var Bb=s(Kn);lm=r(Bb,"args.save_steps"),Bb.forEach(a),im=r(I," . If set to "),Qn=o(I,"CODE",{});var Gb=s(Qn);cm=r(Gb,'"false"'),Gb.forEach(a),dm=r(I,`, the model will not be uploaded. Use along
with `),Zn=o(I,"CODE",{});var Vb=s(Zn);fm=r(Vb,"load_best_model_at_end()"),Vb.forEach(a),mm=r(I," to upload best model."),I.forEach(a),hm=d(Gl),b(ut.$$.fragment,Gl),Gl.forEach(a),pm=d(Bt),eo=o(Bt,"LI",{});var Ub=s(eo);N=o(Ub,"P",{});var j=s(N);to=o(j,"STRONG",{});var qb=s(to);gm=r(qb,"WANDB_WATCH"),qb.forEach(a),um=r(j," ("),ro=o(j,"CODE",{});var Hb=s(ro);_m=r(Hb,"str"),Hb.forEach(a),bm=r(j,", "),ao=o(j,"EM",{});var Jb=s(ao);vm=r(Jb,"optional"),Jb.forEach(a),Em=r(j," defaults to "),no=o(j,"CODE",{});var Yb=s(no);km=r(Yb,'"false"'),Yb.forEach(a),$m=r(j,`):
Can be `),oo=o(j,"CODE",{});var Xb=s(oo);Cm=r(Xb,'"gradients"'),Xb.forEach(a),Tm=r(j,", "),so=o(j,"CODE",{});var Kb=s(so);wm=r(Kb,'"all"'),Kb.forEach(a),ym=r(j,", "),lo=o(j,"CODE",{});var Qb=s(lo);Am=r(Qb,'"parameters"'),Qb.forEach(a),Lm=r(j,", or "),io=o(j,"CODE",{});var Zb=s(io);Dm=r(Zb,'"false"'),Zb.forEach(a),Om=r(j,". Set to "),co=o(j,"CODE",{});var ev=s(co);Mm=r(ev,'"all"'),ev.forEach(a),Im=r(j,` to log gradients and
parameters.`),j.forEach(a),Ub.forEach(a),Sm=d(Bt),fo=o(Bt,"LI",{});var tv=s(fo);se=o(tv,"P",{});var et=s(se);mo=o(et,"STRONG",{});var rv=s(mo);xm=r(rv,"WANDB_PROJECT"),rv.forEach(a),Nm=r(et," ("),ho=o(et,"CODE",{});var av=s(ho);Pm=r(av,"str"),av.forEach(a),Fm=r(et,", "),po=o(et,"EM",{});var nv=s(po);Wm=r(nv,"optional"),nv.forEach(a),jm=r(et,", defaults to "),go=o(et,"CODE",{});var ov=s(go);Rm=r(ov,'"huggingface"'),ov.forEach(a),zm=r(et,`):
Set this to a custom string to store results in a different project.`),et.forEach(a),tv.forEach(a),Bm=d(Bt),uo=o(Bt,"LI",{});var sv=s(uo);Z=o(sv,"P",{});var we=s(Z);_o=o(we,"STRONG",{});var lv=s(_o);Gm=r(lv,"WANDB_DISABLED"),lv.forEach(a),Vm=r(we," ("),bo=o(we,"CODE",{});var iv=s(bo);Um=r(iv,"bool"),iv.forEach(a),qm=r(we,", "),vo=o(we,"EM",{});var cv=s(vo);Hm=r(cv,"optional"),cv.forEach(a),Jm=r(we,", defaults to "),Eo=o(we,"CODE",{});var dv=s(Eo);Ym=r(dv,"False"),dv.forEach(a),Xm=r(we,`):
Whether to disable wandb entirely. Set `),ko=o(we,"CODE",{});var fv=s(ko);Km=r(fv,"WANDB_DISABLED=true"),fv.forEach(a),Qm=r(we," to disable."),we.forEach(a),sv.forEach(a),Bt.forEach(a),Me.forEach(a),on.forEach(a),ml=d(l),$e=o(l,"DIV",{class:!0});var ln=s($e);b($r.$$.fragment,ln),Zm=d(ln),Ce=o(ln,"P",{});var Gt=s(Ce);eh=r(Gt,"A "),Va=o(Gt,"A",{href:!0});var mv=s(Va);th=r(mv,"TrainerCallback"),mv.forEach(a),rh=r(Gt," that sends the logs to "),Cr=o(Gt,"A",{href:!0,rel:!0});var hv=s(Cr);ah=r(hv,"MLflow"),hv.forEach(a),nh=r(Gt,`. Can be disabled by setting
environment variable `),$o=o(Gt,"CODE",{});var pv=s($o);oh=r(pv,"DISABLE_MLFLOW_INTEGRATION = TRUE"),pv.forEach(a),sh=r(Gt,"."),Gt.forEach(a),lh=d(ln),le=o(ln,"DIV",{class:!0});var Vt=s(le);b(Tr.$$.fragment,Vt),ih=d(Vt),Co=o(Vt,"P",{});var gv=s(Co);ch=r(gv,"Setup the optional MLflow integration."),gv.forEach(a),dh=d(Vt),To=o(Vt,"P",{});var uv=s(To);fh=r(uv,"Environment:"),uv.forEach(a),mh=d(Vt),U=o(Vt,"UL",{});var pe=s(U);P=o(pe,"LI",{});var z=s(P);wo=o(z,"STRONG",{});var _v=s(wo);hh=r(_v,"HF_MLFLOW_LOG_ARTIFACTS"),_v.forEach(a),ph=r(z," ("),yo=o(z,"CODE",{});var bv=s(yo);gh=r(bv,"str"),bv.forEach(a),uh=r(z,", "),Ao=o(z,"EM",{});var vv=s(Ao);_h=r(vv,"optional"),vv.forEach(a),bh=r(z,`):
Whether to use MLflow `),Lo=o(z,"CODE",{});var Ev=s(Lo);vh=r(Ev,".log_artifact()"),Ev.forEach(a),Eh=r(z,` facility to log artifacts. This only makes sense if logging to a
remote server, e.g. s3 or GCS. If set to `),Do=o(z,"CODE",{});var kv=s(Do);kh=r(kv,"True"),kv.forEach(a),$h=r(z," or "),Oo=o(z,"EM",{});var $v=s(Oo);Ch=r($v,"1"),$v.forEach(a),Th=r(z,`, will copy each saved checkpoint on each save in
`),Ua=o(z,"A",{href:!0});var Cv=s(Ua);wh=r(Cv,"TrainingArguments"),Cv.forEach(a),yh=r(z,"\u2019s "),Mo=o(z,"CODE",{});var Tv=s(Mo);Ah=r(Tv,"output_dir"),Tv.forEach(a),Lh=r(z,` to the local or remote artifact storage. Using it without a remote
storage will just copy the files to your artifact location.`),z.forEach(a),Dh=d(pe),V=o(pe,"LI",{});var ne=s(V);Io=o(ne,"STRONG",{});var wv=s(Io);Oh=r(wv,"MLFLOW_EXPERIMENT_NAME"),wv.forEach(a),Mh=r(ne," ("),So=o(ne,"CODE",{});var yv=s(So);Ih=r(yv,"str"),yv.forEach(a),Sh=r(ne,", "),xo=o(ne,"EM",{});var Av=s(xo);xh=r(Av,"optional"),Av.forEach(a),Nh=r(ne,", defaults to "),No=o(ne,"CODE",{});var Lv=s(No);Ph=r(Lv,"None"),Lv.forEach(a),Fh=r(ne,`):
Whether to use an MLflow experiment_name under which to launch the run. Default to `),Po=o(ne,"CODE",{});var Dv=s(Po);Wh=r(Dv,"None"),Dv.forEach(a),jh=r(ne,` which will point
to the `),Fo=o(ne,"CODE",{});var Ov=s(Fo);Rh=r(Ov,"Default"),Ov.forEach(a),zh=r(ne,` experiment in MLflow. Otherwise, it is a case sensitive name of the experiment to be
activated. If an experiment with this name does not exist, a new experiment with this name is created.`),ne.forEach(a),Bh=d(pe),ie=o(pe,"LI",{});var tt=s(ie);Wo=o(tt,"STRONG",{});var Mv=s(Wo);Gh=r(Mv,"MLFLOW_TAGS"),Mv.forEach(a),Vh=r(tt," ("),jo=o(tt,"CODE",{});var Iv=s(jo);Uh=r(Iv,"str"),Iv.forEach(a),qh=r(tt,", "),Ro=o(tt,"EM",{});var Sv=s(Ro);Hh=r(Sv,"optional"),Sv.forEach(a),Jh=r(tt,`):
A string dump of a dictionary of key/value pair to be added to the MLflow run as tags. Example:
`),zo=o(tt,"CODE",{});var xv=s(zo);Yh=r(xv,`os.environ['MLFLOW_TAGS']='{"release.candidate": "RC1", "release.version": "2.2.0"}'`),xv.forEach(a),Xh=r(tt,"."),tt.forEach(a),Kh=d(pe),ee=o(pe,"LI",{});var ye=s(ee);Bo=o(ye,"STRONG",{});var Nv=s(Bo);Qh=r(Nv,"MLFLOW_NESTED_RUN"),Nv.forEach(a),Zh=r(ye," ("),Go=o(ye,"CODE",{});var Pv=s(Go);ep=r(Pv,"str"),Pv.forEach(a),tp=r(ye,", "),Vo=o(ye,"EM",{});var Fv=s(Vo);rp=r(Fv,"optional"),Fv.forEach(a),ap=r(ye,`):
Whether to use MLflow nested runs. If set to `),Uo=o(ye,"CODE",{});var Wv=s(Uo);np=r(Wv,"True"),Wv.forEach(a),op=r(ye," or "),qo=o(ye,"EM",{});var jv=s(qo);sp=r(jv,"1"),jv.forEach(a),lp=r(ye,`, will create a nested run inside the current
run.`),ye.forEach(a),ip=d(pe),te=o(pe,"LI",{});var Ae=s(te);Ho=o(Ae,"STRONG",{});var Rv=s(Ho);cp=r(Rv,"MLFLOW_RUN_ID"),Rv.forEach(a),dp=r(Ae," ("),Jo=o(Ae,"CODE",{});var zv=s(Jo);fp=r(zv,"str"),zv.forEach(a),mp=r(Ae,", "),Yo=o(Ae,"EM",{});var Bv=s(Yo);hp=r(Bv,"optional"),Bv.forEach(a),pp=r(Ae,`):
Allow to reattach to an existing run which can be usefull when resuming training from a checkpoint. When
`),Xo=o(Ae,"CODE",{});var Gv=s(Xo);gp=r(Gv,"MLFLOW_RUN_ID"),Gv.forEach(a),up=r(Ae," environment variable is set, "),Ko=o(Ae,"CODE",{});var Vv=s(Ko);_p=r(Vv,"start_run"),Vv.forEach(a),bp=r(Ae,` attempts to resume a run with the specified run ID
and other parameters are ignored.`),Ae.forEach(a),vp=d(pe),ce=o(pe,"LI",{});var rt=s(ce);Qo=o(rt,"STRONG",{});var Uv=s(Qo);Ep=r(Uv,"MLFLOW_FLATTEN_PARAMS"),Uv.forEach(a),kp=r(rt," ("),Zo=o(rt,"CODE",{});var qv=s(Zo);$p=r(qv,"str"),qv.forEach(a),Cp=r(rt,", "),es=o(rt,"EM",{});var Hv=s(es);Tp=r(Hv,"optional"),Hv.forEach(a),wp=r(rt,", defaults to "),ts=o(rt,"CODE",{});var Jv=s(ts);yp=r(Jv,"False"),Jv.forEach(a),Ap=r(rt,`):
Whether to flatten the parameters dictionary before logging.`),rt.forEach(a),pe.forEach(a),Vt.forEach(a),ln.forEach(a),hl=d(l),Be=o(l,"DIV",{class:!0});var Vl=s(Be);b(wr.$$.fragment,Vl),Lp=d(Vl),Ge=o(Vl,"P",{});var cn=s(Ge);Dp=r(cn,"A "),qa=o(cn,"A",{href:!0});var Yv=s(qa);Op=r(Yv,"TrainerCallback"),Yv.forEach(a),Mp=r(cn," that sends the logs to "),yr=o(cn,"A",{href:!0,rel:!0});var Xv=s(yr);Ip=r(Xv,"AzureML"),Xv.forEach(a),Sp=r(cn,"."),cn.forEach(a),Vl.forEach(a),pl=d(l),Ve=o(l,"DIV",{class:!0});var Ul=s(Ve);b(Ar.$$.fragment,Ul),xp=d(Ul),Lr=o(Ul,"P",{});var ql=s(Lr);Np=r(ql,"A "),Ha=o(ql,"A",{href:!0});var Kv=s(Ha);Pp=r(Kv,"TrainerCallback"),Kv.forEach(a),Fp=r(ql," that tracks the CO2 emission of training."),ql.forEach(a),Ul.forEach(a),gl=d(l),Ue=o(l,"DIV",{class:!0});var Hl=s(Ue);b(Dr.$$.fragment,Hl),Wp=d(Hl),Or=o(Hl,"P",{});var Jl=s(Or);jp=r(Jl,"TrainerCallback that sends the logs to "),Mr=o(Jl,"A",{href:!0,rel:!0});var Qv=s(Mr);Rp=r(Qv,"Neptune"),Qv.forEach(a),zp=r(Jl,"."),Jl.forEach(a),Hl.forEach(a),ul=d(l),re=o(l,"DIV",{class:!0});var Ut=s(re);b(Ir.$$.fragment,Ut),Bp=d(Ut),qe=o(Ut,"P",{});var dn=s(qe);Gp=r(dn,"A "),Ja=o(dn,"A",{href:!0});var Zv=s(Ja);Vp=r(Zv,"TrainerCallback"),Zv.forEach(a),Up=r(dn," that sends the logs to "),Sr=o(dn,"A",{href:!0,rel:!0});var e1=s(Sr);qp=r(e1,"ClearML"),e1.forEach(a),Hp=r(dn,"."),dn.forEach(a),Jp=d(Ut),rs=o(Ut,"P",{});var t1=s(rs);Yp=r(t1,"Environment:"),t1.forEach(a),Xp=d(Ut),He=o(Ut,"UL",{});var fn=s(He);de=o(fn,"LI",{});var at=s(de);as=o(at,"STRONG",{});var r1=s(as);Kp=r(r1,"CLEARML_PROJECT"),r1.forEach(a),Qp=r(at," ("),ns=o(at,"CODE",{});var a1=s(ns);Zp=r(a1,"str"),a1.forEach(a),eg=r(at,", "),os=o(at,"EM",{});var n1=s(os);tg=r(n1,"optional"),n1.forEach(a),rg=r(at,", defaults to "),ss=o(at,"CODE",{});var o1=s(ss);ag=r(o1,"HuggingFace Transformers"),o1.forEach(a),ng=r(at,`):
ClearML project name.`),at.forEach(a),og=d(fn),fe=o(fn,"LI",{});var nt=s(fe);ls=o(nt,"STRONG",{});var s1=s(ls);sg=r(s1,"CLEARML_TASK"),s1.forEach(a),lg=r(nt," ("),is=o(nt,"CODE",{});var l1=s(is);ig=r(l1,"str"),l1.forEach(a),cg=r(nt,", "),cs=o(nt,"EM",{});var i1=s(cs);dg=r(i1,"optional"),i1.forEach(a),fg=r(nt,", defaults to "),ds=o(nt,"CODE",{});var c1=s(ds);mg=r(c1,"Trainer"),c1.forEach(a),hg=r(nt,`):
ClearML task name.`),nt.forEach(a),pg=d(fn),me=o(fn,"LI",{});var ot=s(me);fs=o(ot,"STRONG",{});var d1=s(fs);gg=r(d1,"CLEARML_LOG_MODEL"),d1.forEach(a),ug=r(ot," ("),ms=o(ot,"CODE",{});var f1=s(ms);_g=r(f1,"bool"),f1.forEach(a),bg=r(ot,", "),hs=o(ot,"EM",{});var m1=s(hs);vg=r(m1,"optional"),m1.forEach(a),Eg=r(ot,", defaults to "),ps=o(ot,"CODE",{});var h1=s(ps);kg=r(h1,"False"),h1.forEach(a),$g=r(ot,`):
Whether to log models as artifacts during training.`),ot.forEach(a),fn.forEach(a),Ut.forEach(a),_l=d(l),Je=o(l,"H2",{class:!0});var Yl=s(Je);_t=o(Yl,"A",{id:!0,class:!0,href:!0});var p1=s(_t);gs=o(p1,"SPAN",{});var g1=s(gs);b(xr.$$.fragment,g1),g1.forEach(a),p1.forEach(a),Cg=d(Yl),us=o(Yl,"SPAN",{});var u1=s(us);Tg=r(u1,"TrainerCallback"),u1.forEach(a),Yl.forEach(a),bl=d(l),$=o(l,"DIV",{class:!0});var T=s($);b(Nr.$$.fragment,T),wg=d(T),_s=o(T,"P",{});var _1=s(_s);yg=r(_1,`A class for objects that will inspect the state of the training loop at some events and take some decisions. At
each of those events the following arguments are available:`),_1.forEach(a),Ag=d(T),Pr=o(T,"P",{});var Xl=s(Pr);Lg=r(Xl,"The "),bs=o(Xl,"CODE",{});var b1=s(bs);Dg=r(b1,"control"),b1.forEach(a),Og=r(Xl,` object is the only one that can be changed by the callback, in which case the event that changes it
should return the modified version.`),Xl.forEach(a),Mg=d(T),q=o(T,"P",{});var ge=s(q);Ig=r(ge,"The argument "),vs=o(ge,"CODE",{});var v1=s(vs);Sg=r(v1,"args"),v1.forEach(a),xg=r(ge,", "),Es=o(ge,"CODE",{});var E1=s(Es);Ng=r(E1,"state"),E1.forEach(a),Pg=r(ge," and "),ks=o(ge,"CODE",{});var k1=s(ks);Fg=r(k1,"control"),k1.forEach(a),Wg=r(ge," are positionals for all events, all the others are grouped in "),$s=o(ge,"CODE",{});var $1=s($s);jg=r($1,"kwargs"),$1.forEach(a),Rg=r(ge,`.
You can unpack the ones you need in the signature of the event using them. As an example, see the code of the
simple `),Cs=o(ge,"CODE",{});var C1=s(Cs);zg=r(C1,"~transformer.PrinterCallback"),C1.forEach(a),Bg=r(ge,"."),ge.forEach(a),Gg=d(T),b(bt.$$.fragment,T),Vg=d(T),vt=o(T,"DIV",{class:!0});var Kl=s(vt);b(Fr.$$.fragment,Kl),Ug=d(Kl),Ts=o(Kl,"P",{});var T1=s(Ts);qg=r(T1,"Event called at the beginning of an epoch."),T1.forEach(a),Kl.forEach(a),Hg=d(T),Et=o(T,"DIV",{class:!0});var Ql=s(Et);b(Wr.$$.fragment,Ql),Jg=d(Ql),ws=o(Ql,"P",{});var w1=s(ws);Yg=r(w1,"Event called at the end of an epoch."),w1.forEach(a),Ql.forEach(a),Xg=d(T),kt=o(T,"DIV",{class:!0});var Zl=s(kt);b(jr.$$.fragment,Zl),Kg=d(Zl),ys=o(Zl,"P",{});var y1=s(ys);Qg=r(y1,"Event called after an evaluation phase."),y1.forEach(a),Zl.forEach(a),Zg=d(T),$t=o(T,"DIV",{class:!0});var ei=s($t);b(Rr.$$.fragment,ei),eu=d(ei),zr=o(ei,"P",{});var ti=s(zr);tu=r(ti,"Event called at the end of the initialization of the "),Ya=o(ti,"A",{href:!0});var A1=s(Ya);ru=r(A1,"Trainer"),A1.forEach(a),au=r(ti,"."),ti.forEach(a),ei.forEach(a),nu=d(T),Ct=o(T,"DIV",{class:!0});var ri=s(Ct);b(Br.$$.fragment,ri),ou=d(ri),As=o(ri,"P",{});var L1=s(As);su=r(L1,"Event called after logging the last logs."),L1.forEach(a),ri.forEach(a),lu=d(T),Tt=o(T,"DIV",{class:!0});var ai=s(Tt);b(Gr.$$.fragment,ai),iu=d(ai),Ls=o(ai,"P",{});var D1=s(Ls);cu=r(D1,"Event called after a successful prediction."),D1.forEach(a),ai.forEach(a),du=d(T),wt=o(T,"DIV",{class:!0});var ni=s(wt);b(Vr.$$.fragment,ni),fu=d(ni),Ds=o(ni,"P",{});var O1=s(Ds);mu=r(O1,"Event called after a prediction step."),O1.forEach(a),ni.forEach(a),hu=d(T),yt=o(T,"DIV",{class:!0});var oi=s(yt);b(Ur.$$.fragment,oi),pu=d(oi),Os=o(oi,"P",{});var M1=s(Os);gu=r(M1,"Event called after a checkpoint save."),M1.forEach(a),oi.forEach(a),uu=d(T),At=o(T,"DIV",{class:!0});var si=s(At);b(qr.$$.fragment,si),_u=d(si),Ms=o(si,"P",{});var I1=s(Ms);bu=r(I1,`Event called at the beginning of a training step. If using gradient accumulation, one training step might take
several inputs.`),I1.forEach(a),si.forEach(a),vu=d(T),Lt=o(T,"DIV",{class:!0});var li=s(Lt);b(Hr.$$.fragment,li),Eu=d(li),Is=o(li,"P",{});var S1=s(Is);ku=r(S1,`Event called at the end of a training step. If using gradient accumulation, one training step might take
several inputs.`),S1.forEach(a),li.forEach(a),$u=d(T),Dt=o(T,"DIV",{class:!0});var ii=s(Dt);b(Jr.$$.fragment,ii),Cu=d(ii),Ss=o(ii,"P",{});var x1=s(Ss);Tu=r(x1,"Event called at the end of an substep during gradient accumulation."),x1.forEach(a),ii.forEach(a),wu=d(T),Ot=o(T,"DIV",{class:!0});var ci=s(Ot);b(Yr.$$.fragment,ci),yu=d(ci),xs=o(ci,"P",{});var N1=s(xs);Au=r(N1,"Event called at the beginning of training."),N1.forEach(a),ci.forEach(a),Lu=d(T),Mt=o(T,"DIV",{class:!0});var di=s(Mt);b(Xr.$$.fragment,di),Du=d(di),Ns=o(di,"P",{});var P1=s(Ns);Ou=r(P1,"Event called at the end of training."),P1.forEach(a),di.forEach(a),T.forEach(a),vl=d(l),It=o(l,"P",{});var fi=s(It);Mu=r(fi,"Here is an example of how to register a custom callback with the PyTorch "),Xa=o(fi,"A",{href:!0});var F1=s(Xa);Iu=r(F1,"Trainer"),F1.forEach(a),Su=r(fi,":"),fi.forEach(a),El=d(l),b(Kr.$$.fragment,l),kl=d(l),St=o(l,"P",{});var mi=s(St);xu=r(mi,"Another way to register a callback is to call "),Ps=o(mi,"CODE",{});var W1=s(Ps);Nu=r(W1,"trainer.add_callback()"),W1.forEach(a),Pu=r(mi," as follows:"),mi.forEach(a),$l=d(l),b(Qr.$$.fragment,l),Cl=d(l),Ye=o(l,"H2",{class:!0});var hi=s(Ye);xt=o(hi,"A",{id:!0,class:!0,href:!0});var j1=s(xt);Fs=o(j1,"SPAN",{});var R1=s(Fs);b(Zr.$$.fragment,R1),R1.forEach(a),j1.forEach(a),Fu=d(hi),Ws=o(hi,"SPAN",{});var z1=s(Ws);Wu=r(z1,"TrainerState"),z1.forEach(a),hi.forEach(a),Tl=d(l),H=o(l,"DIV",{class:!0});var Ie=s(H);b(ea.$$.fragment,Ie),ju=d(Ie),Xe=o(Ie,"P",{});var mn=s(Xe);Ru=r(mn,"A class containing the "),Ka=o(mn,"A",{href:!0});var B1=s(Ka);zu=r(B1,"Trainer"),B1.forEach(a),Bu=r(mn,` inner state that will be saved along the model and optimizer when checkpointing
and passed to the `),Qa=o(mn,"A",{href:!0});var G1=s(Qa);Gu=r(G1,"TrainerCallback"),G1.forEach(a),Vu=r(mn,"."),mn.forEach(a),Uu=d(Ie),b(Nt.$$.fragment,Ie),qu=d(Ie),Pt=o(Ie,"DIV",{class:!0});var pi=s(Pt);b(ta.$$.fragment,pi),Hu=d(pi),ra=o(pi,"P",{});var gi=s(ra);Ju=r(gi,"Create an instance from the content of "),js=o(gi,"CODE",{});var V1=s(js);Yu=r(V1,"json_path"),V1.forEach(a),Xu=r(gi,"."),gi.forEach(a),pi.forEach(a),Ku=d(Ie),Ft=o(Ie,"DIV",{class:!0});var ui=s(Ft);b(aa.$$.fragment,ui),Qu=d(ui),na=o(ui,"P",{});var _i=s(na);Zu=r(_i,"Save the content of this instance in JSON format inside "),Rs=o(_i,"CODE",{});var U1=s(Rs);e_=r(U1,"json_path"),U1.forEach(a),t_=r(_i,"."),_i.forEach(a),ui.forEach(a),Ie.forEach(a),wl=d(l),Ke=o(l,"H2",{class:!0});var bi=s(Ke);Wt=o(bi,"A",{id:!0,class:!0,href:!0});var q1=s(Wt);zs=o(q1,"SPAN",{});var H1=s(zs);b(oa.$$.fragment,H1),H1.forEach(a),q1.forEach(a),r_=d(bi),Bs=o(bi,"SPAN",{});var J1=s(Bs);a_=r(J1,"TrainerControl"),J1.forEach(a),bi.forEach(a),yl=d(l),Qe=o(l,"DIV",{class:!0});var vi=s(Qe);b(sa.$$.fragment,vi),n_=d(vi),Ze=o(vi,"P",{});var hn=s(Ze);o_=r(hn,"A class that handles the "),Za=o(hn,"A",{href:!0});var Y1=s(Za);s_=r(Y1,"Trainer"),Y1.forEach(a),l_=r(hn," control flow. This class is used by the "),en=o(hn,"A",{href:!0});var X1=s(en);i_=r(X1,"TrainerCallback"),X1.forEach(a),c_=r(hn,` to activate some
switches in the training loop.`),hn.forEach(a),vi.forEach(a),this.h()},h(){i(h,"name","hf:doc:metadata"),i(h,"content",JSON.stringify(b2)),i(C,"id","callbacks"),i(C,"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"),i(C,"href","#callbacks"),i(u,"class","relative group"),i(da,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),i(fa,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerControl"),i(ma,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),i(ha,"href","trainer"),i(pa,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),i(ua,"href","/docs/transformers/main/en/main_classes/callback#transformers.DefaultFlowCallback"),i(_a,"href","/docs/transformers/main/en/main_classes/callback#transformers.PrinterCallback"),i(ba,"href","/docs/transformers/main/en/main_classes/callback#transformers.ProgressCallback"),i(va,"href","/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments"),i(ka,"href","/docs/transformers/main/en/main_classes/callback#transformers.integrations.TensorBoardCallback"),i($a,"href","/docs/transformers/main/en/main_classes/callback#transformers.integrations.WandbCallback"),i(qt,"href","https://www.wandb.com/"),i(qt,"rel","nofollow"),i(Ca,"href","/docs/transformers/main/en/main_classes/callback#transformers.integrations.CometCallback"),i(Ht,"href","https://www.comet.ml/site/"),i(Ht,"rel","nofollow"),i(Ta,"href","/docs/transformers/main/en/main_classes/callback#transformers.integrations.MLflowCallback"),i(Jt,"href","https://www.mlflow.org/"),i(Jt,"rel","nofollow"),i(wa,"href","/docs/transformers/main/en/main_classes/callback#transformers.integrations.NeptuneCallback"),i(Yt,"href","https://neptune.ai/"),i(Yt,"rel","nofollow"),i(ya,"href","/docs/transformers/main/en/main_classes/callback#transformers.integrations.AzureMLCallback"),i(Xt,"href","https://pypi.org/project/azureml-sdk/"),i(Xt,"rel","nofollow"),i(Aa,"href","/docs/transformers/main/en/main_classes/callback#transformers.integrations.CodeCarbonCallback"),i(Kt,"href","https://pypi.org/project/codecarbon/"),i(Kt,"rel","nofollow"),i(La,"href","/docs/transformers/main/en/main_classes/callback#transformers.integrations.ClearMLCallback"),i(Qt,"href","https://github.com/allegroai/clearml"),i(Qt,"rel","nofollow"),i(Da,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Oa,"href","/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments"),i(Ma,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),i(Ia,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerState"),i(Sa,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerControl"),i(pt,"id","transformers.integrations.CometCallback"),i(pt,"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"),i(pt,"href","#transformers.integrations.CometCallback"),i(xe,"class","relative group"),i(xa,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Na,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(tr,"href","https://www.comet.ml/site/"),i(tr,"rel","nofollow"),i(nr,"href","https://www.comet.ml/docs/python-sdk/advanced/#comet-configuration-variables"),i(nr,"rel","nofollow"),i(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Pa,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Fa,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Wa,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ja,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Ra,"href","/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments"),i(za,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerState"),i(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ba,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(pr,"href","https://www.tensorflow.org/tensorboard"),i(pr,"rel","nofollow"),i(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ga,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(ur,"href","https://www.wandb.com/"),i(ur,"rel","nofollow"),i(Er,"href","https://docs.wandb.ai/guides/integrations/huggingface"),i(Er,"rel","nofollow"),i(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Va,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Cr,"href","https://www.mlflow.org/"),i(Cr,"rel","nofollow"),i(Ua,"href","/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments"),i(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(qa,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(yr,"href","https://pypi.org/project/azureml-sdk/"),i(yr,"rel","nofollow"),i(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ha,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Mr,"href","https://neptune.ai"),i(Mr,"rel","nofollow"),i(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ja,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Sr,"href","https://clear.ml/"),i(Sr,"rel","nofollow"),i(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(_t,"id","transformers.TrainerCallback"),i(_t,"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"),i(_t,"href","#transformers.TrainerCallback"),i(Je,"class","relative group"),i(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ya,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),i($t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(yt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(At,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ot,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Xa,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),i(xt,"id","transformers.TrainerState"),i(xt,"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"),i(xt,"href","#transformers.TrainerState"),i(Ye,"class","relative group"),i(Ka,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),i(Qa,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Wt,"id","transformers.TrainerControl"),i(Wt,"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"),i(Wt,"href","#transformers.TrainerControl"),i(Ke,"class","relative group"),i(Za,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),i(en,"href","/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback"),i(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(l,f){e(document.head,h),m(l,D,f),m(l,u,f),e(u,C),e(C,A),v(k,A,null),e(u,L),e(u,w),e(w,M),m(l,x,f),m(l,Y,f),e(Y,Se),e(Y,da),e(da,Ei),e(Y,ki),m(l,Zs,f),m(l,oe,f),e(oe,$i),e(oe,fa),e(fa,Ci),e(oe,Ti),e(oe,ma),e(ma,wi),e(oe,yi),e(oe,ha),e(ha,Ai),e(oe,Li),m(l,el,f),m(l,st,f),e(st,Di),e(st,pa),e(pa,Oi),e(st,Mi),m(l,tl,f),m(l,S,f),e(S,ga),e(ga,ua),e(ua,Ii),e(ga,Si),e(S,xi),e(S,Le),e(Le,_a),e(_a,Ni),e(Le,Pi),e(Le,ba),e(ba,Fi),e(Le,Wi),e(Le,va),e(va,ji),e(Le,Ri),e(S,zi),e(S,Ea),e(Ea,ka),e(ka,Bi),e(Ea,Gi),e(S,Vi),e(S,lt),e(lt,$a),e($a,Ui),e(lt,qi),e(lt,qt),e(qt,Hi),e(lt,Ji),e(S,Yi),e(S,it),e(it,Ca),e(Ca,Xi),e(it,Ki),e(it,Ht),e(Ht,Qi),e(it,Zi),e(S,ec),e(S,ct),e(ct,Ta),e(Ta,tc),e(ct,rc),e(ct,Jt),e(Jt,ac),e(ct,nc),e(S,oc),e(S,dt),e(dt,wa),e(wa,sc),e(dt,lc),e(dt,Yt),e(Yt,ic),e(dt,cc),e(S,dc),e(S,ft),e(ft,ya),e(ya,fc),e(ft,mc),e(ft,Xt),e(Xt,hc),e(ft,pc),e(S,gc),e(S,mt),e(mt,Aa),e(Aa,uc),e(mt,_c),e(mt,Kt),e(Kt,bc),e(mt,vc),e(S,Ec),e(S,ht),e(ht,La),e(La,kc),e(ht,$c),e(ht,Qt),e(Qt,Cc),e(ht,Tc),m(l,rl,f),m(l,B,f),e(B,wc),e(B,Da),e(Da,yc),e(B,Ac),e(B,Oa),e(Oa,Lc),e(B,Dc),e(B,Ma),e(Ma,Oc),e(B,Mc),e(B,Ia),e(Ia,Ic),e(B,Sc),e(B,Sa),e(Sa,xc),e(B,Nc),m(l,al,f),m(l,xe,f),e(xe,pt),e(pt,pn),v(Zt,pn,null),e(xe,Pc),e(xe,gn),e(gn,Fc),m(l,nl,f),m(l,gt,f),e(gt,Wc),e(gt,xa),e(xa,jc),e(gt,Rc),m(l,ol,f),m(l,ue,f),v(er,ue,null),e(ue,zc),e(ue,Ne),e(Ne,Bc),e(Ne,Na),e(Na,Gc),e(Ne,Vc),e(Ne,tr),e(tr,Uc),e(Ne,qc),e(ue,Hc),e(ue,X),v(rr,X,null),e(X,Jc),e(X,un),e(un,Yc),e(X,Xc),e(X,_n),e(_n,Kc),e(X,Qc),e(X,_e),e(_e,R),e(R,bn),e(bn,Zc),e(R,ed),e(R,vn),e(vn,td),e(R,rd),e(R,En),e(En,ad),e(R,nd),e(R,kn),e(kn,od),e(R,sd),e(R,$n),e($n,ld),e(R,id),e(R,Cn),e(Cn,cd),e(R,dd),e(R,Tn),e(Tn,fd),e(R,md),e(_e,hd),e(_e,De),e(De,wn),e(wn,pd),e(De,gd),e(De,yn),e(yn,ud),e(De,_d),e(De,An),e(An,bd),e(De,vd),e(_e,Ed),e(_e,K),e(K,Ln),e(Ln,kd),e(K,$d),e(K,Dn),e(Dn,Cd),e(K,Td),e(K,On),e(On,wd),e(K,yd),e(K,Mn),e(Mn,Ad),e(K,Ld),e(K,In),e(In,Dd),e(K,Od),e(_e,Md),e(_e,G),e(G,Sn),e(Sn,Id),e(G,Sd),e(G,xn),e(xn,xd),e(G,Nd),e(G,Nn),e(Nn,Pd),e(G,Fd),e(G,Pn),e(Pn,Wd),e(G,jd),e(G,Fn),e(Fn,Rd),e(G,zd),e(G,Wn),e(Wn,Bd),e(G,Gd),e(X,Vd),e(X,ar),e(ar,Ud),e(ar,nr),e(nr,qd),e(ar,Hd),m(l,sl,f),m(l,Pe,f),v(or,Pe,null),e(Pe,Jd),e(Pe,sr),e(sr,Yd),e(sr,Pa),e(Pa,Xd),e(sr,Kd),m(l,ll,f),m(l,Fe,f),v(lr,Fe,null),e(Fe,Qd),e(Fe,ir),e(ir,Zd),e(ir,Fa),e(Fa,ef),e(ir,tf),m(l,il,f),m(l,We,f),v(cr,We,null),e(We,rf),e(We,dr),e(dr,af),e(dr,Wa),e(Wa,nf),e(dr,of),m(l,cl,f),m(l,be,f),v(fr,be,null),e(be,sf),e(be,mr),e(mr,lf),e(mr,ja),e(ja,cf),e(mr,df),e(be,ff),e(be,ve),e(ve,mf),e(ve,Ra),e(Ra,hf),e(ve,pf),e(ve,jn),e(jn,gf),e(ve,uf),e(ve,za),e(za,_f),e(ve,bf),m(l,dl,f),m(l,je,f),v(hr,je,null),e(je,vf),e(je,Re),e(Re,Ef),e(Re,Ba),e(Ba,kf),e(Re,$f),e(Re,pr),e(pr,Cf),e(Re,Tf),m(l,fl,f),m(l,Ee,f),v(gr,Ee,null),e(Ee,wf),e(Ee,ze),e(ze,yf),e(ze,Ga),e(Ga,Af),e(ze,Lf),e(ze,ur),e(ur,Df),e(ze,Of),e(Ee,Mf),e(Ee,Q),v(_r,Q,null),e(Q,If),e(Q,br),e(br,Sf),e(br,Rn),e(Rn,xf),e(br,Nf),e(Q,Pf),e(Q,vr),e(vr,Ff),e(vr,Er),e(Er,Wf),e(vr,jf),e(Q,Rf),e(Q,zn),e(zn,zf),e(Q,Bf),e(Q,ke),e(ke,kr),e(kr,O),e(O,Bn),e(Bn,Gf),e(O,Vf),e(O,Gn),e(Gn,Uf),e(O,qf),e(O,Vn),e(Vn,Hf),e(O,Jf),e(O,Un),e(Un,Yf),e(O,Xf),e(O,qn),e(qn,Kf),e(O,Qf),e(O,Hn),e(Hn,Zf),e(O,em),e(O,Jn),e(Jn,tm),e(O,rm),e(O,Yn),e(Yn,am),e(O,nm),e(O,Xn),e(Xn,om),e(O,sm),e(O,Kn),e(Kn,lm),e(O,im),e(O,Qn),e(Qn,cm),e(O,dm),e(O,Zn),e(Zn,fm),e(O,mm),e(kr,hm),v(ut,kr,null),e(ke,pm),e(ke,eo),e(eo,N),e(N,to),e(to,gm),e(N,um),e(N,ro),e(ro,_m),e(N,bm),e(N,ao),e(ao,vm),e(N,Em),e(N,no),e(no,km),e(N,$m),e(N,oo),e(oo,Cm),e(N,Tm),e(N,so),e(so,wm),e(N,ym),e(N,lo),e(lo,Am),e(N,Lm),e(N,io),e(io,Dm),e(N,Om),e(N,co),e(co,Mm),e(N,Im),e(ke,Sm),e(ke,fo),e(fo,se),e(se,mo),e(mo,xm),e(se,Nm),e(se,ho),e(ho,Pm),e(se,Fm),e(se,po),e(po,Wm),e(se,jm),e(se,go),e(go,Rm),e(se,zm),e(ke,Bm),e(ke,uo),e(uo,Z),e(Z,_o),e(_o,Gm),e(Z,Vm),e(Z,bo),e(bo,Um),e(Z,qm),e(Z,vo),e(vo,Hm),e(Z,Jm),e(Z,Eo),e(Eo,Ym),e(Z,Xm),e(Z,ko),e(ko,Km),e(Z,Qm),m(l,ml,f),m(l,$e,f),v($r,$e,null),e($e,Zm),e($e,Ce),e(Ce,eh),e(Ce,Va),e(Va,th),e(Ce,rh),e(Ce,Cr),e(Cr,ah),e(Ce,nh),e(Ce,$o),e($o,oh),e(Ce,sh),e($e,lh),e($e,le),v(Tr,le,null),e(le,ih),e(le,Co),e(Co,ch),e(le,dh),e(le,To),e(To,fh),e(le,mh),e(le,U),e(U,P),e(P,wo),e(wo,hh),e(P,ph),e(P,yo),e(yo,gh),e(P,uh),e(P,Ao),e(Ao,_h),e(P,bh),e(P,Lo),e(Lo,vh),e(P,Eh),e(P,Do),e(Do,kh),e(P,$h),e(P,Oo),e(Oo,Ch),e(P,Th),e(P,Ua),e(Ua,wh),e(P,yh),e(P,Mo),e(Mo,Ah),e(P,Lh),e(U,Dh),e(U,V),e(V,Io),e(Io,Oh),e(V,Mh),e(V,So),e(So,Ih),e(V,Sh),e(V,xo),e(xo,xh),e(V,Nh),e(V,No),e(No,Ph),e(V,Fh),e(V,Po),e(Po,Wh),e(V,jh),e(V,Fo),e(Fo,Rh),e(V,zh),e(U,Bh),e(U,ie),e(ie,Wo),e(Wo,Gh),e(ie,Vh),e(ie,jo),e(jo,Uh),e(ie,qh),e(ie,Ro),e(Ro,Hh),e(ie,Jh),e(ie,zo),e(zo,Yh),e(ie,Xh),e(U,Kh),e(U,ee),e(ee,Bo),e(Bo,Qh),e(ee,Zh),e(ee,Go),e(Go,ep),e(ee,tp),e(ee,Vo),e(Vo,rp),e(ee,ap),e(ee,Uo),e(Uo,np),e(ee,op),e(ee,qo),e(qo,sp),e(ee,lp),e(U,ip),e(U,te),e(te,Ho),e(Ho,cp),e(te,dp),e(te,Jo),e(Jo,fp),e(te,mp),e(te,Yo),e(Yo,hp),e(te,pp),e(te,Xo),e(Xo,gp),e(te,up),e(te,Ko),e(Ko,_p),e(te,bp),e(U,vp),e(U,ce),e(ce,Qo),e(Qo,Ep),e(ce,kp),e(ce,Zo),e(Zo,$p),e(ce,Cp),e(ce,es),e(es,Tp),e(ce,wp),e(ce,ts),e(ts,yp),e(ce,Ap),m(l,hl,f),m(l,Be,f),v(wr,Be,null),e(Be,Lp),e(Be,Ge),e(Ge,Dp),e(Ge,qa),e(qa,Op),e(Ge,Mp),e(Ge,yr),e(yr,Ip),e(Ge,Sp),m(l,pl,f),m(l,Ve,f),v(Ar,Ve,null),e(Ve,xp),e(Ve,Lr),e(Lr,Np),e(Lr,Ha),e(Ha,Pp),e(Lr,Fp),m(l,gl,f),m(l,Ue,f),v(Dr,Ue,null),e(Ue,Wp),e(Ue,Or),e(Or,jp),e(Or,Mr),e(Mr,Rp),e(Or,zp),m(l,ul,f),m(l,re,f),v(Ir,re,null),e(re,Bp),e(re,qe),e(qe,Gp),e(qe,Ja),e(Ja,Vp),e(qe,Up),e(qe,Sr),e(Sr,qp),e(qe,Hp),e(re,Jp),e(re,rs),e(rs,Yp),e(re,Xp),e(re,He),e(He,de),e(de,as),e(as,Kp),e(de,Qp),e(de,ns),e(ns,Zp),e(de,eg),e(de,os),e(os,tg),e(de,rg),e(de,ss),e(ss,ag),e(de,ng),e(He,og),e(He,fe),e(fe,ls),e(ls,sg),e(fe,lg),e(fe,is),e(is,ig),e(fe,cg),e(fe,cs),e(cs,dg),e(fe,fg),e(fe,ds),e(ds,mg),e(fe,hg),e(He,pg),e(He,me),e(me,fs),e(fs,gg),e(me,ug),e(me,ms),e(ms,_g),e(me,bg),e(me,hs),e(hs,vg),e(me,Eg),e(me,ps),e(ps,kg),e(me,$g),m(l,_l,f),m(l,Je,f),e(Je,_t),e(_t,gs),v(xr,gs,null),e(Je,Cg),e(Je,us),e(us,Tg),m(l,bl,f),m(l,$,f),v(Nr,$,null),e($,wg),e($,_s),e(_s,yg),e($,Ag),e($,Pr),e(Pr,Lg),e(Pr,bs),e(bs,Dg),e(Pr,Og),e($,Mg),e($,q),e(q,Ig),e(q,vs),e(vs,Sg),e(q,xg),e(q,Es),e(Es,Ng),e(q,Pg),e(q,ks),e(ks,Fg),e(q,Wg),e(q,$s),e($s,jg),e(q,Rg),e(q,Cs),e(Cs,zg),e(q,Bg),e($,Gg),v(bt,$,null),e($,Vg),e($,vt),v(Fr,vt,null),e(vt,Ug),e(vt,Ts),e(Ts,qg),e($,Hg),e($,Et),v(Wr,Et,null),e(Et,Jg),e(Et,ws),e(ws,Yg),e($,Xg),e($,kt),v(jr,kt,null),e(kt,Kg),e(kt,ys),e(ys,Qg),e($,Zg),e($,$t),v(Rr,$t,null),e($t,eu),e($t,zr),e(zr,tu),e(zr,Ya),e(Ya,ru),e(zr,au),e($,nu),e($,Ct),v(Br,Ct,null),e(Ct,ou),e(Ct,As),e(As,su),e($,lu),e($,Tt),v(Gr,Tt,null),e(Tt,iu),e(Tt,Ls),e(Ls,cu),e($,du),e($,wt),v(Vr,wt,null),e(wt,fu),e(wt,Ds),e(Ds,mu),e($,hu),e($,yt),v(Ur,yt,null),e(yt,pu),e(yt,Os),e(Os,gu),e($,uu),e($,At),v(qr,At,null),e(At,_u),e(At,Ms),e(Ms,bu),e($,vu),e($,Lt),v(Hr,Lt,null),e(Lt,Eu),e(Lt,Is),e(Is,ku),e($,$u),e($,Dt),v(Jr,Dt,null),e(Dt,Cu),e(Dt,Ss),e(Ss,Tu),e($,wu),e($,Ot),v(Yr,Ot,null),e(Ot,yu),e(Ot,xs),e(xs,Au),e($,Lu),e($,Mt),v(Xr,Mt,null),e(Mt,Du),e(Mt,Ns),e(Ns,Ou),m(l,vl,f),m(l,It,f),e(It,Mu),e(It,Xa),e(Xa,Iu),e(It,Su),m(l,El,f),v(Kr,l,f),m(l,kl,f),m(l,St,f),e(St,xu),e(St,Ps),e(Ps,Nu),e(St,Pu),m(l,$l,f),v(Qr,l,f),m(l,Cl,f),m(l,Ye,f),e(Ye,xt),e(xt,Fs),v(Zr,Fs,null),e(Ye,Fu),e(Ye,Ws),e(Ws,Wu),m(l,Tl,f),m(l,H,f),v(ea,H,null),e(H,ju),e(H,Xe),e(Xe,Ru),e(Xe,Ka),e(Ka,zu),e(Xe,Bu),e(Xe,Qa),e(Qa,Gu),e(Xe,Vu),e(H,Uu),v(Nt,H,null),e(H,qu),e(H,Pt),v(ta,Pt,null),e(Pt,Hu),e(Pt,ra),e(ra,Ju),e(ra,js),e(js,Yu),e(ra,Xu),e(H,Ku),e(H,Ft),v(aa,Ft,null),e(Ft,Qu),e(Ft,na),e(na,Zu),e(na,Rs),e(Rs,e_),e(na,t_),m(l,wl,f),m(l,Ke,f),e(Ke,Wt),e(Wt,zs),v(oa,zs,null),e(Ke,r_),e(Ke,Bs),e(Bs,a_),m(l,yl,f),m(l,Qe,f),v(sa,Qe,null),e(Qe,n_),e(Qe,Ze),e(Ze,o_),e(Ze,Za),e(Za,s_),e(Ze,l_),e(Ze,en),e(en,i_),e(Ze,c_),Al=!0},p(l,[f]){const la={};f&2&&(la.$$scope={dirty:f,ctx:l}),ut.$set(la);const Gs={};f&2&&(Gs.$$scope={dirty:f,ctx:l}),bt.$set(Gs);const Vs={};f&2&&(Vs.$$scope={dirty:f,ctx:l}),Nt.$set(Vs)},i(l){Al||(p(k.$$.fragment,l),p(Zt.$$.fragment,l),p(er.$$.fragment,l),p(rr.$$.fragment,l),p(or.$$.fragment,l),p(lr.$$.fragment,l),p(cr.$$.fragment,l),p(fr.$$.fragment,l),p(hr.$$.fragment,l),p(gr.$$.fragment,l),p(_r.$$.fragment,l),p(ut.$$.fragment,l),p($r.$$.fragment,l),p(Tr.$$.fragment,l),p(wr.$$.fragment,l),p(Ar.$$.fragment,l),p(Dr.$$.fragment,l),p(Ir.$$.fragment,l),p(xr.$$.fragment,l),p(Nr.$$.fragment,l),p(bt.$$.fragment,l),p(Fr.$$.fragment,l),p(Wr.$$.fragment,l),p(jr.$$.fragment,l),p(Rr.$$.fragment,l),p(Br.$$.fragment,l),p(Gr.$$.fragment,l),p(Vr.$$.fragment,l),p(Ur.$$.fragment,l),p(qr.$$.fragment,l),p(Hr.$$.fragment,l),p(Jr.$$.fragment,l),p(Yr.$$.fragment,l),p(Xr.$$.fragment,l),p(Kr.$$.fragment,l),p(Qr.$$.fragment,l),p(Zr.$$.fragment,l),p(ea.$$.fragment,l),p(Nt.$$.fragment,l),p(ta.$$.fragment,l),p(aa.$$.fragment,l),p(oa.$$.fragment,l),p(sa.$$.fragment,l),Al=!0)},o(l){g(k.$$.fragment,l),g(Zt.$$.fragment,l),g(er.$$.fragment,l),g(rr.$$.fragment,l),g(or.$$.fragment,l),g(lr.$$.fragment,l),g(cr.$$.fragment,l),g(fr.$$.fragment,l),g(hr.$$.fragment,l),g(gr.$$.fragment,l),g(_r.$$.fragment,l),g(ut.$$.fragment,l),g($r.$$.fragment,l),g(Tr.$$.fragment,l),g(wr.$$.fragment,l),g(Ar.$$.fragment,l),g(Dr.$$.fragment,l),g(Ir.$$.fragment,l),g(xr.$$.fragment,l),g(Nr.$$.fragment,l),g(bt.$$.fragment,l),g(Fr.$$.fragment,l),g(Wr.$$.fragment,l),g(jr.$$.fragment,l),g(Rr.$$.fragment,l),g(Br.$$.fragment,l),g(Gr.$$.fragment,l),g(Vr.$$.fragment,l),g(Ur.$$.fragment,l),g(qr.$$.fragment,l),g(Hr.$$.fragment,l),g(Jr.$$.fragment,l),g(Yr.$$.fragment,l),g(Xr.$$.fragment,l),g(Kr.$$.fragment,l),g(Qr.$$.fragment,l),g(Zr.$$.fragment,l),g(ea.$$.fragment,l),g(Nt.$$.fragment,l),g(ta.$$.fragment,l),g(aa.$$.fragment,l),g(oa.$$.fragment,l),g(sa.$$.fragment,l),Al=!1},d(l){a(h),l&&a(D),l&&a(u),E(k),l&&a(x),l&&a(Y),l&&a(Zs),l&&a(oe),l&&a(el),l&&a(st),l&&a(tl),l&&a(S),l&&a(rl),l&&a(B),l&&a(al),l&&a(xe),E(Zt),l&&a(nl),l&&a(gt),l&&a(ol),l&&a(ue),E(er),E(rr),l&&a(sl),l&&a(Pe),E(or),l&&a(ll),l&&a(Fe),E(lr),l&&a(il),l&&a(We),E(cr),l&&a(cl),l&&a(be),E(fr),l&&a(dl),l&&a(je),E(hr),l&&a(fl),l&&a(Ee),E(gr),E(_r),E(ut),l&&a(ml),l&&a($e),E($r),E(Tr),l&&a(hl),l&&a(Be),E(wr),l&&a(pl),l&&a(Ve),E(Ar),l&&a(gl),l&&a(Ue),E(Dr),l&&a(ul),l&&a(re),E(Ir),l&&a(_l),l&&a(Je),E(xr),l&&a(bl),l&&a($),E(Nr),E(bt),E(Fr),E(Wr),E(jr),E(Rr),E(Br),E(Gr),E(Vr),E(Ur),E(qr),E(Hr),E(Jr),E(Yr),E(Xr),l&&a(vl),l&&a(It),l&&a(El),E(Kr,l),l&&a(kl),l&&a(St),l&&a($l),E(Qr,l),l&&a(Cl),l&&a(Ye),E(Zr),l&&a(Tl),l&&a(H),E(ea),E(Nt),E(ta),E(aa),l&&a(wl),l&&a(Ke),E(oa),l&&a(yl),l&&a(Qe),E(sa)}}}const b2={local:"callbacks",sections:[{local:"transformers.integrations.CometCallback",title:"Available Callbacks"},{local:"transformers.TrainerCallback",title:"TrainerCallback"},{local:"transformers.TrainerState",title:"TrainerState"},{local:"transformers.TrainerControl",title:"TrainerControl"}],title:"Callbacks"};function v2(W){return l2(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class y2 extends K1{constructor(h){super();Q1(this,h,v2,_2,Z1,{})}}export{y2 as default,b2 as metadata};
