-
Notifications
You must be signed in to change notification settings - Fork 549
feat(minf-mm-sc/tq): Support SC/TQ multimodal inference. #3921
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
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
85d7601
ci: bump Megatron-Bridge to b11414c7, emerging-optimizers to v0.3.0
kajalj22 1235709
Fix CUDA IMA from using MambaMixer with NRL offloading.
cspades 63eda8b
Support Megatron-LLM inference backend for multimodal RL.
cspades 089e6f5
Post-rebase housekeeping.
cspades ff243c0
Pass pre-expanded media tokens to MLLM.
cspades 3ac9345
Remove scripts from branch.
cspades 9bbb32e
Deprecate media_cache_key.
cspades 99e9ccd
Preserve bounded image normalization after rebase.
cspades 1fce161
Align multimodal engine state with main lifecycle.
cspades f1318c3
More rebase fixes.
cspades c6c3004
Retreat the model prompt config back to the wrapper. Users can just c…
cspades 9c5886b
Add tests and lint.
cspades dfb5487
Address Claude and Fable reviews
cspades 66f96ea
Address more review feedback.
cspades f755067
Add video_model_type to RL mcore gen config, and lint.
cspades 6d6eabd
Support multimodal Megatron-Inference with NeMo-RL TransferQueue (V2).
cspades 42526bb
WAR fix for multimodal request checkpoint embedding recompute.
cspades 963d5e3
Address review feedback and incorporate code from #2957.
cspades 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
Submodule Megatron-Bridge
updated
144 files
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
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
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
...s/recipes/vlm/vlm_grpo-nemotron-omni-30ba3b-circle-count-1n4g-megatron_generation.v1.yaml
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 @@ | ||
| defaults: ../../vlm_grpo_3B_megatron.yaml | ||
| grpo: | ||
| num_prompts_per_step: 2 | ||
| num_generations_per_prompt: 8 | ||
| max_num_steps: 4 | ||
| val_period: 0 | ||
| max_val_samples: null | ||
| val_batch_size: null | ||
| async_grpo: | ||
| enabled: true | ||
| max_trajectory_age_steps: 2 | ||
| in_flight_weight_updates: true | ||
| loss_fn: | ||
| reference_policy_kl_penalty: 0.0 | ||
| use_importance_sampling_correction: true | ||
| checkpointing: | ||
| enabled: false | ||
| checkpoint_dir: results/nemo-rl-omni/nemotron-omni-circle-count-1n4g | ||
| policy: | ||
| model_name: nvidia/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-BF16 | ||
| is_vlm: true | ||
| train_global_batch_size: 16 | ||
| logprob_batch_size: 1 | ||
| max_total_sequence_length: 8192 | ||
| sequence_packing: | ||
| enabled: true | ||
| megatron_cfg: | ||
| env_vars: | ||
| TORCH_CUDA_ARCH_LIST: '10.0' | ||
| tensor_model_parallel_size: 2 | ||
| expert_model_parallel_size: 2 | ||
| sequence_parallel: true | ||
| bias_activation_fusion: false | ||
| activation_checkpointing: true | ||
| generation: | ||
| backend: megatron | ||
| bad_words: null | ||
| mcore_generation_config: | ||
| expose_http_server: true | ||
| buffer_size_gb: 8 | ||
| num_cuda_graphs: -1 | ||
| max_tokens: ${policy.max_total_sequence_length} | ||
| transformer_impl: transformer_engine | ||
| activation_checkpointing: false | ||
| tensor_model_parallel_size: 2 | ||
| expert_model_parallel_size: 2 | ||
| expert_tensor_parallel_size: 1 | ||
| sequence_parallel: true | ||
| moe_pad_experts_for_cuda_graph_inference: true | ||
| image_dynamic_resolution: true | ||
| logprobs_mode: raw_logprobs | ||
| megatron_inference_wrapper: megatron.core.inference.model_inference_wrappers.multimodal.nemotron_omni_inference_wrapper.NemotronOmniInferenceWrapper | ||
| vllm_cfg: | ||
| async_engine: true | ||
| expose_http_server: true | ||
| colocated: | ||
| enabled: false | ||
| resources: | ||
| gpus_per_node: 2 | ||
| num_nodes: 1 | ||
| data: | ||
| _override_: true | ||
| max_input_seq_length: null | ||
| shuffle: false | ||
| num_workers: 0 | ||
| train: | ||
| data_path: 3rdparty/Gym-workspace/Gym/resources_servers/circle_count/data/example.jsonl | ||
| validation: | ||
| data_path: 3rdparty/Gym-workspace/Gym/resources_servers/circle_count/data/example.jsonl | ||
| default: | ||
| dataset_name: NemoGymDataset | ||
| env_name: nemo_gym | ||
| prompt_file: null | ||
| processor: nemo_gym_data_processor | ||
| env: | ||
| _override_: true | ||
| should_use_nemo_gym: true | ||
| should_log_nemo_gym_responses: true | ||
| nemo_gym: | ||
| is_trajectory_collection: false | ||
| port_range_low: 5000 | ||
| port_range_high: 5999 | ||
| config_paths: | ||
| - responses_api_models/vllm_model/configs/vllm_model_for_training.yaml | ||
| - resources_servers/circle_count/configs/circle_count.yaml | ||
| circle_count_simple_agent: | ||
| responses_api_agents: | ||
| simple_agent: | ||
| max_steps: 1 | ||
| logger: | ||
| tensorboard_enabled: false | ||
| wandb: | ||
| project: nemo-rl-omni | ||
| name: nemotron-omni-circle-count-1n4g | ||
| cluster: | ||
| gpus_per_node: 4 |
51 changes: 51 additions & 0 deletions
51
...pes/vlm/vlm_grpo-nemotron-omni-30ba3b-clevr-1n4g-megatron-single-controller-async.v1.yaml
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,51 @@ | ||
| # NeMo-RL v2 SingleController overlay for one-node, non-colocated Omni CLEVR. | ||
| defaults: ./vlm_grpo-nemotron-omni-30ba3b-clevr-1n4g-megatron_generation.v1.yaml | ||
|
|
||
| grpo: | ||
| async_grpo: null | ||
| val_period: 0 | ||
| val_at_start: false | ||
| val_at_end: false | ||
|
|
||
| data_plane: | ||
| enabled: true | ||
| impl: transfer_queue | ||
| backend: simple | ||
| claim_meta_poll_interval_s: 0.5 | ||
| simple: | ||
| num_storage_units: 2 | ||
|
|
||
| async_rl: | ||
| sampler: | ||
| name: in_order | ||
| max_lookahead_versions: 1 | ||
| recompute_kv_cache_after_weight_updates: false | ||
| min_groups_for_streaming_train: ${grpo.num_prompts_per_step} | ||
| max_inflight_prompts: ${mul:${grpo.num_prompts_per_step}, 2} | ||
| max_buffered_rollouts: ${mul:${grpo.num_prompts_per_step}, 2} | ||
| diagnostics: true | ||
|
|
||
| policy: | ||
| generation: | ||
| backend: megatron | ||
| colocated: | ||
| enabled: false | ||
| resources: | ||
| num_nodes: 1 | ||
| gpus_per_node: 2 | ||
| mcore_generation_config: | ||
| transformer_impl: inference_optimized | ||
| moe_router_dtype: fp32 | ||
| moe_pad_experts_for_cuda_graph_inference: false | ||
| cuda_graph_impl: local | ||
| inference_cuda_graph_scope: block | ||
| num_cuda_graphs: -1 | ||
| use_cuda_graphs_for_non_decode_steps: false | ||
| enable_chunked_prefill: true | ||
| async_sched_mode: async | ||
| kv_cache_management_mode: persist | ||
| refit_backend: nccl | ||
|
|
||
| cluster: | ||
| num_nodes: 1 | ||
| gpus_per_node: 4 | ||
72 changes: 72 additions & 0 deletions
72
.../configs/recipes/vlm/vlm_grpo-nemotron-omni-30ba3b-clevr-1n4g-megatron_generation.v1.yaml
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,72 @@ | ||
| defaults: ../../vlm_grpo_3B_megatron.yaml | ||
| grpo: | ||
| num_prompts_per_step: 2 | ||
| num_generations_per_prompt: 8 | ||
| max_num_steps: 4 | ||
| val_period: 0 | ||
| async_grpo: | ||
| enabled: true | ||
| max_trajectory_age_steps: 2 | ||
| in_flight_weight_updates: true | ||
| loss_fn: | ||
| reference_policy_kl_penalty: 0.0 | ||
| use_importance_sampling_correction: true | ||
| checkpointing: | ||
| enabled: false | ||
| checkpoint_dir: results/nemo-rl-omni/nemotron-omni-clevr-megatron-1n4g | ||
| policy: | ||
| model_name: nvidia/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-BF16 | ||
| is_vlm: true | ||
| train_global_batch_size: 16 | ||
| logprob_batch_size: 1 | ||
| sequence_packing: | ||
| enabled: true | ||
| megatron_cfg: | ||
| env_vars: | ||
| TORCH_CUDA_ARCH_LIST: '10.0' | ||
| tensor_model_parallel_size: 2 | ||
| expert_model_parallel_size: 2 | ||
| sequence_parallel: true | ||
| bias_activation_fusion: false | ||
| activation_checkpointing: true | ||
| generation: | ||
| backend: megatron | ||
| max_new_tokens: 512 | ||
| stop_strings: | ||
| - <image> | ||
| - <img> | ||
| - </img> | ||
| - <so_embedding> | ||
| - <so_start> | ||
| - <so_end> | ||
| mcore_generation_config: | ||
| buffer_size_gb: 8 | ||
| num_cuda_graphs: -1 | ||
| max_tokens: ${policy.max_total_sequence_length} | ||
| refit_backend: gloo | ||
| transformer_impl: transformer_engine | ||
| activation_checkpointing: false | ||
| tensor_model_parallel_size: 2 | ||
| expert_model_parallel_size: 2 | ||
| expert_tensor_parallel_size: 1 | ||
| sequence_parallel: true | ||
| moe_pad_experts_for_cuda_graph_inference: true | ||
| image_dynamic_resolution: true | ||
| logprobs_mode: raw_logprobs | ||
| megatron_inference_wrapper: megatron.core.inference.model_inference_wrappers.multimodal.nemotron_omni_inference_wrapper.NemotronOmniInferenceWrapper | ||
| colocated: | ||
| enabled: false | ||
| resources: | ||
| gpus_per_node: 2 | ||
| num_nodes: 1 | ||
| data: | ||
| num_workers: 0 | ||
| default: | ||
| prompt_file: examples/prompts/clevr_cogent_cot_nemotron_omni.txt | ||
| logger: | ||
| tensorboard_enabled: false | ||
| wandb: | ||
| project: nemo-rl-omni | ||
| name: nemotron-omni-clevr-megatron-1n4g | ||
| cluster: | ||
| gpus_per_node: 4 |
51 changes: 51 additions & 0 deletions
51
...pes/vlm/vlm_grpo-nemotron-omni-30ba3b-clevr-8n4g-megatron-single-controller-async.v1.yaml
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,51 @@ | ||
| # NeMo-RL v2 SingleController overlay for eight-node, non-colocated Omni CLEVR. | ||
| defaults: ./vlm_grpo-nemotron-omni-30ba3b-clevr-8n4g-megatron_generation.v1.yaml | ||
|
|
||
| grpo: | ||
| async_grpo: null | ||
| val_period: 0 | ||
| val_at_start: false | ||
| val_at_end: false | ||
|
|
||
| data_plane: | ||
| enabled: true | ||
| impl: transfer_queue | ||
| backend: simple | ||
| claim_meta_poll_interval_s: 0.5 | ||
| simple: | ||
| num_storage_units: 16 | ||
|
|
||
| async_rl: | ||
| sampler: | ||
| name: in_order | ||
| max_lookahead_versions: 1 | ||
| recompute_kv_cache_after_weight_updates: false | ||
| min_groups_for_streaming_train: ${grpo.num_prompts_per_step} | ||
| max_inflight_prompts: ${mul:${grpo.num_prompts_per_step}, 2} | ||
| max_buffered_rollouts: ${mul:${grpo.num_prompts_per_step}, 2} | ||
| diagnostics: false | ||
|
|
||
| policy: | ||
| generation: | ||
| backend: megatron | ||
| colocated: | ||
| enabled: false | ||
| resources: | ||
| num_nodes: 6 | ||
| gpus_per_node: 4 | ||
| mcore_generation_config: | ||
| transformer_impl: inference_optimized | ||
| moe_router_dtype: fp32 | ||
| moe_pad_experts_for_cuda_graph_inference: false | ||
| cuda_graph_impl: local | ||
| inference_cuda_graph_scope: block | ||
| num_cuda_graphs: -1 | ||
| use_cuda_graphs_for_non_decode_steps: false | ||
| enable_chunked_prefill: true | ||
| async_sched_mode: async | ||
| kv_cache_management_mode: persist | ||
| refit_backend: nccl | ||
|
|
||
| cluster: | ||
| num_nodes: 8 | ||
| gpus_per_node: 4 |
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.
1 action item. Applies to all four new recipes, not just this one.
TL;DR — the four new recipes have no driver script, which breaks an existing unit test:
assert 271 == 267.It is PR-introduced — counting from git, the merge-base has 267 recipe YAMLs against 267 suite entries and passes; this branch has 271. The test is
pytest.mark.run_first, so it fails early in the unit lane.The
testingskill asks for three things per recipe: the YAML, a driver.shintests/test_suites/vlm/matching the base name, and an entry in a suite list. This PR has the first only, and the four appear in no list at all — not evendisabled.txt.Worth noting the practical cost, since both parent recipes are currently in
disabled.txtand nobody loses coverage today: because these four are in no list, re-enabling the Omni family later won't pick them up. It's also why the CP+VLM+TQ coverage gap has no route to being closed.AI-1
Add
tests/test_suites/vlm/<same-basename>.shfor each of the four (copy the shape ofvlm_grpo-nemotron-omni-30ba3b-clevr-1n4g-megatron_generation.v1.sh) and list them — indisabled.txtif the family is meant to stay off for now. Multi-file, so no suggestion block.Context — no action
This wasn't caught because
/ok to testwas posted on #3920 rather than on this PR, so no GitLab lane has run here. Running it will also surface the two failing tests flagged separately.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.
if we add these to this PR, we should have a driver script. do these tests pair with a v1 one? if so, could you add wandb with evidence that convergence matches and then we deprecate the v1 nightlies of these and replace them with v2? that way we don't increase our nightly GPU hrs too much (we're actually overdue for a major trimming)
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.
I disabled the V1 nightlies since I need to find a better setup than a pretrained Omni since it has basically a converged loss curve. Can I add these nightly tests after the code freeze? For now, I verified not standalone convergence but rather parity with vLLM as my true north offline, and I need to check in an L1 functional just to test against basic errors.