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:
parent
f1d171d59a
commit
8c72f4df00
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue