Skip to content

Commit de18bcd

Browse files
kamran-nvidiaclaude
andcommitted
Merge main into the Nemotron 3 Ultra 384-GPU SFT recipe branch
Resolve the conflict in recipes/nemotronh/h100/__init__.py: keep main's removal of the retired Nemotron Nano v2 and NemotronH entries (#6370) and this branch's rename of the Ultra SFT recipe to nemotron_3_ultra_sft_384gpu_h100_bf16_openmathinstruct2_packed_config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kamran Jafari <kjafarisadeg@nvidia.com>
2 parents b0d07f4 + 618c6c8 commit de18bcd

224 files changed

Lines changed: 6712 additions & 11850 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/ISSUE_TEMPLATE/model_support_request.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ body:
2727
description: Pick the closest fit for the requested model.
2828
options:
2929
- Dense decoder-only (e.g. Llama, Qwen, Gemma, Mistral, Nemotron)
30-
- MoE decoder-only (e.g. DeepSeek V2/V3, OLMoE, Qwen3-MoE, MiniMax-M2)
30+
- MoE decoder-only (e.g. DeepSeek V3, OLMoE, Qwen3-MoE, MiniMax-M2)
3131
- VLM / multimodal (e.g. Qwen-VL, Gemma-VL, Nemotron-VL)
32-
- SSM / hybrid (e.g. Mamba, Nemotron-H)
32+
- SSM / hybrid (e.g. Mamba, Nemotron 3)
3333
- Encoder-decoder (e.g. T5)
3434
- Other / unsure
3535
validations:

‎.github/actions/test-template/action.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ runs:
177177
set -e
178178
export GH_TOKEN=${{ inputs.github-token }}
179179
180+
# Keep the FlashAttention generation policy scoped to CI tests.
181+
export NVTE_FLASH_ATTN_V2=1 NVTE_FLASH_ATTN_V3=0 NVTE_FLASH_ATTN_V4=0
182+
180183
if [[ "${{ contains(inputs.runner, 'gcp') }}" == "true" ]]; then
181184
export NCCL_ENV_PLUGIN=none
182185
export NCCL_NET_PLUGIN=none

‎.main.commit‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8949def81eb744b9219e2d794c80265928c40a5b
1+
e0c5e18673bf4d4fd89cf87c4f1afbe521fe297f

‎3rdparty/Megatron-LM‎

Submodule Megatron-LM updated 256 files

