Skip to content

Add DP-balanced sequence-packing scheduler and wrap_data_iterator entry point - #6684

Queued
ilml wants to merge 1 commit into
NVIDIA:mainfrom
ilml:split/3386-core-packing-scheduler
Queued

Add DP-balanced sequence-packing scheduler and wrap_data_iterator entry point#6684
ilml wants to merge 1 commit into
NVIDIA:mainfrom
ilml:split/3386-core-packing-scheduler

Conversation

@ilml

@ilml ilml commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the DP-balanced sequence-packing scheduler and the wrap_data_iterator entry point to megatron/core/datasets/data_schedule.py, plus documentation and unit tests. Megatron Core changes only — no training-loop or entry-point wiring (those follow in later PRs of the series).

Part of the #3386 split series tracked in the Dynamic Context Parallelism project. Original changes by @xiaoyao0115 in #3386.

Changes

File Change
megatron/core/datasets/data_schedule.py SequencePackingScheduler (DP-balanced) + wrap_data_iterator (+395)
megatron/core/datasets/readme.md Scheduler docs (+22)
tests/unit_tests/test_sequence_packing.py Unit tests (+186)

Contribution process

  • Draft PR per contributing guidelines
  • Commits signed off (DCO)

Series status (updated)

Remaining PRs of the #3386 split, tracked in the Dynamic Context Parallelism project. Reviews run in parallel; merge order:

Order PR Content
1 #5902 config field, CLI arg, validation (independent)
1 #6684 core packing scheduler (independent)
2 #6685 mock SFT + varlen datasets (stacked on #6684)
3 #6686 training-loop + varlen wiring (stacked on #6685)

Merged so far: #5901, #5903, #5908, #6625.

@ilml

ilml commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test e3923e7

@copy-pr-bot

copy-pr-bot Bot commented Aug 19, 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.

…ry point

Split 5/10 from NVIDIA#3386 (sequence packing / THD E2E support). Adds
BasePackingScheduler, DpBalancedScheduler, PackingSchedulerEnum, the
wrap_data_iterator entry point, docs, and the wrap_dataloader unit
tests.

Original changes by @xiaoyao0115 in NVIDIA#3386.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: ilml <tolong@nvidia.com>
@ilml
ilml marked this pull request as ready for review August 19, 2026 21:22
@ilml
ilml requested review from a team as code owners August 19, 2026 21:22
@ilml
ilml enabled auto-merge August 20, 2026 17:59
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the Approved All necessary approvals have been made label Aug 20, 2026
@ilml
ilml added this pull request to the merge queue Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved All necessary approvals have been made complexity: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants