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

Method __init__

bitsandbytes/optim/adam.py:127–176  ·  view source on GitHub ↗

32-bit Adam optimizer. Arguments: params (`torch.tensor`): The input parameters to optimize. lr (`float`, defaults to 1e-3): The learning rate. betas (`tuple(float, float)`, defaults to (0.9, 0.999)):

(
        self,
        params,
        lr=1e-3,
        betas=(0.9, 0.999),
        eps=1e-8,
        weight_decay=0,
        amsgrad=False,
        optim_bits=32,
        args=None,
        min_8bit_size=4096,
        is_paged=False,
    )

Source from the content-addressed store, hash-verified

125
126class Adam32bit(Optimizer2State):
127 def __init__(
128 self,
129 params,
130 lr=1e-3,
131 betas=(0.9, 0.999),
132 eps=1e-8,
133 weight_decay=0,
134 amsgrad=False,
135 optim_bits=32,
136 args=None,
137 min_8bit_size=4096,
138 is_paged=False,
139 ):
140 """
141 32-bit Adam optimizer.
142
143 Arguments:
144 params (`torch.tensor`):
145 The input parameters to optimize.
146 lr (`float`, defaults to 1e-3):
147 The learning rate.
148 betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
149 The beta values are the decay rates of the first and second-order moment of the optimizer.
150 eps (`float`, defaults to 1e-8):
151 The epsilon value prevents division by zero in the optimizer.
152 weight_decay (`float`, defaults to 0.0):
153 The weight decay value for the optimizer.
154 amsgrad (`bool`, defaults to `False`):
155 Whether to use the [AMSGrad](https://hf.co/papers/1904.09237) variant of Adam that uses the maximum of past squared gradients instead.
156 optim_bits (`int`, defaults to 32):
157 The number of bits of the optimizer state.
158 args (`object`, defaults to `None`):
159 An object with additional arguments.
160 min_8bit_size (`int`, defaults to 4096):
161 The minimum number of elements of the parameter tensors for 8-bit optimization.
162 is_paged (`bool`, defaults to `False`):
163 Whether the optimizer is a paged optimizer or not.
164 """
165 super().__init__(
166 "adam",
167 params,
168 lr,
169 betas,
170 eps,
171 weight_decay,
172 32,
173 args,
174 min_8bit_size,
175 is_paged=is_paged,
176 )
177
178
179class PagedAdam(Optimizer2State):

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected