Skip to content

Commit

Permalink
Remove redundant noise attr from Plateau scheduler (use parent)
Browse files Browse the repository at this point in the history
  • Loading branch information
rwightman committed Mar 22, 2022
1 parent 7514439 commit 341b464
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions timm/scheduler/plateau_lr.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ def __init__(self,
noise_seed=None,
initialize=True,
):
super().__init__(optimizer, 'lr', initialize=initialize)
super().__init__(
optimizer,
'lr',
noise_range_t=noise_range_t,
noise_type=noise_type,
noise_pct=noise_pct,
noise_std=noise_std,
noise_seed=noise_seed,
initialize=initialize,
)

self.lr_scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(
self.optimizer,
Expand All @@ -43,11 +52,6 @@ def __init__(self,
min_lr=lr_min
)

self.noise_range_t = noise_range_t
self.noise_pct = noise_pct
self.noise_type = noise_type
self.noise_std = noise_std
self.noise_seed = noise_seed if noise_seed is not None else 42
self.warmup_t = warmup_t
self.warmup_lr_init = warmup_lr_init
if self.warmup_t:
Expand Down Expand Up @@ -84,7 +88,6 @@ def step(self, epoch, metric=None):

if self._is_apply_noise(epoch):
self._apply_noise(epoch)


def _apply_noise(self, epoch):
noise = self._calculate_noise(epoch)
Expand Down

0 comments on commit 341b464

Please sign in to comment.