Skip to content

fix: add validation for make_sequence_length_divisible_by - #3028

Open
NolenLiang wants to merge 1 commit into
mainfrom
nliang/fix-seq-length-divisible-validation
Open

NolenLiang wants to merge 1 commit into
mainfrom
nliang/fix-seq-length-divisible-validation

Conversation

@NolenLiang

@NolenLiang NolenLiang commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PR #2933 fixed a flaky distillation_nemo_gym CI test by hardcoding
make_sequence_length_divisible_by=4. This PR adds an early, actionable
validation for the underlying DTensor sequence-length constraint.

Confirmed constraint

  • Context parallel load balancing requires a multiple of
    2 * context_parallel_size.
  • Tensor parallelism adds a tensor_parallel_size factor only when sequence
    parallelism is enabled.
  • If both constraints apply, the required factor is their product, not their
    least common multiple.
  • NeMo RL currently rejects DTensor CP together with TP+SP, so supported
    configurations effectively use either the CP factor or the TP+SP factor.

Changes

  • Add one shared validate_sequence_length_divisibility helper.
  • Call it from both the DTensor V1 worker and the Automodel/DTensor V2 setup
    before model loading.
  • Raise a clear ValueError that reports the required minimum pad factor.
  • Add unit coverage for valid and invalid CP, TP+SP, positivity, and the
    product-vs-LCM case.
  • Keep example and reference YAML recipes unchanged, per the earlier design
    discussion.

Testing

  • 8 passed for the focused sequence-divisibility unit tests.
  • Ruff 0.9.9 lint, import sorting, and format checks pass on every changed
    Python file.

@NolenLiang
NolenLiang requested review from a team and terrykong as code owners July 1, 2026 13:58
@copy-pr-bot

copy-pr-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@NolenLiang NolenLiang added the CI:L1 Run doctests, unit tests, and functional tests label Jul 1, 2026
@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 671ab67

@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test f563c0b

@NolenLiang
NolenLiang force-pushed the nliang/fix-seq-length-divisible-validation branch from f563c0b to 05879af Compare July 2, 2026 05:55
@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 05879af

@NolenLiang
NolenLiang force-pushed the nliang/fix-seq-length-divisible-validation branch from 05879af to 4320f02 Compare July 29, 2026 07:28
@NolenLiang

Copy link
Copy Markdown
Contributor Author

/ok to test 4320f02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant