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

Method __init__

bitsandbytes/optim/sgd.py:108–152  ·  view source on GitHub ↗

32-bit SGD optimizer. Arguments: params (`torch.tensor`): The input parameters to optimize. lr (`float`): The learning rate. momentum (`float`, defaults to 0): The momentum value speeds up the optim

(
        self,
        params,
        lr,
        momentum=0,
        dampening=0,
        weight_decay=0,
        nesterov=False,
        args=None,
        min_8bit_size=4096,
    )

Source from the content-addressed store, hash-verified

106
107class SGD32bit(Optimizer1State):
108 def __init__(
109 self,
110 params,
111 lr,
112 momentum=0,
113 dampening=0,
114 weight_decay=0,
115 nesterov=False,
116 args=None,
117 min_8bit_size=4096,
118 ):
119 """
120 32-bit SGD optimizer.
121
122 Arguments:
123 params (`torch.tensor`):
124 The input parameters to optimize.
125 lr (`float`):
126 The learning rate.
127 momentum (`float`, defaults to 0):
128 The momentum value speeds up the optimizer by taking bigger steps.
129 dampening (`float`, defaults to 0):
130 The dampening value reduces the momentum of the optimizer.
131 weight_decay (`float`, defaults to 0.0):
132 The weight decay value for the optimizer.
133 nesterov (`bool`, defaults to `False`):
134 Whether to use Nesterov momentum.
135 args (`object`, defaults to `None`):
136 An object with additional arguments.
137 min_8bit_size (`int`, defaults to 4096):
138 The minimum number of elements of the parameter tensors for 8-bit optimization.
139 """
140 if momentum == 0:
141 raise NotImplementedError("SGD without momentum is not supported!")
142 super().__init__(
143 "momentum",
144 params,
145 lr,
146 (momentum, dampening),
147 0.0,
148 weight_decay,
149 32,
150 args,
151 min_8bit_size,
152 )

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected