MCPcopy Create free account
hub / github.com/RylonW/DocNLC / update_learning_rate

Method update_learning_rate

models/base_model.py:51–63  ·  view source on GitHub ↗
(self, cur_iter, warmup_iter=-1)

Source from the content-addressed store, hash-verified

49 return init_lr_groups_l
50
51 def update_learning_rate(self, cur_iter, warmup_iter=-1):
52 for scheduler in self.schedulers:
53 scheduler.step()
54 # set up warm-up learning rate
55 if cur_iter < warmup_iter:
56 # get initial lr for each group
57 init_lr_g_l = self._get_init_lr()
58 # modify warming-up learning rates
59 warm_up_lr_l = []
60 for init_lr_g in init_lr_g_l:
61 warm_up_lr_l.append([v / warmup_iter * cur_iter for v in init_lr_g])
62 # set learning rate
63 self._set_lr(warm_up_lr_l)
64
65 def get_current_learning_rate(self):
66 return [param_group['lr'] for param_group in self.optimizers[0].param_groups]

Callers 2

mainFunction · 0.80
mainFunction · 0.80

Calls 2

_get_init_lrMethod · 0.95
_set_lrMethod · 0.95

Tested by

no test coverage detected