import{s as fa,f as Kt,o as ga,n as tr}from"../chunks/scheduler.9bc65507.js";import{S as _a,i as wa,g as l,s as a,r as p,A as ba,h as m,f as t,c as n,j as z,u as d,x as w,k as $,y as o,a as i,v as h,d as u,t as f,w as g}from"../chunks/index.707bf1b6.js";import{D as M}from"../chunks/Docstring.570ddb64.js";import{C as rr}from"../chunks/CodeBlock.54a9f38d.js";import{E as er}from"../chunks/ExampleCodeBlock.bc2be6bc.js";import{H as Z,E as $a}from"../chunks/EditOnGithub.922df6ba.js";function va(U){let c,A="Example:",x,_,v;return _=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(),p(_.$$.fragment)},l(s){c=m(s,"P",{"data-svelte-h":!0}),w(c)!=="svelte-11lpom8"&&(c.textContent=A),x=n(s),d(_.$$.fragment,s)},m(s,T){i(s,c,T),i(s,x,T),h(_,s,T),v=!0},p:tr,i(s){v||(u(_.$$.fragment,s),v=!0)},o(s){f(_.$$.fragment,s),v=!1},d(s){s&&(t(c),t(x)),g(_,s)}}}function ya(U){let c,A="Others reported the following combination to work well:",x,_,v;return _=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(),p(_.$$.fragment)},l(s){c=m(s,"P",{"data-svelte-h":!0}),w(c)!=="svelte-mxeef1"&&(c.textContent=A),x=n(s),d(_.$$.fragment,s)},m(s,T){i(s,c,T),i(s,x,T),h(_,s,T),v=!0},p:tr,i(s){v||(u(_.$$.fragment,s),v=!0)},o(s){f(_.$$.fragment,s),v=!1},d(s){s&&(t(c),t(x)),g(_,s)}}}function xa(U){let c,A="scheduler as following:",x,_,v;return _=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(),p(_.$$.fragment)},l(s){c=m(s,"P",{"data-svelte-h":!0}),w(c)!=="svelte-1eua222"&&(c.textContent=A),x=n(s),d(_.$$.fragment,s)},m(s,T){i(s,c,T),i(s,x,T),h(_,s,T),v=!0},p:tr,i(s){v||(u(_.$$.fragment,s),v=!0)},o(s){f(_.$$.fragment,s),v=!1},d(s){s&&(t(c),t(x)),g(_,s)}}}function Ta(U){let c,A="Usage:",x,_,v;return _=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(),p(_.$$.fragment)},l(s){c=m(s,"P",{"data-svelte-h":!0}),w(c)!=="svelte-5wyjqd"&&(c.textContent=A),x=n(s),d(_.$$.fragment,s)},m(s,T){i(s,c,T),i(s,x,T),h(_,s,T),v=!0},p:tr,i(s){v||(u(_.$$.fragment,s),v=!0)},o(s){f(_.$$.fragment,s),v=!1},d(s){s&&(t(c),t(x)),g(_,s)}}}function za(U){let c,A,x,_,v,s,T,Ir="<code>.optimization</code> モジュールは以下を提供します。",ct,ee,Fr="<li>モデルの微調整に使用できる重み減衰が修正されたオプティマイザー、および</li> <li><code>_LRSchedule</code> から継承するスケジュール オブジェクトの形式のいくつかのスケジュール:</li> <li>複数のバッチの勾配を累積するための勾配累積クラス</li>",pt,te,dt,W,re,ar,Ee,Pr=`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,S,ae,or,ke,Vr="Performs a single optimization step.",ht,ne,ut,b,oe,sr,Ie,Gr=`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,Fe,Jr=`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,Nr="This implementation handles low-precision (FP16, bfloat) values, but we have not thoroughly tested.",mr,Ve,Zr='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,Ge,Sr='<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,q,hr,Je,Hr='When using <code>lr=None</code> with <a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer">Trainer</a> you will most likely need to use <code>AdafactorSchedule</code>',ur,B,fr,X,gr,O,se,_r,Ne,qr="Performs a single optimization step",ft,ie,gt,C,le,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,Se,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.`,$r,Y,me,vr,He,Or="Creates an optimizer from its config with WarmUp custom object.",_t,D,ce,yr,qe,Yr="Creates an optimizer with a learning rate schedule using a warmup phase followed by a linear decay.",wt,pe,bt,de,$t,R,he,xr,Be,Qr="An enumeration.",vt,E,ue,Tr,Xe,Kr="Unified API to get any scheduler from its name.",yt,k,fe,zr,Oe,ea="Create a schedule with a constant learning rate, using the learning rate set in optimizer.",xt,I,ge,Mr,Ye,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,_e,ra,zt,F,we,Ar,Qe,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,be,na,At,P,$e,Cr,Ke,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,ye,Wr,et,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.`,jt,xe,la,Lt,j,Te,jr,tt,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.`,Lr,rt,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,G,ze,Ur,at,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,Me,Rt,J,Ae,Dr,nt,da="Applies a warmup schedule on a given learning rate decay schedule.",Et,Ce,kt,We,It,L,je,Rr,ot,ha=`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,Q,Le,kr,st,ua="Resets the accumulated gradients on the current replica.",Ft,Ue,Pt,mt,Vt;return v=new Z({props:{title:"Optimization",local:"optimization",headingTag:"h1"}}),te=new Z({props:{title:"AdamW (PyTorch)",local:"transformers.AdamW",headingTag:"h2"}}),re=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/main/src/transformers/optimization.py#L555"}}),ae=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/main/src/transformers/optimization.py#L606"}}),ne=new Z({props:{title:"AdaFactor (PyTorch)",local:"transformers.Adafactor",headingTag:"h2"}}),oe=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/main/src/transformers/optimization.py#L669"}}),H=new er({props:{anchor:"transformers.Adafactor.example",$$slots:{default:[va]},$$scope:{ctx:U}}}),q=new er({props:{anchor:"transformers.Adafactor.example-2",$$slots:{default:[ya]},$$scope:{ctx:U}}}),B=new er({props:{anchor:"transformers.Adafactor.example-3",$$slots:{default:[xa]},$$scope:{ctx:U}}}),X=new er({props:{anchor:"transformers.Adafactor.example-4",$$slots:{default:[Ta]},$$scope:{ctx:U}}}),se=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/main/src/transformers/optimization.py#L815"}}),ie=new Z({props:{title:"AdamWeightDecay (TensorFlow)",local:"transformers.AdamWeightDecay",headingTag:"h2"}}),le=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/main/src/transformers/optimization_tf.py#L180"}}),me=new M({props:{name:"from_config",anchor:"transformers.AdamWeightDecay.from_config",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/optimization_tf.py#L237"}}),ce=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/main/src/transformers/optimization_tf.py#L96"}}),pe=new Z({props:{title:"Schedules",local:"schedules",headingTag:"h2"}}),de=new Z({props:{title:"Learning Rate Schedules (Pytorch)",local:"transformers.SchedulerType",headingTag:"h3"}}),he=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/main/src/transformers/trainer_utils.py#L405"}}),ue=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/main/src/transformers/optimization.py#L471"}}),fe=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/main/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>
`}}),ge=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/main/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>
`}}),we=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/main/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>
`}}),$e=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/main/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>
`}}),ye=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/main/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>
`}}),Te=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/main/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>
`}}),ze=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/main/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 Z({props:{title:"Warmup (TensorFlow)",local:"transformers.WarmUp",headingTag:"h3"}}),Ae=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/main/src/transformers/optimization_tf.py#L38"}}),Ce=new Z({props:{title:"Gradient Strategies",local:"gradient-strategies",headingTag:"h2"}}),We=new Z({props:{title:"GradientAccumulator (TensorFlow)",local:"transformers.GradientAccumulator",headingTag:"h3"}}),je=new M({props:{name:"class transformers.GradientAccumulator",anchor:"transformers.GradientAccumulator",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/optimization_tf.py#L310"}}),Le=new M({props:{name:"reset",anchor:"transformers.GradientAccumulator.reset",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/optimization_tf.py#L372"}}),Ue=new $a({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/main_classes/optimizer_schedules.md"}}),{c(){c=l("meta"),A=a(),x=l("p"),_=a(),p(v.$$.fragment),s=a(),T=l("p"),T.innerHTML=Ir,ct=a(),ee=l("ul"),ee.innerHTML=Fr,pt=a(),p(te.$$.fragment),dt=a(),W=l("div"),p(re.$$.fragment),ar=a(),Ee=l("p"),Ee.innerHTML=Pr,nr=a(),S=l("div"),p(ae.$$.fragment),or=a(),ke=l("p"),ke.textContent=Vr,ht=a(),p(ne.$$.fragment),ut=a(),b=l("div"),p(oe.$$.fragment),sr=a(),Ie=l("p"),Ie.innerHTML=Gr,ir=a(),Fe=l("p"),Fe.innerHTML=Jr,lr=a(),Pe=l("p"),Pe.textContent=Nr,mr=a(),Ve=l("p"),Ve.innerHTML=Zr,cr=a(),Ge=l("ul"),Ge.innerHTML=Sr,pr=a(),p(H.$$.fragment),dr=a(),p(q.$$.fragment),hr=a(),Je=l("p"),Je.innerHTML=Hr,ur=a(),p(B.$$.fragment),fr=a(),p(X.$$.fragment),gr=a(),O=l("div"),p(se.$$.fragment),_r=a(),Ne=l("p"),Ne.textContent=qr,ft=a(),p(ie.$$.fragment),gt=a(),C=l("div"),p(le.$$.fragment),wr=a(),Ze=l("p"),Ze.innerHTML=Br,br=a(),Se=l("p"),Se.textContent=Xr,$r=a(),Y=l("div"),p(me.$$.fragment),vr=a(),He=l("p"),He.textContent=Or,_t=a(),D=l("div"),p(ce.$$.fragment),yr=a(),qe=l("p"),qe.textContent=Yr,wt=a(),p(pe.$$.fragment),bt=a(),p(de.$$.fragment),$t=a(),R=l("div"),p(he.$$.fragment),xr=a(),Be=l("p"),Be.textContent=Qr,vt=a(),E=l("div"),p(ue.$$.fragment),Tr=a(),Xe=l("p"),Xe.textContent=Kr,yt=a(),k=l("div"),p(fe.$$.fragment),zr=a(),Oe=l("p"),Oe.textContent=ea,xt=a(),I=l("div"),p(ge.$$.fragment),Mr=a(),Ye=l("p"),Ye.textContent=ta,Tt=a(),_e=l("img"),zt=a(),F=l("div"),p(we.$$.fragment),Ar=a(),Qe=l("p"),Qe.textContent=aa,Mt=a(),be=l("img"),At=a(),P=l("div"),p($e.$$.fragment),Cr=a(),Ke=l("p"),Ke.textContent=oa,Ct=a(),ve=l("img"),Wt=a(),V=l("div"),p(ye.$$.fragment),Wr=a(),et=l("p"),et.textContent=ia,jt=a(),xe=l("img"),Lt=a(),j=l("div"),p(Te.$$.fragment),jr=a(),tt=l("p"),tt.innerHTML=ma,Lr=a(),rt=l("p"),rt.innerHTML=ca,Ut=a(),G=l("div"),p(ze.$$.fragment),Ur=a(),at=l("p"),at.textContent=pa,Dt=a(),p(Me.$$.fragment),Rt=a(),J=l("div"),p(Ae.$$.fragment),Dr=a(),nt=l("p"),nt.textContent=da,Et=a(),p(Ce.$$.fragment),kt=a(),p(We.$$.fragment),It=a(),L=l("div"),p(je.$$.fragment),Rr=a(),ot=l("p"),ot.innerHTML=ha,Er=a(),Q=l("div"),p(Le.$$.fragment),kr=a(),st=l("p"),st.textContent=ua,Ft=a(),p(Ue.$$.fragment),Pt=a(),mt=l("p"),this.h()},l(e){const r=ba("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),_=n(e),d(v.$$.fragment,e),s=n(e),T=m(e,"P",{"data-svelte-h":!0}),w(T)!=="svelte-17yfr74"&&(T.innerHTML=Ir),ct=n(e),ee=m(e,"UL",{"data-svelte-h":!0}),w(ee)!=="svelte-1rrczld"&&(ee.innerHTML=Fr),pt=n(e),d(te.$$.fragment,e),dt=n(e),W=m(e,"DIV",{class:!0});var N=z(W);d(re.$$.fragment,N),ar=n(N),Ee=m(N,"P",{"data-svelte-h":!0}),w(Ee)!=="svelte-b86q21"&&(Ee.innerHTML=Pr),nr=n(N),S=m(N,"DIV",{class:!0});var De=z(S);d(ae.$$.fragment,De),or=n(De),ke=m(De,"P",{"data-svelte-h":!0}),w(ke)!=="svelte-1gr03w4"&&(ke.textContent=Vr),De.forEach(t),N.forEach(t),ht=n(e),d(ne.$$.fragment,e),ut=n(e),b=m(e,"DIV",{class:!0});var y=z(b);d(oe.$$.fragment,y),sr=n(y),Ie=m(y,"P",{"data-svelte-h":!0}),w(Ie)!=="svelte-114ll6r"&&(Ie.innerHTML=Gr),ir=n(y),Fe=m(y,"P",{"data-svelte-h":!0}),w(Fe)!=="svelte-9bvrpy"&&(Fe.innerHTML=Jr),lr=n(y),Pe=m(y,"P",{"data-svelte-h":!0}),w(Pe)!=="svelte-1dxk71o"&&(Pe.textContent=Nr),mr=n(y),Ve=m(y,"P",{"data-svelte-h":!0}),w(Ve)!=="svelte-kc6644"&&(Ve.innerHTML=Zr),cr=n(y),Ge=m(y,"UL",{"data-svelte-h":!0}),w(Ge)!=="svelte-p81jc"&&(Ge.innerHTML=Sr),pr=n(y),d(H.$$.fragment,y),dr=n(y),d(q.$$.fragment,y),hr=n(y),Je=m(y,"P",{"data-svelte-h":!0}),w(Je)!=="svelte-11152nx"&&(Je.innerHTML=Hr),ur=n(y),d(B.$$.fragment,y),fr=n(y),d(X.$$.fragment,y),gr=n(y),O=m(y,"DIV",{class:!0});var Re=z(O);d(se.$$.fragment,Re),_r=n(Re),Ne=m(Re,"P",{"data-svelte-h":!0}),w(Ne)!=="svelte-6lkj7q"&&(Ne.textContent=qr),Re.forEach(t),y.forEach(t),ft=n(e),d(ie.$$.fragment,e),gt=n(e),C=m(e,"DIV",{class:!0});var K=z(C);d(le.$$.fragment,K),wr=n(K),Ze=m(K,"P",{"data-svelte-h":!0}),w(Ze)!=="svelte-towids"&&(Ze.innerHTML=Br),br=n(K),Se=m(K,"P",{"data-svelte-h":!0}),w(Se)!=="svelte-id029h"&&(Se.textContent=Xr),$r=n(K),Y=m(K,"DIV",{class:!0});var Gt=z(Y);d(me.$$.fragment,Gt),vr=n(Gt),He=m(Gt,"P",{"data-svelte-h":!0}),w(He)!=="svelte-3iict9"&&(He.textContent=Or),Gt.forEach(t),K.forEach(t),_t=n(e),D=m(e,"DIV",{class:!0});var Jt=z(D);d(ce.$$.fragment,Jt),yr=n(Jt),qe=m(Jt,"P",{"data-svelte-h":!0}),w(qe)!=="svelte-16qojcu"&&(qe.textContent=Yr),Jt.forEach(t),wt=n(e),d(pe.$$.fragment,e),bt=n(e),d(de.$$.fragment,e),$t=n(e),R=m(e,"DIV",{class:!0});var Nt=z(R);d(he.$$.fragment,Nt),xr=n(Nt),Be=m(Nt,"P",{"data-svelte-h":!0}),w(Be)!=="svelte-ofujqi"&&(Be.textContent=Qr),Nt.forEach(t),vt=n(e),E=m(e,"DIV",{class:!0});var Zt=z(E);d(ue.$$.fragment,Zt),Tr=n(Zt),Xe=m(Zt,"P",{"data-svelte-h":!0}),w(Xe)!=="svelte-1oh310h"&&(Xe.textContent=Kr),Zt.forEach(t),yt=n(e),k=m(e,"DIV",{class:!0});var St=z(k);d(fe.$$.fragment,St),zr=n(St),Oe=m(St,"P",{"data-svelte-h":!0}),w(Oe)!=="svelte-cadr4a"&&(Oe.textContent=ea),St.forEach(t),xt=n(e),I=m(e,"DIV",{class:!0});var Ht=z(I);d(ge.$$.fragment,Ht),Mr=n(Ht),Ye=m(Ht,"P",{"data-svelte-h":!0}),w(Ye)!=="svelte-1lj8vcj"&&(Ye.textContent=ta),Ht.forEach(t),Tt=n(e),_e=m(e,"IMG",{alt:!0,src:!0}),zt=n(e),F=m(e,"DIV",{class:!0});var qt=z(F);d(we.$$.fragment,qt),Ar=n(qt),Qe=m(qt,"P",{"data-svelte-h":!0}),w(Qe)!=="svelte-1lhkhz0"&&(Qe.textContent=aa),qt.forEach(t),Mt=n(e),be=m(e,"IMG",{alt:!0,src:!0}),At=n(e),P=m(e,"DIV",{class:!0});var Bt=z(P);d($e.$$.fragment,Bt),Cr=n(Bt),Ke=m(Bt,"P",{"data-svelte-h":!0}),w(Ke)!=="svelte-1pclsvt"&&(Ke.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);d(ye.$$.fragment,Xt),Wr=n(Xt),et=m(Xt,"P",{"data-svelte-h":!0}),w(et)!=="svelte-17q4ov5"&&(et.textContent=ia),Xt.forEach(t),jt=n(e),xe=m(e,"IMG",{alt:!0,src:!0}),Lt=n(e),j=m(e,"DIV",{class:!0});var it=z(j);d(Te.$$.fragment,it),jr=n(it),tt=m(it,"P",{"data-svelte-h":!0}),w(tt)!=="svelte-1y55gjq"&&(tt.innerHTML=ma),Lr=n(it),rt=m(it,"P",{"data-svelte-h":!0}),w(rt)!=="svelte-1tn0l2l"&&(rt.innerHTML=ca),it.forEach(t),Ut=n(e),G=m(e,"DIV",{class:!0});var Ot=z(G);d(ze.$$.fragment,Ot),Ur=n(Ot),at=m(Ot,"P",{"data-svelte-h":!0}),w(at)!=="svelte-yp2yn6"&&(at.textContent=pa),Ot.forEach(t),Dt=n(e),d(Me.$$.fragment,e),Rt=n(e),J=m(e,"DIV",{class:!0});var Yt=z(J);d(Ae.$$.fragment,Yt),Dr=n(Yt),nt=m(Yt,"P",{"data-svelte-h":!0}),w(nt)!=="svelte-1mfn66a"&&(nt.textContent=da),Yt.forEach(t),Et=n(e),d(Ce.$$.fragment,e),kt=n(e),d(We.$$.fragment,e),It=n(e),L=m(e,"DIV",{class:!0});var lt=z(L);d(je.$$.fragment,lt),Rr=n(lt),ot=m(lt,"P",{"data-svelte-h":!0}),w(ot)!=="svelte-8tkiw"&&(ot.innerHTML=ha),Er=n(lt),Q=m(lt,"DIV",{class:!0});var Qt=z(Q);d(Le.$$.fragment,Qt),kr=n(Qt),st=m(Qt,"P",{"data-svelte-h":!0}),w(st)!=="svelte-v0y289"&&(st.textContent=ua),Qt.forEach(t),lt.forEach(t),Ft=n(e),d(Ue.$$.fragment,e),Pt=n(e),mt=m(e,"P",{}),z(mt).forEach(t),this.h()},h(){$(c,"name","hf:doc:metadata"),$(c,"content",Ma),$(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(W,"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"),$(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(C,"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"),$(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(E,"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"),$(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(_e,"alt",""),Kt(_e.src,ra="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/warmup_constant_schedule.png")||$(_e,"src",ra),$(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(be,"alt",""),Kt(be.src,na="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/warmup_cosine_schedule.png")||$(be,"src",na),$(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(ve,"alt",""),Kt(ve.src,sa="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/warmup_cosine_hard_restarts_schedule.png")||$(ve,"src",sa),$(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(xe,"alt",""),Kt(xe.src,la="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/warmup_linear_schedule.png")||$(xe,"src",la),$(j,"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"),$(J,"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"),$(L,"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){o(document.head,c),i(e,A,r),i(e,x,r),i(e,_,r),h(v,e,r),i(e,s,r),i(e,T,r),i(e,ct,r),i(e,ee,r),i(e,pt,r),h(te,e,r),i(e,dt,r),i(e,W,r),h(re,W,null),o(W,ar),o(W,Ee),o(W,nr),o(W,S),h(ae,S,null),o(S,or),o(S,ke),i(e,ht,r),h(ne,e,r),i(e,ut,r),i(e,b,r),h(oe,b,null),o(b,sr),o(b,Ie),o(b,ir),o(b,Fe),o(b,lr),o(b,Pe),o(b,mr),o(b,Ve),o(b,cr),o(b,Ge),o(b,pr),h(H,b,null),o(b,dr),h(q,b,null),o(b,hr),o(b,Je),o(b,ur),h(B,b,null),o(b,fr),h(X,b,null),o(b,gr),o(b,O),h(se,O,null),o(O,_r),o(O,Ne),i(e,ft,r),h(ie,e,r),i(e,gt,r),i(e,C,r),h(le,C,null),o(C,wr),o(C,Ze),o(C,br),o(C,Se),o(C,$r),o(C,Y),h(me,Y,null),o(Y,vr),o(Y,He),i(e,_t,r),i(e,D,r),h(ce,D,null),o(D,yr),o(D,qe),i(e,wt,r),h(pe,e,r),i(e,bt,r),h(de,e,r),i(e,$t,r),i(e,R,r),h(he,R,null),o(R,xr),o(R,Be),i(e,vt,r),i(e,E,r),h(ue,E,null),o(E,Tr),o(E,Xe),i(e,yt,r),i(e,k,r),h(fe,k,null),o(k,zr),o(k,Oe),i(e,xt,r),i(e,I,r),h(ge,I,null),o(I,Mr),o(I,Ye),i(e,Tt,r),i(e,_e,r),i(e,zt,r),i(e,F,r),h(we,F,null),o(F,Ar),o(F,Qe),i(e,Mt,r),i(e,be,r),i(e,At,r),i(e,P,r),h($e,P,null),o(P,Cr),o(P,Ke),i(e,Ct,r),i(e,ve,r),i(e,Wt,r),i(e,V,r),h(ye,V,null),o(V,Wr),o(V,et),i(e,jt,r),i(e,xe,r),i(e,Lt,r),i(e,j,r),h(Te,j,null),o(j,jr),o(j,tt),o(j,Lr),o(j,rt),i(e,Ut,r),i(e,G,r),h(ze,G,null),o(G,Ur),o(G,at),i(e,Dt,r),h(Me,e,r),i(e,Rt,r),i(e,J,r),h(Ae,J,null),o(J,Dr),o(J,nt),i(e,Et,r),h(Ce,e,r),i(e,kt,r),h(We,e,r),i(e,It,r),i(e,L,r),h(je,L,null),o(L,Rr),o(L,ot),o(L,Er),o(L,Q),h(Le,Q,null),o(Q,kr),o(Q,st),i(e,Ft,r),h(Ue,e,r),i(e,Pt,r),i(e,mt,r),Vt=!0},p(e,[r]){const N={};r&2&&(N.$$scope={dirty:r,ctx:e}),H.$set(N);const De={};r&2&&(De.$$scope={dirty:r,ctx:e}),q.$set(De);const y={};r&2&&(y.$$scope={dirty:r,ctx:e}),B.$set(y);const Re={};r&2&&(Re.$$scope={dirty:r,ctx:e}),X.$set(Re)},i(e){Vt||(u(v.$$.fragment,e),u(te.$$.fragment,e),u(re.$$.fragment,e),u(ae.$$.fragment,e),u(ne.$$.fragment,e),u(oe.$$.fragment,e),u(H.$$.fragment,e),u(q.$$.fragment,e),u(B.$$.fragment,e),u(X.$$.fragment,e),u(se.$$.fragment,e),u(ie.$$.fragment,e),u(le.$$.fragment,e),u(me.$$.fragment,e),u(ce.$$.fragment,e),u(pe.$$.fragment,e),u(de.$$.fragment,e),u(he.$$.fragment,e),u(ue.$$.fragment,e),u(fe.$$.fragment,e),u(ge.$$.fragment,e),u(we.$$.fragment,e),u($e.$$.fragment,e),u(ye.$$.fragment,e),u(Te.$$.fragment,e),u(ze.$$.fragment,e),u(Me.$$.fragment,e),u(Ae.$$.fragment,e),u(Ce.$$.fragment,e),u(We.$$.fragment,e),u(je.$$.fragment,e),u(Le.$$.fragment,e),u(Ue.$$.fragment,e),Vt=!0)},o(e){f(v.$$.fragment,e),f(te.$$.fragment,e),f(re.$$.fragment,e),f(ae.$$.fragment,e),f(ne.$$.fragment,e),f(oe.$$.fragment,e),f(H.$$.fragment,e),f(q.$$.fragment,e),f(B.$$.fragment,e),f(X.$$.fragment,e),f(se.$$.fragment,e),f(ie.$$.fragment,e),f(le.$$.fragment,e),f(me.$$.fragment,e),f(ce.$$.fragment,e),f(pe.$$.fragment,e),f(de.$$.fragment,e),f(he.$$.fragment,e),f(ue.$$.fragment,e),f(fe.$$.fragment,e),f(ge.$$.fragment,e),f(we.$$.fragment,e),f($e.$$.fragment,e),f(ye.$$.fragment,e),f(Te.$$.fragment,e),f(ze.$$.fragment,e),f(Me.$$.fragment,e),f(Ae.$$.fragment,e),f(Ce.$$.fragment,e),f(We.$$.fragment,e),f(je.$$.fragment,e),f(Le.$$.fragment,e),f(Ue.$$.fragment,e),Vt=!1},d(e){e&&(t(A),t(x),t(_),t(s),t(T),t(ct),t(ee),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($t),t(R),t(vt),t(E),t(yt),t(k),t(xt),t(I),t(Tt),t(_e),t(zt),t(F),t(Mt),t(be),t(At),t(P),t(Ct),t(ve),t(Wt),t(V),t(jt),t(xe),t(Lt),t(j),t(Ut),t(G),t(Dt),t(Rt),t(J),t(Et),t(kt),t(It),t(L),t(Ft),t(Pt),t(mt)),t(c),g(v,e),g(te,e),g(re),g(ae),g(ne,e),g(oe),g(H),g(q),g(B),g(X),g(se),g(ie,e),g(le),g(me),g(ce),g(pe,e),g(de,e),g(he),g(ue),g(fe),g(ge),g(we),g($e),g(ye),g(Te),g(ze),g(Me,e),g(Ae),g(Ce,e),g(We,e),g(je),g(Le),g(Ue,e)}}}const Ma='{"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},{"title":"Warmup (TensorFlow)","local":"transformers.WarmUp","sections":[],"depth":3}],"depth":2},{"title":"Gradient Strategies","local":"gradient-strategies","sections":[{"title":"GradientAccumulator (TensorFlow)","local":"transformers.GradientAccumulator","sections":[],"depth":3}],"depth":2}],"depth":1}';function Aa(U){return ga(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ra extends _a{constructor(c){super(),wa(this,c,Aa,za,fa,{})}}export{Ra as component};
