Skip to content

Commit

Permalink
[Fix] Fix T_max may be None in CosineAnnealingParamScheduler (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyixiao18 committed Nov 19, 2022
1 parent d6f41bc commit 9d5b417
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mmengine/optim/scheduler/param_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def __init__(self,
@classmethod
def build_iter_from_epoch(cls,
*args,
T_max,
T_max=None,
begin=0,
end=INF,
by_epoch=True,
Expand All @@ -653,7 +653,8 @@ def build_iter_from_epoch(cls,
f'`epoch_length` must be a positive integer, ' \
f'but got {epoch_length}.'
by_epoch = False
T_max = T_max * epoch_length
if T_max is not None:
T_max = T_max * epoch_length
begin = int(begin * epoch_length)
if end != INF:
end = int(end * epoch_length)
Expand Down

0 comments on commit 9d5b417

Please sign in to comment.