fix(train): support eval-only mode (--num-rollout 0)#2109
Open
EazyReal wants to merge 1 commit into
Open
Conversation
a658aac to
9e5f530
Compare
9e5f530 to
1f59044
Compare
1f59044 to
6f3d1d3
Compare
Contributor
Author
|
@zhuzilin could you review this one? Eval-only mode with --num-rollout 0 still constructs the Megatron optimizer scheduler, which rejects zero lr_decay_steps; this keeps the training loop at zero rollouts while giving the scheduler the smallest valid shape. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
get_optimizer_param_schedulernow computes the estimated training-iteration count once and clamps the scheduler-visibletrain_itersto at least 1 before deriving Megatron LR/WD schedule steps.A CPU regression test (
tests/test_eval_only_optimizer_scheduler.py) stubs Megatron'sOptimizerParamScheduler, preserves itslr_decay_steps > 0assertion, and is registered in thecpu-unittestmatrix.Why
train.pyhas an eval-only path for--num-rollout 0with--eval-interval, but model and optimizer setup run before that branch. Withnum_rollout == 0, the old estimate producedtrain_iters == 0, thenlr_decay_steps == 0, so Megatron aborted before eval could start.The clamp only gives the scheduler a valid nonzero size for zero-estimated runs. It does not add training iterations; the training loop is still controlled by
args.num_rollout. For normal configs that already estimate at least one optimizer step, the value is unchanged.Validation
tests/test_eval_only_optimizer_scheduler.pycovers both the eval-only startup case (num_rollout=0no longer trips Megatron's scheduler assertion and setstrain_iters == 1) and a normal training config wheretrain_itersremains16.Fixes #1785