‎README.md‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,34 +221,28 @@ For a deeper dive into conversion design and advanced usage, see the [models REA
221221

222222
Megatron Bridge provides out-of-the-box bridges and training recipes for a wide range of models, built on top of base model architectures from [Megatron Core](https://github.com/NVIDIA/Megatron-LM/tree/main/megatron/core). Refer to the [models directory](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/main/src/megatron/bridge/models) for the full list of model bridges.
223223

224-
> **Deprecation notice:** Gemma 1 (2B/7B), Gemma 2 (2B/9B/27B), Llama 2,
225-
> Mistral 7B, Mistral Small 3 24B, Nemotron H v1 (4B/8B/47B/56B), and the
226-
> legacy `NemotronForCausalLM` bridge previously documented for Nemotron-4 340B
227-
> are no longer actively maintained or tested against current upstream
228-
> checkpoints. They will be removed in Megatron Bridge 0.7.0.
229-
230224
| Family | Supported variants |
231225
|----------------|--------------------|
232226
| [**BAGEL**](docs/models/bagel/bagel.md) | BAGEL-7B-MoT (requires the tested MCore `dev` revision and `bagel` extra) |
233227
| [**Bailing**](docs/models/bailing/index.md) | Ling 2.0 / Ling MoE V2 (Bailing) |
234228
| [**BERT**](docs/models/bert/index.md) | Megatron-Style BERT (`MegatronBertForMaskedLM`) |
235-
| [**DeepSeek**](docs/models/deepseek/index.md) | DeepSeek V2 / V2 Lite (deprecated), DeepSeek V3, DeepSeek V4 / V4 Flash |
229+
| [**DeepSeek**](docs/models/deepseek/index.md) | DeepSeek V3, DeepSeek V4 / V4 Flash |
236230
| [**Diffusion**](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/main/src/megatron/bridge/diffusion/models) | FLUX, LLaDA 1.5, Nemotron-Labs Diffusion, WAN |
237231
| **Ernie** | [Ernie 4.5 MoE](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/main/src/megatron/bridge/models/ernie), [Ernie 4.5 VL MoE](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/main/src/megatron/bridge/models/ernie_vl) |
238232
| [**EXAONE**](docs/models/exaone/exaone.md) | EXAONE 4.0, EXAONE 4.5 VL, K-EXAONE MoE |
239233
| [**Falcon**](docs/models/falcon/index.md) | Falcon H1 |
240-
| [**Gemma**](docs/models/gemma/index.md) | Gemma / Gemma 2 (deprecated), Gemma 3, Gemma 3-VL, Gemma 4 (26B-A4B MoE / 31B dense), Gemma 4-VL (26B-A4B MoE) |
234+
| [**Gemma**](docs/models/gemma/index.md) | Gemma 3, Gemma 3-VL, Gemma 4 (26B-A4B MoE / 31B dense), Gemma 4-VL (26B-A4B MoE) |
241235
| [**GLM**](docs/models/glm/index.md) | GLM-4.5 / GLM-4.7 / GLM-4.7-Flash, GLM-4.5V, GLM-5 / GLM-5.1 / GLM-5.2 / [GLM-5.3](docs/models/glm/glm5-2.md) |
242236
| [**GPT-OSS**](docs/models/gpt_oss/index.md) | GPT-oss |
243237
| [**HY V3**](https://huggingface.co/tencent/Hy3-preview-Base) | Hy3 preview-Base (HF → Megatron checkpoint conversion) |
244238
| [**Kimi**](docs/models/kimi/index.md) | Kimi K2, Kimi-K2.5-VL, Kimi K3 |
245-
| [**Llama**](docs/models/llama/index.md) | Llama 2 (deprecated), Llama 3 / 3.1 / 3.2 / 3.3 |
239+
| [**Llama**](docs/models/llama/index.md) | Llama 3 / 3.1 / 3.2 / 3.3 |
246240
| [**MiniMax**](docs/models/minimax/index.md) | MiniMax-M2 / M2.5 / M2.7, MiniMax-M3 |
247-
| [**Mistral**](docs/models/mistral/index.md) | Mistral 7B / Small 3 24B (deprecated), Ministral 3 (3B/8B/14B) |
241+
| [**Mistral**](docs/models/mistral/index.md) | Ministral 3 (3B/8B/14B) |
248242
| [**Xiaomi-MiMo**](docs/models/mimo/index.md) | Xiaomi-MiMo, MiMo-V2-Flash |
249243
| [**Moonlight**](docs/models/moonlight/index.md) | Moonlight |
250244
| [**Muse Glimmer**](docs/models/muse_glimmer/muse-glimmer.md) | Muse Glimmer 30B |
251-
| [**Nemotron**](docs/models/nemotron/index.md) | Nemotron H v1 (deprecated), Nemotron Nano v2 (deprecated), Nemotron-3 Nano, Nemotron-3 Super, Nemotron-3 Ultra, Llama Nemotron (deprecated), Nemotron Nano v2 VL (deprecated), Nemotron-3 Nano Omni |
245+
| [**Nemotron**](docs/models/nemotron/index.md) | Nemotron-3 Nano, Nemotron-3 Super, Nemotron-3 Ultra, Nemotron-3 Nano Omni |
252246
| [**OLMoE**](docs/models/olmoe/index.md) | OLMoE |
253247
| [**Qwen**](docs/models/qwen/index.md) | Qwen2 / Qwen2.5, Qwen3, Qwen3-MoE, Qwen3 Next, Qwen3.5 (dense/MoE), Qwen2.5-VL, Qwen3-VL, Qwen3.5-VL, Qwen3.6-VL, Qwen2 Audio, Qwen2.5-Omni, Qwen3-Omni, Qwen3-ASR |
254248
| [**Sarvam**](docs/models/sarvam/index.md) | Sarvam |

‎docker/Dockerfile.ci‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
ARG BASE_IMAGE=nvcr.io/nvidia/pytorch:26.08-py3
15+
ARG BASE_IMAGE=nvcr.io/nvidia/pytorch:26.09-py3
1616
FROM ${BASE_IMAGE} AS base
1717

1818
ENV PATH="/opt/venv/bin:/usr/local/bin:$PATH" \

‎docker/common/fw_pyproject.toml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ override-dependencies = [
6161
"pyzmq==25.1.2", # @URL: https://github.com/NVIDIA/NeMo/issues/13625
6262
"tiktoken>=0.9.0", # let megatron-hub win over nemo-toolkit
6363
"datasets==4.8.5",
64-
"pyarrow>=21.0.0", # datasets 4.8.5 needs >=21; override export-deploy's <21 cap (not exercised by training)
64+
# datasets 4.8.5 needs >=21, overriding export-deploy's <21 cap.
65+
# PyArrow 26 requires NumPy 2; preserve MBridge's NumPy 1 runtime.
66+
"pyarrow>=21.0.0,<26",
6567
"fsspec[http]>=2023.1.0,<=2024.9.0",
6668
"transformers; sys_platform == 'never'", # Defer to transformers in MBridge install
6769
"packaging>=25.0",

‎docs/_static/model-verification/catalog-v1.json‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,35 +1347,35 @@
13471347
"workflow": "pretrain"
13481348
},
13491349
{
1350-
"bridge_commit": "330f87c0a391eb2770cbf2306352cc807211d7ba",
1350+
"bridge_commit": "b2ebece6a78fbee6a734655cc6993c13a08b60a4",
13511351
"command_topologies": [
13521352
{
1353-
"gpus_per_node": "1",
1353+
"gpus_per_node": "8",
13541354
"nodes": "1",
13551355
"recipe": "gemma3_vl_4b_sft_config",
13561356
"sequence_length": "4096",
1357-
"total_gpus": 1
1357+
"total_gpus": 8
13581358
}
13591359
],
13601360
"commands": [
1361-
"./scripts/training/train.sh --nodes 1 --gpus-per-node 1 --recipe gemma3_vl_4b_sft_config --mode sft --dataset cord-v2 --pretrained_checkpoint work/model-verification/gemma-3-4b-it/imported-megatron/iter_0000000 --max_steps 10 --seq_length 4096 'dataset.source.load_kwargs={revision:\"7f0115a4b758a71d6473b8d085751692da2fef98\"}' validation.eval_iters=0 validation.eval_interval=0 checkpoint.load=null --save_dir work/model-verification/gemma-3-4b-it/sft-checkpoints --save_interval 10 logger.log_interval=1 logger.log_throughput=true"
1361+
"./scripts/training/train.sh --nodes 1 --gpus-per-node 8 --recipe gemma3_vl_4b_sft_config --mode sft --dataset cord-v2 --pretrained_checkpoint work/model-verification/gemma-3-4b-it/imported-megatron/iter_0000000 --max_steps 10 --seq_length 4096 'dataset.source.load_kwargs={revision:\"7f0115a4b758a71d6473b8d085751692da2fef98\"}' validation.eval_iters=0 validation.eval_interval=0 checkpoint.load=null --save_dir work/model-verification/gemma-3-4b-it/sft-checkpoints --save_interval 10 logger.log_interval=1 logger.log_throughput=true"
13621362
],
13631363
"dimensions": {},
13641364
"enabled_features": {},
13651365
"entry_id": "gemma-3-4b-it-sft-h100",
1366-
"expected_result": "Pending exact-revision CORD-v2 full-SFT verification with the public Gemma 3 VL 4B H100 recipe. The run must complete at least ten optimizer steps with finite loss, no skipped or NaN iterations, all five metrics, and a reloadable final full-model checkpoint.\n",
1366+
"expected_result": "On 8 H100s, the TP1/PP1 recipe completes exactly ten exact-revision CORD-v2 full-SFT steps at global batch size 32 and sequence length 4096. Loss is finite from 1.163850 to 0.143927 with no skipped or NaN iterations. The ten-step metric window includes the first-step cold-start cost by policy, and the final iteration-10 checkpoint saves successfully.\n",
13671367
"hardware": "H100",
1368-
"last_verified": null,
1368+
"last_verified": "2026-10-09",
13691369
"metrics": {
1370-
"final_loss": null,
1371-
"initial_loss": null,
1372-
"last_10_steps_model_tflops_per_gpu_avg": null,
1373-
"last_10_steps_step_time_ms_avg": null,
1374-
"last_10_steps_tokens_per_second_per_gpu_avg": null
1370+
"final_loss": 0.143927,
1371+
"initial_loss": 1.16385,
1372+
"last_10_steps_model_tflops_per_gpu_avg": 22.45,
1373+
"last_10_steps_step_time_ms_avg": 5461.01,
1374+
"last_10_steps_tokens_per_second_per_gpu_avg": 3000.178
13751375
},
13761376
"precision": "bf16",
13771377
"source_pointer": "items.sft.H100",
1378-
"status": "unverified",
1378+
"status": "verified",
13791379
"variant": null,
13801380
"workflow": "sft"
13811381
},
@@ -1481,7 +1481,7 @@
14811481
"min_transformers_version": "5.8.0",
14821482
"slug": "gemma-3-4b-it",
14831483
"source_card": "examples/model_verification_cards/gemma-3-4b-it/card.yaml",
1484-
"summary": "Performance disclaimer: this model has not been performance-tuned; reported timing and throughput metrics are sanity checks, not optimized performance results. Gemma 3 4B Instruct exact-checkpoint CPU and TP2/PP2 GPU import, CPU and TP2/PP2 GPU export, manual multimodal forward parity, and deterministic TP2/PP2 inference are verified. SFT, post-SFT export/inference, and PEFT remain pending. Pretraining and checkpoint resume are unsupported because there is no public exact-model pretraining recipe. Long-context SFT is unsupported because the required dense local/global attention biases currently exclude context parallelism and in-batch THD packing. Existing toy-model tests are not used as exact-model evidence.\n",
1484+
"summary": "Performance disclaimer: this model has not been performance-tuned; reported timing and throughput metrics are sanity checks, not optimized performance results. Gemma 3 4B Instruct exact-checkpoint CPU and TP2/PP2 GPU import, CPU and TP2/PP2 GPU export, manual multimodal forward parity, deterministic TP2/PP2 inference, and 8-GPU H100 full SFT are verified. Post-SFT export/inference and PEFT remain pending. Pretraining and checkpoint resume are unsupported because there is no public exact-model pretraining recipe. Long-context SFT is unsupported because the required dense local/global attention biases currently exclude context parallelism and in-batch THD packing. Existing toy-model tests are not used as exact-model evidence.\n",
14851485
"title": "gemma_3_4b_it"
14861486
},
14871487
{
@@ -4818,7 +4818,7 @@
48184818
"workflow": "sft_export_inference"
48194819
},
48204820
{
4821-
"bridge_commit": "44f3031a2e77ff455eb128efbaa19322ad6397a6",
4821+
"bridge_commit": "ffeb5a7ae817a5a6ccfa3850d7dee937faad7f0b",
48224822
"command_topologies": [
48234823
{
48244824
"gpus_per_node": "8",
@@ -4837,15 +4837,15 @@
48374837
"sequence_packing": "offline"
48384838
},
48394839
"entry_id": "nemotron-3-super-120b-a12b-sft-long-context-h100",
4840-
"expected_result": "On 16 H100s, the dedicated TP1/PP8/CP2/EP2 recipe completes exactly ten packed 32K SFT steps with pad-4 alignment, full recompute, and full optimizer CPU offload. Loss is finite from 1.168852 to 1.008992 with no skipped or NaN iterations. The ten-step metric window includes the first-step cold-start cost by policy, the resolved configuration is persisted, and the final model-only checkpoint saves successfully.\n",
4840+
"expected_result": "On 16 H100s, the dedicated TP1/PP8/CP2/EP2 recipe completes exactly ten packed 32K SFT steps with pad-4 alignment, full recompute, and full optimizer CPU offload. Loss is finite from 1.168852 to 1.011637 with no skipped or NaN iterations. The ten-step metric window includes the first-step cold-start cost by policy, the resolved configuration is persisted, and the final model-only checkpoint saves successfully.\n",
48414841
"hardware": "H100",
4842-
"last_verified": "2026-07-24",
4842+
"last_verified": "2026-10-08",
48434843
"metrics": {
4844-
"final_loss": 1.008992,
4844+
"final_loss": 1.011637,
48454845
"initial_loss": 1.168852,
4846-
"last_10_steps_model_tflops_per_gpu_avg": 5.58,
4847-
"last_10_steps_step_time_ms_avg": 132859.58,
4848-
"last_10_steps_tokens_per_second_per_gpu_avg": 30.83
4846+
"last_10_steps_model_tflops_per_gpu_avg": 6.89,
4847+
"last_10_steps_step_time_ms_avg": 123114.4,
4848+
"last_10_steps_tokens_per_second_per_gpu_avg": 33.27
48494849
},
48504850
"precision": "bf16",
48514851
"source_pointer": "items.sft_long_context.H100",

‎docs/bridge-guide.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ from megatron.bridge import AutoBridge
6363

6464
# Load with specific settings
6565
bridge = AutoBridge.from_hf_pretrained(
66-
"meta-llama/Llama-2-7b-hf",
66+
"meta-llama/Meta-Llama-3-8B",
6767
torch_dtype=torch.float16,
6868
device_map="auto",
6969
trust_remote_code=True,
@@ -346,7 +346,7 @@ AutoBridge.to_megatron_model(load_weights: bool = True, hf_path: str | Path | No
346346
AutoBridge.load_hf_weights(model: list[MegatronModule], hf_path: str | Path | None = None) -> None
347347

348348
# Megatron → HF conversion
349-
AutoBridge.export_hf_weights(model: list[MegatronModule], cpu: bool = False, show_progress: bool = True, conversion_tasks: Optional[list[WeightConversionTask]] = None) -> Iterable[HFWeightTuple]
349+
AutoBridge.export_hf_weights(model: list[MegatronModule], cpu: bool = False, show_progress: bool = True, conversion_tasks: Optional[list[WeightConversionTask]] = None, current_pp_stage_only: bool = False) -> Iterable[HFWeightTuple]
350350
AutoBridge.save_hf_pretrained(model: list[MegatronModule], path: str | Path, show_progress: bool = True) -> None
351351
AutoBridge.save_hf_weights(model: list[MegatronModule], path: str | Path, show_progress: bool = True) -> None
352352

‎docs/bridge-rl-integration.md‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,28 @@ for name, weight in bridge.export_hf_weights(megatron_model, cpu=True, show_prog
352352

353353
Point your inference engine (e.g., vLLM) to `"/path/to/hf_export"`.
354354

355-
### B) Zero-copy streaming via ZMQ (fast refit, colocated)
355+
### B) Pipeline-stage-local streaming for RL weight synchronization
356+
357+
When inference workers collectively receive shards from every training pipeline stage, avoid replicating the full
358+
HF stream across PP ranks:
359+
360+
```python
361+
for name, weight in bridge.export_hf_weights(
362+
megatron_model,
363+
show_progress=False,
364+
current_pp_stage_only=True,
365+
):
366+
send_to_inference_workers(name, weight)
367+
```
368+
369+
- `current_pp_stage_only` changes ownership only across the PP axis.
370+
- TP/EP ranks in the owning stage still gather shards and perform normal HF layout conversion.
371+
- Combining one representative stream from every PP stage reconstructs the normal complete export.
372+
- Source-only HF passthrough tensors are assigned to PP stage 0; duplicate Megatron parameters use the lowest PP owner.
373+
374+
This mode is opt-in. Omitting the flag preserves the complete stream on every rank.
375+
376+
### C) Zero-copy streaming via ZMQ (fast refit, colocated)
356377

357378
Stream tensors from the training side to your inference runtime without writing to disk. The transport is ZMQ peer-to-peer with async send/recv and ping‑pong buffers for overlap; Ray is used only for lightweight coordination. This replaces the earlier ad‑hoc per‑tensor IPC handle passing and aligns with the refactor in [NVIDIA-NeMo/RL#1267](https://github.com/NVIDIA-NeMo/RL/pull/1267).
358379

0 commit comments

Comments
 (0)