Skip to content

Accept warmup_num_steps=0 in the warmup LR schedulers again - #8804

Draft
vineethsaivs wants to merge 1 commit into
deepspeedai:masterfrom
vineethsaivs:fix/warmup-schedulers-zero-steps
Draft

vineethsaivs wants to merge 1 commit into
deepspeedai:masterfrom
vineethsaivs:fix/warmup-schedulers-zero-steps

Conversation

@vineethsaivs

Copy link
Copy Markdown
Contributor

WarmupLR, WarmupDecayLR and WarmupCosineLR raise ValueError: warmup_num_steps must be a positive integer, got 0 since 0.19.3. HF Trainer writes 0 into "warmup_num_steps": "auto" when no warmup is set, so those runs fail at startup on transformers before 5.18 (5.18 works around it with max(1, ...) in huggingface/transformers#48640). HodeTech/ForgeLM#502 hit this.

Cause: #8126 added a <= 0 check. Before it, 0 was valid and max(2, warmup_num_steps) clamped it to 2, the same as 1.

Fix: Reject only negative values in both checks, so 0 behaves as before. None and negative values still raise.

Test: New test_warmup_schedulers_accept_zero_warmup_num_steps checks that 0 gives the same LRs as 2 for all three schedulers. It fails on master with that ValueError and passes after. test_lr_schedulers.py passes (91 tests, CPU). yapf and flake8 are clean.

@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
The positive-integer check from deepspeedai#8126 rejects 0, which HF Trainer
writes into "warmup_num_steps": "auto" whenever no warmup is set.
Before that check, 0 was clamped to 2 like 1. Reject only negative
values so 0 keeps that behavior.

Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
@vineethsaivs
vineethsaivs force-pushed the fix/warmup-schedulers-zero-steps branch from bc71e0e to 8c4806e Compare November 29, 2026 08:42
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. and removed skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. labels Nov 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant