-
Notifications
You must be signed in to change notification settings - Fork 534
Add Cosmos3 Nano DFlash multimodal training recipe #2053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
skierat
wants to merge
10
commits into
main
Choose a base branch
from
skierat/dflash_recipe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1ca95cc
feat(specdec): add Cosmos3 Nano DFlash multimodal training recipe
skierat 9d839c0
Fix Cosmos3 Nano DFlash training notebook workflow
skierat 3196515
refactor(specdec): unify DFlash dataset merge workflow
skierat ad12fc4
test(specdec): cover VLM DFlash collator paths
skierat 862e611
test(specdec): cover VLM collator edge cases
skierat 228ad4d
test(specdec): cover VLM content normalization edge cases
skierat 5683e84
fix(specdec): harden multimodal generation and remote-code handling
skierat 8e43d47
fix(specdec): harden multimodal media delivery
skierat 0ebed91
fix(specdec): harden dataset preparation and parallel merge recovery
skierat 691039c
fix typo
skierat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../.agents/skills/benchmark-model-kernels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
examples/speculative_decoding/distributed_generate/launch_multimodal.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| if [ $# -lt 10 ]; then | ||
| echo "Usage: $0 <job_id> <backend> <model_path> <shard_path> <output_path> <scripts_path> <start_shard> <jobs_per_node> <media_path> [num_frames] <comma_separated_node_names> [system_prompt]" | ||
| echo "Also accepted: $0 <job_id> <backend> <model_path> <shard_path> <output_path> <scripts_path> <start_shard> <jobs_per_node> <comma_separated_node_names> <media_path> [num_frames] [system_prompt]" | ||
| echo "Example: $0 245387 sglang /model/ /shards/ /output/ /scripts/ 0 10 /media/ 16 cluster-01" | ||
| echo "Optional env: SGLANG_TP_SIZE=8 NUM_TEMPERATURES=8 NUM_THREADS=8 SGLANG_EXTRA_ARGS='--mem-fraction-static 0.75'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| JOB_ID=$1 | ||
| BACKEND=$2 | ||
| MODEL_PATH=$3 | ||
| DATA_PATH=$4 | ||
| OUTPUT_PATH=$5 | ||
| SCRIPTS_PATH=$6 | ||
| START_SHARD=$7 | ||
| JOBS_PER_NODE=$8 | ||
| ARG9=$9 | ||
| ARG10=${10:-} | ||
| ARG11=${11:-} | ||
| ARG12=${12:-} | ||
|
|
||
| if [[ "$ARG9" == */* || "$ARG9" == .* ]]; then | ||
| MEDIA_PATH=$ARG9 | ||
| NUM_FRAMES="${ARG10:-32}" | ||
| NODE_NAME=$ARG11 | ||
| SYSTEM_PROMPT="$ARG12" | ||
| else | ||
| NODE_NAME=$ARG9 | ||
| MEDIA_PATH=$ARG10 | ||
| NUM_FRAMES="${ARG11:-32}" | ||
| SYSTEM_PROMPT="$ARG12" | ||
| fi | ||
|
|
||
| if [ -z "${NODE_NAME:-}" ] || [ -z "${MEDIA_PATH:-}" ]; then | ||
| echo "ERROR: both media_path and node_name are required." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| IFS=',' read -r -a NODE_LIST <<< "$NODE_NAME" | ||
|
|
||
| if [ "$BACKEND" != "sglang" ]; then | ||
| echo "Multimodal generation currently supports backend=sglang." | ||
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p "$OUTPUT_PATH" | ||
|
|
||
| # Set CONTAINER_IMAGE to a local .sqsh image to avoid pulling from the registry. | ||
| DEFAULT_CONTAINER_IMAGE="lmsysorg/sglang:v0.5.3-cu129" | ||
| CONTAINER_IMAGE="${CONTAINER_IMAGE:-$DEFAULT_CONTAINER_IMAGE}" | ||
|
|
||
| counter=$START_SHARD | ||
| worker_pids=() | ||
| for node in "${NODE_LIST[@]}"; do | ||
| echo "Processing node: $node" | ||
| srun --output=srun_vlm_worker_${node}.log --jobid=$JOB_ID -N 1 --ntasks=1 --ntasks-per-node=1 -w "$node" \ | ||
| --mpi pmix --overlap --container-image="$CONTAINER_IMAGE" \ | ||
| --container-mounts="$MODEL_PATH":/model/,"$DATA_PATH":/input_data/,"$OUTPUT_PATH":/output_data/,"$SCRIPTS_PATH":/scripts/,"$MEDIA_PATH":/media_data/ \ | ||
| bash /scripts/distributed_generate/worker_multimodal.sh "$counter" "$BACKEND" "$JOBS_PER_NODE" "$NUM_FRAMES" "$SYSTEM_PROMPT" & | ||
|
|
||
| echo "srun multimodal command for node $node started with PID $!" >> srun_launch_multimodal.log | ||
| worker_pids+=("$!") | ||
| counter=$((counter + JOBS_PER_NODE)) | ||
| done | ||
|
|
||
| echo "Started multimodal workers, each processing $JOBS_PER_NODE shards of data. Will process shards $START_SHARD through $((counter - 1))." | ||
|
|
||
| worker_status=0 | ||
| for worker_pid in "${worker_pids[@]}"; do | ||
| if ! wait "$worker_pid"; then | ||
| worker_status=1 | ||
| fi | ||
| done | ||
|
|
||
| if [ "$worker_status" -ne 0 ]; then | ||
| echo "ERROR: one or more multimodal workers failed." >&2 | ||
| fi | ||
| exit "$worker_status" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Quote the
srunarguments.--output=srun_vlm_worker_${node}.logand--jobid=$JOB_IDare unquoted, so a node name with a glob character or whitespace splits into extra arguments.launch.shLine 56 already quotes both.🔧 Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 Shellcheck (0.11.0)
[info] 72-72: Double quote to prevent globbing and word splitting.
(SC2086)
[info] 72-72: Double quote to prevent globbing and word splitting.
(SC2086)
🤖 Prompt for AI Agents
Source: Linters/SAST tools