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

Class PagedAdam32bit

bitsandbytes/optim/adam.py:296–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294
295
296class PagedAdam32bit(Optimizer2State):
297 def __init__(
298 self,
299 params,
300 lr=1e-3,
301 betas=(0.9, 0.999),
302 eps=1e-8,
303 weight_decay=0,
304 amsgrad=False,
305 optim_bits=32,
306 args=None,
307 min_8bit_size=4096,
308 is_paged=False,
309 ):
310 """
311 Paged 32-bit Adam optimizer.
312
313 Arguments:
314 params (`torch.tensor`):
315 The input parameters to optimize.
316 lr (`float`, defaults to 1e-3):
317 The learning rate.
318 betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
319 The beta values are the decay rates of the first and second-order moment of the optimizer.
320 eps (`float`, defaults to 1e-8):
321 The epsilon value prevents division by zero in the optimizer.
322 weight_decay (`float`, defaults to 0.0):
323 The weight decay value for the optimizer.
324 amsgrad (`bool`, defaults to `False`):
325 Whether to use the [AMSGrad](https://hf.co/papers/1904.09237) variant of Adam that uses the maximum of past squared gradients instead.
326 optim_bits (`int`, defaults to 32):
327 The number of bits of the optimizer state.
328 args (`object`, defaults to `None`):
329 An object with additional arguments.
330 min_8bit_size (`int`, defaults to 4096):
331 The minimum number of elements of the parameter tensors for 8-bit optimization.
332 is_paged (`bool`, defaults to `False`):
333 Whether the optimizer is a paged optimizer or not.
334 """
335 super().__init__(
336 "adam",
337 params,
338 lr,
339 betas,
340 eps,
341 weight_decay,
342 32,
343 args,
344 min_8bit_size,
345 is_paged=True,
346 )

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected