MCPcopy
hub / github.com/thuml/Transfer-Learning-Library / __init__

Method __init__

tllib/utils/scheduler.py:27–53  ·  view source on GitHub ↗
(
            self,
            optimizer,
            milestones,
            gamma=0.1,
            warmup_factor=1.0 / 3,
            warmup_steps=500,
            warmup_method="linear",
            last_epoch=-1,
    )

Source from the content-addressed store, hash-verified

25 """
26
27 def __init__(
28 self,
29 optimizer,
30 milestones,
31 gamma=0.1,
32 warmup_factor=1.0 / 3,
33 warmup_steps=500,
34 warmup_method="linear",
35 last_epoch=-1,
36 ):
37 if not list(milestones) == sorted(milestones):
38 raise ValueError(
39 "Milestones should be a list of" " increasing integers. Got {}",
40 milestones,
41 )
42
43 if warmup_method not in ("constant", "linear"):
44 raise ValueError(
45 "Only 'constant' or 'linear' warmup_method accepted"
46 "got {}".format(warmup_method)
47 )
48 self.milestones = milestones
49 self.gamma = gamma
50 self.warmup_factor = warmup_factor
51 self.warmup_steps = warmup_steps
52 self.warmup_method = warmup_method
53 super(WarmupMultiStepLR, self).__init__(optimizer, last_epoch)
54
55 def get_lr(self):
56 warmup_factor = 1

Callers

nothing calls this directly

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected