Skip to content

Express the Cosmos3 Nano DFlash recipe as a launcher YAML example - #2173

Open
h-guo18 wants to merge 2 commits into
skierat/dflash_recipefrom
haoguo/dflash-cosmos3-launcher-example
Open

Express the Cosmos3 Nano DFlash recipe as a launcher YAML example#2173
h-guo18 wants to merge 2 commits into
skierat/dflash_recipefrom
haoguo/dflash-cosmos3-launcher-example

Conversation

@h-guo18

@h-guo18 h-guo18 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Targets skierat/dflash_recipe (#2053), not main. Merging this into that
branch before #2053 lands keeps the recipe as a single reviewable unit.

What this changes

Ports the train_dflash_cosmos3_nano.ipynb workflow to tools/launcher as a
7-task pipeline, and replaces the notebook with a README that keeps its prose.

None of the Python, shell, or tests from #2053 are touched. The diff is
additive except for deleting the notebook:

recipes/README_dflash_cosmos3_nano.md                    +122
recipes/train_dflash_cosmos3_nano.ipynb                  -732
common/specdec/merge_dflash_datasets.sh                   +52
common/specdec/multimodal_prepare_shards.sh              +154
common/specdec/multimodal_synthetic_generation.sh        +128
examples/nvidia/Cosmos3-Nano/hf_online_dflash_multimodal.yaml +205

Why

Every other speculative-decoding recipe in the repo is already a launcher YAML
(Qwen3-8B, Qwen3-30B-A3B, Kimi-K2.6, MiniMax-M3, gpt-oss-20b). This makes the
Cosmos3 Nano recipe consistent with them, and picks up three things the
notebook could not:

  • Training and export are already implemented.
    common/specdec/dflash_online_training.sh runs the accelerate launch and
    exports every checkpoint, so the notebook's separate export step goes away.
    The vLLM smoke test reuses common/specdec/vllm_smoke_test.sh, which also
    asserts a minimum acceptance length rather than only printing a command.
  • CI coverage. tests/test_examples_resolve.py validates the YAML
    structurally (60 passed locally, including this example). The notebook could
    only be checked with jq empty.
  • No committed cluster specifics. The notebook hardcoded a personal
    $HF_HOME, a personal .sqsh image, and a specific Slurm account. Those
    become per-cluster overrides. The YAML's defaults are deliberately generic.

Behavior parity

Every flag and default is carried over verbatim — the training.* / dflash.*
overrides, the six VLM_* caps, the dedup parameters, the per-source sample
counts and shuffle seeds.

The one real rewrite is shard-to-node assignment. The notebook cells computed a
node list by hand and passed job_id + comma-separated node names into
launch_multimodal.sh. The launcher owns the allocation, so
multimodal_synthetic_generation.sh derives both from SLURM_JOB_ID /
SLURM_JOB_NODELIST instead. I verified the rounding covers every shard with
no gaps and that the out-of-range guards fire.

Prose

The notebook's explanatory content is preserved in
recipes/README_dflash_cosmos3_nano.md: why DFlash trains on the target's own
completions rather than human-written answers, what each data source
contributes, what the merge guarantees (absolute media paths → vlm_img_dir=/;
dedup removes redundancy, not temperature diversity), and the training
constraints — training_seq_len % dflash_block_size == 0, why the VLM_* caps
exist, and that setting data.vlm_processor is what selects the multimodal
collator. Per-step detail lives in YAML comments next to the settings.

Not addressed here

Deliberately scoped to the example layout. The review comments on #2053 itself
(the removed truncation=True turning an over-length sample into a job-fatal
ValueError, the shape-based tensor padding, and hash() making parallel merge
non-reproducible across processes) are unchanged and still worth a look.

🤖 Generated with Claude Code

Ports the train_dflash_cosmos3_nano.ipynb workflow to tools/launcher as a
7-task pipeline, matching how the other speculative-decoding recipes
(Qwen3-8B, Qwen3-30B-A3B, Kimi-K2.6, MiniMax-M3) are already expressed.

Behavior is preserved: every prepare/generate/merge/train/export/serve step
keeps the notebook's flags and defaults. Training and export now reuse the
existing common/specdec/dflash_online_training.sh (which already exports every
checkpoint, so the notebook's separate export step is no longer needed) and
the vLLM smoke test reuses common/specdec/vllm_smoke_test.sh.

Three new wrapper scripts cover the data-synthesis half:
  multimodal_prepare_shards.sh      — download + shard one source
  multimodal_synthetic_generation.sh — generate target completions
  merge_dflash_datasets.sh          — merge + dedup

The generation wrapper derives its shard-to-node assignment from the
launcher's own allocation (SLURM_JOB_ID / SLURM_JOB_NODELIST) instead of
taking a job id and node list as arguments, which is what the notebook cells
did by hand.

Two incidental benefits: the YAML is covered by
tests/test_examples_resolve.py (the notebook could only be checked with
`jq empty`), and the cluster-specific paths baked into the notebook
(a personal $HF_HOME, a personal .sqsh image, a specific Slurm account) become
per-cluster overrides rather than committed defaults.

The notebook's explanatory prose is kept in a new
recipes/README_dflash_cosmos3_nano.md — why DFlash trains on the target's own
completions, what each data source contributes, what the merge guarantees, and
the training constraints (seq_len divisibility, the VLM_* caps, and that
data.vlm_processor is what selects the multimodal collator).

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
@h-guo18
h-guo18 requested review from a team as code owners August 12, 2026 13:36
@h-guo18
h-guo18 requested review from yeyu-nvidia and removed request for a team August 12, 2026 13:36
@copy-pr-bot

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

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • main
  • release/.*
  • feature/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1f8a5560-6436-4422-ab44-6400c75f0591

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

The prepare wrapper reimplemented the PAI-Bench-U download that
prepare_multimodal_synthetic_shards.py already performs via --download, so use
the script's own path instead of a second `hf download` call.

Semantics are unchanged. Its snapshot_download takes no revision argument, so
the explicit CLI download is kept for the PAI_REVISION case only; both branches
land the same dataset in the same directory before sharding. PAI_REPO_ID and
FORCE_DOWNLOAD are now forwarded too — PAI_REPO_ID was previously accepted by
the launch wrapper but never reached the prepare step.

VQA's curl/unzip stays in the wrapper: the Python script has no download path
for it, only --vqa_root/--image_root over already-extracted data.

Also collapses the duplicated per-argument validation in both wrappers.

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
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.

1 participant