From 6068a3cd43348d2f8d5881eb9b716e82f9a6c5b5 Mon Sep 17 00:00:00 2001 From: Rasaboun <40967731+Rasaboun@users.noreply.github.com> Date: Fri, 7 Aug 2026 10:31:47 +0200 Subject: [PATCH] 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. --- toolkit/scheduler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/toolkit/scheduler.py b/toolkit/scheduler.py index 2404ae69..ab87f68b 100644 --- a/toolkit/scheduler.py +++ b/toolkit/scheduler.py @@ -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