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

Method __init__

bitsandbytes/optim/lars.py:12–63  ·  view source on GitHub ↗

Base LARS 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 optimi

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

Source from the content-addressed store, hash-verified

10
11class LARS(Optimizer1State):
12 def __init__(
13 self,
14 params,
15 lr,
16 momentum=0,
17 dampening=0,
18 weight_decay=0,
19 nesterov=False,
20 optim_bits=32,
21 args=None,
22 min_8bit_size=4096,
23 max_unorm=0.02,
24 ):
25 """
26 Base LARS optimizer.
27
28 Arguments:
29 params (`torch.tensor`):
30 The input parameters to optimize.
31 lr (`float`):
32 The learning rate.
33 momentum (`float`, defaults to 0):
34 The momentum value speeds up the optimizer by taking bigger steps.
35 dampening (`float`, defaults to 0):
36 The dampening value reduces the momentum of the optimizer.
37 weight_decay (`float`, defaults to 1e-2):
38 The weight decay value for the optimizer.
39 nesterov (`bool`, defaults to `False`):
40 Whether to use Nesterov momentum.
41 optim_bits (`int`, defaults to 32):
42 The number of bits of the optimizer state.
43 args (`object`, defaults to `None`):
44 An object with additional arguments.
45 min_8bit_size (`int`, defaults to 4096):
46 The minimum number of elements of the parameter tensors for 8-bit optimization.
47 max_unorm (`float`, defaults to 0.02):
48 The maximum gradient norm.
49 """
50 if momentum == 0:
51 raise NotImplementedError("LARS without momentum is not supported!")
52 super().__init__(
53 "lars",
54 params,
55 lr,
56 (momentum, dampening),
57 0.0,
58 weight_decay,
59 optim_bits,
60 args,
61 min_8bit_size,
62 max_unorm=max_unorm,
63 )
64
65
66class LARS8bit(Optimizer1State):

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected