Skip to content

Commit

Permalink
Cleaner way to get options.
Browse files Browse the repository at this point in the history
  • Loading branch information
veichta committed Jan 24, 2024
1 parent 5863345 commit 84b9a12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gluefactory/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ def get_lr_scheduler(optimizer, conf):
scheduler = get_lr_scheduler(optimizer, scheduler_conf)
schedulers.append(scheduler)

# remove conf.options.schedulers
del conf.options.schedulers
options = {k: v for k, v in conf.options.items() if k != "schedulers"}
return getattr(torch.optim.lr_scheduler, conf.type)(
optimizer, schedulers, **conf.options
optimizer, schedulers, **options
)

return getattr(torch.optim.lr_scheduler, conf.type)(optimizer, **conf.options)

# backward compatibility
Expand Down

0 comments on commit 84b9a12

Please sign in to comment.