import{s as wa,B as Kt,o as ba,n as tr}from"../chunks/scheduler.9991993c.js";import{S as va,i as $a,g as l,s as a,r as h,A as ya,h as m,f as t,c as n,j as z,u,x as d,k as v,y as s,a as o,v as f,d as g,t as _,w}from"../chunks/index.7fc9a5e7.js";import{D as M}from"../chunks/Docstring.0d7e3ebb.js";import{C as rr}from"../chunks/CodeBlock.e11cba92.js";import{E as er}from"../chunks/ExampleCodeBlock.46b9776a.js";import{H as lt,E as xa}from"../chunks/EditOnGithub.84ab7f0e.js";function Ta(U){let c,A="Example:",x,p,$;return p=new rr({props:{code:"QWRhZmFjdG9yKG1vZGVsLnBhcmFtZXRlcnMoKSUyQyUyMHNjYWxlX3BhcmFtZXRlciUzREZhbHNlJTJDJTIwcmVsYXRpdmVfc3RlcCUzREZhbHNlJTJDJTIwd2FybXVwX2luaXQlM0RGYWxzZSUyQyUyMGxyJTNEMWUtMyk=",highlighted:'Adafactor(model.parameters(), scale_parameter=<span class="hljs-literal">False</span>, relative_step=<span class="hljs-literal">False</span>, warmup_init=<span class="hljs-literal">False</span>, lr=<span class="hljs-number">1e-3</span>)',wrap:!1}}),{c(){c=l("p"),c.textContent=A,x=a(),h(p.$$.fragment)},l(i){c=m(i,"P",{"data-svelte-h":!0}),d(c)!=="svelte-11lpom8"&&(c.textContent=A),x=n(i),u(p.$$.fragment,i)},m(i,T){o(i,c,T),o(i,x,T),f(p,i,T),$=!0},p:tr,i(i){$||(g(p.$$.fragment,i),$=!0)},o(i){_(p.$$.fragment,i),$=!1},d(i){i&&(t(c),t(x)),w(p,i)}}}function za(U){let c,A="Others reported the following combination to work well:",x,p,$;return p=new rr({props:{code:"QWRhZmFjdG9yKG1vZGVsLnBhcmFtZXRlcnMoKSUyQyUyMHNjYWxlX3BhcmFtZXRlciUzRFRydWUlMkMlMjByZWxhdGl2ZV9zdGVwJTNEVHJ1ZSUyQyUyMHdhcm11cF9pbml0JTNEVHJ1ZSUyQyUyMGxyJTNETm9uZSk=",highlighted:'Adafactor(model.parameters(), scale_parameter=<span class="hljs-literal">True</span>, relative_step=<span class="hljs-literal">True</span>, warmup_init=<span class="hljs-literal">True</span>, lr=<span class="hljs-literal">None</span>)',wrap:!1}}),{c(){c=l("p"),c.textContent=A,x=a(),h(p.$$.fragment)},l(i){c=m(i,"P",{"data-svelte-h":!0}),d(c)!=="svelte-mxeef1"&&(c.textContent=A),x=n(i),u(p.$$.fragment,i)},m(i,T){o(i,c,T),o(i,x,T),f(p,i,T),$=!0},p:tr,i(i){$||(g(p.$$.fragment,i),$=!0)},o(i){_(p.$$.fragment,i),$=!1},d(i){i&&(t(c),t(x)),w(p,i)}}}function Ma(U){let c,A="scheduler as following:",x,p,$;return p=new rr({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5vcHRpbWl6YXRpb24lMjBpbXBvcnQlMjBBZGFmYWN0b3IlMkMlMjBBZGFmYWN0b3JTY2hlZHVsZSUwQSUwQW9wdGltaXplciUyMCUzRCUyMEFkYWZhY3Rvcihtb2RlbC5wYXJhbWV0ZXJzKCklMkMlMjBzY2FsZV9wYXJhbWV0ZXIlM0RUcnVlJTJDJTIwcmVsYXRpdmVfc3RlcCUzRFRydWUlMkMlMjB3YXJtdXBfaW5pdCUzRFRydWUlMkMlMjBsciUzRE5vbmUpJTBBbHJfc2NoZWR1bGVyJTIwJTNEJTIwQWRhZmFjdG9yU2NoZWR1bGUob3B0aW1pemVyKSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKC4uLiUyQyUyMG9wdGltaXplcnMlM0Qob3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyKSk=",highlighted:`<span class="hljs-keyword">from</span> transformers.optimization <span class="hljs-keyword">import</span> Adafactor, AdafactorSchedule

optimizer = Adafactor(model.parameters(), scale_parameter=<span class="hljs-literal">True</span>, relative_step=<span class="hljs-literal">True</span>, warmup_init=<span class="hljs-literal">True</span>, lr=<span class="hljs-literal">None</span>)
lr_scheduler = AdafactorSchedule(optimizer)
trainer = Trainer(..., optimizers=(optimizer, lr_scheduler))`,wrap:!1}}),{c(){c=l("p"),c.textContent=A,x=a(),h(p.$$.fragment)},l(i){c=m(i,"P",{"data-svelte-h":!0}),d(c)!=="svelte-1eua222"&&(c.textContent=A),x=n(i),u(p.$$.fragment,i)},m(i,T){o(i,c,T),o(i,x,T),f(p,i,T),$=!0},p:tr,i(i){$||(g(p.$$.fragment,i),$=!0)},o(i){_(p.$$.fragment,i),$=!1},d(i){i&&(t(c),t(x)),w(p,i)}}}function Aa(U){let c,A="Usage:",x,p,$;return p=new rr({props:{code:"JTIzJTIwcmVwbGFjZSUyMEFkYW1XJTIwd2l0aCUyMEFkYWZhY3RvciUwQW9wdGltaXplciUyMCUzRCUyMEFkYWZhY3RvciglMEElMjAlMjAlMjAlMjBtb2RlbC5wYXJhbWV0ZXJzKCklMkMlMEElMjAlMjAlMjAlMjBsciUzRDFlLTMlMkMlMEElMjAlMjAlMjAlMjBlcHMlM0QoMWUtMzAlMkMlMjAxZS0zKSUyQyUwQSUyMCUyMCUyMCUyMGNsaXBfdGhyZXNob2xkJTNEMS4wJTJDJTBBJTIwJTIwJTIwJTIwZGVjYXlfcmF0ZSUzRC0wLjglMkMlMEElMjAlMjAlMjAlMjBiZXRhMSUzRE5vbmUlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAlMkMlMEElMjAlMjAlMjAlMjByZWxhdGl2ZV9zdGVwJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBzY2FsZV9wYXJhbWV0ZXIlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMHdhcm11cF9pbml0JTNERmFsc2UlMkMlMEEp",highlighted:`<span class="hljs-comment"># replace AdamW with Adafactor</span>
optimizer = Adafactor(
    model.parameters(),
    lr=<span class="hljs-number">1e-3</span>,
    eps=(<span class="hljs-number">1e-30</span>, <span class="hljs-number">1e-3</span>),
    clip_threshold=<span class="hljs-number">1.0</span>,
    decay_rate=-<span class="hljs-number">0.8</span>,
    beta1=<span class="hljs-literal">None</span>,
    weight_decay=<span class="hljs-number">0.0</span>,
    relative_step=<span class="hljs-literal">False</span>,
    scale_parameter=<span class="hljs-literal">False</span>,
    warmup_init=<span class="hljs-literal">False</span>,
)`,wrap:!1}}),{c(){c=l("p"),c.textContent=A,x=a(),h(p.$$.fragment)},l(i){c=m(i,"P",{"data-svelte-h":!0}),d(c)!=="svelte-5wyjqd"&&(c.textContent=A),x=n(i),u(p.$$.fragment,i)},m(i,T){o(i,c,T),o(i,x,T),f(p,i,T),$=!0},p:tr,i(i){$||(g(p.$$.fragment,i),$=!0)},o(i){_(p.$$.fragment,i),$=!1},d(i){i&&(t(c),t(x)),w(p,i)}}}function Ca(U){let c,A,x,p,$,i,T,Ir="<code>.optimization</code> 模块提供了：",ct,K,Pr="<li>一个带有固定权重衰减的优化器，可用于微调模型</li> <li>继承自 <code>_LRSchedule</code> 多个调度器：</li> <li>一个梯度累积类，用于累积多个批次的梯度</li>",pt,ee,dt,W,te,ar,Re,Fr=`Implements Adam algorithm with weight decay fix as introduced in <a href="https://arxiv.org/abs/1711.05101" rel="nofollow">Decoupled Weight Decay
Regularization</a>.`,nr,G,re,or,Ee,Vr="Performs a single optimization step.",ht,ae,ut,b,ne,sr,ke,Jr=`AdaFactor pytorch implementation can be used as a drop in replacement for Adam original fairseq code:
<a href="https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py" rel="nofollow">https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py</a>`,ir,Ie,Nr=`Paper: <em>Adafactor: Adaptive Learning Rates with Sublinear Memory Cost</em> <a href="https://arxiv.org/abs/1804.04235" rel="nofollow">https://arxiv.org/abs/1804.04235</a> Note that
this optimizer internally adjusts the learning rate depending on the <code>scale_parameter</code>, <code>relative_step</code> and
<code>warmup_init</code> options. To use a manual (external) learning rate schedule you should set <code>scale_parameter=False</code> and
<code>relative_step=False</code>.`,lr,Pe,Zr="This implementation handles low-precision (FP16, bfloat) values, but we have not thoroughly tested.",mr,Fe,Gr='Recommended T5 finetuning settings (<a href="https://discuss.huggingface.co/t/t5-finetuning-tips/684/3" rel="nofollow">https://discuss.huggingface.co/t/t5-finetuning-tips/684/3</a>):',cr,Ve,Hr='<li><p>Training without LR warmup or clip_threshold is not recommended.</p> <ul><li>use scheduled LR warm-up to fixed LR</li> <li>use clip_threshold=1.0 (<a href="https://arxiv.org/abs/1804.04235" rel="nofollow">https://arxiv.org/abs/1804.04235</a>)</li></ul></li> <li><p>Disable relative updates</p></li> <li><p>Use scale_parameter=False</p></li> <li><p>Additional optimizer operations like gradient clipping should not be used alongside Adafactor</p></li>',pr,H,dr,S,hr,Je,Sr="When using <code>lr=None</code> with <code>Trainer</code> you will most likely need to use <code>AdafactorSchedule</code>",ur,q,fr,B,gr,X,oe,_r,Ne,qr="Performs a single optimization step",ft,se,gt,C,ie,wr,Ze,Br=`Adam enables L2 weight decay and clip_by_global_norm on gradients. Just adding the square of the weights to the
loss function is <em>not</em> the correct way of using L2 regularization/weight decay with Adam, since that will interact
with the m and v parameters in strange ways as shown in <a href="https://arxiv.org/abs/1711.05101" rel="nofollow">Decoupled Weight Decay
Regularization</a>.`,br,Ge,Xr=`Instead we want to decay the weights in a manner that doesn’t interact with the m/v parameters. This is equivalent
to adding the square of the weights to the loss with plain (non-momentum) SGD.`,vr,O,le,$r,He,Or="Creates an optimizer from its config with WarmUp custom object.",_t,D,me,yr,Se,Yr="Creates an optimizer with a learning rate schedule using a warmup phase followed by a linear decay.",wt,ce,bt,pe,vt,R,de,xr,qe,Qr="An enumeration.",$t,E,he,Tr,Be,Kr="Unified API to get any scheduler from its name.",yt,k,ue,zr,Xe,ea="Create a schedule with a constant learning rate, using the learning rate set in optimizer.",xt,I,fe,Mr,Oe,ta=`Create a schedule with a constant learning rate preceded by a warmup period during which the learning rate
increases linearly between 0 and the initial lr set in the optimizer.`,Tt,ge,ra,zt,P,_e,Ar,Ye,aa=`Create a schedule with a learning rate that decreases following the values of the cosine function between the
initial lr set in the optimizer to 0, after a warmup period during which it increases linearly between 0 and the
initial lr set in the optimizer.`,Mt,we,na,At,F,be,Cr,Qe,oa=`Create a schedule with a learning rate that decreases following the values of the cosine function between the
initial lr set in the optimizer to 0, with several hard restarts, after a warmup period during which it increases
linearly between 0 and the initial lr set in the optimizer.`,Ct,ve,sa,Wt,V,$e,Wr,Ke,ia=`Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0, after
a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer.`,Lt,ye,la,jt,L,xe,Lr,et,ma=`Create a schedule with a learning rate that decreases as a polynomial decay from the initial lr set in the
optimizer to end lr defined by <em>lr_end</em>, after a warmup period during which it increases linearly from 0 to the
initial lr set in the optimizer.`,jr,tt,ca=`Note: <em>power</em> defaults to 1.0 as in the fairseq implementation, which in turn is based on the original BERT
implementation at
<a href="https://github.com/google-research/bert/blob/f39e881b169b9d53bea03d2d341b31707a6c052b/optimization.py#L37" rel="nofollow">https://github.com/google-research/bert/blob/f39e881b169b9d53bea03d2d341b31707a6c052b/optimization.py#L37</a>`,Ut,J,Te,Ur,rt,pa=`Create a schedule with an inverse square-root learning rate, from the initial lr set in the optimizer, after a
warmup period which increases lr linearly from 0 to the initial lr set in the optimizer.`,Dt,ze,da="### Warmup (TensorFlow)[[transformers.WarmUp]]",Rt,N,Me,Dr,at,ha="Applies a warmup schedule on a given learning rate decay schedule.",Et,Ae,ua="## Gradient Strategies",kt,Ce,fa="### GradientAccumulator (TensorFlow)[[transformers.GradientAccumulator]]",It,j,We,Rr,nt,ga=`Gradient accumulation utility. When used with a distribution strategy, the accumulator should be called in a
replica context. Gradients will be accumulated locally on each replica and without synchronization. Users should
then call <code>.gradients</code>, scale the gradients if required, and pass the result to <code>apply_gradients</code>.`,Er,Y,Le,kr,ot,_a="Resets the accumulated gradients on the current replica.",Pt,je,Ft,mt,Vt;return $=new lt({props:{title:"Optimization",local:"optimization",headingTag:"h1"}}),ee=new lt({props:{title:"AdamW (PyTorch)",local:"transformers.AdamW",headingTag:"h2"}}),te=new M({props:{name:"class transformers.AdamW",anchor:"transformers.AdamW",parameters:[{name:"params",val:": Iterable"},{name:"lr",val:": float = 0.001"},{name:"betas",val:": Tuple = (0.9, 0.999)"},{name:"eps",val:": float = 1e-06"},{name:"weight_decay",val:": float = 0.0"},{name:"correct_bias",val:": bool = True"},{name:"no_deprecation_warning",val:": bool = False"}],parametersDescription:[{anchor:"transformers.AdamW.params",description:`<strong>params</strong> (<code>Iterable[nn.parameter.Parameter]</code>) &#x2014;
Iterable of parameters to optimize or dictionaries defining parameter groups.`,name:"params"},{anchor:"transformers.AdamW.lr",description:`<strong>lr</strong> (<code>float</code>, <em>optional</em>, defaults to 0.001) &#x2014;
The learning rate to use.`,name:"lr"},{anchor:"transformers.AdamW.betas",description:`<strong>betas</strong> (<code>Tuple[float,float]</code>, <em>optional</em>, defaults to <code>(0.9, 0.999)</code>) &#x2014;
Adam&#x2019;s betas parameters (b1, b2).`,name:"betas"},{anchor:"transformers.AdamW.eps",description:`<strong>eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
Adam&#x2019;s epsilon for numerical stability.`,name:"eps"},{anchor:"transformers.AdamW.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Decoupled weight decay to apply.`,name:"weight_decay"},{anchor:"transformers.AdamW.correct_bias",description:`<strong>correct_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to correct bias in Adam (for instance, in Bert TF repository they use <code>False</code>).`,name:"correct_bias"},{anchor:"transformers.AdamW.no_deprecation_warning",description:`<strong>no_deprecation_warning</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
A flag used to disable the deprecation warning (set to <code>True</code> to disable the warning).`,name:"no_deprecation_warning"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L558"}}),re=new M({props:{name:"step",anchor:"transformers.AdamW.step",parameters:[{name:"closure",val:": Callable = None"}],parametersDescription:[{anchor:"transformers.AdamW.step.closure",description:"<strong>closure</strong> (<code>Callable</code>, <em>optional</em>) &#x2014; A closure that reevaluates the model and returns the loss.",name:"closure"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L609"}}),ae=new lt({props:{title:"AdaFactor (PyTorch)",local:"transformers.Adafactor",headingTag:"h2"}}),ne=new M({props:{name:"class transformers.Adafactor",anchor:"transformers.Adafactor",parameters:[{name:"params",val:""},{name:"lr",val:" = None"},{name:"eps",val:" = (1e-30, 0.001)"},{name:"clip_threshold",val:" = 1.0"},{name:"decay_rate",val:" = -0.8"},{name:"beta1",val:" = None"},{name:"weight_decay",val:" = 0.0"},{name:"scale_parameter",val:" = True"},{name:"relative_step",val:" = True"},{name:"warmup_init",val:" = False"}],parametersDescription:[{anchor:"transformers.Adafactor.params",description:`<strong>params</strong> (<code>Iterable[nn.parameter.Parameter]</code>) &#x2014;
Iterable of parameters to optimize or dictionaries defining parameter groups.`,name:"params"},{anchor:"transformers.Adafactor.lr",description:`<strong>lr</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The external learning rate.`,name:"lr"},{anchor:"transformers.Adafactor.eps",description:`<strong>eps</strong> (<code>Tuple[float, float]</code>, <em>optional</em>, defaults to <code>(1e-30, 0.001)</code>) &#x2014;
Regularization constants for square gradient and parameter scale respectively`,name:"eps"},{anchor:"transformers.Adafactor.clip_threshold",description:`<strong>clip_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Threshold of root mean square of final gradient update`,name:"clip_threshold"},{anchor:"transformers.Adafactor.decay_rate",description:`<strong>decay_rate</strong> (<code>float</code>, <em>optional</em>, defaults to -0.8) &#x2014;
Coefficient used to compute running averages of square`,name:"decay_rate"},{anchor:"transformers.Adafactor.beta1",description:`<strong>beta1</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Coefficient used for computing running averages of gradient`,name:"beta1"},{anchor:"transformers.Adafactor.weight_decay",description:`<strong>weight_decay</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Weight decay (L2 penalty)`,name:"weight_decay"},{anchor:"transformers.Adafactor.scale_parameter",description:`<strong>scale_parameter</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
If True, learning rate is scaled by root mean square`,name:"scale_parameter"},{anchor:"transformers.Adafactor.relative_step",description:`<strong>relative_step</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
If True, time-dependent learning rate is computed instead of external learning rate`,name:"relative_step"},{anchor:"transformers.Adafactor.warmup_init",description:`<strong>warmup_init</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Time-dependent learning rate computation depends on whether warm-up initialization is being used`,name:"warmup_init"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L672"}}),H=new er({props:{anchor:"transformers.Adafactor.example",$$slots:{default:[Ta]},$$scope:{ctx:U}}}),S=new er({props:{anchor:"transformers.Adafactor.example-2",$$slots:{default:[za]},$$scope:{ctx:U}}}),q=new er({props:{anchor:"transformers.Adafactor.example-3",$$slots:{default:[Ma]},$$scope:{ctx:U}}}),B=new er({props:{anchor:"transformers.Adafactor.example-4",$$slots:{default:[Aa]},$$scope:{ctx:U}}}),oe=new M({props:{name:"step",anchor:"transformers.Adafactor.step",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"transformers.Adafactor.step.closure",description:`<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L818"}}),se=new lt({props:{title:"AdamWeightDecay (TensorFlow)",local:"transformers.AdamWeightDecay",headingTag:"h2"}}),ie=new M({props:{name:"class transformers.AdamWeightDecay",anchor:"transformers.AdamWeightDecay",parameters:[{name:"learning_rate",val:": Union = 0.001"},{name:"beta_1",val:": float = 0.9"},{name:"beta_2",val:": float = 0.999"},{name:"epsilon",val:": float = 1e-07"},{name:"amsgrad",val:": bool = False"},{name:"weight_decay_rate",val:": float = 0.0"},{name:"include_in_weight_decay",val:": Optional = None"},{name:"exclude_from_weight_decay",val:": Optional = None"},{name:"name",val:": str = 'AdamWeightDecay'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.AdamWeightDecay.learning_rate",description:`<strong>learning_rate</strong> (<code>Union[float, LearningRateSchedule]</code>, <em>optional</em>, defaults to 0.001) &#x2014;
The learning rate to use or a schedule.`,name:"learning_rate"},{anchor:"transformers.AdamWeightDecay.beta_1",description:`<strong>beta_1</strong> (<code>float</code>, <em>optional</em>, defaults to 0.9) &#x2014;
The beta1 parameter in Adam, which is the exponential decay rate for the 1st momentum estimates.`,name:"beta_1"},{anchor:"transformers.AdamWeightDecay.beta_2",description:`<strong>beta_2</strong> (<code>float</code>, <em>optional</em>, defaults to 0.999) &#x2014;
The beta2 parameter in Adam, which is the exponential decay rate for the 2nd momentum estimates.`,name:"beta_2"},{anchor:"transformers.AdamWeightDecay.epsilon",description:`<strong>epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-07) &#x2014;
The epsilon parameter in Adam, which is a small constant for numerical stability.`,name:"epsilon"},{anchor:"transformers.AdamWeightDecay.amsgrad",description:`<strong>amsgrad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to apply AMSGrad variant of this algorithm or not, see <a href="https://arxiv.org/abs/1904.09237" rel="nofollow">On the Convergence of Adam and
Beyond</a>.`,name:"amsgrad"},{anchor:"transformers.AdamWeightDecay.weight_decay_rate",description:`<strong>weight_decay_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The weight decay to apply.`,name:"weight_decay_rate"},{anchor:"transformers.AdamWeightDecay.include_in_weight_decay",description:`<strong>include_in_weight_decay</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
List of the parameter names (or re patterns) to apply weight decay to. If none is passed, weight decay is
applied to all parameters by default (unless they are in <code>exclude_from_weight_decay</code>).`,name:"include_in_weight_decay"},{anchor:"transformers.AdamWeightDecay.exclude_from_weight_decay",description:`<strong>exclude_from_weight_decay</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
List of the parameter names (or re patterns) to exclude from applying weight decay to. If a
<code>include_in_weight_decay</code> is passed, the names in it will supersede this list.`,name:"exclude_from_weight_decay"},{anchor:"transformers.AdamWeightDecay.name",description:`<strong>name</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;AdamWeightDecay&quot;</code>) &#x2014;
Optional name for the operations created when applying gradients.`,name:"name"},{anchor:"transformers.AdamWeightDecay.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Keyword arguments. Allowed to be {<code>clipnorm</code>, <code>clipvalue</code>, <code>lr</code>, <code>decay</code>}. <code>clipnorm</code> is clip gradients by
norm; <code>clipvalue</code> is clip gradients by value, <code>decay</code> is included for backward compatibility to allow time
inverse decay of learning rate. <code>lr</code> is included for backward compatibility, recommended to use
<code>learning_rate</code> instead.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization_tf.py#L180"}}),le=new M({props:{name:"from_config",anchor:"transformers.AdamWeightDecay.from_config",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization_tf.py#L237"}}),me=new M({props:{name:"transformers.create_optimizer",anchor:"transformers.create_optimizer",parameters:[{name:"init_lr",val:": float"},{name:"num_train_steps",val:": int"},{name:"num_warmup_steps",val:": int"},{name:"min_lr_ratio",val:": float = 0.0"},{name:"adam_beta1",val:": float = 0.9"},{name:"adam_beta2",val:": float = 0.999"},{name:"adam_epsilon",val:": float = 1e-08"},{name:"adam_clipnorm",val:": Optional = None"},{name:"adam_global_clipnorm",val:": Optional = None"},{name:"weight_decay_rate",val:": float = 0.0"},{name:"power",val:": float = 1.0"},{name:"include_in_weight_decay",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.create_optimizer.init_lr",description:`<strong>init_lr</strong> (<code>float</code>) &#x2014;
The desired learning rate at the end of the warmup phase.`,name:"init_lr"},{anchor:"transformers.create_optimizer.num_train_steps",description:`<strong>num_train_steps</strong> (<code>int</code>) &#x2014;
The total number of training steps.`,name:"num_train_steps"},{anchor:"transformers.create_optimizer.num_warmup_steps",description:`<strong>num_warmup_steps</strong> (<code>int</code>) &#x2014;
The number of warmup steps.`,name:"num_warmup_steps"},{anchor:"transformers.create_optimizer.min_lr_ratio",description:`<strong>min_lr_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The final learning rate at the end of the linear decay will be <code>init_lr * min_lr_ratio</code>.`,name:"min_lr_ratio"},{anchor:"transformers.create_optimizer.adam_beta1",description:`<strong>adam_beta1</strong> (<code>float</code>, <em>optional</em>, defaults to 0.9) &#x2014;
The beta1 to use in Adam.`,name:"adam_beta1"},{anchor:"transformers.create_optimizer.adam_beta2",description:`<strong>adam_beta2</strong> (<code>float</code>, <em>optional</em>, defaults to 0.999) &#x2014;
The beta2 to use in Adam.`,name:"adam_beta2"},{anchor:"transformers.create_optimizer.adam_epsilon",description:`<strong>adam_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-8) &#x2014;
The epsilon to use in Adam.`,name:"adam_epsilon"},{anchor:"transformers.create_optimizer.adam_clipnorm",description:`<strong>adam_clipnorm</strong> (<code>float</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
If not <code>None</code>, clip the gradient norm for each weight tensor to this value.`,name:"adam_clipnorm"},{anchor:"transformers.create_optimizer.adam_global_clipnorm",description:`<strong>adam_global_clipnorm</strong> (<code>float</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
If not <code>None</code>, clip gradient norm to this value. When using this argument, the norm is computed over all
weight tensors, as if they were concatenated into a single vector.`,name:"adam_global_clipnorm"},{anchor:"transformers.create_optimizer.weight_decay_rate",description:`<strong>weight_decay_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The weight decay to use.`,name:"weight_decay_rate"},{anchor:"transformers.create_optimizer.power",description:`<strong>power</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The power to use for PolynomialDecay.`,name:"power"},{anchor:"transformers.create_optimizer.include_in_weight_decay",description:`<strong>include_in_weight_decay</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
List of the parameter names (or re patterns) to apply weight decay to. If none is passed, weight decay is
applied to all parameters except bias and layer norm parameters.`,name:"include_in_weight_decay"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization_tf.py#L96"}}),ce=new lt({props:{title:"Schedules",local:"schedules",headingTag:"h2"}}),pe=new lt({props:{title:"Learning Rate Schedules (Pytorch)",local:"transformers.SchedulerType",headingTag:"h3"}}),de=new M({props:{name:"class transformers.SchedulerType",anchor:"transformers.SchedulerType",parameters:[{name:"value",val:""},{name:"names",val:" = None"},{name:"module",val:" = None"},{name:"qualname",val:" = None"},{name:"type",val:" = None"},{name:"start",val:" = 1"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/trainer_utils.py#L408"}}),he=new M({props:{name:"transformers.get_scheduler",anchor:"transformers.get_scheduler",parameters:[{name:"name",val:": Union"},{name:"optimizer",val:": Optimizer"},{name:"num_warmup_steps",val:": Optional = None"},{name:"num_training_steps",val:": Optional = None"},{name:"scheduler_specific_kwargs",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.get_scheduler.name",description:`<strong>name</strong> (<code>str</code> or <code>SchedulerType</code>) &#x2014;
The name of the scheduler to use.`,name:"name"},{anchor:"transformers.get_scheduler.optimizer",description:`<strong>optimizer</strong> (<code>torch.optim.Optimizer</code>) &#x2014;
The optimizer that will be used during training.`,name:"optimizer"},{anchor:"transformers.get_scheduler.num_warmup_steps",description:`<strong>num_warmup_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of warmup steps to do. This is not required by all schedulers (hence the argument being
optional), the function will raise an error if it&#x2019;s unset and the scheduler type requires it.`,name:"num_warmup_steps"},{anchor:"transformers.get_scheduler.num_training_steps",description:`<strong>num_training_steps</strong> (\`int&#x201C;, <em>optional</em>) &#x2014;
The number of training steps to do. This is not required by all schedulers (hence the argument being
optional), the function will raise an error if it&#x2019;s unset and the scheduler type requires it.`,name:"num_training_steps"},{anchor:"transformers.get_scheduler.scheduler_specific_kwargs",description:`<strong>scheduler_specific_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Extra parameters for schedulers such as cosine with restarts. Mismatched scheduler types and scheduler
parameters will cause the scheduler function to raise a TypeError.`,name:"scheduler_specific_kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L471"}}),ue=new M({props:{name:"transformers.get_constant_schedule",anchor:"transformers.get_constant_schedule",parameters:[{name:"optimizer",val:": Optimizer"},{name:"last_epoch",val:": int = -1"}],parametersDescription:[{anchor:"transformers.get_constant_schedule.optimizer",description:`<strong>optimizer</strong> (<code>~torch.optim.Optimizer</code>) &#x2014;
The optimizer for which to schedule the learning rate.`,name:"optimizer"},{anchor:"transformers.get_constant_schedule.last_epoch",description:`<strong>last_epoch</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The index of the last epoch when resuming training.`,name:"last_epoch"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L40",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.optim.lr_scheduler.LambdaLR</code> with the appropriate schedule.</p>
`}}),fe=new M({props:{name:"transformers.get_constant_schedule_with_warmup",anchor:"transformers.get_constant_schedule_with_warmup",parameters:[{name:"optimizer",val:": Optimizer"},{name:"num_warmup_steps",val:": int"},{name:"last_epoch",val:": int = -1"}],parametersDescription:[{anchor:"transformers.get_constant_schedule_with_warmup.optimizer",description:`<strong>optimizer</strong> (<code>~torch.optim.Optimizer</code>) &#x2014;
The optimizer for which to schedule the learning rate.`,name:"optimizer"},{anchor:"transformers.get_constant_schedule_with_warmup.num_warmup_steps",description:`<strong>num_warmup_steps</strong> (<code>int</code>) &#x2014;
The number of steps for the warmup phase.`,name:"num_warmup_steps"},{anchor:"transformers.get_constant_schedule_with_warmup.last_epoch",description:`<strong>last_epoch</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The index of the last epoch when resuming training.`,name:"last_epoch"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L81",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.optim.lr_scheduler.LambdaLR</code> with the appropriate schedule.</p>
`}}),_e=new M({props:{name:"transformers.get_cosine_schedule_with_warmup",anchor:"transformers.get_cosine_schedule_with_warmup",parameters:[{name:"optimizer",val:": Optimizer"},{name:"num_warmup_steps",val:": int"},{name:"num_training_steps",val:": int"},{name:"num_cycles",val:": float = 0.5"},{name:"last_epoch",val:": int = -1"}],parametersDescription:[{anchor:"transformers.get_cosine_schedule_with_warmup.optimizer",description:`<strong>optimizer</strong> (<code>~torch.optim.Optimizer</code>) &#x2014;
The optimizer for which to schedule the learning rate.`,name:"optimizer"},{anchor:"transformers.get_cosine_schedule_with_warmup.num_warmup_steps",description:`<strong>num_warmup_steps</strong> (<code>int</code>) &#x2014;
The number of steps for the warmup phase.`,name:"num_warmup_steps"},{anchor:"transformers.get_cosine_schedule_with_warmup.num_training_steps",description:`<strong>num_training_steps</strong> (<code>int</code>) &#x2014;
The total number of training steps.`,name:"num_training_steps"},{anchor:"transformers.get_cosine_schedule_with_warmup.num_cycles",description:`<strong>num_cycles</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The number of waves in the cosine schedule (the defaults is to just decrease from the max value to 0
following a half-cosine).`,name:"num_cycles"},{anchor:"transformers.get_cosine_schedule_with_warmup.last_epoch",description:`<strong>last_epoch</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The index of the last epoch when resuming training.`,name:"last_epoch"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L144",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.optim.lr_scheduler.LambdaLR</code> with the appropriate schedule.</p>
`}}),be=new M({props:{name:"transformers.get_cosine_with_hard_restarts_schedule_with_warmup",anchor:"transformers.get_cosine_with_hard_restarts_schedule_with_warmup",parameters:[{name:"optimizer",val:": Optimizer"},{name:"num_warmup_steps",val:": int"},{name:"num_training_steps",val:": int"},{name:"num_cycles",val:": int = 1"},{name:"last_epoch",val:": int = -1"}],parametersDescription:[{anchor:"transformers.get_cosine_with_hard_restarts_schedule_with_warmup.optimizer",description:`<strong>optimizer</strong> (<code>~torch.optim.Optimizer</code>) &#x2014;
The optimizer for which to schedule the learning rate.`,name:"optimizer"},{anchor:"transformers.get_cosine_with_hard_restarts_schedule_with_warmup.num_warmup_steps",description:`<strong>num_warmup_steps</strong> (<code>int</code>) &#x2014;
The number of steps for the warmup phase.`,name:"num_warmup_steps"},{anchor:"transformers.get_cosine_with_hard_restarts_schedule_with_warmup.num_training_steps",description:`<strong>num_training_steps</strong> (<code>int</code>) &#x2014;
The total number of training steps.`,name:"num_training_steps"},{anchor:"transformers.get_cosine_with_hard_restarts_schedule_with_warmup.num_cycles",description:`<strong>num_cycles</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of hard restarts to use.`,name:"num_cycles"},{anchor:"transformers.get_cosine_with_hard_restarts_schedule_with_warmup.last_epoch",description:`<strong>last_epoch</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The index of the last epoch when resuming training.`,name:"last_epoch"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L189",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.optim.lr_scheduler.LambdaLR</code> with the appropriate schedule.</p>
`}}),$e=new M({props:{name:"transformers.get_linear_schedule_with_warmup",anchor:"transformers.get_linear_schedule_with_warmup",parameters:[{name:"optimizer",val:""},{name:"num_warmup_steps",val:""},{name:"num_training_steps",val:""},{name:"last_epoch",val:" = -1"}],parametersDescription:[{anchor:"transformers.get_linear_schedule_with_warmup.optimizer",description:`<strong>optimizer</strong> (<code>~torch.optim.Optimizer</code>) &#x2014;
The optimizer for which to schedule the learning rate.`,name:"optimizer"},{anchor:"transformers.get_linear_schedule_with_warmup.num_warmup_steps",description:`<strong>num_warmup_steps</strong> (<code>int</code>) &#x2014;
The number of steps for the warmup phase.`,name:"num_warmup_steps"},{anchor:"transformers.get_linear_schedule_with_warmup.num_training_steps",description:`<strong>num_training_steps</strong> (<code>int</code>) &#x2014;
The total number of training steps.`,name:"num_training_steps"},{anchor:"transformers.get_linear_schedule_with_warmup.last_epoch",description:`<strong>last_epoch</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The index of the last epoch when resuming training.`,name:"last_epoch"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L108",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.optim.lr_scheduler.LambdaLR</code> with the appropriate schedule.</p>
`}}),xe=new M({props:{name:"transformers.get_polynomial_decay_schedule_with_warmup",anchor:"transformers.get_polynomial_decay_schedule_with_warmup",parameters:[{name:"optimizer",val:""},{name:"num_warmup_steps",val:""},{name:"num_training_steps",val:""},{name:"lr_end",val:" = 1e-07"},{name:"power",val:" = 1.0"},{name:"last_epoch",val:" = -1"}],parametersDescription:[{anchor:"transformers.get_polynomial_decay_schedule_with_warmup.optimizer",description:`<strong>optimizer</strong> (<code>~torch.optim.Optimizer</code>) &#x2014;
The optimizer for which to schedule the learning rate.`,name:"optimizer"},{anchor:"transformers.get_polynomial_decay_schedule_with_warmup.num_warmup_steps",description:`<strong>num_warmup_steps</strong> (<code>int</code>) &#x2014;
The number of steps for the warmup phase.`,name:"num_warmup_steps"},{anchor:"transformers.get_polynomial_decay_schedule_with_warmup.num_training_steps",description:`<strong>num_training_steps</strong> (<code>int</code>) &#x2014;
The total number of training steps.`,name:"num_training_steps"},{anchor:"transformers.get_polynomial_decay_schedule_with_warmup.lr_end",description:`<strong>lr_end</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-7) &#x2014;
The end LR.`,name:"lr_end"},{anchor:"transformers.get_polynomial_decay_schedule_with_warmup.power",description:`<strong>power</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Power factor.`,name:"power"},{anchor:"transformers.get_polynomial_decay_schedule_with_warmup.last_epoch",description:`<strong>last_epoch</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The index of the last epoch when resuming training.`,name:"last_epoch"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L243",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.optim.lr_scheduler.LambdaLR</code> with the appropriate schedule.</p>
`}}),Te=new M({props:{name:"transformers.get_inverse_sqrt_schedule",anchor:"transformers.get_inverse_sqrt_schedule",parameters:[{name:"optimizer",val:": Optimizer"},{name:"num_warmup_steps",val:": int"},{name:"timescale",val:": int = None"},{name:"last_epoch",val:": int = -1"}],parametersDescription:[{anchor:"transformers.get_inverse_sqrt_schedule.optimizer",description:`<strong>optimizer</strong> (<code>~torch.optim.Optimizer</code>) &#x2014;
The optimizer for which to schedule the learning rate.`,name:"optimizer"},{anchor:"transformers.get_inverse_sqrt_schedule.num_warmup_steps",description:`<strong>num_warmup_steps</strong> (<code>int</code>) &#x2014;
The number of steps for the warmup phase.`,name:"num_warmup_steps"},{anchor:"transformers.get_inverse_sqrt_schedule.timescale",description:`<strong>timescale</strong> (<code>int</code>, <em>optional</em>, defaults to <code>num_warmup_steps</code>) &#x2014;
Time scale.`,name:"timescale"},{anchor:"transformers.get_inverse_sqrt_schedule.last_epoch",description:`<strong>last_epoch</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
The index of the last epoch when resuming training.`,name:"last_epoch"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization.py#L297",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.optim.lr_scheduler.LambdaLR</code> with the appropriate schedule.</p>
`}}),Me=new M({props:{name:"class transformers.WarmUp",anchor:"transformers.WarmUp",parameters:[{name:"initial_learning_rate",val:": float"},{name:"decay_schedule_fn",val:": Callable"},{name:"warmup_steps",val:": int"},{name:"power",val:": float = 1.0"},{name:"name",val:": str = None"}],parametersDescription:[{anchor:"transformers.WarmUp.initial_learning_rate",description:`<strong>initial_learning_rate</strong> (<code>float</code>) &#x2014;
The initial learning rate for the schedule after the warmup (so this will be the learning rate at the end
of the warmup).`,name:"initial_learning_rate"},{anchor:"transformers.WarmUp.decay_schedule_fn",description:`<strong>decay_schedule_fn</strong> (<code>Callable</code>) &#x2014;
The schedule function to apply after the warmup for the rest of training.`,name:"decay_schedule_fn"},{anchor:"transformers.WarmUp.warmup_steps",description:`<strong>warmup_steps</strong> (<code>int</code>) &#x2014;
The number of steps for the warmup part of training.`,name:"warmup_steps"},{anchor:"transformers.WarmUp.power",description:`<strong>power</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The power to use for the polynomial warmup (defaults is a linear warmup).`,name:"power"},{anchor:"transformers.WarmUp.name",description:`<strong>name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Optional name prefix for the returned tensors during the schedule.`,name:"name"}],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization_tf.py#L38"}}),We=new M({props:{name:"class transformers.GradientAccumulator",anchor:"transformers.GradientAccumulator",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization_tf.py#L310"}}),Le=new M({props:{name:"reset",anchor:"transformers.GradientAccumulator.reset",parameters:[],source:"https://github.com/huggingface/transformers/blob/vr_30799/src/transformers/optimization_tf.py#L372"}}),je=new xa({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/main_classes/optimizer_schedules.md"}}),{c(){c=l("meta"),A=a(),x=l("p"),p=a(),h($.$$.fragment),i=a(),T=l("p"),T.innerHTML=Ir,ct=a(),K=l("ul"),K.innerHTML=Pr,pt=a(),h(ee.$$.fragment),dt=a(),W=l("div"),h(te.$$.fragment),ar=a(),Re=l("p"),Re.innerHTML=Fr,nr=a(),G=l("div"),h(re.$$.fragment),or=a(),Ee=l("p"),Ee.textContent=Vr,ht=a(),h(ae.$$.fragment),ut=a(),b=l("div"),h(ne.$$.fragment),sr=a(),ke=l("p"),ke.innerHTML=Jr,ir=a(),Ie=l("p"),Ie.innerHTML=Nr,lr=a(),Pe=l("p"),Pe.textContent=Zr,mr=a(),Fe=l("p"),Fe.innerHTML=Gr,cr=a(),Ve=l("ul"),Ve.innerHTML=Hr,pr=a(),h(H.$$.fragment),dr=a(),h(S.$$.fragment),hr=a(),Je=l("p"),Je.innerHTML=Sr,ur=a(),h(q.$$.fragment),fr=a(),h(B.$$.fragment),gr=a(),X=l("div"),h(oe.$$.fragment),_r=a(),Ne=l("p"),Ne.textContent=qr,ft=a(),h(se.$$.fragment),gt=a(),C=l("div"),h(ie.$$.fragment),wr=a(),Ze=l("p"),Ze.innerHTML=Br,br=a(),Ge=l("p"),Ge.textContent=Xr,vr=a(),O=l("div"),h(le.$$.fragment),$r=a(),He=l("p"),He.textContent=Or,_t=a(),D=l("div"),h(me.$$.fragment),yr=a(),Se=l("p"),Se.textContent=Yr,wt=a(),h(ce.$$.fragment),bt=a(),h(pe.$$.fragment),vt=a(),R=l("div"),h(de.$$.fragment),xr=a(),qe=l("p"),qe.textContent=Qr,$t=a(),E=l("div"),h(he.$$.fragment),Tr=a(),Be=l("p"),Be.textContent=Kr,yt=a(),k=l("div"),h(ue.$$.fragment),zr=a(),Xe=l("p"),Xe.textContent=ea,xt=a(),I=l("div"),h(fe.$$.fragment),Mr=a(),Oe=l("p"),Oe.textContent=ta,Tt=a(),ge=l("img"),zt=a(),P=l("div"),h(_e.$$.fragment),Ar=a(),Ye=l("p"),Ye.textContent=aa,Mt=a(),we=l("img"),At=a(),F=l("div"),h(be.$$.fragment),Cr=a(),Qe=l("p"),Qe.textContent=oa,Ct=a(),ve=l("img"),Wt=a(),V=l("div"),h($e.$$.fragment),Wr=a(),Ke=l("p"),Ke.textContent=ia,Lt=a(),ye=l("img"),jt=a(),L=l("div"),h(xe.$$.fragment),Lr=a(),et=l("p"),et.innerHTML=ma,jr=a(),tt=l("p"),tt.innerHTML=ca,Ut=a(),J=l("div"),h(Te.$$.fragment),Ur=a(),rt=l("p"),rt.textContent=pa,Dt=a(),ze=l("p"),ze.textContent=da,Rt=a(),N=l("div"),h(Me.$$.fragment),Dr=a(),at=l("p"),at.textContent=ha,Et=a(),Ae=l("p"),Ae.textContent=ua,kt=a(),Ce=l("p"),Ce.textContent=fa,It=a(),j=l("div"),h(We.$$.fragment),Rr=a(),nt=l("p"),nt.innerHTML=ga,Er=a(),Y=l("div"),h(Le.$$.fragment),kr=a(),ot=l("p"),ot.textContent=_a,Pt=a(),h(je.$$.fragment),Ft=a(),mt=l("p"),this.h()},l(e){const r=ya("svelte-u9bgzb",document.head);c=m(r,"META",{name:!0,content:!0}),r.forEach(t),A=n(e),x=m(e,"P",{}),z(x).forEach(t),p=n(e),u($.$$.fragment,e),i=n(e),T=m(e,"P",{"data-svelte-h":!0}),d(T)!=="svelte-1p2ld9z"&&(T.innerHTML=Ir),ct=n(e),K=m(e,"UL",{"data-svelte-h":!0}),d(K)!=="svelte-p818uy"&&(K.innerHTML=Pr),pt=n(e),u(ee.$$.fragment,e),dt=n(e),W=m(e,"DIV",{class:!0});var Z=z(W);u(te.$$.fragment,Z),ar=n(Z),Re=m(Z,"P",{"data-svelte-h":!0}),d(Re)!=="svelte-b86q21"&&(Re.innerHTML=Fr),nr=n(Z),G=m(Z,"DIV",{class:!0});var Ue=z(G);u(re.$$.fragment,Ue),or=n(Ue),Ee=m(Ue,"P",{"data-svelte-h":!0}),d(Ee)!=="svelte-1gr03w4"&&(Ee.textContent=Vr),Ue.forEach(t),Z.forEach(t),ht=n(e),u(ae.$$.fragment,e),ut=n(e),b=m(e,"DIV",{class:!0});var y=z(b);u(ne.$$.fragment,y),sr=n(y),ke=m(y,"P",{"data-svelte-h":!0}),d(ke)!=="svelte-114ll6r"&&(ke.innerHTML=Jr),ir=n(y),Ie=m(y,"P",{"data-svelte-h":!0}),d(Ie)!=="svelte-9bvrpy"&&(Ie.innerHTML=Nr),lr=n(y),Pe=m(y,"P",{"data-svelte-h":!0}),d(Pe)!=="svelte-1dxk71o"&&(Pe.textContent=Zr),mr=n(y),Fe=m(y,"P",{"data-svelte-h":!0}),d(Fe)!=="svelte-kc6644"&&(Fe.innerHTML=Gr),cr=n(y),Ve=m(y,"UL",{"data-svelte-h":!0}),d(Ve)!=="svelte-p81jc"&&(Ve.innerHTML=Hr),pr=n(y),u(H.$$.fragment,y),dr=n(y),u(S.$$.fragment,y),hr=n(y),Je=m(y,"P",{"data-svelte-h":!0}),d(Je)!=="svelte-w4e00h"&&(Je.innerHTML=Sr),ur=n(y),u(q.$$.fragment,y),fr=n(y),u(B.$$.fragment,y),gr=n(y),X=m(y,"DIV",{class:!0});var De=z(X);u(oe.$$.fragment,De),_r=n(De),Ne=m(De,"P",{"data-svelte-h":!0}),d(Ne)!=="svelte-6lkj7q"&&(Ne.textContent=qr),De.forEach(t),y.forEach(t),ft=n(e),u(se.$$.fragment,e),gt=n(e),C=m(e,"DIV",{class:!0});var Q=z(C);u(ie.$$.fragment,Q),wr=n(Q),Ze=m(Q,"P",{"data-svelte-h":!0}),d(Ze)!=="svelte-towids"&&(Ze.innerHTML=Br),br=n(Q),Ge=m(Q,"P",{"data-svelte-h":!0}),d(Ge)!=="svelte-id029h"&&(Ge.textContent=Xr),vr=n(Q),O=m(Q,"DIV",{class:!0});var Jt=z(O);u(le.$$.fragment,Jt),$r=n(Jt),He=m(Jt,"P",{"data-svelte-h":!0}),d(He)!=="svelte-3iict9"&&(He.textContent=Or),Jt.forEach(t),Q.forEach(t),_t=n(e),D=m(e,"DIV",{class:!0});var Nt=z(D);u(me.$$.fragment,Nt),yr=n(Nt),Se=m(Nt,"P",{"data-svelte-h":!0}),d(Se)!=="svelte-16qojcu"&&(Se.textContent=Yr),Nt.forEach(t),wt=n(e),u(ce.$$.fragment,e),bt=n(e),u(pe.$$.fragment,e),vt=n(e),R=m(e,"DIV",{class:!0});var Zt=z(R);u(de.$$.fragment,Zt),xr=n(Zt),qe=m(Zt,"P",{"data-svelte-h":!0}),d(qe)!=="svelte-ofujqi"&&(qe.textContent=Qr),Zt.forEach(t),$t=n(e),E=m(e,"DIV",{class:!0});var Gt=z(E);u(he.$$.fragment,Gt),Tr=n(Gt),Be=m(Gt,"P",{"data-svelte-h":!0}),d(Be)!=="svelte-1oh310h"&&(Be.textContent=Kr),Gt.forEach(t),yt=n(e),k=m(e,"DIV",{class:!0});var Ht=z(k);u(ue.$$.fragment,Ht),zr=n(Ht),Xe=m(Ht,"P",{"data-svelte-h":!0}),d(Xe)!=="svelte-cadr4a"&&(Xe.textContent=ea),Ht.forEach(t),xt=n(e),I=m(e,"DIV",{class:!0});var St=z(I);u(fe.$$.fragment,St),Mr=n(St),Oe=m(St,"P",{"data-svelte-h":!0}),d(Oe)!=="svelte-1lj8vcj"&&(Oe.textContent=ta),St.forEach(t),Tt=n(e),ge=m(e,"IMG",{alt:!0,src:!0}),zt=n(e),P=m(e,"DIV",{class:!0});var qt=z(P);u(_e.$$.fragment,qt),Ar=n(qt),Ye=m(qt,"P",{"data-svelte-h":!0}),d(Ye)!=="svelte-1lhkhz0"&&(Ye.textContent=aa),qt.forEach(t),Mt=n(e),we=m(e,"IMG",{alt:!0,src:!0}),At=n(e),F=m(e,"DIV",{class:!0});var Bt=z(F);u(be.$$.fragment,Bt),Cr=n(Bt),Qe=m(Bt,"P",{"data-svelte-h":!0}),d(Qe)!=="svelte-1pclsvt"&&(Qe.textContent=oa),Bt.forEach(t),Ct=n(e),ve=m(e,"IMG",{alt:!0,src:!0}),Wt=n(e),V=m(e,"DIV",{class:!0});var Xt=z(V);u($e.$$.fragment,Xt),Wr=n(Xt),Ke=m(Xt,"P",{"data-svelte-h":!0}),d(Ke)!=="svelte-17q4ov5"&&(Ke.textContent=ia),Xt.forEach(t),Lt=n(e),ye=m(e,"IMG",{alt:!0,src:!0}),jt=n(e),L=m(e,"DIV",{class:!0});var st=z(L);u(xe.$$.fragment,st),Lr=n(st),et=m(st,"P",{"data-svelte-h":!0}),d(et)!=="svelte-1y55gjq"&&(et.innerHTML=ma),jr=n(st),tt=m(st,"P",{"data-svelte-h":!0}),d(tt)!=="svelte-1k7dul1"&&(tt.innerHTML=ca),st.forEach(t),Ut=n(e),J=m(e,"DIV",{class:!0});var Ot=z(J);u(Te.$$.fragment,Ot),Ur=n(Ot),rt=m(Ot,"P",{"data-svelte-h":!0}),d(rt)!=="svelte-yp2yn6"&&(rt.textContent=pa),Ot.forEach(t),Dt=n(e),ze=m(e,"P",{"data-svelte-h":!0}),d(ze)!=="svelte-1yx7yxn"&&(ze.textContent=da),Rt=n(e),N=m(e,"DIV",{class:!0});var Yt=z(N);u(Me.$$.fragment,Yt),Dr=n(Yt),at=m(Yt,"P",{"data-svelte-h":!0}),d(at)!=="svelte-1mfn66a"&&(at.textContent=ha),Yt.forEach(t),Et=n(e),Ae=m(e,"P",{"data-svelte-h":!0}),d(Ae)!=="svelte-1ft7kux"&&(Ae.textContent=ua),kt=n(e),Ce=m(e,"P",{"data-svelte-h":!0}),d(Ce)!=="svelte-p8npgf"&&(Ce.textContent=fa),It=n(e),j=m(e,"DIV",{class:!0});var it=z(j);u(We.$$.fragment,it),Rr=n(it),nt=m(it,"P",{"data-svelte-h":!0}),d(nt)!=="svelte-8tkiw"&&(nt.innerHTML=ga),Er=n(it),Y=m(it,"DIV",{class:!0});var Qt=z(Y);u(Le.$$.fragment,Qt),kr=n(Qt),ot=m(Qt,"P",{"data-svelte-h":!0}),d(ot)!=="svelte-v0y289"&&(ot.textContent=_a),Qt.forEach(t),it.forEach(t),Pt=n(e),u(je.$$.fragment,e),Ft=n(e),mt=m(e,"P",{}),z(mt).forEach(t),this.h()},h(){v(c,"name","hf:doc:metadata"),v(c,"content",Wa),v(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(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(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(ge,"alt",""),Kt(ge.src,ra="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/warmup_constant_schedule.png")||v(ge,"src",ra),v(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(we,"alt",""),Kt(we.src,na="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/warmup_cosine_schedule.png")||v(we,"src",na),v(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(ve,"alt",""),Kt(ve.src,sa="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/warmup_cosine_hard_restarts_schedule.png")||v(ve,"src",sa),v(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(ye,"alt",""),Kt(ye.src,la="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/warmup_linear_schedule.png")||v(ye,"src",la),v(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,r){s(document.head,c),o(e,A,r),o(e,x,r),o(e,p,r),f($,e,r),o(e,i,r),o(e,T,r),o(e,ct,r),o(e,K,r),o(e,pt,r),f(ee,e,r),o(e,dt,r),o(e,W,r),f(te,W,null),s(W,ar),s(W,Re),s(W,nr),s(W,G),f(re,G,null),s(G,or),s(G,Ee),o(e,ht,r),f(ae,e,r),o(e,ut,r),o(e,b,r),f(ne,b,null),s(b,sr),s(b,ke),s(b,ir),s(b,Ie),s(b,lr),s(b,Pe),s(b,mr),s(b,Fe),s(b,cr),s(b,Ve),s(b,pr),f(H,b,null),s(b,dr),f(S,b,null),s(b,hr),s(b,Je),s(b,ur),f(q,b,null),s(b,fr),f(B,b,null),s(b,gr),s(b,X),f(oe,X,null),s(X,_r),s(X,Ne),o(e,ft,r),f(se,e,r),o(e,gt,r),o(e,C,r),f(ie,C,null),s(C,wr),s(C,Ze),s(C,br),s(C,Ge),s(C,vr),s(C,O),f(le,O,null),s(O,$r),s(O,He),o(e,_t,r),o(e,D,r),f(me,D,null),s(D,yr),s(D,Se),o(e,wt,r),f(ce,e,r),o(e,bt,r),f(pe,e,r),o(e,vt,r),o(e,R,r),f(de,R,null),s(R,xr),s(R,qe),o(e,$t,r),o(e,E,r),f(he,E,null),s(E,Tr),s(E,Be),o(e,yt,r),o(e,k,r),f(ue,k,null),s(k,zr),s(k,Xe),o(e,xt,r),o(e,I,r),f(fe,I,null),s(I,Mr),s(I,Oe),o(e,Tt,r),o(e,ge,r),o(e,zt,r),o(e,P,r),f(_e,P,null),s(P,Ar),s(P,Ye),o(e,Mt,r),o(e,we,r),o(e,At,r),o(e,F,r),f(be,F,null),s(F,Cr),s(F,Qe),o(e,Ct,r),o(e,ve,r),o(e,Wt,r),o(e,V,r),f($e,V,null),s(V,Wr),s(V,Ke),o(e,Lt,r),o(e,ye,r),o(e,jt,r),o(e,L,r),f(xe,L,null),s(L,Lr),s(L,et),s(L,jr),s(L,tt),o(e,Ut,r),o(e,J,r),f(Te,J,null),s(J,Ur),s(J,rt),o(e,Dt,r),o(e,ze,r),o(e,Rt,r),o(e,N,r),f(Me,N,null),s(N,Dr),s(N,at),o(e,Et,r),o(e,Ae,r),o(e,kt,r),o(e,Ce,r),o(e,It,r),o(e,j,r),f(We,j,null),s(j,Rr),s(j,nt),s(j,Er),s(j,Y),f(Le,Y,null),s(Y,kr),s(Y,ot),o(e,Pt,r),f(je,e,r),o(e,Ft,r),o(e,mt,r),Vt=!0},p(e,[r]){const Z={};r&2&&(Z.$$scope={dirty:r,ctx:e}),H.$set(Z);const Ue={};r&2&&(Ue.$$scope={dirty:r,ctx:e}),S.$set(Ue);const y={};r&2&&(y.$$scope={dirty:r,ctx:e}),q.$set(y);const De={};r&2&&(De.$$scope={dirty:r,ctx:e}),B.$set(De)},i(e){Vt||(g($.$$.fragment,e),g(ee.$$.fragment,e),g(te.$$.fragment,e),g(re.$$.fragment,e),g(ae.$$.fragment,e),g(ne.$$.fragment,e),g(H.$$.fragment,e),g(S.$$.fragment,e),g(q.$$.fragment,e),g(B.$$.fragment,e),g(oe.$$.fragment,e),g(se.$$.fragment,e),g(ie.$$.fragment,e),g(le.$$.fragment,e),g(me.$$.fragment,e),g(ce.$$.fragment,e),g(pe.$$.fragment,e),g(de.$$.fragment,e),g(he.$$.fragment,e),g(ue.$$.fragment,e),g(fe.$$.fragment,e),g(_e.$$.fragment,e),g(be.$$.fragment,e),g($e.$$.fragment,e),g(xe.$$.fragment,e),g(Te.$$.fragment,e),g(Me.$$.fragment,e),g(We.$$.fragment,e),g(Le.$$.fragment,e),g(je.$$.fragment,e),Vt=!0)},o(e){_($.$$.fragment,e),_(ee.$$.fragment,e),_(te.$$.fragment,e),_(re.$$.fragment,e),_(ae.$$.fragment,e),_(ne.$$.fragment,e),_(H.$$.fragment,e),_(S.$$.fragment,e),_(q.$$.fragment,e),_(B.$$.fragment,e),_(oe.$$.fragment,e),_(se.$$.fragment,e),_(ie.$$.fragment,e),_(le.$$.fragment,e),_(me.$$.fragment,e),_(ce.$$.fragment,e),_(pe.$$.fragment,e),_(de.$$.fragment,e),_(he.$$.fragment,e),_(ue.$$.fragment,e),_(fe.$$.fragment,e),_(_e.$$.fragment,e),_(be.$$.fragment,e),_($e.$$.fragment,e),_(xe.$$.fragment,e),_(Te.$$.fragment,e),_(Me.$$.fragment,e),_(We.$$.fragment,e),_(Le.$$.fragment,e),_(je.$$.fragment,e),Vt=!1},d(e){e&&(t(A),t(x),t(p),t(i),t(T),t(ct),t(K),t(pt),t(dt),t(W),t(ht),t(ut),t(b),t(ft),t(gt),t(C),t(_t),t(D),t(wt),t(bt),t(vt),t(R),t($t),t(E),t(yt),t(k),t(xt),t(I),t(Tt),t(ge),t(zt),t(P),t(Mt),t(we),t(At),t(F),t(Ct),t(ve),t(Wt),t(V),t(Lt),t(ye),t(jt),t(L),t(Ut),t(J),t(Dt),t(ze),t(Rt),t(N),t(Et),t(Ae),t(kt),t(Ce),t(It),t(j),t(Pt),t(Ft),t(mt)),t(c),w($,e),w(ee,e),w(te),w(re),w(ae,e),w(ne),w(H),w(S),w(q),w(B),w(oe),w(se,e),w(ie),w(le),w(me),w(ce,e),w(pe,e),w(de),w(he),w(ue),w(fe),w(_e),w(be),w($e),w(xe),w(Te),w(Me),w(We),w(Le),w(je,e)}}}const Wa='{"title":"Optimization","local":"optimization","sections":[{"title":"AdamW (PyTorch)","local":"transformers.AdamW","sections":[],"depth":2},{"title":"AdaFactor (PyTorch)","local":"transformers.Adafactor","sections":[],"depth":2},{"title":"AdamWeightDecay (TensorFlow)","local":"transformers.AdamWeightDecay","sections":[],"depth":2},{"title":"Schedules","local":"schedules","sections":[{"title":"Learning Rate Schedules (Pytorch)","local":"transformers.SchedulerType","sections":[],"depth":3}],"depth":2}],"depth":1}';function La(U){return ba(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ia extends va{constructor(c){super(),$a(this,c,La,Ca,wa,{})}}export{Ia as component};
