EdgeTA / utils /dl /common /lr_scheduler.py
LINC-BIT's picture
Upload 1912 files
b84549f verified
raw
history blame contribute delete
395 Bytes
def get_linear_schedule_with_warmup(num_warmup_steps, num_training_steps):
def lr_lambda(current_step: int):
if current_step < num_warmup_steps:
return float(current_step) / float(max(1, num_warmup_steps))
return max(
0.0, float(num_training_steps - current_step) / float(max(1, num_training_steps - num_warmup_steps))
)
return lr_lambda