MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / LAMB32bit

Class LAMB32bit

bitsandbytes/optim/lamb.py:137–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135
136
137class LAMB32bit(Optimizer2State):
138 def __init__(
139 self,
140 params,
141 lr=1e-3,
142 bias_correction=True,
143 betas=(0.9, 0.999),
144 eps=1e-8,
145 weight_decay=0,
146 amsgrad=False,
147 adam_w_mode=True,
148 args=None,
149 min_8bit_size=4096,
150 max_unorm=1.0,
151 ):
152 """
153 32-bit LAMB optimizer.
154
155 Arguments:
156 params (`torch.tensor`):
157 The input parameters to optimize.
158 lr (`float`, defaults to 1e-3):
159 The learning rate.
160 bias_correction (`bool`, defaults to `True`):
161 Whether to apply bias correction to the first and second-order moments.
162 betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
163 The beta values are the decay rates of the first and second-order moment of the optimizer.
164 eps (`float`, defaults to 1e-8):
165 The epsilon value prevents division by zero in the optimizer.
166 weight_decay (`float`, defaults to 1e-2):
167 The weight decay value for the optimizer.
168 amsgrad (`bool`, defaults to `False`):
169 Whether to use the [AMSGrad](https://hf.co/papers/1904.09237) variant of Adam that uses the maximum of past squared gradients instead.
170 adam_w_mode (`bool`, defaults to `True`):
171 Whether to use the AdamW variant.
172 args (`object`, defaults to `None`):
173 An object with additional arguments.
174 min_8bit_size (`int`, defaults to 4096):
175 The minimum number of elements of the parameter tensors for 8-bit optimization.
176 max_unorm (`float`, defaults to 1.0):
177 The maximum gradient norm.
178 """
179 super().__init__(
180 "lamb",
181 params,
182 lr,
183 betas,
184 eps,
185 weight_decay,
186 32,
187 args,
188 min_8bit_size,
189 max_unorm=max_unorm,
190 )

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected