Skip to content

Commit

Permalink
fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ain-soph committed Nov 28, 2021
1 parent 2b35683 commit ebb8d58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions trojanvision/models/nas/darts.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from typing import Union
from typing import TYPE_CHECKING
from trojanzoo.utils.fim import KFAC, EKFAC
from trojanzoo.utils.model import ExponentialMovingAverage
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
import torch.utils.data
Expand Down
4 changes: 2 additions & 2 deletions trojanzoo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,12 @@ def define_optimizer(
raise RuntimeError(
f'Invalid warmup lr method "{lr_warmup_method}".'
'Only linear and constant are supported.')
lr_scheduler = torch.optim.lr_scheduler.SequentialLR(
_lr_scheduler = torch.optim.lr_scheduler.SequentialLR(
optimizer,
schedulers=[warmup_lr_scheduler, main_lr_scheduler],
milestones=[lr_warmup_epochs])
else:
lr_scheduler = main_lr_scheduler
_lr_scheduler = main_lr_scheduler
return optimizer, _lr_scheduler

# define loss function
Expand Down

0 comments on commit ebb8d58

Please sign in to comment.