Improve StormScope recipe masking ergonomics#1762
Conversation
Greptile SummaryThis PR consolidates StormScope's spatial masking into a single dataloader-owned interface and fixes a domain-parallelism shape bug. The old dual-source masking (dataset
Important Files Changed
Reviews (1): Last reviewed commit: "Improve recipe masking ergonomics" | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
jleinonen
left a comment
There was a problem hiding this comment.
With the channel masking added, looks good!
…rides - FGNDiT: add attention_backend + detokenizer args; default detokenizer to proj_reshape_2d_conv (zero-init conv head, suppresses checkerboard on spiky channels like precipitation and w, PR NVIDIA#1731). natten2d_rope short-circuits the pos_embed padding hack since DiT forces pos_embed=none when RoPE is selected. - ModelConfig: expose attention_backend and detokenizer fields. - LossConfig: add channel_loss_weights dict for per-channel multipliers on top of the existing GraphCast/area weights (stormcast NVIDIA#1762 pattern). - Trainer: apply channel_loss_weights overrides when building loss_weights. - YAMLs: add new model fields; clean up obvious comments. Signed-off-by: Kashif Rasul <kashif.rasul@gmail.com>
PhysicsNeMo Pull Request
Description
Summary
Reworks spatial masking in the StormCast/StormScope recipe into a single, dataloader-owned interface, and fixes a domain-parallelism bug in the loss-mask construction. Previously masking came from two reconciled-at-train-time sources (a dataloader
maskkey and a NaN-inspection pathway), which was confusing and produced a shape bug under domain parallelism. Changes:"mask"served by the dataset (convention1=valid,0=invalid) is now the only mask source. The NaN-inspection pathway is removed entirely.Trainer._build_masks(target, batch_mask)translates that mask into a loss weight and aninvalid_mask;use_nan_mask_tokensnow solely controls whetherinvalid_maskis also injected into the DiT forward so it can swap invalid tokens for its learned mask token.use_nan_mask_tokens, the loss weight is pooled to patch granularity (max_pool2d) and expanded back (interpolate), matching the model's token-level substitution. The patch size is read directly from the constructed DiT (patch_size), and the expansion uses a scalarscale_factor. Pixel-level weight is retained otherwise.(B, 1, H, W)as a height-sharded ShardTensor through pooling and expansion.use_mask: false(mock dataset) anduse_nan_mask_tokens: false(stormscope hyperparameters) defaults so the keys exist in the OmegaConf struct, documents the"mask"key in the dataset docstring and README, and adds an optionaluse_maskpattern to the mock dataset.Tests
test_maskingnow exercises the full masked DiT path across three launch configs — single (1 GPU), domain_parallel (2 GPU, height-sharded), and data_domain_parallel (4 GPU, 2×2 data+domain mesh) — skipping configs that don't match the launched world size.Checklist
Dependencies
Review Process
All PRs are reviewed by the PhysicsNeMo team before merging.
Depending on which files are changed, GitHub may automatically assign a maintainer for review.
We are also testing AI-based code review tools (e.g., Greptile), which may add automated comments with a confidence score.
This score reflects the AI’s assessment of merge readiness and is not a qualitative judgment of your work, nor is
it an indication that the PR will be accepted / rejected.
AI-generated feedback should be reviewed critically for usefulness.
You are not required to respond to every AI comment, but they are intended to help both authors and reviewers.
Please react to Greptile comments with 👍 or 👎 to provide feedback on their accuracy.