fix: make constant_with_warmup tolerate a missing total_iters

Same defect as the step branch, opposite direction: the branch used an
unguarded del kwargs['total_iters'], so get_lr_scheduler raised
KeyError: 'total_iters' whenever it was called without the trainer's
injection. Switch to the same pop() used elsewhere so every branch is
safe both with and without the key.
This commit is contained in:
Rasaboun 2026-08-07 10:17:19 +02:00
parent f1d171d59a
commit 8c72f4df00
No known key found for this signature in database
GPG Key ID: EA0A25A69C89B7E5
1 changed files with 1 additions and 1 deletions

View File

@ -43,7 +43,7 @@ def get_lr_scheduler(
if 'num_warmup_steps' not in kwargs:
print(f"WARNING: num_warmup_steps not in kwargs. Using default value of 1000")
kwargs['num_warmup_steps'] = 1000
del kwargs['total_iters']
kwargs.pop('total_iters', None)
return get_constant_schedule_with_warmup(optimizer, **kwargs)
else:
# try to use a diffusers scheduler