fix: name the config key when step scheduler is missing step_size
Without step_size, StepLR raises 'missing 1 required positional argument', which is Python-level phrasing that does not tell a config author the value belongs under lr_scheduler_params. Raise with the config path instead. Deliberately an error rather than a default: step_size determines the shape of the entire lr curve, so a guessed value would train to completion and quietly produce a worse result with no signal anything was wrong.
This commit is contained in:
parent
8c72f4df00
commit
6068a3cd43
|
|
@ -24,6 +24,11 @@ def get_lr_scheduler(
|
|||
# StepLR decays purely on step_size/gamma and has no notion of run
|
||||
# length, so drop the total_iters the trainer injects.
|
||||
kwargs.pop('total_iters', None)
|
||||
if 'step_size' not in kwargs:
|
||||
raise ValueError(
|
||||
"lr_scheduler 'step' requires lr_scheduler_params.step_size "
|
||||
"(number of steps between each lr decay)"
|
||||
)
|
||||
|
||||
return torch.optim.lr_scheduler.StepLR(
|
||||
optimizer, **kwargs
|
||||
|
|
|
|||
Loading…
Reference in New Issue