Replace assert statement with if condition and ValueError (#13263)

This commit is contained in:
Nishant Prabhu 2021-08-25 21:44:03 +05:30 committed by GitHub
parent 46554fc12f
commit 225de5ccbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,7 +201,8 @@ def get_polynomial_decay_schedule_with_warmup(
"""
lr_init = optimizer.defaults["lr"]
assert lr_init > lr_end, f"lr_end ({lr_end}) must be be smaller than initial lr ({lr_init})"
if not (lr_init > lr_end):
raise ValueError(f"lr_end ({lr_end}) must be be smaller than initial lr ({lr_init})")
def lr_lambda(current_step: int):
if current_step < num_warmup_steps: