Base RMSprop optimizer. Arguments: params (`torch.tensor`): The input parameters to optimize. lr (`float`, defaults to 1e-2): The learning rate. alpha (`float`, defaults to 0.99): The alpha value is
(
self,
params,
lr=1e-2,
alpha=0.99,
eps=1e-8,
weight_decay=0,
momentum=0,
centered=False,
optim_bits=32,
args=None,
min_8bit_size=4096,
)
| 7 | |
| 8 | class RMSprop(Optimizer1State): |
| 9 | def __init__( |
| 10 | self, |
| 11 | params, |
| 12 | lr=1e-2, |
| 13 | alpha=0.99, |
| 14 | eps=1e-8, |
| 15 | weight_decay=0, |
| 16 | momentum=0, |
| 17 | centered=False, |
| 18 | optim_bits=32, |
| 19 | args=None, |
| 20 | min_8bit_size=4096, |
| 21 | ): |
| 22 | """ |
| 23 | Base RMSprop optimizer. |
| 24 | |
| 25 | Arguments: |
| 26 | params (`torch.tensor`): |
| 27 | The input parameters to optimize. |
| 28 | lr (`float`, defaults to 1e-2): |
| 29 | The learning rate. |
| 30 | alpha (`float`, defaults to 0.99): |
| 31 | The alpha value is the decay rate of the squared gradients of the optimizer. |
| 32 | eps (`float`, defaults to 1e-8): |
| 33 | The epsilon value prevents division by zero in the optimizer. |
| 34 | weight_decay (`float`, defaults to 0.0): |
| 35 | The weight decay value for the optimizer. |
| 36 | momentum (`float`, defaults to 0): |
| 37 | The momentum value speeds up the optimizer by taking bigger steps. |
| 38 | centered (`bool`, defaults to `False`): |
| 39 | Whether the gradients are normalized by the variance. If `True`, it can help training at the expense of additional compute. |
| 40 | optim_bits (`int`, defaults to 32): |
| 41 | The number of bits of the optimizer state. |
| 42 | args (`object`, defaults to `None`): |
| 43 | An object with additional arguments. |
| 44 | min_8bit_size (`int`, defaults to 4096): |
| 45 | The minimum number of elements of the parameter tensors for 8-bit optimization. |
| 46 | """ |
| 47 | if alpha == 0: |
| 48 | raise NotImplementedError("RMSprop with alpha==0.0 is not supported!") |
| 49 | if centered: |
| 50 | raise NotImplementedError("Centered RMSprop is not supported!") |
| 51 | super().__init__( |
| 52 | "rmsprop", |
| 53 | params, |
| 54 | lr, |
| 55 | (alpha, momentum), |
| 56 | eps, |
| 57 | weight_decay, |
| 58 | optim_bits, |
| 59 | args, |
| 60 | min_8bit_size, |
| 61 | ) |
| 62 | |
| 63 | |
| 64 | class RMSprop8bit(Optimizer1State): |