MCPcopy Create free account
hub / github.com/PrathamLearnsToCode/paper2code / lr_lambda

Function lr_lambda

skills/paper2code/scaffolds/train_template.py:102–106  ·  view source on GitHub ↗
(step)

Source from the content-addressed store, hash-verified

100 return None
101 elif schedule == "cosine":
102 def lr_lambda(step):
103 if step < warmup_steps:
104 return step / max(warmup_steps, 1)
105 progress = (step - warmup_steps) / max(total_steps - warmup_steps, 1)
106 return 0.5 * (1.0 + math.cos(math.pi * progress))
107 return torch.optim.lr_scheduler.LambdaLR(optimizer, lr_lambda)
108 elif schedule == "linear":
109 def lr_lambda(step):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected