import{s as _o,c as Co,u as ko,g as wo,d as yo,o as Mo,n as Ja}from"../chunks/scheduler.9bc65507.js";import{S as vo,i as To,r as f,u as g,v as h,d,t as p,w as u,g as s,m as ho,s as r,h as o,j as T,n as uo,f as n,c as a,k as $,a as i,y as t,o as xo,A as Lo,x as c}from"../chunks/index.707bf1b6.js";import{T as $o}from"../chunks/Tip.c2ecdbf4.js";import{D as w}from"../chunks/Docstring.17db21ae.js";import{C as ja}from"../chunks/CodeBlock.54a9f38d.js";import{E as bo}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H as jr}from"../chunks/Heading.342b1fa6.js";function Io(I){let m,x,b,C,y;const _=I[1].default,M=Co(_,I,I[2],null);return{c(){m=s("p"),x=ho("Deprecated in "),b=ho(I[0]),C=r(),M&&M.c(),this.h()},l(L){m=o(L,"P",{class:!0});var E=T(m);x=uo(E,"Deprecated in "),b=uo(E,I[0]),E.forEach(n),C=a(L),M&&M.l(L),this.h()},h(){$(m,"class","font-medium")},m(L,E){i(L,m,E),t(m,x),t(m,b),i(L,C,E),M&&M.m(L,E),y=!0},p(L,E){(!y||E&1)&&xo(b,L[0]),M&&M.p&&(!y||E&4)&&ko(M,_,L,L[2],y?yo(_,L[2],E,null):wo(L[2]),null)},i(L){y||(d(M,L),y=!0)},o(L){p(M,L),y=!1},d(L){L&&(n(m),n(C)),M&&M.d(L)}}}function Eo(I){let m,x;return m=new $o({props:{warning:!0,$$slots:{default:[Io]},$$scope:{ctx:I}}}),{c(){f(m.$$.fragment)},l(b){g(m.$$.fragment,b)},m(b,C){h(m,b,C),x=!0},p(b,[C]){const y={};C&5&&(y.$$scope={dirty:C,ctx:b}),m.$set(y)},i(b){x||(d(m.$$.fragment,b),x=!0)},o(b){p(m.$$.fragment,b),x=!1},d(b){u(m,b)}}}function Ho(I,m,x){let{$$slots:b={},$$scope:C}=m,{version:y}=m;return I.$$set=_=>{"version"in _&&x(0,y=_.version),"$$scope"in _&&x(2,C=_.$$scope)},[y,b,C]}class jo extends vo{constructor(m){super(),To(this,m,Ho,Eo,_o,{version:0})}}function Jo(I){let m,x="Setting <code>WANDB_LOG_MODEL</code> as <code>bool</code> will be deprecated in version 5 of 🤗 Transformers.";return{c(){m=s("p"),m.innerHTML=x},l(b){m=o(b,"P",{"data-svelte-h":!0}),c(m)!=="svelte-fxlq1n"&&(m.innerHTML=x)},m(b,C){i(b,m,C)},p:Ja,d(b){b&&n(m)}}}function Ao(I){let m,x="Example:",b,C,y;return C=new ja({props:{code:"JTIzJTIwTm90ZSUzQSUyMFRoaXMlMjBleGFtcGxlJTIwc2tpcHMlMjBvdmVyJTIwc29tZSUyMHNldHVwJTIwc3RlcHMlMjBmb3IlMjBicmV2aXR5LiUwQWZyb20lMjBmbHl0ZWtpdCUyMGltcG9ydCUyMGN1cnJlbnRfY29udGV4dCUyQyUyMHRhc2slMEElMEElMEElNDB0YXNrJTBBZGVmJTIwdHJhaW5faGZfdHJhbnNmb3JtZXIoKSUzQSUwQSUyMCUyMCUyMCUyMGNwJTIwJTNEJTIwY3VycmVudF9jb250ZXh0KCkuY2hlY2twb2ludCUwQSUyMCUyMCUyMCUyMHRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKC4uLiUyQyUyMGNhbGxiYWNrcyUzRCU1QkZseXRlQ2FsbGJhY2soKSU1RCklMEElMjAlMjAlMjAlMjBvdXRwdXQlMjAlM0QlMjB0cmFpbmVyLnRyYWluKHJlc3VtZV9mcm9tX2NoZWNrcG9pbnQlM0RjcC5yZXN0b3JlKCkp",highlighted:`<span class="hljs-comment"># Note: This example skips over some setup steps for brevity.</span>
<span class="hljs-keyword">from</span> flytekit <span class="hljs-keyword">import</span> current_context, task


<span class="hljs-meta">@task</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">train_hf_transformer</span>():
    cp = current_context().checkpoint
    trainer = Trainer(..., callbacks=[FlyteCallback()])
    output = trainer.train(resume_from_checkpoint=cp.restore())`,wrap:!1}}),{c(){m=s("p"),m.textContent=x,b=r(),f(C.$$.fragment)},l(_){m=o(_,"P",{"data-svelte-h":!0}),c(m)!=="svelte-11lpom8"&&(m.textContent=x),b=a(_),g(C.$$.fragment,_)},m(_,M){i(_,m,M),i(_,b,M),h(C,_,M),y=!0},p:Ja,i(_){y||(d(C.$$.fragment,_),y=!0)},o(_){p(C.$$.fragment,_),y=!1},d(_){_&&(n(m),n(b)),u(C,_)}}}function Uo(I){let m,x="Example:",b,C,y;return C=new ja({props:{code:"Y2xhc3MlMjBQcmludGVyQ2FsbGJhY2soVHJhaW5lckNhbGxiYWNrKSUzQSUwQSUyMCUyMCUyMCUyMGRlZiUyMG9uX2xvZyhzZWxmJTJDJTIwYXJncyUyQyUyMHN0YXRlJTJDJTIwY29udHJvbCUyQyUyMGxvZ3MlM0ROb25lJTJDJTIwKiprd2FyZ3MpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwXyUyMCUzRCUyMGxvZ3MucG9wKCUyMnRvdGFsX2Zsb3MlMjIlMkMlMjBOb25lKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwc3RhdGUuaXNfbG9jYWxfcHJvY2Vzc196ZXJvJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJpbnQobG9ncyk=",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)`,wrap:!1}}),{c(){m=s("p"),m.textContent=x,b=r(),f(C.$$.fragment)},l(_){m=o(_,"P",{"data-svelte-h":!0}),c(m)!=="svelte-11lpom8"&&(m.textContent=x),b=a(_),g(C.$$.fragment,_)},m(_,M){i(_,m,M),i(_,b,M),h(C,_,M),y=!0},p:Ja,i(_){y||(d(C.$$.fragment,_),y=!0)},o(_){p(C.$$.fragment,_),y=!1},d(_){_&&(n(m),n(b)),u(C,_)}}}function Do(I){let m,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 <code>gradient_accumulation_steps=n</code>, then one update
step requires going through <em>n</em> batches.`;return{c(){m=s("p"),m.innerHTML=x},l(b){m=o(b,"P",{"data-svelte-h":!0}),c(m)!=="svelte-rhwh6p"&&(m.innerHTML=x)},m(b,C){i(b,m,C)},p:Ja,d(b){b&&n(m)}}}function No(I){let m,x,b,C,y,_,M,L=`Callbacks are objects that can customize the behavior of the training loop in the PyTorch
<a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> (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…) and take decisions (like early
stopping).`,E,ye,ss=`Callbacks are “read only” pieces of code, apart from the <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerControl">TrainerControl</a> object they return, they
cannot change anything in the training loop. For customizations that require changes in the training loop, you should
subclass <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> and override the methods you need (see <a href="trainer">trainer</a> for examples).`,Jr,Me,os='By default, <code>TrainingArguments.report_to</code> is set to <code>&quot;all&quot;</code>, so a <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> will use the following callbacks.',Ar,xe,ls=`<li><a href="/docs/transformers/main/en/main_classes/callback#transformers.DefaultFlowCallback">DefaultFlowCallback</a> which handles the default behavior for logging, saving and evaluation.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.PrinterCallback">PrinterCallback</a> or <a href="/docs/transformers/main/en/main_classes/callback#transformers.ProgressCallback">ProgressCallback</a> to display progress and print the
logs (the first one is used if you deactivate tqdm through the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>, otherwise
it’s the second one).</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.TensorBoardCallback">TensorBoardCallback</a> if tensorboard is accessible (either through PyTorch &gt;= 1.4
or tensorboardX).</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.WandbCallback">WandbCallback</a> if <a href="https://www.wandb.com/" rel="nofollow">wandb</a> is installed.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.CometCallback">CometCallback</a> if <a href="https://www.comet.ml/site/" rel="nofollow">comet_ml</a> is installed.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.MLflowCallback">MLflowCallback</a> if <a href="https://www.mlflow.org/" rel="nofollow">mlflow</a> is installed.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.NeptuneCallback">NeptuneCallback</a> if <a href="https://neptune.ai/" rel="nofollow">neptune</a> is installed.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.AzureMLCallback">AzureMLCallback</a> if <a href="https://pypi.org/project/azureml-sdk/" rel="nofollow">azureml-sdk</a> is
installed.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.CodeCarbonCallback">CodeCarbonCallback</a> if <a href="https://pypi.org/project/codecarbon/" rel="nofollow">codecarbon</a> is
installed.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.ClearMLCallback">ClearMLCallback</a> if <a href="https://github.com/allegroai/clearml" rel="nofollow">clearml</a> is installed.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.DagsHubCallback">DagsHubCallback</a> if <a href="https://dagshub.com/" rel="nofollow">dagshub</a> is installed.</li> <li><a href="/docs/transformers/main/en/main_classes/callback#transformers.integrations.FlyteCallback">FlyteCallback</a> if <a href="https://flyte.org/" rel="nofollow">flyte</a> is installed.</li>`,Ur,Le,is="If a package is installed but you don’t wish to use the accompanying integration, you can change <code>TrainingArguments.report_to</code> to a list of just those integrations you want to use (e.g. <code>[&quot;azure_ml&quot;, &quot;wandb&quot;]</code>).",Dr,Ie,cs=`The main class that implements callbacks is <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a>. It gets the
<a href="/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> used to instantiate the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>, can access that
Trainer’s internal state via <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerState">TrainerState</a>, and can take some actions on the training loop via
<a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerControl">TrainerControl</a>.`,Nr,Ee,Fr,He,ms='Here is the list of the available <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> in the library:',Sr,F,je,Aa,wt,ds='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that sends the logs to <a href="https://www.comet.ml/site/" rel="nofollow">Comet ML</a>.',Ua,j,Je,Da,yt,ps="Setup the optional Comet.ml integration.",Na,Mt,fs="Environment:",Fa,xt,gs=`<li><strong>COMET_MODE</strong> (<code>str</code>, <em>optional</em>, defaults to <code>ONLINE</code>):
Whether to create an online, offline experiment or disable Comet logging. Can be <code>OFFLINE</code>, <code>ONLINE</code>, or
<code>DISABLED</code>.</li> <li><strong>COMET_PROJECT_NAME</strong> (<code>str</code>, <em>optional</em>):
Comet project name for experiments.</li> <li><strong>COMET_OFFLINE_DIRECTORY</strong> (<code>str</code>, <em>optional</em>):
Folder to use for saving offline experiments when <code>COMET_MODE</code> is <code>OFFLINE</code>.</li> <li><strong>COMET_LOG_ASSETS</strong> (<code>str</code>, <em>optional</em>, defaults to <code>TRUE</code>):
Whether or not to log training assets (tf event logs, checkpoints, etc), to Comet. Can be <code>TRUE</code>, or
<code>FALSE</code>.</li>`,Sa,Lt,hs=`For a number of configurable items in the environment, see
<a href="https://www.comet.ml/docs/python-sdk/advanced/#comet-configuration-variables" rel="nofollow">here</a>.`,Pr,O,Ae,Pa,It,us='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that handles the default flow of the training loop for logs, evaluation and checkpoints.',Wr,V,Ue,Wa,Et,bs='A bare <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that just prints the logs.',Br,X,De,Ba,Ht,_s='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that displays the progress of training or evaluation.',zr,S,Ne,za,jt,vs='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that handles early stopping.',Ra,Jt,Ts=`This callback depends on <a href="/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> argument <em>load_best_model_at_end</em> functionality to set best_metric
in <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerState">TrainerState</a>. Note that if the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> argument <em>save_steps</em> differs from <em>eval_steps</em>, the
early stopping will not occur until the next save step.`,Rr,Z,Fe,Ga,At,$s='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that sends the logs to <a href="https://www.tensorflow.org/tensorboard" rel="nofollow">TensorBoard</a>.',Gr,P,Se,qa,Ut,Cs='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that logs metrics, media, model checkpoints to <a href="https://www.wandb.com/" rel="nofollow">Weight and Biases</a>.',Ya,J,Pe,Oa,Dt,ks="Setup the optional Weights &amp; Biases (<em>wandb</em>) integration.",Va,Nt,ws=`One can subclass and override this method to customize the setup if needed. Find more information
<a href="https://docs.wandb.ai/guides/integrations/huggingface" rel="nofollow">here</a>. You can also override the following environment
variables:`,Xa,Ft,ys="Environment:",Za,W,We,St,Ms=`<strong>WANDB_LOG_MODEL</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;false&quot;</code>):
Whether to log model and checkpoints during training. Can be <code>&quot;end&quot;</code>, <code>&quot;checkpoint&quot;</code> or <code>&quot;false&quot;</code>. If set
to <code>&quot;end&quot;</code>, the model will be uploaded at the end of training. If set to <code>&quot;checkpoint&quot;</code>, the checkpoint
will be uploaded every <code>args.save_steps</code> . If set to <code>&quot;false&quot;</code>, the model will not be uploaded. Use along
with <code>load_best_model_at_end()</code> to upload best model.`,Qa,re,Ka,Pt,xs=`<p><strong>WANDB_WATCH</strong> (<code>str</code>, <em>optional</em> defaults to <code>&quot;false&quot;</code>):
Can be <code>&quot;gradients&quot;</code>, <code>&quot;all&quot;</code>, <code>&quot;parameters&quot;</code>, or <code>&quot;false&quot;</code>. Set to <code>&quot;all&quot;</code> to log gradients and
parameters.</p>`,en,Wt,Ls=`<p><strong>WANDB_PROJECT</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;huggingface&quot;</code>):
Set this to a custom string to store results in a different project.</p>`,tn,Bt,Is=`<p><strong>WANDB_DISABLED</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether to disable wandb entirely. Set <code>WANDB_DISABLED=true</code> to disable.</p>`,qr,B,Be,rn,zt,Es=`A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that sends the logs to <a href="https://www.mlflow.org/" rel="nofollow">MLflow</a>. Can be disabled by setting
environment variable <code>DISABLE_MLFLOW_INTEGRATION = TRUE</code>.`,an,D,ze,nn,Rt,Hs="Setup the optional MLflow integration.",sn,Gt,js="Environment:",on,qt,Js=`<li><strong>HF_MLFLOW_LOG_ARTIFACTS</strong> (<code>str</code>, <em>optional</em>):
Whether to use MLflow <code>.log_artifact()</code> facility to log artifacts. This only makes sense if logging to a
remote server, e.g. s3 or GCS. If set to <code>True</code> or <em>1</em>, will copy each saved checkpoint on each save in
<a href="/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>’s <code>output_dir</code> to the local or remote artifact storage. Using it without a remote
storage will just copy the files to your artifact location.</li> <li><strong>MLFLOW_EXPERIMENT_NAME</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>):
Whether to use an MLflow experiment_name under which to launch the run. Default to <code>None</code> which will point
to the <code>Default</code> 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.</li> <li><strong>MLFLOW_TAGS</strong> (<code>str</code>, <em>optional</em>):
A string dump of a dictionary of key/value pair to be added to the MLflow run as tags. Example:
<code>os.environ[&#39;MLFLOW_TAGS&#39;]=&#39;{&quot;release.candidate&quot;: &quot;RC1&quot;, &quot;release.version&quot;: &quot;2.2.0&quot;}&#39;</code>.</li> <li><strong>MLFLOW_NESTED_RUN</strong> (<code>str</code>, <em>optional</em>):
Whether to use MLflow nested runs. If set to <code>True</code> or <em>1</em>, will create a nested run inside the current
run.</li> <li><strong>MLFLOW_RUN_ID</strong> (<code>str</code>, <em>optional</em>):
Allow to reattach to an existing run which can be usefull when resuming training from a checkpoint. When
<code>MLFLOW_RUN_ID</code> environment variable is set, <code>start_run</code> attempts to resume a run with the specified run ID
and other parameters are ignored.</li> <li><strong>MLFLOW_FLATTEN_PARAMS</strong> (<code>str</code>, <em>optional</em>, defaults to <code>False</code>):
Whether to flatten the parameters dictionary before logging.</li>`,Yr,Q,Re,ln,Yt,As='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that sends the logs to <a href="https://pypi.org/project/azureml-sdk/" rel="nofollow">AzureML</a>.',Or,K,Ge,cn,Ot,Us='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that tracks the CO2 emission of training.',Vr,z,qe,mn,Vt,Ds='TrainerCallback that sends the logs to <a href="https://app.neptune.ai" rel="nofollow">Neptune</a>.',dn,Xt,Ns=`For instructions and examples, see the <a href="https://docs.neptune.ai/integrations/transformers" rel="nofollow">Transformers integration
guide</a> in the Neptune documentation.`,Xr,A,Ye,pn,Zt,Fs='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that sends the logs to <a href="https://clear.ml/" rel="nofollow">ClearML</a>.',fn,Qt,Ss="Environment:",gn,Kt,Ps=`<li><strong>CLEARML_PROJECT</strong> (<code>str</code>, <em>optional</em>, defaults to <code>HuggingFace Transformers</code>):
ClearML project name.</li> <li><strong>CLEARML_TASK</strong> (<code>str</code>, <em>optional</em>, defaults to <code>Trainer</code>):
ClearML task name.</li> <li><strong>CLEARML_LOG_MODEL</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>):
Whether to log models as artifacts during training.</li>`,Zr,R,Oe,hn,er,Ws='A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that logs to <a href="https://dagshub.com/" rel="nofollow">DagsHub</a>. Extends <code>MLflowCallback</code>',un,N,Ve,bn,tr,Bs="Setup the DagsHub’s Logging integration.",_n,rr,zs="Environment:",vn,ar,Rs=`<li><strong>HF_DAGSHUB_LOG_ARTIFACTS</strong> (<code>str</code>, <em>optional</em>):
Whether to save the data and model artifacts for the experiment. Default to <code>False</code>.</li>`,Qr,G,Xe,Tn,nr,Gs=`A <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> that sends the logs to <a href="https://flyte.org/" rel="nofollow">Flyte</a>.
NOTE: This callback only works within a Flyte task.`,$n,ae,Kr,Ze,ea,v,Qe,Cn,sr,qs=`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:`,kn,or,Ys=`The <code>control</code> 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.`,wn,lr,Os=`The argument <code>args</code>, <code>state</code> and <code>control</code> are positionals for all events, all the others are grouped in <code>kwargs</code>.
You can unpack the ones you need in the signature of the event using them. As an example, see the code of the
simple <code>~transformer.PrinterCallback</code>.`,yn,ne,Mn,se,Ke,xn,ir,Vs="Event called at the beginning of an epoch.",Ln,oe,et,In,cr,Xs="Event called at the end of an epoch.",En,le,tt,Hn,mr,Zs="Event called after an evaluation phase.",jn,ie,rt,Jn,dr,Qs='Event called at the end of the initialization of the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>.',An,ce,at,Un,pr,Ks="Event called after logging the last logs.",Dn,me,nt,Nn,fr,eo="Event called after a successful prediction.",Fn,de,st,Sn,gr,to="Event called after a prediction step.",Pn,pe,ot,Wn,hr,ro="Event called after a checkpoint save.",Bn,fe,lt,zn,ur,ao=`Event called at the beginning of a training step. If using gradient accumulation, one training step might take
several inputs.`,Rn,ge,it,Gn,br,no=`Event called at the end of a training step. If using gradient accumulation, one training step might take
several inputs.`,qn,he,ct,Yn,_r,so="Event called at the end of an substep during gradient accumulation.",On,ue,mt,Vn,vr,oo="Event called at the beginning of training.",Xn,be,dt,Zn,Tr,lo="Event called at the end of training.",ta,pt,io='Here is an example of how to register a custom callback with the PyTorch <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>:',ra,ft,aa,gt,co="Another way to register a callback is to call <code>trainer.add_callback()</code> as follows:",na,ht,sa,ut,oa,H,bt,Qn,$r,mo=`A class containing the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> inner state that will be saved along the model and optimizer when checkpointing
and passed to the <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a>.`,Kn,_e,es,ve,_t,ts,Cr,po="Create an instance from the content of <code>json_path</code>.",rs,Te,vt,as,kr,fo="Save the content of this instance in JSON format inside <code>json_path</code>.",la,Tt,ia,ee,$t,ns,wr,go=`A class that handles the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> control flow. This class is used by the <a href="/docs/transformers/main/en/main_classes/callback#transformers.TrainerCallback">TrainerCallback</a> to activate some
switches in the training loop.`,ca,Hr,ma;return y=new jr({props:{title:"Callbacks",local:"callbacks",headingTag:"h1"}}),Ee=new jr({props:{title:"Available Callbacks",local:"transformers.integrations.CometCallback",headingTag:"h2"}}),je=new w({props:{name:"class transformers.integrations.CometCallback",anchor:"transformers.integrations.CometCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L829"}}),Je=new w({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/integration_utils.py#L840"}}),Ae=new w({props:{name:"class transformers.DefaultFlowCallback",anchor:"transformers.DefaultFlowCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L425"}}),Ue=new w({props:{name:"class transformers.PrinterCallback",anchor:"transformers.PrinterCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L525"}}),De=new w({props:{name:"class transformers.ProgressCallback",anchor:"transformers.ProgressCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_callback.py#L475"}}),Ne=new w({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#L536"}}),Fe=new w({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/integration_utils.py#L575"}}),Se=new w({props:{name:"class transformers.integrations.WandbCallback",anchor:"transformers.integrations.WandbCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L661"}}),Pe=new w({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/integration_utils.py#L686"}}),re=new jo({props:{version:"5.0",$$slots:{default:[Jo]},$$scope:{ctx:I}}}),Be=new w({props:{name:"class transformers.integrations.MLflowCallback",anchor:"transformers.integrations.MLflowCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L929"}}),ze=new w({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/integration_utils.py#L948"}}),Re=new w({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/integration_utils.py#L906"}}),Ge=new w({props:{name:"class transformers.integrations.CodeCarbonCallback",anchor:"transformers.integrations.CodeCarbonCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L1395"}}),qe=new w({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:" = 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>, <em>optional</em>) &#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/setup/installation" rel="nofollow">docs</a>.`,name:"api_token"},{anchor:"transformers.integrations.NeptuneCallback.project",description:`<strong>project</strong> (<code>str</code>, <em>optional</em>) &#x2014; Name of an existing Neptune project, in the form &#x201C;workspace-name/project-name&#x201D;.
You can find and copy the name in Neptune from the project settings -&gt; Properties. If None (default), the
value of the <code>NEPTUNE_PROJECT</code> environment variable is used.`,name:"project"},{anchor:"transformers.integrations.NeptuneCallback.name",description:"<strong>name</strong> (<code>str</code>, <em>optional</em>) &#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 metadata logged by the callback.`,name:"base_namespace"},{anchor:"transformers.integrations.NeptuneCallback.log_parameters",description:`<strong>log_parameters</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#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>, <em>optional</em>) &#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 <code>None</code>, does not upload checkpoints.`,name:"log_checkpoints"},{anchor:"transformers.integrations.NeptuneCallback.run",description:`<strong>run</strong> (<code>Run</code>, <em>optional</em>) &#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/logging/to_existing_object" rel="nofollow">docs</a>.`,name:"run"},{anchor:"transformers.integrations.NeptuneCallback.*neptune_run_kwargs",description:`*<strong>*neptune_run_kwargs</strong> (<em>optional</em>) &#x2014;
Additional keyword arguments to be passed directly to the
<a href="https://docs.neptune.ai/api/neptune#init_run" rel="nofollow"><code>neptune.init_run()</code></a> function when a new run is created.`,name:"*neptune_run_kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L1124"}}),Ye=new w({props:{name:"class transformers.integrations.ClearMLCallback",anchor:"transformers.integrations.ClearMLCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L1424"}}),Oe=new w({props:{name:"class transformers.integrations.DagsHubCallback",anchor:"transformers.integrations.DagsHubCallback",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L1064"}}),Ve=new w({props:{name:"setup",anchor:"transformers.integrations.DagsHubCallback.setup",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L1078"}}),Xe=new w({props:{name:"class transformers.integrations.FlyteCallback",anchor:"transformers.integrations.FlyteCallback",parameters:[{name:"save_log_history",val:": bool = True"},{name:"sync_checkpoints",val:": bool = True"}],parametersDescription:[{anchor:"transformers.integrations.FlyteCallback.save_log_history",description:`<strong>save_log_history</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
When set to True, the training logs are saved as a Flyte Deck.`,name:"save_log_history"},{anchor:"transformers.integrations.FlyteCallback.sync_checkpoints",description:`<strong>sync_checkpoints</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
When set to True, checkpoints are synced with Flyte and can be used to resume training in the case of an
interruption.`,name:"sync_checkpoints"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/integration_utils.py#L1545"}}),ae=new bo({props:{anchor:"transformers.integrations.FlyteCallback.example",$$slots:{default:[Ao]},$$scope:{ctx:I}}}),Ze=new jr({props:{title:"TrainerCallback",local:"transformers.TrainerCallback",headingTag:"h2"}}),Qe=new w({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#L168"}}),ne=new bo({props:{anchor:"transformers.TrainerCallback.example",$$slots:{default:[Uo]},$$scope:{ctx:I}}}),Ke=new w({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#L237"}}),et=new w({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#L243"}}),tt=new w({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#L269"}}),rt=new w({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#L219"}}),at=new w({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#L287"}}),nt=new w({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#L275"}}),st=new w({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#L293"}}),ot=new w({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#L281"}}),lt=new w({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#L249"}}),it=new w({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#L262"}}),ct=new w({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#L256"}}),mt=new w({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#L225"}}),dt=new w({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#L231"}}),ft=new ja({props:{code:"Y2xhc3MlMjBNeUNhbGxiYWNrKFRyYWluZXJDYWxsYmFjayklM0ElMEElMjAlMjAlMjAlMjAlMjJBJTIwY2FsbGJhY2slMjB0aGF0JTIwcHJpbnRzJTIwYSUyMG1lc3NhZ2UlMjBhdCUyMHRoZSUyMGJlZ2lubmluZyUyMG9mJTIwdHJhaW5pbmclMjIlMEElMEElMjAlMjAlMjAlMjBkZWYlMjBvbl90cmFpbl9iZWdpbihzZWxmJTJDJTIwYXJncyUyQyUyMHN0YXRlJTJDJTIwY29udHJvbCUyQyUyMCoqa3dhcmdzKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByaW50KCUyMlN0YXJ0aW5nJTIwdHJhaW5pbmclMjIpJTBBJTBBJTBBdHJhaW5lciUyMCUzRCUyMFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRHRyYWluX2RhdGFzZXQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RldmFsX2RhdGFzZXQlMkMlMEElMjAlMjAlMjAlMjBjYWxsYmFja3MlM0QlNUJNeUNhbGxiYWNrJTVEJTJDJTIwJTIwJTIzJTIwV2UlMjBjYW4lMjBlaXRoZXIlMjBwYXNzJTIwdGhlJTIwY2FsbGJhY2slMjBjbGFzcyUyMHRoaXMlMjB3YXklMjBvciUyMGFuJTIwaW5zdGFuY2UlMjBvZiUyMGl0JTIwKE15Q2FsbGJhY2soKSklMEEp",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>
)`,wrap:!1}}),ht=new ja({props:{code:"dHJhaW5lciUyMCUzRCUyMFRyYWluZXIoLi4uKSUwQXRyYWluZXIuYWRkX2NhbGxiYWNrKE15Q2FsbGJhY2spJTBBJTIzJTIwQWx0ZXJuYXRpdmVseSUyQyUyMHdlJTIwY2FuJTIwcGFzcyUyMGFuJTIwaW5zdGFuY2UlMjBvZiUyMHRoZSUyMGNhbGxiYWNrJTIwY2xhc3MlMEF0cmFpbmVyLmFkZF9jYWxsYmFjayhNeUNhbGxiYWNrKCkp",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())`,wrap:!1}}),ut=new jr({props:{title:"TrainerState",local:"transformers.TrainerState",headingTag:"h2"}}),bt=new w({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:"logging_steps",val:": int = 500"},{name:"eval_steps",val:": int = 500"},{name:"save_steps",val:": int = 500"},{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.logging_steps",description:`<strong>logging_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Log every X updates steps`,name:"logging_steps"},{anchor:"transformers.TrainerState.eval_steps",description:`<strong>eval_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Run an evaluation every X steps.`,name:"eval_steps"},{anchor:"transformers.TrainerState.save_steps",description:`<strong>save_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 500) &#x2014;
Save checkpoint every X updates steps.`,name:"save_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"}}),_e=new $o({props:{$$slots:{default:[Do]},$$scope:{ctx:I}}}),_t=new w({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#L110"}}),vt=new w({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#L104"}}),Tt=new jr({props:{title:"TrainerControl",local:"transformers.TrainerControl",headingTag:"h2"}}),$t=new w({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#L119"}}),{c(){m=s("meta"),x=r(),b=s("p"),C=r(),f(y.$$.fragment),_=r(),M=s("p"),M.innerHTML=L,E=r(),ye=s("p"),ye.innerHTML=ss,Jr=r(),Me=s("p"),Me.innerHTML=os,Ar=r(),xe=s("ul"),xe.innerHTML=ls,Ur=r(),Le=s("p"),Le.innerHTML=is,Dr=r(),Ie=s("p"),Ie.innerHTML=cs,Nr=r(),f(Ee.$$.fragment),Fr=r(),He=s("p"),He.innerHTML=ms,Sr=r(),F=s("div"),f(je.$$.fragment),Aa=r(),wt=s("p"),wt.innerHTML=ds,Ua=r(),j=s("div"),f(Je.$$.fragment),Da=r(),yt=s("p"),yt.textContent=ps,Na=r(),Mt=s("p"),Mt.textContent=fs,Fa=r(),xt=s("ul"),xt.innerHTML=gs,Sa=r(),Lt=s("p"),Lt.innerHTML=hs,Pr=r(),O=s("div"),f(Ae.$$.fragment),Pa=r(),It=s("p"),It.innerHTML=us,Wr=r(),V=s("div"),f(Ue.$$.fragment),Wa=r(),Et=s("p"),Et.innerHTML=bs,Br=r(),X=s("div"),f(De.$$.fragment),Ba=r(),Ht=s("p"),Ht.innerHTML=_s,zr=r(),S=s("div"),f(Ne.$$.fragment),za=r(),jt=s("p"),jt.innerHTML=vs,Ra=r(),Jt=s("p"),Jt.innerHTML=Ts,Rr=r(),Z=s("div"),f(Fe.$$.fragment),Ga=r(),At=s("p"),At.innerHTML=$s,Gr=r(),P=s("div"),f(Se.$$.fragment),qa=r(),Ut=s("p"),Ut.innerHTML=Cs,Ya=r(),J=s("div"),f(Pe.$$.fragment),Oa=r(),Dt=s("p"),Dt.innerHTML=ks,Va=r(),Nt=s("p"),Nt.innerHTML=ws,Xa=r(),Ft=s("p"),Ft.textContent=ys,Za=r(),W=s("ul"),We=s("li"),St=s("p"),St.innerHTML=Ms,Qa=r(),f(re.$$.fragment),Ka=r(),Pt=s("li"),Pt.innerHTML=xs,en=r(),Wt=s("li"),Wt.innerHTML=Ls,tn=r(),Bt=s("li"),Bt.innerHTML=Is,qr=r(),B=s("div"),f(Be.$$.fragment),rn=r(),zt=s("p"),zt.innerHTML=Es,an=r(),D=s("div"),f(ze.$$.fragment),nn=r(),Rt=s("p"),Rt.textContent=Hs,sn=r(),Gt=s("p"),Gt.textContent=js,on=r(),qt=s("ul"),qt.innerHTML=Js,Yr=r(),Q=s("div"),f(Re.$$.fragment),ln=r(),Yt=s("p"),Yt.innerHTML=As,Or=r(),K=s("div"),f(Ge.$$.fragment),cn=r(),Ot=s("p"),Ot.innerHTML=Us,Vr=r(),z=s("div"),f(qe.$$.fragment),mn=r(),Vt=s("p"),Vt.innerHTML=Ds,dn=r(),Xt=s("p"),Xt.innerHTML=Ns,Xr=r(),A=s("div"),f(Ye.$$.fragment),pn=r(),Zt=s("p"),Zt.innerHTML=Fs,fn=r(),Qt=s("p"),Qt.textContent=Ss,gn=r(),Kt=s("ul"),Kt.innerHTML=Ps,Zr=r(),R=s("div"),f(Oe.$$.fragment),hn=r(),er=s("p"),er.innerHTML=Ws,un=r(),N=s("div"),f(Ve.$$.fragment),bn=r(),tr=s("p"),tr.textContent=Bs,_n=r(),rr=s("p"),rr.textContent=zs,vn=r(),ar=s("ul"),ar.innerHTML=Rs,Qr=r(),G=s("div"),f(Xe.$$.fragment),Tn=r(),nr=s("p"),nr.innerHTML=Gs,$n=r(),f(ae.$$.fragment),Kr=r(),f(Ze.$$.fragment),ea=r(),v=s("div"),f(Qe.$$.fragment),Cn=r(),sr=s("p"),sr.textContent=qs,kn=r(),or=s("p"),or.innerHTML=Ys,wn=r(),lr=s("p"),lr.innerHTML=Os,yn=r(),f(ne.$$.fragment),Mn=r(),se=s("div"),f(Ke.$$.fragment),xn=r(),ir=s("p"),ir.textContent=Vs,Ln=r(),oe=s("div"),f(et.$$.fragment),In=r(),cr=s("p"),cr.textContent=Xs,En=r(),le=s("div"),f(tt.$$.fragment),Hn=r(),mr=s("p"),mr.textContent=Zs,jn=r(),ie=s("div"),f(rt.$$.fragment),Jn=r(),dr=s("p"),dr.innerHTML=Qs,An=r(),ce=s("div"),f(at.$$.fragment),Un=r(),pr=s("p"),pr.textContent=Ks,Dn=r(),me=s("div"),f(nt.$$.fragment),Nn=r(),fr=s("p"),fr.textContent=eo,Fn=r(),de=s("div"),f(st.$$.fragment),Sn=r(),gr=s("p"),gr.textContent=to,Pn=r(),pe=s("div"),f(ot.$$.fragment),Wn=r(),hr=s("p"),hr.textContent=ro,Bn=r(),fe=s("div"),f(lt.$$.fragment),zn=r(),ur=s("p"),ur.textContent=ao,Rn=r(),ge=s("div"),f(it.$$.fragment),Gn=r(),br=s("p"),br.textContent=no,qn=r(),he=s("div"),f(ct.$$.fragment),Yn=r(),_r=s("p"),_r.textContent=so,On=r(),ue=s("div"),f(mt.$$.fragment),Vn=r(),vr=s("p"),vr.textContent=oo,Xn=r(),be=s("div"),f(dt.$$.fragment),Zn=r(),Tr=s("p"),Tr.textContent=lo,ta=r(),pt=s("p"),pt.innerHTML=io,ra=r(),f(ft.$$.fragment),aa=r(),gt=s("p"),gt.innerHTML=co,na=r(),f(ht.$$.fragment),sa=r(),f(ut.$$.fragment),oa=r(),H=s("div"),f(bt.$$.fragment),Qn=r(),$r=s("p"),$r.innerHTML=mo,Kn=r(),f(_e.$$.fragment),es=r(),ve=s("div"),f(_t.$$.fragment),ts=r(),Cr=s("p"),Cr.innerHTML=po,rs=r(),Te=s("div"),f(vt.$$.fragment),as=r(),kr=s("p"),kr.innerHTML=fo,la=r(),f(Tt.$$.fragment),ia=r(),ee=s("div"),f($t.$$.fragment),ns=r(),wr=s("p"),wr.innerHTML=go,ca=r(),Hr=s("p"),this.h()},l(e){const l=Lo("svelte-u9bgzb",document.head);m=o(l,"META",{name:!0,content:!0}),l.forEach(n),x=a(e),b=o(e,"P",{}),T(b).forEach(n),C=a(e),g(y.$$.fragment,e),_=a(e),M=o(e,"P",{"data-svelte-h":!0}),c(M)!=="svelte-117jlmj"&&(M.innerHTML=L),E=a(e),ye=o(e,"P",{"data-svelte-h":!0}),c(ye)!=="svelte-1ouow8t"&&(ye.innerHTML=ss),Jr=a(e),Me=o(e,"P",{"data-svelte-h":!0}),c(Me)!=="svelte-c2r1ku"&&(Me.innerHTML=os),Ar=a(e),xe=o(e,"UL",{"data-svelte-h":!0}),c(xe)!=="svelte-a6tokk"&&(xe.innerHTML=ls),Ur=a(e),Le=o(e,"P",{"data-svelte-h":!0}),c(Le)!=="svelte-r4lsec"&&(Le.innerHTML=is),Dr=a(e),Ie=o(e,"P",{"data-svelte-h":!0}),c(Ie)!=="svelte-8ifmvc"&&(Ie.innerHTML=cs),Nr=a(e),g(Ee.$$.fragment,e),Fr=a(e),He=o(e,"P",{"data-svelte-h":!0}),c(He)!=="svelte-1l9ib2b"&&(He.innerHTML=ms),Sr=a(e),F=o(e,"DIV",{class:!0});var te=T(F);g(je.$$.fragment,te),Aa=a(te),wt=o(te,"P",{"data-svelte-h":!0}),c(wt)!=="svelte-kwk50w"&&(wt.innerHTML=ds),Ua=a(te),j=o(te,"DIV",{class:!0});var U=T(j);g(Je.$$.fragment,U),Da=a(U),yt=o(U,"P",{"data-svelte-h":!0}),c(yt)!=="svelte-1bfkm9x"&&(yt.textContent=ps),Na=a(U),Mt=o(U,"P",{"data-svelte-h":!0}),c(Mt)!=="svelte-1fkshtn"&&(Mt.textContent=fs),Fa=a(U),xt=o(U,"UL",{"data-svelte-h":!0}),c(xt)!=="svelte-12drq5x"&&(xt.innerHTML=gs),Sa=a(U),Lt=o(U,"P",{"data-svelte-h":!0}),c(Lt)!=="svelte-1faq0a7"&&(Lt.innerHTML=hs),U.forEach(n),te.forEach(n),Pr=a(e),O=o(e,"DIV",{class:!0});var Ct=T(O);g(Ae.$$.fragment,Ct),Pa=a(Ct),It=o(Ct,"P",{"data-svelte-h":!0}),c(It)!=="svelte-tbohg7"&&(It.innerHTML=us),Ct.forEach(n),Wr=a(e),V=o(e,"DIV",{class:!0});var kt=T(V);g(Ue.$$.fragment,kt),Wa=a(kt),Et=o(kt,"P",{"data-svelte-h":!0}),c(Et)!=="svelte-u33mq4"&&(Et.innerHTML=bs),kt.forEach(n),Br=a(e),X=o(e,"DIV",{class:!0});var da=T(X);g(De.$$.fragment,da),Ba=a(da),Ht=o(da,"P",{"data-svelte-h":!0}),c(Ht)!=="svelte-1arpznt"&&(Ht.innerHTML=_s),da.forEach(n),zr=a(e),S=o(e,"DIV",{class:!0});var yr=T(S);g(Ne.$$.fragment,yr),za=a(yr),jt=o(yr,"P",{"data-svelte-h":!0}),c(jt)!=="svelte-1uk5lii"&&(jt.innerHTML=vs),Ra=a(yr),Jt=o(yr,"P",{"data-svelte-h":!0}),c(Jt)!=="svelte-1hyho8y"&&(Jt.innerHTML=Ts),yr.forEach(n),Rr=a(e),Z=o(e,"DIV",{class:!0});var pa=T(Z);g(Fe.$$.fragment,pa),Ga=a(pa),At=o(pa,"P",{"data-svelte-h":!0}),c(At)!=="svelte-11ee725"&&(At.innerHTML=$s),pa.forEach(n),Gr=a(e),P=o(e,"DIV",{class:!0});var Mr=T(P);g(Se.$$.fragment,Mr),qa=a(Mr),Ut=o(Mr,"P",{"data-svelte-h":!0}),c(Ut)!=="svelte-mdmk5i"&&(Ut.innerHTML=Cs),Ya=a(Mr),J=o(Mr,"DIV",{class:!0});var q=T(J);g(Pe.$$.fragment,q),Oa=a(q),Dt=o(q,"P",{"data-svelte-h":!0}),c(Dt)!=="svelte-op70zs"&&(Dt.innerHTML=ks),Va=a(q),Nt=o(q,"P",{"data-svelte-h":!0}),c(Nt)!=="svelte-m2rt7w"&&(Nt.innerHTML=ws),Xa=a(q),Ft=o(q,"P",{"data-svelte-h":!0}),c(Ft)!=="svelte-1fkshtn"&&(Ft.textContent=ys),Za=a(q),W=o(q,"UL",{});var $e=T(W);We=o($e,"LI",{});var fa=T(We);St=o(fa,"P",{"data-svelte-h":!0}),c(St)!=="svelte-py3r3s"&&(St.innerHTML=Ms),Qa=a(fa),g(re.$$.fragment,fa),fa.forEach(n),Ka=a($e),Pt=o($e,"LI",{"data-svelte-h":!0}),c(Pt)!=="svelte-dx3m30"&&(Pt.innerHTML=xs),en=a($e),Wt=o($e,"LI",{"data-svelte-h":!0}),c(Wt)!=="svelte-n1uh6c"&&(Wt.innerHTML=Ls),tn=a($e),Bt=o($e,"LI",{"data-svelte-h":!0}),c(Bt)!=="svelte-ybo66z"&&(Bt.innerHTML=Is),$e.forEach(n),q.forEach(n),Mr.forEach(n),qr=a(e),B=o(e,"DIV",{class:!0});var xr=T(B);g(Be.$$.fragment,xr),rn=a(xr),zt=o(xr,"P",{"data-svelte-h":!0}),c(zt)!=="svelte-1oxe4mu"&&(zt.innerHTML=Es),an=a(xr),D=o(xr,"DIV",{class:!0});var Ce=T(D);g(ze.$$.fragment,Ce),nn=a(Ce),Rt=o(Ce,"P",{"data-svelte-h":!0}),c(Rt)!=="svelte-nmg16f"&&(Rt.textContent=Hs),sn=a(Ce),Gt=o(Ce,"P",{"data-svelte-h":!0}),c(Gt)!=="svelte-1fkshtn"&&(Gt.textContent=js),on=a(Ce),qt=o(Ce,"UL",{"data-svelte-h":!0}),c(qt)!=="svelte-1vll7l2"&&(qt.innerHTML=Js),Ce.forEach(n),xr.forEach(n),Yr=a(e),Q=o(e,"DIV",{class:!0});var ga=T(Q);g(Re.$$.fragment,ga),ln=a(ga),Yt=o(ga,"P",{"data-svelte-h":!0}),c(Yt)!=="svelte-a0ewdh"&&(Yt.innerHTML=As),ga.forEach(n),Or=a(e),K=o(e,"DIV",{class:!0});var ha=T(K);g(Ge.$$.fragment,ha),cn=a(ha),Ot=o(ha,"P",{"data-svelte-h":!0}),c(Ot)!=="svelte-wnzizl"&&(Ot.innerHTML=Us),ha.forEach(n),Vr=a(e),z=o(e,"DIV",{class:!0});var Lr=T(z);g(qe.$$.fragment,Lr),mn=a(Lr),Vt=o(Lr,"P",{"data-svelte-h":!0}),c(Vt)!=="svelte-4ag9j6"&&(Vt.innerHTML=Ds),dn=a(Lr),Xt=o(Lr,"P",{"data-svelte-h":!0}),c(Xt)!=="svelte-1mhjcx0"&&(Xt.innerHTML=Ns),Lr.forEach(n),Xr=a(e),A=o(e,"DIV",{class:!0});var ke=T(A);g(Ye.$$.fragment,ke),pn=a(ke),Zt=o(ke,"P",{"data-svelte-h":!0}),c(Zt)!=="svelte-1qgg58f"&&(Zt.innerHTML=Fs),fn=a(ke),Qt=o(ke,"P",{"data-svelte-h":!0}),c(Qt)!=="svelte-1fkshtn"&&(Qt.textContent=Ss),gn=a(ke),Kt=o(ke,"UL",{"data-svelte-h":!0}),c(Kt)!=="svelte-15svthu"&&(Kt.innerHTML=Ps),ke.forEach(n),Zr=a(e),R=o(e,"DIV",{class:!0});var Ir=T(R);g(Oe.$$.fragment,Ir),hn=a(Ir),er=o(Ir,"P",{"data-svelte-h":!0}),c(er)!=="svelte-1w5b5fu"&&(er.innerHTML=Ws),un=a(Ir),N=o(Ir,"DIV",{class:!0});var we=T(N);g(Ve.$$.fragment,we),bn=a(we),tr=o(we,"P",{"data-svelte-h":!0}),c(tr)!=="svelte-1wbmj3"&&(tr.textContent=Bs),_n=a(we),rr=o(we,"P",{"data-svelte-h":!0}),c(rr)!=="svelte-1fkshtn"&&(rr.textContent=zs),vn=a(we),ar=o(we,"UL",{"data-svelte-h":!0}),c(ar)!=="svelte-dna85o"&&(ar.innerHTML=Rs),we.forEach(n),Ir.forEach(n),Qr=a(e),G=o(e,"DIV",{class:!0});var Er=T(G);g(Xe.$$.fragment,Er),Tn=a(Er),nr=o(Er,"P",{"data-svelte-h":!0}),c(nr)!=="svelte-7nm0bd"&&(nr.innerHTML=Gs),$n=a(Er),g(ae.$$.fragment,Er),Er.forEach(n),Kr=a(e),g(Ze.$$.fragment,e),ea=a(e),v=o(e,"DIV",{class:!0});var k=T(v);g(Qe.$$.fragment,k),Cn=a(k),sr=o(k,"P",{"data-svelte-h":!0}),c(sr)!=="svelte-14xg00o"&&(sr.textContent=qs),kn=a(k),or=o(k,"P",{"data-svelte-h":!0}),c(or)!=="svelte-1xprdvt"&&(or.innerHTML=Ys),wn=a(k),lr=o(k,"P",{"data-svelte-h":!0}),c(lr)!=="svelte-1vv9zs6"&&(lr.innerHTML=Os),yn=a(k),g(ne.$$.fragment,k),Mn=a(k),se=o(k,"DIV",{class:!0});var ua=T(se);g(Ke.$$.fragment,ua),xn=a(ua),ir=o(ua,"P",{"data-svelte-h":!0}),c(ir)!=="svelte-106889p"&&(ir.textContent=Vs),ua.forEach(n),Ln=a(k),oe=o(k,"DIV",{class:!0});var ba=T(oe);g(et.$$.fragment,ba),In=a(ba),cr=o(ba,"P",{"data-svelte-h":!0}),c(cr)!=="svelte-oshcpj"&&(cr.textContent=Xs),ba.forEach(n),En=a(k),le=o(k,"DIV",{class:!0});var _a=T(le);g(tt.$$.fragment,_a),Hn=a(_a),mr=o(_a,"P",{"data-svelte-h":!0}),c(mr)!=="svelte-1o0xh73"&&(mr.textContent=Zs),_a.forEach(n),jn=a(k),ie=o(k,"DIV",{class:!0});var va=T(ie);g(rt.$$.fragment,va),Jn=a(va),dr=o(va,"P",{"data-svelte-h":!0}),c(dr)!=="svelte-1wy373q"&&(dr.innerHTML=Qs),va.forEach(n),An=a(k),ce=o(k,"DIV",{class:!0});var Ta=T(ce);g(at.$$.fragment,Ta),Un=a(Ta),pr=o(Ta,"P",{"data-svelte-h":!0}),c(pr)!=="svelte-10eiwg0"&&(pr.textContent=Ks),Ta.forEach(n),Dn=a(k),me=o(k,"DIV",{class:!0});var $a=T(me);g(nt.$$.fragment,$a),Nn=a($a),fr=o($a,"P",{"data-svelte-h":!0}),c(fr)!=="svelte-1df7x4n"&&(fr.textContent=eo),$a.forEach(n),Fn=a(k),de=o(k,"DIV",{class:!0});var Ca=T(de);g(st.$$.fragment,Ca),Sn=a(Ca),gr=o(Ca,"P",{"data-svelte-h":!0}),c(gr)!=="svelte-18swygp"&&(gr.textContent=to),Ca.forEach(n),Pn=a(k),pe=o(k,"DIV",{class:!0});var ka=T(pe);g(ot.$$.fragment,ka),Wn=a(ka),hr=o(ka,"P",{"data-svelte-h":!0}),c(hr)!=="svelte-19xp05v"&&(hr.textContent=ro),ka.forEach(n),Bn=a(k),fe=o(k,"DIV",{class:!0});var wa=T(fe);g(lt.$$.fragment,wa),zn=a(wa),ur=o(wa,"P",{"data-svelte-h":!0}),c(ur)!=="svelte-7af61p"&&(ur.textContent=ao),wa.forEach(n),Rn=a(k),ge=o(k,"DIV",{class:!0});var ya=T(ge);g(it.$$.fragment,ya),Gn=a(ya),br=o(ya,"P",{"data-svelte-h":!0}),c(br)!=="svelte-8cdxjr"&&(br.textContent=no),ya.forEach(n),qn=a(k),he=o(k,"DIV",{class:!0});var Ma=T(he);g(ct.$$.fragment,Ma),Yn=a(Ma),_r=o(Ma,"P",{"data-svelte-h":!0}),c(_r)!=="svelte-sluvs0"&&(_r.textContent=so),Ma.forEach(n),On=a(k),ue=o(k,"DIV",{class:!0});var xa=T(ue);g(mt.$$.fragment,xa),Vn=a(xa),vr=o(xa,"P",{"data-svelte-h":!0}),c(vr)!=="svelte-6bvy6d"&&(vr.textContent=oo),xa.forEach(n),Xn=a(k),be=o(k,"DIV",{class:!0});var La=T(be);g(dt.$$.fragment,La),Zn=a(La),Tr=o(La,"P",{"data-svelte-h":!0}),c(Tr)!=="svelte-zzwxsv"&&(Tr.textContent=lo),La.forEach(n),k.forEach(n),ta=a(e),pt=o(e,"P",{"data-svelte-h":!0}),c(pt)!=="svelte-jteqqf"&&(pt.innerHTML=io),ra=a(e),g(ft.$$.fragment,e),aa=a(e),gt=o(e,"P",{"data-svelte-h":!0}),c(gt)!=="svelte-8gc48t"&&(gt.innerHTML=co),na=a(e),g(ht.$$.fragment,e),sa=a(e),g(ut.$$.fragment,e),oa=a(e),H=o(e,"DIV",{class:!0});var Y=T(H);g(bt.$$.fragment,Y),Qn=a(Y),$r=o(Y,"P",{"data-svelte-h":!0}),c($r)!=="svelte-2lch02"&&($r.innerHTML=mo),Kn=a(Y),g(_e.$$.fragment,Y),es=a(Y),ve=o(Y,"DIV",{class:!0});var Ia=T(ve);g(_t.$$.fragment,Ia),ts=a(Ia),Cr=o(Ia,"P",{"data-svelte-h":!0}),c(Cr)!=="svelte-hbs6ga"&&(Cr.innerHTML=po),Ia.forEach(n),rs=a(Y),Te=o(Y,"DIV",{class:!0});var Ea=T(Te);g(vt.$$.fragment,Ea),as=a(Ea),kr=o(Ea,"P",{"data-svelte-h":!0}),c(kr)!=="svelte-dkslae"&&(kr.innerHTML=fo),Ea.forEach(n),Y.forEach(n),la=a(e),g(Tt.$$.fragment,e),ia=a(e),ee=o(e,"DIV",{class:!0});var Ha=T(ee);g($t.$$.fragment,Ha),ns=a(Ha),wr=o(Ha,"P",{"data-svelte-h":!0}),c(wr)!=="svelte-lakwdm"&&(wr.innerHTML=go),Ha.forEach(n),ca=a(e),Hr=o(e,"P",{}),T(Hr).forEach(n),this.h()},h(){$(m,"name","hf:doc:metadata"),$(m,"content",Fo),$(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,l){t(document.head,m),i(e,x,l),i(e,b,l),i(e,C,l),h(y,e,l),i(e,_,l),i(e,M,l),i(e,E,l),i(e,ye,l),i(e,Jr,l),i(e,Me,l),i(e,Ar,l),i(e,xe,l),i(e,Ur,l),i(e,Le,l),i(e,Dr,l),i(e,Ie,l),i(e,Nr,l),h(Ee,e,l),i(e,Fr,l),i(e,He,l),i(e,Sr,l),i(e,F,l),h(je,F,null),t(F,Aa),t(F,wt),t(F,Ua),t(F,j),h(Je,j,null),t(j,Da),t(j,yt),t(j,Na),t(j,Mt),t(j,Fa),t(j,xt),t(j,Sa),t(j,Lt),i(e,Pr,l),i(e,O,l),h(Ae,O,null),t(O,Pa),t(O,It),i(e,Wr,l),i(e,V,l),h(Ue,V,null),t(V,Wa),t(V,Et),i(e,Br,l),i(e,X,l),h(De,X,null),t(X,Ba),t(X,Ht),i(e,zr,l),i(e,S,l),h(Ne,S,null),t(S,za),t(S,jt),t(S,Ra),t(S,Jt),i(e,Rr,l),i(e,Z,l),h(Fe,Z,null),t(Z,Ga),t(Z,At),i(e,Gr,l),i(e,P,l),h(Se,P,null),t(P,qa),t(P,Ut),t(P,Ya),t(P,J),h(Pe,J,null),t(J,Oa),t(J,Dt),t(J,Va),t(J,Nt),t(J,Xa),t(J,Ft),t(J,Za),t(J,W),t(W,We),t(We,St),t(We,Qa),h(re,We,null),t(W,Ka),t(W,Pt),t(W,en),t(W,Wt),t(W,tn),t(W,Bt),i(e,qr,l),i(e,B,l),h(Be,B,null),t(B,rn),t(B,zt),t(B,an),t(B,D),h(ze,D,null),t(D,nn),t(D,Rt),t(D,sn),t(D,Gt),t(D,on),t(D,qt),i(e,Yr,l),i(e,Q,l),h(Re,Q,null),t(Q,ln),t(Q,Yt),i(e,Or,l),i(e,K,l),h(Ge,K,null),t(K,cn),t(K,Ot),i(e,Vr,l),i(e,z,l),h(qe,z,null),t(z,mn),t(z,Vt),t(z,dn),t(z,Xt),i(e,Xr,l),i(e,A,l),h(Ye,A,null),t(A,pn),t(A,Zt),t(A,fn),t(A,Qt),t(A,gn),t(A,Kt),i(e,Zr,l),i(e,R,l),h(Oe,R,null),t(R,hn),t(R,er),t(R,un),t(R,N),h(Ve,N,null),t(N,bn),t(N,tr),t(N,_n),t(N,rr),t(N,vn),t(N,ar),i(e,Qr,l),i(e,G,l),h(Xe,G,null),t(G,Tn),t(G,nr),t(G,$n),h(ae,G,null),i(e,Kr,l),h(Ze,e,l),i(e,ea,l),i(e,v,l),h(Qe,v,null),t(v,Cn),t(v,sr),t(v,kn),t(v,or),t(v,wn),t(v,lr),t(v,yn),h(ne,v,null),t(v,Mn),t(v,se),h(Ke,se,null),t(se,xn),t(se,ir),t(v,Ln),t(v,oe),h(et,oe,null),t(oe,In),t(oe,cr),t(v,En),t(v,le),h(tt,le,null),t(le,Hn),t(le,mr),t(v,jn),t(v,ie),h(rt,ie,null),t(ie,Jn),t(ie,dr),t(v,An),t(v,ce),h(at,ce,null),t(ce,Un),t(ce,pr),t(v,Dn),t(v,me),h(nt,me,null),t(me,Nn),t(me,fr),t(v,Fn),t(v,de),h(st,de,null),t(de,Sn),t(de,gr),t(v,Pn),t(v,pe),h(ot,pe,null),t(pe,Wn),t(pe,hr),t(v,Bn),t(v,fe),h(lt,fe,null),t(fe,zn),t(fe,ur),t(v,Rn),t(v,ge),h(it,ge,null),t(ge,Gn),t(ge,br),t(v,qn),t(v,he),h(ct,he,null),t(he,Yn),t(he,_r),t(v,On),t(v,ue),h(mt,ue,null),t(ue,Vn),t(ue,vr),t(v,Xn),t(v,be),h(dt,be,null),t(be,Zn),t(be,Tr),i(e,ta,l),i(e,pt,l),i(e,ra,l),h(ft,e,l),i(e,aa,l),i(e,gt,l),i(e,na,l),h(ht,e,l),i(e,sa,l),h(ut,e,l),i(e,oa,l),i(e,H,l),h(bt,H,null),t(H,Qn),t(H,$r),t(H,Kn),h(_e,H,null),t(H,es),t(H,ve),h(_t,ve,null),t(ve,ts),t(ve,Cr),t(H,rs),t(H,Te),h(vt,Te,null),t(Te,as),t(Te,kr),i(e,la,l),h(Tt,e,l),i(e,ia,l),i(e,ee,l),h($t,ee,null),t(ee,ns),t(ee,wr),i(e,ca,l),i(e,Hr,l),ma=!0},p(e,[l]){const te={};l&2&&(te.$$scope={dirty:l,ctx:e}),re.$set(te);const U={};l&2&&(U.$$scope={dirty:l,ctx:e}),ae.$set(U);const Ct={};l&2&&(Ct.$$scope={dirty:l,ctx:e}),ne.$set(Ct);const kt={};l&2&&(kt.$$scope={dirty:l,ctx:e}),_e.$set(kt)},i(e){ma||(d(y.$$.fragment,e),d(Ee.$$.fragment,e),d(je.$$.fragment,e),d(Je.$$.fragment,e),d(Ae.$$.fragment,e),d(Ue.$$.fragment,e),d(De.$$.fragment,e),d(Ne.$$.fragment,e),d(Fe.$$.fragment,e),d(Se.$$.fragment,e),d(Pe.$$.fragment,e),d(re.$$.fragment,e),d(Be.$$.fragment,e),d(ze.$$.fragment,e),d(Re.$$.fragment,e),d(Ge.$$.fragment,e),d(qe.$$.fragment,e),d(Ye.$$.fragment,e),d(Oe.$$.fragment,e),d(Ve.$$.fragment,e),d(Xe.$$.fragment,e),d(ae.$$.fragment,e),d(Ze.$$.fragment,e),d(Qe.$$.fragment,e),d(ne.$$.fragment,e),d(Ke.$$.fragment,e),d(et.$$.fragment,e),d(tt.$$.fragment,e),d(rt.$$.fragment,e),d(at.$$.fragment,e),d(nt.$$.fragment,e),d(st.$$.fragment,e),d(ot.$$.fragment,e),d(lt.$$.fragment,e),d(it.$$.fragment,e),d(ct.$$.fragment,e),d(mt.$$.fragment,e),d(dt.$$.fragment,e),d(ft.$$.fragment,e),d(ht.$$.fragment,e),d(ut.$$.fragment,e),d(bt.$$.fragment,e),d(_e.$$.fragment,e),d(_t.$$.fragment,e),d(vt.$$.fragment,e),d(Tt.$$.fragment,e),d($t.$$.fragment,e),ma=!0)},o(e){p(y.$$.fragment,e),p(Ee.$$.fragment,e),p(je.$$.fragment,e),p(Je.$$.fragment,e),p(Ae.$$.fragment,e),p(Ue.$$.fragment,e),p(De.$$.fragment,e),p(Ne.$$.fragment,e),p(Fe.$$.fragment,e),p(Se.$$.fragment,e),p(Pe.$$.fragment,e),p(re.$$.fragment,e),p(Be.$$.fragment,e),p(ze.$$.fragment,e),p(Re.$$.fragment,e),p(Ge.$$.fragment,e),p(qe.$$.fragment,e),p(Ye.$$.fragment,e),p(Oe.$$.fragment,e),p(Ve.$$.fragment,e),p(Xe.$$.fragment,e),p(ae.$$.fragment,e),p(Ze.$$.fragment,e),p(Qe.$$.fragment,e),p(ne.$$.fragment,e),p(Ke.$$.fragment,e),p(et.$$.fragment,e),p(tt.$$.fragment,e),p(rt.$$.fragment,e),p(at.$$.fragment,e),p(nt.$$.fragment,e),p(st.$$.fragment,e),p(ot.$$.fragment,e),p(lt.$$.fragment,e),p(it.$$.fragment,e),p(ct.$$.fragment,e),p(mt.$$.fragment,e),p(dt.$$.fragment,e),p(ft.$$.fragment,e),p(ht.$$.fragment,e),p(ut.$$.fragment,e),p(bt.$$.fragment,e),p(_e.$$.fragment,e),p(_t.$$.fragment,e),p(vt.$$.fragment,e),p(Tt.$$.fragment,e),p($t.$$.fragment,e),ma=!1},d(e){e&&(n(x),n(b),n(C),n(_),n(M),n(E),n(ye),n(Jr),n(Me),n(Ar),n(xe),n(Ur),n(Le),n(Dr),n(Ie),n(Nr),n(Fr),n(He),n(Sr),n(F),n(Pr),n(O),n(Wr),n(V),n(Br),n(X),n(zr),n(S),n(Rr),n(Z),n(Gr),n(P),n(qr),n(B),n(Yr),n(Q),n(Or),n(K),n(Vr),n(z),n(Xr),n(A),n(Zr),n(R),n(Qr),n(G),n(Kr),n(ea),n(v),n(ta),n(pt),n(ra),n(aa),n(gt),n(na),n(sa),n(oa),n(H),n(la),n(ia),n(ee),n(ca),n(Hr)),n(m),u(y,e),u(Ee,e),u(je),u(Je),u(Ae),u(Ue),u(De),u(Ne),u(Fe),u(Se),u(Pe),u(re),u(Be),u(ze),u(Re),u(Ge),u(qe),u(Ye),u(Oe),u(Ve),u(Xe),u(ae),u(Ze,e),u(Qe),u(ne),u(Ke),u(et),u(tt),u(rt),u(at),u(nt),u(st),u(ot),u(lt),u(it),u(ct),u(mt),u(dt),u(ft,e),u(ht,e),u(ut,e),u(bt),u(_e),u(_t),u(vt),u(Tt,e),u($t)}}}const Fo='{"title":"Callbacks","local":"callbacks","sections":[{"title":"Available Callbacks","local":"transformers.integrations.CometCallback","sections":[],"depth":2},{"title":"TrainerCallback","local":"transformers.TrainerCallback","sections":[],"depth":2},{"title":"TrainerState","local":"transformers.TrainerState","sections":[],"depth":2},{"title":"TrainerControl","local":"transformers.TrainerControl","sections":[],"depth":2}],"depth":1}';function So(I){return Mo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Yo extends vo{constructor(m){super(),To(this,m,So,No,_o,{})}}export{Yo as component};
