Skip to content

Commit

Permalink
add optimizer step to prevent warning in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian committed Apr 9, 2024
1 parent 2fa65b9 commit 8ee20f3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ def test_schedulers(self):
constant_step = int(self.train_steps * self.constant_lr_ratio)
remaining_step = self.train_steps - constant_step
for _ in range(constant_step):
self.optimizer.step()
self.lr_scheduler.step()
self.assertEqual(
self.lr_scheduler.get_last_lr()[0], self._lr * self.min_lr_ratio
)
for _ in range(remaining_step):
self.optimizer.step()
self.lr_scheduler.step()
self.assertEqual(
self.lr_scheduler.get_last_lr()[0], self._lr * self.min_lr_ratio
Expand Down

0 comments on commit 8ee20f3

Please sign in to comment.