MCPcopy Create free account
hub / github.com/HobbitLong/PyContrast / warmup_learning_rate

Method warmup_learning_rate

pycontrast/learning/base_trainer.py:81–89  ·  view source on GitHub ↗
(self, epoch, batch_id, total_batches, optimizer)

Source from the content-addressed store, hash-verified

79 param_group['lr'] = lr
80
81 def warmup_learning_rate(self, epoch, batch_id, total_batches, optimizer):
82 args = self.args
83 if args.warm and epoch <= args.warm_epochs:
84 p = (batch_id + (epoch - 1) * total_batches) / \
85 (args.warm_epochs * total_batches)
86 lr = args.warmup_from + p * (args.warmup_to - args.warmup_from)
87
88 for param_group in optimizer.param_groups:
89 param_group['lr'] = lr

Callers 2

_train_mocoMethod · 0.80
_train_memMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected