Skip to content

Fix/dsv4 cp relax assert offline packed thd - #6158

Merged
thomasdhc merged 2 commits into
NVIDIA:devfrom
weijiac0619:fix/dsv4-cp-relax-assert-offline-packed-thd
Jul 31, 2026
Merged

Fix/dsv4 cp relax assert offline packed thd#6158
thomasdhc merged 2 commits into
NVIDIA:devfrom
weijiac0619:fix/dsv4-cp-relax-assert-offline-packed-thd

Conversation

@weijiac0619

@weijiac0619 weijiac0619 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What does this PR do?

Remove the overly strict sequence_packing_scheduler is not None assertion for DSv4 hybrid + CP, which blocked offline-packed SFT. the forward path already enforces THD format correctness at runtime via ValueError("DSv4 Hybrid with CP requires qkv_format='thd'").

⚠️ For major changes (either in lines of code or in its impact), please make sure to first share a design doc with the team. If you're unsure what's the best way to do so, contact @NVIDIA/mcore-oncall.

Issue tracking

For PRs from open-source community contributors:

  • New features: a linked issue is required. Please open a feature request and reference it here before submitting the PR.
  • Small updates (bug fixes, minor improvements): a linked issue is recommended and will accelerate the PR review process.

Linked issue:

Contribution process

Pre-checks

  • I have added relevant unit tests
  • I have added relevant functional tests
  • I have added proper typing to my code Typing guidelines
  • I have added relevant documentation
  • I have run the autoformatter.sh on my PR

Code review

Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!

All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.

Step 1: Mark PR as "Ready for Review"

  1. When your PR is ready, click Ready for Review.
  2. An oncall reviewer is auto-assigned and expert reviewers are notified based on your changes.
    • Some PRs may jump straight to step 2. This is determined by .github/CODEOWNERS.

⚠️ Only mark as ready once merge-conflicts are resolved and the CI is passing.
Final Review might get declined if these requirements are not fulfilled.

Step 2: Final Review

For PRs that change megatron/core, once all expert reviewers have approved, the Final Review label is applied automatically and final reviewers are assigned.

For PRs outside megatron/core, this step is skipped.

Step 3: Approved

Once all required reviewers have approved, the Approved label is applied automatically.

Merge

Any member of mcore-engineers will be able to merge your PR.

…ked THD

DSv4 hybrid + CP > 1 previously required sequence_packing_scheduler, but
offline-packed SFT supplies pre-packed THD data externally without the
scheduler. Allow cp_partition_mode=contiguous as an alternative signal that
THD inputs are externally provided, so Bridge offline-packed SFT does not
need to set sequence_packing_scheduler to bypass the validation.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 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.

@weijiac0619
weijiac0619 changed the base branch from main to dev July 30, 2026 18:19
@weijiac0619
weijiac0619 marked this pull request as ready for review July 30, 2026 20:53
@weijiac0619
weijiac0619 requested review from a team as code owners July 30, 2026 20:53
…d + CP

The assert required sequence_packing_scheduler to be set for DSv4 hybrid
with CP > 1, assuming THD inputs always come from MCore online packing.
This blocked offline-packed SFT (externally pre-packed THD data) without
a semantically correct workaround.

Remove the assert entirely — the forward path already enforces THD format
via ValueError("DSv4 Hybrid with CP requires qkv_format=thd") if THD data
is not actually provided. Legitimate misconfigurations are caught at runtime.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@hxbai

hxbai commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

/ok to test efc4009

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30649507989

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30654314227

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 31, 2026
@cuichenx
cuichenx added this pull request to the merge queue Jul 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 31, 2026
@cuichenx
cuichenx added this pull request to the merge queue Jul 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 31, 2026
@thomasdhc
thomasdhc added this pull request to the merge queue Jul 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 31, 2026
@thomasdhc
thomasdhc merged commit 2fbe3e8 into NVIDIA:dev Jul 31, 2026
90 checks passed
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30664843680

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants