MCPcopy
hub / github.com/HobbitLong/SupContrast / warmup_learning_rate

Function warmup_learning_rate

util.py:68–75  ·  view source on GitHub ↗
(args, epoch, batch_id, total_batches, optimizer)

Source from the content-addressed store, hash-verified

66
67
68def warmup_learning_rate(args, epoch, batch_id, total_batches, optimizer):
69 if args.warm and epoch <= args.warm_epochs:
70 p = (batch_id + (epoch - 1) * total_batches) / \
71 (args.warm_epochs * total_batches)
72 lr = args.warmup_from + p * (args.warmup_to - args.warmup_from)
73
74 for param_group in optimizer.param_groups:
75 param_group['lr'] = lr
76
77
78def set_optimizer(opt, model):

Callers 3

trainFunction · 0.90
trainFunction · 0.90
trainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected