Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Fix lr scheduler tests & lr schedulers #4242

Merged
merged 4 commits into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion parlai/nn/lr_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _is_lr_warming_up(self):
return (
hasattr(self, 'warmup_scheduler')
and self.warmup_scheduler is not None
and self._number_training_updates < self.warmup_updates
and self.warmup_scheduler.get_last_lr()[0] < 1.0
)

def _warmup_lr(self, step):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_lr_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ def _test_scheduler(self, **kwargs):
)
assert logs_first[20]['lr'] == logs_second[0]['lr']

if 'warump_updates' in kwargs:
if 'warmup_updates' in kwargs:
full_logs = logs_first[:20] + logs_second
assert full_logs[kwargs['warmup_updates']]['lr'] == 1.0
assert full_logs[kwargs['warmup_updates'] - 1]['lr'] == 1.0

return logs_first, logs_second

Expand Down