feat(diffusion): periodic validation loss during training - #3579
Open
beccohov wants to merge 9 commits into
Open
feat(diffusion): periodic validation loss during training#3579beccohov wants to merge 9 commits into
beccohov wants to merge 9 commits into
Conversation
Signed-off-by: Arkadii Be <beccohov@gmail.com>
Contributor
Author
|
Hey @HuiyingLi, |
Contributor
|
Thank you! Taking a look |
Contributor
|
/claude review |
Contributor
|
LGTM |
jgerh
reviewed
Aug 18, 2026
jgerh
left a comment
Contributor
There was a problem hiding this comment.
Completed tech pubs review of docs/guides/diffusion/finetune.mdx and provided a few copyedits and suggested text revisions.
Contributor
|
/ok to test bdf62d5 |
Contributor
|
🌿 Preview your docs: https://nvidia-preview-preview-01a0d3db9687.docs.buildwithfern.com/nemo/automodel |
Contributor
Author
|
Thanks, @HuiyingLi |
Contributor
|
@zyzhou5 could you please take a look too, thanks! |
Contributor
|
/ok to test 01a0d3d |
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 ?
Adds periodic validation loss to the diffusion training recipe, so checking eval loss no longer means saving a checkpoint and running the eval set through the model by hand.
Changelog
data.validation_dataloaderblock, resolved by the sameresolve_diffusion_dataloaderas the training loader (_typed_config.py), so it takes the same four builders and the same field validation. One loader, matching the training side, rather than the dict of named loaders the LLM recipe has.setup()with the same dp sharding and batch size as the training loader, and raises if it comes out empty. Half-configured setups get a warning instead of silence: a loader withoutval_every_stepsvalidates on checkpoint steps only,val_every_stepswithout a loader is skipped._run_validation_epochscores the held-out set with the training flow-matching objective ineval()undertorch.no_grad(), restores train mode in afinally, and reduces[loss_sum, batch_count]in one all-reduce over the dp group, so the mean does not depend on how batches are spread across ranks. CP is excluded from that reduction since every peer computes the same full-sequence loss.ScopedRNG(seed=self.seed). Without it the sampled timesteps dominate the curve and validation would consume the training RNG stream, changing the run. FP8 autocast is deliberately not applied: delayed-scaling amax history is training state and should not be updated from held-out batches.step_scheduler.is_val_step, before the checkpoint branch, and logsval_lossto the console and to W&B.wan2_2_t2v_flow.yaml) and the diffusion fine-tuning guide.Before your PR is "Ready for review"
Pre checks:
Additional Information
dp_size: 2) against a small Wan transformer: validation fired at the configured steps and the run finished clean. Also ran the same training twice, with and without validation enabled, and the training losses and final weights come out bit-identical, which is the property the fixed seed and RNG restore are there for.cp_size > 1,tp_size > 1, multi-node, and the LoRA and FP8 paths.