feat(vlm): enable validation under pipeline parallelism - #3759
Draft
HuiyingLi wants to merge 2 commits into
Draft
Conversation
Route validation batches through the same _forward_backward_step path as training but via a forward-only AutoPipeline.eval() (which preserves the model-owned kwargs chunk spec that a bare schedule.eval() would drop), broadcast the last-stage loss, and require validation drop_last under PP since AutoPipeline uses a fixed outer batch size. The parity script gains a val_loss metric and the Gemma4 PP2 L2 test now asserts validation parity, so a stale PP validation skip cannot pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
Contributor
Author
|
/claude review |
Contributor
|
LGTM |
Keep the pipeline-validation aggregation and broadcast behavior identical to the LLM recipe so the common path can be extracted later. Retain AutoPipeline.eval() as the VLM-specific chunk-spec adapter. Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
Contributor
Author
|
/ok to test 38d7e03 |
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 does this PR do ?
Enables VLM validation under pipeline parallelism. Previously the recipe logged "Validation is not supported for pipeline parallelism" and skipped it, so any PP finetune ran blind on val_loss. Split out of #3614 to keep that PR focused on the Engine boundary.
Validation batches go through the same
_forward_backward_steppath as training — media staging, stage-shape updates, CP sharding included — but through a new forward-onlyAutoPipeline.eval(). The eval entry sharesstep()'s kwargs-chunk-spec save/restore, which a bareschedule.eval(...)call (the LLM recipe's pattern) would silently drop for models that declareget_pipeline_kwargs_chunk_dims(e.g. Qwen3.5-MoE's media layouts). The last PP stage sums per-microbatch losses and broadcasts the epoch loss to the other stages.Changelog
recipes/vlm/finetune.py: remove the PP validation gate; add_run_pp_validation_epoch(loss DP-allreduced with CP, token count without, last-stage broadcast, clear error when drop_last leaves zero supervised tokens); setup requiresvalidation_dataloader.drop_last=trueunder PP (AutoPipeline uses a fixed outer batch size) and threadspacking_attn_implementation/pp_n_microbatchesinto the validation dataloader build.distributed/pipelining/autopipeline.py: publicAutoPipeline.eval();step/evalshare one_run_scheduleimplementation.recipes/base_recipe.py:_broadcast_from_last_pp_stagemoves up from the LLM recipe so both recipes share one collective.tests/functional_tests/parallelism/compare_parallel_parity.py:--metric {loss,val_loss};L2_Parallelism_VLM_Gemma4_PP2_Parity.shnow also asserts validation-loss parity, so a regression back to skipping validation fails the L2 test.validation_dataloader.drop_last: true.Validation
ruff format/ruff checkclean on changed files.Before your PR is "Ready for review"
Pre checks:
Draft pending full CI.
Additional Information
refactor(engine): training Engine API).🤖 Generated with Claude Code