Repository navigation
[Bug] Validate checkpoint load steps - #4287
Merged
tianyu-l merged 1 commit intoAug 22, 2026
Merged
Conversation
taking-lying-flat
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
August 22, 2026 13:36
tianyu-l
approved these changes
Aug 22, 2026
tianyu-l
pushed a commit
that referenced
this pull request
Sep 19, 2026
…tokens (#4301) With the default validation dataloader (concat-then-split packing, validate.py Config), a per-rank validation split holding fewer than num_tokens_per_batch tokens yields zero packed rows, because `_packing_output_is_full` drops partially filled rows. The validate loop then breaks on the first StopIteration with `accumulated_loss` still None, and the bare `assert accumulated_loss is not None` kills the whole training run with a message-less AssertionError at the first validation step. Without the assert, `global_loss_sum / num_global_valid_tokens` raises ZeroDivisionError instead. This PR replaces the assert with a ValueError naming the cause (validation dataset supplied fewer than num_tokens_per_batch tokens on this rank; concat-then-split packing drops partial batches) and the remedy (decrease training.num_tokens_per_microbatch_per_dp_rank or use a larger validation set), and guards the zero-valid-token division the same way. Same fail-fast-with-a-clear-message class as the merged #4287 and #4291. No numerical path changes: this is validation-layer error handling only, the loss computation is untouched, so no numerics proof applies. No new CLI flags. Tests: two unit tests in tests/unit_tests/test_validate.py construct both zero-batch and zero-valid-token conditions using the file's existing validator harness. On main they fail with the bare AssertionError and ZeroDivisionError; with this change they assert the ValueError messages. pre-commit passes on both touched files.
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.
Summary