Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WarmupDecayLR.warmup_num_steps must not be 0 or 1 #771

Closed
stas00 opened this issue Feb 20, 2021 · 0 comments · Fixed by #772
Closed

WarmupDecayLR.warmup_num_steps must not be 0 or 1 #771

stas00 opened this issue Feb 20, 2021 · 0 comments · Fixed by #772

Comments

@stas00
Copy link
Collaborator

stas00 commented Feb 20, 2021

When using WarmupDecayLR, either

  • the config checker must ensure that warmup_num_steps is not 0 or 1, because it's a 1 / log(warmup_num_steps)
  • or the code needs to be smart enough to handle these 2 cases internally, .e.g:
warmup_num_steps = max(2, warmup_num_steps)

Thank you.

Fix: #772

Error log from the test:

    def __init__(self,
                 optimizer: Optimizer,
                 warmup_min_lr: float = 0.0,
                 warmup_max_lr: float = 0.001,
                 warmup_num_steps: int = 1000,
                 last_batch_iteration: int = -1):
    
        self.optimizer = get_torch_optimizer(optimizer)
    
        self.min_lrs = self._format_param(self.optimizer, warmup_min_lr, "min_lr")
        self.max_lrs = self._format_param(self.optimizer, warmup_max_lr, "max_lr")
        self.delta_lrs = [big - small for big, small in zip(self.max_lrs, self.min_lrs)]
        self.warmup_num_steps = warmup_num_steps
>       self.inverse_log_warm_up = 1.0 / math.log(warmup_num_steps)
E       ZeroDivisionError: float division by zero

DeepSpeed/deepspeed/runtime/lr_schedules.py:710: ZeroDivisionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant