MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / lr_lambda

Function lr_lambda

utils/common.py:955–963  ·  view source on GitHub ↗
(current_step)

Source from the content-addressed store, hash-verified

953 min_lr_multiplier: float = 0.01
954):
955 def lr_lambda(current_step):
956 if current_step < num_warmup_steps:
957 return float(current_step) / float(max(1, num_warmup_steps))
958 progress = float(current_step - num_warmup_steps) / float(
959 max(1, num_training_steps - num_warmup_steps)
960 )
961 return max(
962 min_lr_multiplier, 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress))
963 )
964
965 return LambdaLR(optimizer, lr_lambda, last_epoch)
966

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected