Buckets:

download
raw
57.6 kB
import"../chunks/DsnmJJEf.js";import{i as ua,h as ba,C as va,H as i,D as o,E as fa,s as _a}from"../chunks/BDUskbN2.js";import{p as ya,o as xa,s as t,f as wa,a as Ge,b as Aa,c as e,d as Se,n as r,r as a}from"../chunks/MVX9lrPY.js";const za='{"title":"Optimization","local":"optimization","sections":[{"title":"Optimizers","local":"optimizers","sections":[{"title":"Factory functions","local":"timm.optim.create_optimizer_v2","sections":[],"depth":3}],"depth":2}],"depth":1}';var La=Se('<meta name="hf:doc:metadata"/>'),Ta=Se(`<p></p> <!> <!> <p>This page contains the API reference documentation for learning rate optimizers included in <code>timm</code>.</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Create an optimizer instance via timm registry.</p> <p>Creates and configures an optimizer with appropriate parameter groups and settings.
Supports automatic parameter group creation for weight decay and layer-wise learning
rates, as well as custom parameter grouping.</p> <p>Examples:</p> <blockquote><blockquote><blockquote><!> <p>optimizer = create_optimizer_v2(model, ‘adamw’, lr=1e-3)</p></blockquote></blockquote></blockquote> <blockquote><blockquote><blockquote><!> <p>optimizer = create_optimizer_v2(
… model, ‘sgd’, lr=0.1, momentum=0.9, weight_decay=1e-4
… )</p></blockquote></blockquote></blockquote> <blockquote><blockquote><blockquote><!> <p>optimizer = create_optimizer_v2(
… model, ‘adam’, lr=1e-3, layer_decay=0.7
… )</p></blockquote></blockquote></blockquote> <blockquote><blockquote><blockquote><!> <p>def group_fn(model):
… return [
… &#123;‘params’: model.backbone.parameters(), ‘lr’: 1e-4},
… &#123;‘params’: model.head.parameters(), ‘lr’: 1e-3}
… ]
optimizer = create_optimizer_v2(
… model, ‘sgd’, param_group_fn=group_fn
… )</p></blockquote></blockquote></blockquote> <p>Note:
Parameter group handling precedence:</p> <ol><li>If param_group_fn is provided, it will be used exclusively</li> <li>If layer_decay is provided, layer-wise groups will be created</li> <li>If weight_decay > 0 and filter_bias_and_bn is True, weight decay groups will be created</li> <li>Otherwise, all parameters will be in a single group</li></ol></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>List available optimizer names, optionally filtered.</p> <p>List all registered optimizers, with optional filtering using wildcard patterns.
Optimizers can be filtered using include and exclude patterns, and can optionally
return descriptions with each optimizer name.</p> <p>Examples:</p> <blockquote><blockquote><blockquote><p>list_optimizers()
[‘adam’, ‘adamw’, ‘sgd’, …]</p></blockquote></blockquote></blockquote> <blockquote><blockquote><blockquote><p>list_optimizers([‘la<em>’, ‘nla</em>’]) # List lamb & lars
[‘lamb’, ‘lambc’, ‘larc’, ‘lars’, ‘nlarc’, ‘nlars’]</p></blockquote></blockquote></blockquote> <blockquote><blockquote><blockquote><p>list_optimizers(’<em>adam</em>’, exclude_filters=[‘bnb<em>’, ‘fused</em>’]) # Exclude bnb & apex adam optimizers
[‘adam’, ‘adamax’, ‘adamp’, ‘adamw’, ‘nadam’, ‘nadamw’, ‘radam’]</p></blockquote></blockquote></blockquote> <blockquote><blockquote><blockquote><p>list_optimizers(with_description=True) # Get descriptions
[(‘adabelief’, ‘Adapts learning rate based on gradient prediction error’),
(‘adadelta’, ‘torch.optim Adadelta, Adapts learning rates based on running windows of gradients’),
(‘adafactor’, ‘Memory-efficient implementation of Adam with factored gradients’),
…]</p></blockquote></blockquote></blockquote></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Get optimizer class by name with option to bind default arguments.</p> <p>Retrieves the optimizer class or a partial function with default arguments bound.
This allows direct instantiation of optimizers with their default configurations
without going through the full factory.</p> <p>Examples:</p> <blockquote><blockquote><blockquote><!> <p>SGD = get_optimizer_class(‘sgd’) # nesterov=True bound
opt = SGD(model.parameters(), lr=0.1, momentum=0.9)</p></blockquote></blockquote></blockquote> <blockquote><blockquote><blockquote><!> <p>SGD = get_optimizer_class(‘sgd’)
opt = SGD(model.parameters(), lr=1e-3, momentum=0.9)</p></blockquote></blockquote></blockquote></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements AdaBelief algorithm. Modified from Adam in PyTorch</p> <p>reference: AdaBelief Optimizer, adapting stepsizes by the belief in observed gradients, NeurIPS 2020</p> <p>For a complete table of recommended hyperparameters, see <a href="https://github.com/juntang-zhuang/Adabelief-Optimizer'" rel="nofollow">https://github.com/juntang-zhuang/Adabelief-Optimizer’</a> For example train/args for EfficientNet see these gists</p> <ul><li>link to train_script: <a href="https://gist.github.com/juntang-zhuang/0a501dd51c02278d952cf159bc233037" rel="nofollow">https://gist.github.com/juntang-zhuang/0a501dd51c02278d952cf159bc233037</a></li> <li>link to args.yaml: <a href="https://gist.github.com/juntang-zhuang/517ce3c27022b908bb93f78e4f786dc3" rel="nofollow">https://gist.github.com/juntang-zhuang/517ce3c27022b908bb93f78e4f786dc3</a></li></ul> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements Adafactor algorithm.</p> <p>This implementation is based on: <code>Adafactor: Adaptive Learning Rates with Sublinear Memory Cost</code> (see <a href="https://arxiv.org/abs/1804.04235" rel="nofollow">https://arxiv.org/abs/1804.04235</a>)</p> <p>Note that this optimizer internally adjusts the learning rate depending on the <em>scale_parameter</em>, <em>relative_step</em> and <em>warmup_init</em> options.</p> <p>To use a manual (external) learning rate schedule you should set <code>scale_parameter=False</code> and <code>relative_step=False</code>.</p> <p>Ags:
params: iterable of parameters to optimize or dicts defining parameter groups
lr: external learning rate
eps: regularization constants for square gradient and parameter scale respectively
eps_scale: regularization constants for parameter scale respectively
clip_threshold: threshold of root-mean-square of final gradient update
decay_rate: coefficient used to compute running averages of square gradient
beta1: coefficient used for computing running averages of gradient
weight_decay: weight decay
scale_parameter: if True, learning rate is scaled by root-mean-square of parameter
warmup_init: time-dependent learning rate computation depends on whether warm-up initialization is being used</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>PyTorch implementation of BigVision’s Adafactor variant with both single and multi tensor implementations.</p> <p>Adapted from <a href="https://github.com/google-research/big_vision" rel="nofollow">https://github.com/google-research/big_vision</a> by Ross Wightman</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements the AdaHessian algorithm from “ADAHESSIAN: An Adaptive Second OrderOptimizer for Machine Learning”</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Gets all parameters in all param_groups with gradients</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Computes the Hutchinson approximation of the hessian trace and accumulates it for each trainable parameter.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Zeros out the accumulated hessian traces.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements a pytorch variant of Adan.</p> <p>Adan was proposed in Adan: Adaptive Nesterov Momentum Algorithm for Faster Optimizing Deep Models <a href="https://arxiv.org/abs/2208.06677" rel="nofollow">https://arxiv.org/abs/2208.06677</a></p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>ADOPT: Modified Adam Can Converge with Any β2 with the Optimal Rate: <a href="https://arxiv.org/abs/2411.02853" rel="nofollow">https://arxiv.org/abs/2411.02853</a></p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Perform a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements a pure pytorch variant of FuseLAMB (NvLamb variant) optimizer from apex.optimizers.FusedLAMB
reference: <a href="https://github.com/NVIDIA/DeepLearningExamples/blob/master/PyTorch/LanguageModeling/Transformer-XL/pytorch/lamb.py" rel="nofollow">https://github.com/NVIDIA/DeepLearningExamples/blob/master/PyTorch/LanguageModeling/Transformer-XL/pytorch/lamb.py</a></p> <p>LAMB was proposed in:</p> <ul><li>Large Batch Optimization for Deep Learning - Training BERT in 76 minutes: <a href="https://arxiv.org/abs/1904.00962" rel="nofollow">https://arxiv.org/abs/1904.00962</a></li> <li>On the Convergence of Adam and Beyond: <a href="https://openreview.net/forum?id=ryQu7f-RZ" rel="nofollow">https://openreview.net/forum?id=ryQu7f-RZ</a></li></ul> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>LaProp Optimizer</p> <p>Paper: LaProp: Separating Momentum and Adaptivity in Adam, <a href="https://arxiv.org/abs/2002.04839" rel="nofollow">https://arxiv.org/abs/2002.04839</a></p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>LARS for PyTorch</p> <p>Paper: <code>Large batch training of Convolutional Networks</code> - <a href="https://arxiv.org/pdf/1708.03888.pdf" rel="nofollow">https://arxiv.org/pdf/1708.03888.pdf</a></p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements Lion algorithm.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>MADGRAD_: A Momentumized, Adaptive, Dual Averaged Gradient Method for Stochastic
Optimization.</p> <p>.. _MADGRAD: <a href="https://arxiv.org/abs/2101.11075" rel="nofollow">https://arxiv.org/abs/2101.11075</a></p> <p>MADGRAD is a general purpose optimizer that can be used in place of SGD or
Adam may converge faster and generalize better. Currently GPU-only.
Typically, the same learning rate schedule that is used for SGD or Adam may
be used. The overall learning rate is not comparable to either method and
should be determined by a hyper-parameter sweep.</p> <p>MADGRAD requires less weight decay than other methods, often as little as
zero. Momentum values used for SGD or Adam’s beta1 should work here also.</p> <p>On sparse problems both weight_decay and momentum should be set to 0.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>MARS Optimizer</p> <p>Paper: MARS: Unleashing the Power of Variance Reduction for Training Large Models <a href="https://arxiv.org/abs/2411.10438" rel="nofollow">https://arxiv.org/abs/2411.10438</a></p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements NAdamW algorithm.</p> <p>See Table 1 in <a href="https://arxiv.org/abs/1910.05446" rel="nofollow">https://arxiv.org/abs/1910.05446</a> for the implementation of
the NAdam algorithm (there is also a comment in the code which highlights
the only difference of NAdamW and AdamW).</p> <p>For further details regarding the algorithm we refer to</p> <ul><li>Decoupled Weight Decay Regularization: <a href="https://arxiv.org/abs/1711.05101" rel="nofollow">https://arxiv.org/abs/1711.05101</a></li> <li>On the Convergence of Adam and Beyond: <a href="https://openreview.net/forum?id=ryQu7f-RZ" rel="nofollow">https://openreview.net/forum?id=ryQu7f-RZ</a></li></ul> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements Novograd algorithm.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements RMSprop algorithm (TensorFlow style epsilon)</p> <p>NOTE: This is a direct cut-and-paste of PyTorch RMSprop with eps applied before sqrt
and a few other modifications to closer match Tensorflow for matching hyper-params.</p> <p>Noteworthy changes include:</p> <ol><li>Epsilon applied inside square-root</li> <li>square_avg initialized to ones</li> <li>LR scaling of update accumulated in momentum buffer</li></ol> <p>Proposed by G. Hinton in his <a href="http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf" rel="nofollow">course</a>.</p> <p>The centered version first appears in <a href="https://arxiv.org/pdf/1308.0850v5.pdf" rel="nofollow">Generating Sequences
With Recurrent Neural Networks</a>.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Performs a single optimization step.</p></div></div> <!> <p></p>`,1);function Na(Re,Ie){ya(Ie,!1),xa(()=>{new URLSearchParams(window.location.search).get("fw")}),ua();var G=Ta();ba("g46xub",Pe=>{var Oe=La();_a(Oe,"content",za),Ge(Pe,Oe)});var S=t(wa(G),2);va(S,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var R=t(S,2);i(R,{title:"Optimization",local:"optimization",headingTag:"h1"});var I=t(R,4);i(I,{title:"Optimizers",local:"optimizers",headingTag:"h2"});var W=t(I,2);i(W,{title:"Factory functions",local:"timm.optim.create_optimizer_v2",headingTag:"h3"});var n=t(W,2),B=e(n);o(B,{name:"timm.optim.create_optimizer_v2",anchor:"timm.optim.create_optimizer_v2",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/_optim_factory.py#L1199",parameters:[{name:"model_or_params",val:": typing.Union[torch.nn.Module, torch.optim.optimizer.ParamsT]"},{name:"opt",val:": str = 'sgd'"},{name:"lr",val:": typing.Optional[float] = None"},{name:"weight_decay",val:": float = 0.0"},{name:"momentum",val:": float = 0.9"},{name:"foreach",val:": typing.Optional[bool] = None"},{name:"filter_bias_and_bn",val:": bool = True"},{name:"fallback_list",val:": typing.Collection[str] = ()"},{name:"fallback_no_weight_decay",val:": bool = False"},{name:"layer_decay",val:": typing.Optional[float] = None"},{name:"layer_decay_min_scale",val:": float = 0.0"},{name:"layer_decay_no_opt_scale",val:": typing.Optional[float] = None"},{name:"param_group_fn",val:": typing.Optional[typing.Callable[[torch.nn.Module], torch.optim.optimizer.ParamsT]] = None"},{name:"**kwargs",val:": typing.Any"}],parametersDescription:[{anchor:"timm.optim.create_optimizer_v2.model_or_params",description:`<strong>model_or_params</strong> &#x2014; A PyTorch model or an iterable of parameters/parameter groups.
If a model is provided, parameters will be automatically extracted and grouped
based on the other arguments.`,name:"model_or_params"},{anchor:"timm.optim.create_optimizer_v2.opt",description:`<strong>opt</strong> &#x2014; Name of the optimizer to create (e.g., &#x2018;adam&#x2019;, &#x2018;adamw&#x2019;, &#x2018;sgd&#x2019;).
Use list_optimizers() to see available options.`,name:"opt"},{anchor:"timm.optim.create_optimizer_v2.lr",description:"<strong>lr</strong> &#x2014; Learning rate. If None, will use the optimizer&#x2019;s default.",name:"lr"},{anchor:"timm.optim.create_optimizer_v2.weight_decay",description:"<strong>weight_decay</strong> &#x2014; Weight decay factor. Will be used to create param groups if model_or_params is a model.",name:"weight_decay"},{anchor:"timm.optim.create_optimizer_v2.momentum",description:`<strong>momentum</strong> &#x2014; Momentum factor for optimizers that support it. Only used if the
chosen optimizer accepts a momentum parameter.`,name:"momentum"},{anchor:"timm.optim.create_optimizer_v2.foreach",description:`<strong>foreach</strong> &#x2014; Enable/disable foreach (multi-tensor) implementation if available.
If None, will use optimizer-specific defaults.`,name:"foreach"},{anchor:"timm.optim.create_optimizer_v2.filter_bias_and_bn",description:`<strong>filter_bias_and_bn</strong> &#x2014; If True, bias, norm layer parameters (all 1d params) will not have
weight decay applied. Only used when model_or_params is a model and
weight_decay &gt; 0.`,name:"filter_bias_and_bn"},{anchor:"timm.optim.create_optimizer_v2.fallback_list",description:`<strong>fallback_list</strong> &#x2014; Collection of parameter name patterns to use fallback optimizer for
hybrid optimizers (e.g., AdamW for Muon). Supports wildcard matching.`,name:"fallback_list"},{anchor:"timm.optim.create_optimizer_v2.fallback_no_weight_decay",description:`<strong>fallback_no_weight_decay</strong> &#x2014; If True, params in model&#x2019;s no_weight_decay() list will use
fallback optimizer for hybrid optimizers (e.g., AdamW for Muon).`,name:"fallback_no_weight_decay"},{anchor:"timm.optim.create_optimizer_v2.layer_decay",description:`<strong>layer_decay</strong> &#x2014; Optional layer-wise learning rate decay factor. If provided,
learning rates will be scaled by layer_decay^(max_depth - layer_depth).
Only used when model_or_params is a model.`,name:"layer_decay"},{anchor:"timm.optim.create_optimizer_v2.param_group_fn",description:`<strong>param_group_fn</strong> &#x2014; Optional function to create custom parameter groups.
If provided, other parameter grouping options will be ignored.`,name:"param_group_fn"},{anchor:"timm.optim.create_optimizer_v2.*kwargs",description:"*<strong>*kwargs</strong> &#x2014; Additional optimizer-specific arguments (e.g., betas for Adam).",name:"*kwargs"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>Configured optimizer instance.</p>
`});var m=t(B,8),C=e(m),E=e(C),We=e(E);i(We,{title:"Basic usage with a model",local:"basic-usage-with-a-model",headingTag:"h1"}),r(2),a(E),a(C),a(m);var s=t(m,2),j=e(s),V=e(j),Be=e(V);i(Be,{title:"SGD with momentum and weight decay",local:"sgd-with-momentum-and-weight-decay",headingTag:"h1"}),r(2),a(V),a(j),a(s);var l=t(s,2),U=e(l),H=e(U),Ce=e(H);i(Ce,{title:"Adam with layer-wise learning rate decay",local:"adam-with-layer-wise-learning-rate-decay",headingTag:"h1"}),r(2),a(H),a(U),a(l);var Z=t(l,2),Q=e(Z),$=e(Q),Ee=e($);i(Ee,{title:"Custom parameter groups",local:"custom-parameter-groups",headingTag:"h1"}),r(2),a($),a(Q),a(Z),r(4),a(n);var p=t(n,2),je=e(p);o(je,{name:"timm.optim.list_optimizers",anchor:"timm.optim.list_optimizers",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/_optim_factory.py#L1102",parameters:[{name:"filter",val:": typing.Union[str, typing.List[str]] = ''"},{name:"exclude_filters",val:": typing.Optional[typing.List[str]] = None"},{name:"with_description",val:": bool = False"}],parametersDescription:[{anchor:"timm.optim.list_optimizers.filter",description:`<strong>filter</strong> &#x2014; Wildcard style filter string or list of filter strings
(e.g., &#x2018;adam<em>&#x2019; for all Adam variants, or [&#x2018;adam</em>&#x2019;, &#x2018;*8bit&#x2019;] for
Adam variants and 8-bit optimizers). Empty string means no filtering.`,name:"filter"},{anchor:"timm.optim.list_optimizers.exclude_filters",description:`<strong>exclude_filters</strong> &#x2014; Optional list of wildcard patterns to exclude. For example,
[&#x2019;<em>8bit&#x2019;, &#x2018;fused</em>&#x2019;] would exclude 8-bit and fused implementations.`,name:"exclude_filters"},{anchor:"timm.optim.list_optimizers.with_description",description:`<strong>with_description</strong> &#x2014; If True, returns tuples of (name, description) instead of
just names. Descriptions provide brief explanations of optimizer characteristics.`,name:"with_description"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>List of optimizer names as strings (e.g., [‘adam’, ‘adamw’, …])
If with_description is True:
List of tuples of (name, description) (e.g., [(‘adam’, ‘Adaptive Moment…’), …])</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If with_description is False</p>
`}),r(14),a(p);var d=t(p,2),X=e(d);o(X,{name:"timm.optim.get_optimizer_class",anchor:"timm.optim.get_optimizer_class",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/_optim_factory.py#L1162",parameters:[{name:"name",val:": str"},{name:"bind_defaults",val:": bool = True"}],parametersDescription:[{anchor:"timm.optim.get_optimizer_class.name",description:"<strong>name</strong> &#x2014; Name of the optimizer to retrieve (e.g., &#x2018;adam&#x2019;, &#x2018;sgd&#x2019;)",name:"name"},{anchor:"timm.optim.get_optimizer_class.bind_defaults",description:`<strong>bind_defaults</strong> &#x2014; If True, returns a partial function with default arguments from OptimInfo bound.
If False, returns the raw optimizer class.`,name:"bind_defaults"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The optimizer class (e.g., torch.optim.Adam)
If bind_defaults is True:
A partial function with default arguments bound</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If bind_defaults is False</p>
`,raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<ul>
<li><code>ValueError</code> — If optimizer name is not found in registry</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>ValueError</code></p>
`});var c=t(X,8),J=e(c),K=e(J),Ve=e(K);i(Ve,{title:"Get SGD with nesterov momentum default",local:"get-sgd-with-nesterov-momentum-default",headingTag:"h1"}),r(2),a(K),a(J),a(c);var Y=t(c,2),ee=e(Y),ae=e(ee),Ue=e(ae);i(Ue,{title:"Get raw optimizer class",local:"get-raw-optimizer-class",headingTag:"h1"}),r(2),a(ae),a(ee),a(Y),a(d);var te=t(d,2);i(te,{title:"Optimizer Classes",local:"timm.optim.AdaBelief",headingTag:"h3"});var g=t(te,2),oe=e(g);o(oe,{name:"class timm.optim.AdaBelief",anchor:"timm.optim.AdaBelief",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adabelief.py#L6",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.001"},{name:"betas",val:" = (0.9, 0.999)"},{name:"eps",val:" = 1e-16"},{name:"weight_decay",val:" = 0"},{name:"amsgrad",val:" = False"},{name:"decoupled_decay",val:" = True"},{name:"fixed_decay",val:" = False"},{name:"rectify",val:" = True"},{name:"degenerated_to_sgd",val:" = True"}],parametersDescription:[{anchor:"timm.optim.AdaBelief.params",description:`<strong>params</strong> (iterable) &#x2014; iterable of parameters to optimize or dicts defining
parameter groups`,name:"params"},{anchor:"timm.optim.AdaBelief.lr",description:"<strong>lr</strong> (float, optional) &#x2014; learning rate (default: 1e-3)",name:"lr"},{anchor:"timm.optim.AdaBelief.betas",description:`<strong>betas</strong> (Tuple[float, float], optional) &#x2014; coefficients used for computing
running averages of gradient and its square (default: (0.9, 0.999))`,name:"betas"},{anchor:"timm.optim.AdaBelief.eps",description:`<strong>eps</strong> (float, optional) &#x2014; term added to the denominator to improve
numerical stability (default: 1e-16)`,name:"eps"},{anchor:"timm.optim.AdaBelief.weight_decay",description:"<strong>weight_decay</strong> (float, optional) &#x2014; weight decay (L2 penalty) (default: 0)",name:"weight_decay"},{anchor:"timm.optim.AdaBelief.amsgrad",description:`<strong>amsgrad</strong> (boolean, optional) &#x2014; whether to use the AMSGrad variant of this
algorithm from the paper <code>On the Convergence of Adam and Beyond</code>_
(default: False)`,name:"amsgrad"},{anchor:"timm.optim.AdaBelief.decoupled_decay",description:`<strong>decoupled_decay</strong> (boolean, optional) &#x2014; (default: True) If set as True, then
the optimizer uses decoupled weight decay as in AdamW`,name:"decoupled_decay"},{anchor:"timm.optim.AdaBelief.fixed_decay",description:`<strong>fixed_decay</strong> (boolean, optional) &#x2014; (default: False) This is used when weight<em>decouple
is set as True.
When fixed_decay == True, the weight decay is performed as
$W</em>{new} = W<em>{old} - W</em>{old} \\times decay$.
When fixed<em>decay == False, the weight decay is performed as
$W</em>{new} = W<em>{old} - W</em>{old} \\times decay \\times lr$. Note that in this case, the
weight decay ratio decreases with learning rate (lr).`,name:"fixed_decay"},{anchor:"timm.optim.AdaBelief.rectify",description:`<strong>rectify</strong> (boolean, optional) &#x2014; (default: True) If set as True, then perform the rectified
update similar to RAdam`,name:"rectify"},{anchor:"timm.optim.AdaBelief.degenerated_to_sgd",description:`<strong>degenerated_to_sgd</strong> (boolean, optional) (default &#x2014;True) If set as True, then perform SGD update
when variance of gradient is high`,name:"degenerated_to_sgd"}]});var re=t(oe,10),He=e(re);o(He,{name:"step",anchor:"timm.optim.AdaBelief.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adabelief.py#L106",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.AdaBelief.step.closure",description:`<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}]}),r(2),a(re),a(g);var h=t(g,2),ie=e(h);o(ie,{name:"class timm.optim.Adafactor",anchor:"timm.optim.Adafactor",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adafactor.py#L21",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": typing.Optional[float] = None"},{name:"eps",val:": float = 1e-30"},{name:"eps_scale",val:": float = 0.001"},{name:"clip_threshold",val:": float = 1.0"},{name:"decay_rate",val:": float = -0.8"},{name:"betas",val:": typing.Optional[typing.Tuple[float, float]] = None"},{name:"weight_decay",val:": float = 0.0"},{name:"scale_parameter",val:": bool = True"},{name:"warmup_init",val:": bool = False"},{name:"min_dim_size_to_factor",val:": int = 16"},{name:"caution",val:": bool = False"}]});var ne=t(ie,12),Ze=e(ne);o(Ze,{name:"step",anchor:"timm.optim.Adafactor.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adafactor.py#L127",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.Adafactor.step.closure",description:"<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model and returns the loss.",name:"closure"}]}),r(2),a(ne),a(h);var u=t(h,2),Qe=e(u);o(Qe,{name:"class timm.optim.AdafactorBigVision",anchor:"timm.optim.AdafactorBigVision",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adafactor_bv.py#L49",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": float = 1.0"},{name:"min_dim_size_to_factor",val:": int = 16"},{name:"decay_rate",val:": float = 0.8"},{name:"decay_offset",val:": int = 0"},{name:"beta2_cap",val:": float = 0.999"},{name:"momentum",val:": typing.Optional[float] = 0.9"},{name:"momentum_dtype",val:": typing.Union[str, torch.dtype] = torch.bfloat16"},{name:"eps",val:": typing.Optional[float] = None"},{name:"weight_decay",val:": float = 0.0"},{name:"clipping_threshold",val:": typing.Optional[float] = None"},{name:"unscaled_wd",val:": bool = False"},{name:"caution",val:": bool = False"},{name:"corrected_weight_decay",val:": bool = False"},{name:"foreach",val:": typing.Optional[bool] = False"}]}),r(4),a(u);var b=t(u,2),me=e(b);o(me,{name:"class timm.optim.Adahessian",anchor:"timm.optim.Adahessian",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adahessian.py#L9",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.1"},{name:"betas",val:" = (0.9, 0.999)"},{name:"eps",val:" = 1e-08"},{name:"weight_decay",val:" = 0.0"},{name:"hessian_power",val:" = 1.0"},{name:"update_each",val:" = 1"},{name:"n_samples",val:" = 1"},{name:"avg_conv_kernel",val:" = False"}],parametersDescription:[{anchor:"timm.optim.Adahessian.params",description:"<strong>params</strong> (iterable) &#x2014; iterable of parameters to optimize or dicts defining parameter groups",name:"params"},{anchor:"timm.optim.Adahessian.lr",description:"<strong>lr</strong> (float, optional) &#x2014; learning rate (default: 0.1)",name:"lr"},{anchor:"timm.optim.Adahessian.betas",description:`<strong>betas</strong> ((float, float), optional) &#x2014; coefficients used for computing running averages of gradient and the
squared hessian trace (default: (0.9, 0.999))`,name:"betas"},{anchor:"timm.optim.Adahessian.eps",description:"<strong>eps</strong> (float, optional) &#x2014; term added to the denominator to improve numerical stability (default: 1e-8)",name:"eps"},{anchor:"timm.optim.Adahessian.weight_decay",description:"<strong>weight_decay</strong> (float, optional) &#x2014; weight decay (L2 penalty) (default: 0.0)",name:"weight_decay"},{anchor:"timm.optim.Adahessian.hessian_power",description:"<strong>hessian_power</strong> (float, optional) &#x2014; exponent of the hessian trace (default: 1.0)",name:"hessian_power"},{anchor:"timm.optim.Adahessian.update_each",description:`<strong>update_each</strong> (int, optional) &#x2014; compute the hessian trace approximation only after <em>this</em> number of steps
(to save time) (default: 1)`,name:"update_each"},{anchor:"timm.optim.Adahessian.n_samples",description:"<strong>n_samples</strong> (int, optional) &#x2014; how many times to sample <code>z</code> for the approximation of the hessian trace (default: 1)",name:"n_samples"}]});var v=t(me,4),$e=e(v);o($e,{name:"get_params",anchor:"timm.optim.Adahessian.get_params",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adahessian.py#L74",parameters:[]}),r(2),a(v);var f=t(v,2),Xe=e(f);o(Xe,{name:"set_hessian",anchor:"timm.optim.Adahessian.set_hessian",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adahessian.py#L90",parameters:[]}),r(2),a(f);var _=t(f,2),Je=e(_);o(Je,{name:"step",anchor:"timm.optim.Adahessian.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adahessian.py#L118",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.Adahessian.step.closure",description:"<strong>closure</strong> (callable, optional) &#x2014; a closure that reevaluates the model and returns the loss (default &#x2014; None)",name:"closure"}]}),r(2),a(_);var se=t(_,2),Ke=e(se);o(Ke,{name:"zero_hessian",anchor:"timm.optim.Adahessian.zero_hessian",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adahessian.py#L81",parameters:[]}),r(2),a(se),a(b);var y=t(b,2),Ye=e(y);o(Ye,{name:"class timm.optim.AdamP",anchor:"timm.optim.AdamP",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adamp.py#L64",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.001"},{name:"betas",val:" = (0.9, 0.999)"},{name:"eps",val:" = 1e-08"},{name:"weight_decay",val:" = 0"},{name:"delta",val:" = 0.1"},{name:"wd_ratio",val:" = 0.1"},{name:"nesterov",val:" = False"},{name:"caution",val:" = False"}]}),a(y);var x=t(y,2),le=e(x);o(le,{name:"class timm.optim.Adan",anchor:"timm.optim.Adan",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adan.py#L46",parameters:[{name:"params",val:""},{name:"lr",val:": float = 0.001"},{name:"betas",val:": typing.Tuple[float, float, float] = (0.98, 0.92, 0.99)"},{name:"eps",val:": float = 1e-08"},{name:"weight_decay",val:": float = 0.0"},{name:"no_prox",val:": bool = False"},{name:"caution",val:": bool = False"},{name:"foreach",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"timm.optim.Adan.params",description:"<strong>params</strong> &#x2014; Iterable of parameters to optimize or dicts defining parameter groups.",name:"params"},{anchor:"timm.optim.Adan.lr",description:"<strong>lr</strong> &#x2014; Learning rate.",name:"lr"},{anchor:"timm.optim.Adan.betas",description:"<strong>betas</strong> &#x2014; Coefficients used for first- and second-order moments.",name:"betas"},{anchor:"timm.optim.Adan.eps",description:"<strong>eps</strong> &#x2014; Term added to the denominator to improve numerical stability.",name:"eps"},{anchor:"timm.optim.Adan.weight_decay",description:"<strong>weight_decay</strong> &#x2014; Decoupled weight decay (L2 penalty)",name:"weight_decay"},{anchor:"timm.optim.Adan.no_prox",description:"<strong>no_prox</strong> &#x2014; How to perform the weight decay",name:"no_prox"},{anchor:"timm.optim.Adan.caution",description:"<strong>caution</strong> &#x2014; Enable caution from &#x2018;Cautious Optimizers&#x2019;",name:"caution"},{anchor:"timm.optim.Adan.foreach",description:"<strong>foreach</strong> &#x2014; If True would use torch._foreach implementation. Faster but uses slightly more memory.",name:"foreach"}]});var pe=t(le,6),ea=e(pe);o(ea,{name:"step",anchor:"timm.optim.Adan.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adan.py#L117",parameters:[{name:"closure",val:" = None"}]}),r(2),a(pe),a(x);var w=t(x,2),de=e(w);o(de,{name:"class timm.optim.Adopt",anchor:"timm.optim.Adopt",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adopt.py#L59",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": typing.Union[float, torch.Tensor] = 0.001"},{name:"betas",val:": typing.Tuple[float, float] = (0.9, 0.9999)"},{name:"eps",val:": float = 1e-06"},{name:"clip_exp",val:": typing.Optional[float] = 0.333"},{name:"weight_decay",val:": float = 0.0"},{name:"decoupled",val:": bool = False"},{name:"corrected_weight_decay",val:": bool = False"},{name:"caution",val:": bool = False"},{name:"foreach",val:": typing.Optional[bool] = False"},{name:"maximize",val:": bool = False"},{name:"capturable",val:": bool = False"},{name:"differentiable",val:": bool = False"}]});var ce=t(de,4),aa=e(ce);o(aa,{name:"step",anchor:"timm.optim.Adopt.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/adopt.py#L188",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.Adopt.step.closure",description:`<strong>closure</strong> (Callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}]}),r(2),a(ce),a(w);var A=t(w,2),ge=e(A);o(ge,{name:"class timm.optim.Lamb",anchor:"timm.optim.Lamb",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/lamb.py#L67",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": float = 0.001"},{name:"bias_correction",val:": bool = True"},{name:"betas",val:": typing.Tuple[float, float] = (0.9, 0.999)"},{name:"eps",val:": float = 1e-06"},{name:"weight_decay",val:": float = 0.01"},{name:"grad_averaging",val:": bool = True"},{name:"max_grad_norm",val:": typing.Optional[float] = 1.0"},{name:"trust_clip",val:": bool = False"},{name:"always_adapt",val:": bool = False"},{name:"caution",val:": bool = False"},{name:"decoupled_decay",val:": bool = False"},{name:"corrected_weight_decay",val:": bool = False"}],parametersDescription:[{anchor:"timm.optim.Lamb.params",description:"<strong>params</strong> &#x2014; Iterable of parameters to optimize or dicts defining parameter groups.",name:"params"},{anchor:"timm.optim.Lamb.lr",description:"<strong>lr</strong> &#x2014; Learning rate",name:"lr"},{anchor:"timm.optim.Lamb.betas",description:"<strong>betas</strong> &#x2014; Coefficients used for computing running averages of gradient and its norm.",name:"betas"},{anchor:"timm.optim.Lamb.eps",description:"<strong>eps</strong> &#x2014; Term added to the denominator to improve numerical stability.",name:"eps"},{anchor:"timm.optim.Lamb.weight_decay",description:"<strong>weight_decay</strong> &#x2014; Weight decay",name:"weight_decay"},{anchor:"timm.optim.Lamb.grad_averaging",description:"<strong>grad_averaging</strong> &#x2014; Whether apply (1-beta2) to grad when calculating running averages of gradient.",name:"grad_averaging"},{anchor:"timm.optim.Lamb.max_grad_norm",description:"<strong>max_grad_norm</strong> &#x2014; Value used to clip global grad norm.",name:"max_grad_norm"},{anchor:"timm.optim.Lamb.trust_clip",description:"<strong>trust_clip</strong> &#x2014; Enable LAMBC trust ratio clipping.",name:"trust_clip"},{anchor:"timm.optim.Lamb.always_adapt",description:"<strong>always_adapt</strong> &#x2014; Apply adaptive learning rate to 0.0 weight decay parameter.",name:"always_adapt"},{anchor:"timm.optim.Lamb.caution",description:"<strong>caution</strong> &#x2014; Apply caution.",name:"caution"},{anchor:"timm.optim.Lamb.decoupled",description:"<strong>decoupled</strong> &#x2014; apply decoupled weight decay",name:"decoupled"},{anchor:"timm.optim.Lamb.corrected_weight_decay",description:"<strong>corrected_weight_decay</strong> &#x2014; apply corrected weight decay (lr**2 / max_lr) when using decoupled_decay",name:"corrected_weight_decay"}]});var he=t(ge,8),ta=e(he);o(ta,{name:"step",anchor:"timm.optim.Lamb.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/lamb.py#L152",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.Lamb.step.closure",description:`<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}]}),r(2),a(he),a(A);var z=t(A,2),ue=e(z);o(ue,{name:"class timm.optim.LaProp",anchor:"timm.optim.LaProp",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/laprop.py#L28",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": float = 0.0004"},{name:"betas",val:": typing.Tuple[float, float] = (0.9, 0.999)"},{name:"eps",val:": float = 1e-15"},{name:"weight_decay",val:": float = 0.0"},{name:"caution",val:": bool = False"},{name:"corrected_weight_decay",val:": bool = False"}]});var be=t(ue,6),oa=e(be);o(oa,{name:"step",anchor:"timm.optim.LaProp.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/laprop.py#L79",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.LaProp.step.closure",description:`<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}]}),r(2),a(be),a(z);var L=t(z,2),ve=e(L);o(ve,{name:"class timm.optim.Lars",anchor:"timm.optim.Lars",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/lars.py#L17",parameters:[{name:"params",val:""},{name:"lr",val:" = 1.0"},{name:"momentum",val:" = 0"},{name:"dampening",val:" = 0"},{name:"weight_decay",val:" = 0"},{name:"nesterov",val:" = False"},{name:"trust_coeff",val:" = 0.001"},{name:"eps",val:" = 1e-08"},{name:"trust_clip",val:" = False"},{name:"always_adapt",val:" = False"}],parametersDescription:[{anchor:"timm.optim.Lars.params",description:"<strong>params</strong> (iterable) &#x2014; iterable of parameters to optimize or dicts defining parameter groups.",name:"params"},{anchor:"timm.optim.Lars.lr",description:"<strong>lr</strong> (float, optional) &#x2014; learning rate (default: 1.0).",name:"lr"},{anchor:"timm.optim.Lars.momentum",description:"<strong>momentum</strong> (float, optional) &#x2014; momentum factor (default: 0)",name:"momentum"},{anchor:"timm.optim.Lars.weight_decay",description:"<strong>weight_decay</strong> (float, optional) &#x2014; weight decay (L2 penalty) (default: 0)",name:"weight_decay"},{anchor:"timm.optim.Lars.dampening",description:"<strong>dampening</strong> (float, optional) &#x2014; dampening for momentum (default: 0)",name:"dampening"},{anchor:"timm.optim.Lars.nesterov",description:"<strong>nesterov</strong> (bool, optional) &#x2014; enables Nesterov momentum (default: False)",name:"nesterov"},{anchor:"timm.optim.Lars.trust_coeff",description:"<strong>trust_coeff</strong> (float) &#x2014; trust coefficient for computing adaptive lr / trust_ratio (default: 0.001)",name:"trust_coeff"},{anchor:"timm.optim.Lars.eps",description:"<strong>eps</strong> (float) &#x2014; eps for division denominator (default: 1e-8)",name:"eps"},{anchor:"timm.optim.Lars.trust_clip",description:"<strong>trust_clip</strong> (bool) &#x2014; enable LARC trust ratio clipping (default: False)",name:"trust_clip"},{anchor:"timm.optim.Lars.always_adapt",description:"<strong>always_adapt</strong> (bool) &#x2014; always apply LARS LR adapt, otherwise only when group weight_decay != 0 (default: False)",name:"always_adapt"}]});var fe=t(ve,6),ra=e(fe);o(ra,{name:"step",anchor:"timm.optim.Lars.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/lars.py#L75",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.Lars.step.closure",description:"<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model and returns the loss.",name:"closure"}]}),r(2),a(fe),a(L);var T=t(L,2),_e=e(T);o(_e,{name:"class timm.optim.Lion",anchor:"timm.optim.Lion",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/lion.py#L32",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": float = 0.0001"},{name:"betas",val:": typing.Tuple[float, float] = (0.9, 0.99)"},{name:"weight_decay",val:": float = 0.0"},{name:"caution",val:": bool = False"},{name:"corrected_weight_decay",val:": bool = False"},{name:"maximize",val:": bool = False"},{name:"foreach",val:": typing.Optional[bool] = None"}]});var ye=t(_e,4),ia=e(ye);o(ia,{name:"step",anchor:"timm.optim.Lion.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/lion.py#L81",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.Lion.step.closure",description:"<strong>closure</strong> &#x2014; A closure that reevaluates the model and returns the loss.",name:"closure"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>the loss.</p>
`}),r(2),a(ye),a(T);var k=t(T,2),na=e(k);o(na,{name:"class timm.optim.Lookahead",anchor:"timm.optim.Lookahead",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/lookahead.py#L15",parameters:[{name:"base_optimizer",val:""},{name:"alpha",val:" = 0.5"},{name:"k",val:" = 6"}]}),a(k);var F=t(k,2),xe=e(F);o(xe,{name:"class timm.optim.MADGRAD",anchor:"timm.optim.MADGRAD",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/madgrad.py#L24",parameters:[{name:"params",val:": typing.Any"},{name:"lr",val:": float = 0.01"},{name:"momentum",val:": float = 0.9"},{name:"weight_decay",val:": float = 0"},{name:"eps",val:": float = 1e-06"},{name:"decoupled_decay",val:": bool = False"}],parametersDescription:[{anchor:"timm.optim.MADGRAD.params",description:`<strong>params</strong> (iterable) &#x2014;
Iterable of parameters to optimize or dicts defining parameter groups.`,name:"params"},{anchor:"timm.optim.MADGRAD.lr",description:`<strong>lr</strong> (float) &#x2014;
Learning rate (default: 1e-2).`,name:"lr"},{anchor:"timm.optim.MADGRAD.momentum",description:`<strong>momentum</strong> (float) &#x2014;
Momentum value in the range [0,1) (default: 0.9).`,name:"momentum"},{anchor:"timm.optim.MADGRAD.weight_decay",description:`<strong>weight_decay</strong> (float) &#x2014;
Weight decay, i.e. a L2 penalty (default: 0).`,name:"weight_decay"},{anchor:"timm.optim.MADGRAD.eps",description:`<strong>eps</strong> (float) &#x2014;
Term added to the denominator outside of the root operation to improve numerical stability. (default: 1e-6).`,name:"eps"}]});var we=t(xe,12),ma=e(we);o(ma,{name:"step",anchor:"timm.optim.MADGRAD.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/madgrad.py#L90",parameters:[{name:"closure",val:": typing.Optional[typing.Callable[[], float]] = None"}],parametersDescription:[{anchor:"timm.optim.MADGRAD.step.closure",description:"<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model and returns the loss.",name:"closure"}]}),r(2),a(we),a(F);var q=t(F,2),Ae=e(q);o(Ae,{name:"class timm.optim.Mars",anchor:"timm.optim.Mars",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/mars.py#L91",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": float = 0.003"},{name:"betas",val:": typing.Tuple[float, float] = (0.9, 0.99)"},{name:"eps",val:": float = 1e-08"},{name:"weight_decay",val:": float = 0.0"},{name:"gamma",val:": float = 0.025"},{name:"mars_type",val:": str = 'adamw'"},{name:"optimize_1d",val:": bool = False"},{name:"lr_1d_factor",val:": float = 1.0"},{name:"betas_1d",val:": typing.Optional[typing.Tuple[float, float]] = None"},{name:"caution",val:": bool = False"}]});var ze=t(Ae,6),sa=e(ze);o(sa,{name:"step",anchor:"timm.optim.Mars.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/mars.py#L141",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.Mars.step.closure",description:`<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}]}),r(2),a(ze),a(q);var N=t(q,2),Le=e(N);o(Le,{name:"class timm.optim.NAdamW",anchor:"timm.optim.NAdamW",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/nadamw.py#L21",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": float = 0.001"},{name:"betas",val:": typing.Tuple[float, float] = (0.9, 0.999)"},{name:"eps",val:": float = 1e-08"},{name:"weight_decay",val:": float = 0.01"},{name:"caution",val:": bool = False"},{name:"corrected_weight_decay",val:": bool = False"},{name:"maximize",val:": bool = False"},{name:"foreach",val:": typing.Optional[bool] = None"},{name:"capturable",val:": bool = False"}],parametersDescription:[{anchor:"timm.optim.NAdamW.params",description:"<strong>params</strong> &#x2014; iterable of parameters to optimize or dicts defining parameter groups",name:"params"},{anchor:"timm.optim.NAdamW.lr",description:"<strong>lr</strong> &#x2014; learning rate",name:"lr"},{anchor:"timm.optim.NAdamW.betas",description:"<strong>betas</strong> &#x2014; coefficients used for computing running averages of gradient and its square",name:"betas"},{anchor:"timm.optim.NAdamW.eps",description:"<strong>eps</strong> &#x2014; term added to the denominator to improve numerical stability",name:"eps"},{anchor:"timm.optim.NAdamW.weight_decay",description:"<strong>weight_decay</strong> &#x2014; weight decay coefficient",name:"weight_decay"},{anchor:"timm.optim.NAdamW.caution",description:"<strong>caution</strong> &#x2014; enable caution",name:"caution"},{anchor:"timm.optim.NAdamW.corrected_weight_decay",description:"<strong>corrected_weight_decay</strong> &#x2014; apply corrected weight decay (lr**2 / max_lr)",name:"corrected_weight_decay"}]});var Te=t(Le,10),la=e(Te);o(la,{name:"step",anchor:"timm.optim.NAdamW.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/nadamw.py#L94",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.NAdamW.step.closure",description:`<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}]}),r(2),a(Te),a(N);var D=t(N,2),ke=e(D);o(ke,{name:"class timm.optim.NvNovoGrad",anchor:"timm.optim.NvNovoGrad",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/nvnovograd.py#L13",parameters:[{name:"params",val:""},{name:"lr",val:" = 0.001"},{name:"betas",val:" = (0.95, 0.98)"},{name:"eps",val:" = 1e-08"},{name:"weight_decay",val:" = 0"},{name:"grad_averaging",val:" = False"},{name:"amsgrad",val:" = False"}],parametersDescription:[{anchor:"timm.optim.NvNovoGrad.params",description:`<strong>params</strong> (iterable) &#x2014; iterable of parameters to optimize or dicts defining
parameter groups`,name:"params"},{anchor:"timm.optim.NvNovoGrad.lr",description:"<strong>lr</strong> (float, optional) &#x2014; learning rate (default: 1e-3)",name:"lr"},{anchor:"timm.optim.NvNovoGrad.betas",description:`<strong>betas</strong> (Tuple[float, float], optional) &#x2014; coefficients used for computing
running averages of gradient and its square (default: (0.95, 0.98))`,name:"betas"},{anchor:"timm.optim.NvNovoGrad.eps",description:`<strong>eps</strong> (float, optional) &#x2014; term added to the denominator to improve
numerical stability (default: 1e-8)`,name:"eps"},{anchor:"timm.optim.NvNovoGrad.weight_decay",description:"<strong>weight_decay</strong> (float, optional) &#x2014; weight decay (L2 penalty) (default: 0)",name:"weight_decay"},{anchor:"timm.optim.NvNovoGrad.grad_averaging",description:"<strong>grad_averaging</strong> &#x2014; gradient averaging",name:"grad_averaging"},{anchor:"timm.optim.NvNovoGrad.amsgrad",description:`<strong>amsgrad</strong> (boolean, optional) &#x2014; whether to use the AMSGrad variant of this
algorithm from the paper <code>On the Convergence of Adam and Beyond</code>_
(default: False)`,name:"amsgrad"}]});var Fe=t(ke,4),pa=e(Fe);o(pa,{name:"step",anchor:"timm.optim.NvNovoGrad.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/nvnovograd.py#L66",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.NvNovoGrad.step.closure",description:"<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model",name:"closure"},{anchor:"timm.optim.NvNovoGrad.step.and",description:"<strong>and</strong> returns the loss. &#x2014;",name:"and"}]}),r(2),a(Fe),a(D);var M=t(D,2),qe=e(M);o(qe,{name:"class timm.optim.RMSpropTF",anchor:"timm.optim.RMSpropTF",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/rmsprop_tf.py#L21",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": float = 0.01"},{name:"alpha",val:": float = 0.9"},{name:"eps",val:": float = 1e-10"},{name:"weight_decay",val:": float = 0"},{name:"momentum",val:": float = 0.0"},{name:"centered",val:": bool = False"},{name:"decoupled_decay",val:": bool = False"},{name:"corrected_weight_decay",val:": bool = False"},{name:"lr_in_momentum",val:": bool = True"},{name:"caution",val:": bool = False"}],parametersDescription:[{anchor:"timm.optim.RMSpropTF.params",description:"<strong>params</strong> &#x2014; iterable of parameters to optimize or dicts defining parameter groups",name:"params"},{anchor:"timm.optim.RMSpropTF.lr",description:"<strong>lr</strong> &#x2014; learning rate",name:"lr"},{anchor:"timm.optim.RMSpropTF.momentum",description:"<strong>momentum</strong> &#x2014; momentum factor",name:"momentum"},{anchor:"timm.optim.RMSpropTF.alpha",description:"<strong>alpha</strong> &#x2014; smoothing (decay) constant",name:"alpha"},{anchor:"timm.optim.RMSpropTF.eps",description:"<strong>eps</strong> &#x2014; term added to the denominator to improve numerical stability",name:"eps"},{anchor:"timm.optim.RMSpropTF.centered",description:"<strong>centered</strong> &#x2014; if <code>True</code>, compute the centered RMSProp, the gradient is normalized by an estimation of its variance",name:"centered"},{anchor:"timm.optim.RMSpropTF.weight_decay",description:"<strong>weight_decay</strong> &#x2014; weight decay (L2 penalty) (default: 0)",name:"weight_decay"},{anchor:"timm.optim.RMSpropTF.decoupled_decay",description:'<strong>decoupled_decay</strong> &#x2014; decoupled weight decay as per <a href="https://arxiv.org/abs/1711.05101" rel="nofollow">https://arxiv.org/abs/1711.05101</a>',name:"decoupled_decay"},{anchor:"timm.optim.RMSpropTF.corrected_weight_decay",description:"<strong>corrected_weight_decay</strong> &#x2014; apply corrected weight decay (lr**2 / max_lr) when decoupled_decay is True",name:"corrected_weight_decay"},{anchor:"timm.optim.RMSpropTF.lr_in_momentum",description:"<strong>lr_in_momentum</strong> &#x2014; learning rate scaling is included in the momentum buffer update as per defaults in Tensorflow",name:"lr_in_momentum"},{anchor:"timm.optim.RMSpropTF.caution",description:"<strong>caution</strong> &#x2014; apply caution",name:"caution"}]});var Ne=t(qe,14),da=e(Ne);o(da,{name:"step",anchor:"timm.optim.RMSpropTF.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/rmsprop_tf.py#L99",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.RMSpropTF.step.closure",description:`<strong>closure</strong> (callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}]}),r(2),a(Ne),a(M);var P=t(M,2),ca=e(P);o(ca,{name:"class timm.optim.SGDP",anchor:"timm.optim.SGDP",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/sgdp.py#L22",parameters:[{name:"params",val:""},{name:"lr",val:" = torch.optim.optimizer.required"},{name:"momentum",val:" = 0"},{name:"dampening",val:" = 0"},{name:"weight_decay",val:" = 0"},{name:"nesterov",val:" = False"},{name:"eps",val:" = 1e-08"},{name:"delta",val:" = 0.1"},{name:"wd_ratio",val:" = 0.1"},{name:"caution",val:" = False"}]}),a(P);var O=t(P,2),De=e(O);o(De,{name:"class timm.optim.SGDW",anchor:"timm.optim.SGDW",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/sgdw.py#L25",parameters:[{name:"params",val:": ParamsT"},{name:"lr",val:": float = 0.001"},{name:"momentum",val:": float = 0.0"},{name:"dampening",val:": float = 0.0"},{name:"weight_decay",val:": float = 0.0"},{name:"nesterov",val:": bool = False"},{name:"caution",val:": bool = False"},{name:"corrected_weight_decay",val:": bool = False"},{name:"maximize",val:": bool = False"},{name:"foreach",val:": typing.Optional[bool] = None"},{name:"differentiable",val:": bool = False"}]});var Me=t(De,2),ga=e(Me);o(ga,{name:"step",anchor:"timm.optim.SGDW.step",source:"https://github.com/huggingface/pytorch-image-models/blob/vr_2739/timm/optim/sgdw.py#L94",parameters:[{name:"closure",val:" = None"}],parametersDescription:[{anchor:"timm.optim.SGDW.step.closure",description:`<strong>closure</strong> (Callable, optional) &#x2014; A closure that reevaluates the model
and returns the loss.`,name:"closure"}]}),r(2),a(Me),a(O);var ha=t(O,2);fa(ha,{source:"https://github.com/huggingface/pytorch-image-models/blob/main/hfdocs/source/reference/optimizers.mdx"}),r(2),Ge(Re,G),Aa()}export{Na as component};

Xet Storage Details

Size:
57.6 kB
·
Xet hash:
9b5874432a0fc013bfe93c2340d28a74acfb81a928d84478b26d56745873e012

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.