Skip to content

Commit b723f28

Browse files
committed
Merge remote-tracking branch 'origin/main' into chcui/rhea/qwen35-text-pretrain-recipe
Signed-off-by: Chen Cui <chcui@nvidia.com> # Conflicts: # src/megatron/bridge/recipes/nemotronh/__init__.py
2 parents 80d8c4b + 16846a8 commit b723f28

292 files changed

Lines changed: 22968 additions & 2887 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/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ ruff.toml @nvidia-nemo/automation
77

88
scripts/performance/argument_parser.py @nvidia-nemo/automation @malay-nagda @erhoo82
99
scripts/performance/setup_experiment.py @nvidia-nemo/automation @malay-nagda @erhoo82
10+
scripts/performance/bootstrap.py @nvidia-nemo/automation @malay-nagda @erhoo82
1011
scripts/performance/run_script.py @nvidia-nemo/automation @malay-nagda @erhoo82
1112
scripts/performance/run_recipe.py @nvidia-nemo/automation @malay-nagda @erhoo82

.github/workflows/cicd-main.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,11 @@ jobs:
305305
REGISTRY_AWS: ${{ needs.pre-flight.outputs.registry }}
306306
REGISTRY_GCP: ${{ env.container-registry-gb200 }}
307307
IS_MEMBER: ${{ needs.pre-flight.outputs.is_member }}
308+
DISABLE_GB200_TESTS: ${{ vars.DISABLE_GB200_TESTS }}
308309
run: |
309310
AWS_ENTRY=$(jq -nc --arg registry "$REGISTRY_AWS" --arg runner "${RUNNER_PREFIX}" \
310311
'{"cloud": "aws", "registry": $registry, "runner": $runner}')
311-
if [[ "$IS_MEMBER" == "true" ]]; then
312+
if [[ "$IS_MEMBER" == "true" && "$DISABLE_GB200_TESTS" != "true" ]]; then
312313
GCP_ENTRY=$(jq -nc --arg registry "$REGISTRY_GCP" --arg runner "nemo-ci-gcp-gpu-x2" \
313314
'{"cloud": "gcp", "registry": $registry, "runner": $runner}')
314315
MATRIX=$(jq -nc --argjson aws "$AWS_ENTRY" --argjson gcp "$GCP_ENTRY" \
@@ -410,10 +411,24 @@ jobs:
410411
# digest on every cold build. Listing more than one cache-from donor lets
411412
# BuildKit chain from a conflicting copy of such a layer and miss every
412413
# layer downstream — a ~40 min cold rebuild even when a warm cache exists.
413-
# So read EXACTLY ONE donor: PR builds integrate into main, so they seed
414-
# from main; main/branch builds seed from their own chain.
414+
# So we still read EXACTLY ONE donor; only WHICH donor changes below.
415+
#
416+
# A PR's first build has no cache of its own and seeds from main. Every
417+
# LATER push on the same PR seeds from the PR's OWN buildcache instead of
418+
# main: a PR that touches an early layer (Dockerfile.ci, pyproject.toml,
419+
# uv.lock, the MCore stubs) never has those layers in main-buildcache, so
420+
# seeding from main cold-rebuilt the ~40 min dependency layer on EVERY
421+
# push. Seeding from the PR's own cache reuses the layers that same PR
422+
# already built and pushed to ${KEY}-buildcache. This stays single-donor,
423+
# so the non-reproducible-DeepEP cascade above cannot happen. The probe
424+
# falls back to main on any error, so this never fails the build.
415425
if [[ -n "$PR_NUMBER" && "${{ github.ref }}" != "refs/heads/main" ]]; then
416-
SEED="main"
426+
PR_CACHE="${{ matrix.registry }}/megatron-bridge:${KEY}-buildcache"
427+
if docker buildx imagetools inspect "$PR_CACHE" > /dev/null 2>&1; then
428+
SEED="$KEY"
429+
else
430+
SEED="main"
431+
fi
417432
else
418433
SEED="$KEY"
419434
fi
@@ -782,6 +797,7 @@ jobs:
782797
)
783798
&& !cancelled()
784799
&& needs.pre-flight.outputs.is_member == 'true'
800+
&& vars.DISABLE_GB200_TESTS != 'true'
785801
steps:
786802
- uses: actions/checkout@v6
787803
with:
@@ -843,6 +859,7 @@ jobs:
843859
)
844860
&& !cancelled()
845861
&& needs.pre-flight.outputs.is_member == 'true'
862+
&& vars.DISABLE_GB200_TESTS != 'true'
846863
&& (github.event.inputs.test_suite == '' || github.event.inputs.test_suite == 'all' || github.event.inputs.test_suite == 'functional-only' || contains('L0 L1 L2', github.event.inputs.test_suite))
847864
name: gb200_${{ matrix.script }}
848865
environment: ${{ contains(needs.pre-flight.outputs.registry, 'azure') && 'nemo-ci' || '' }}
@@ -890,6 +907,7 @@ jobs:
890907
)
891908
&& !cancelled()
892909
&& needs.pre-flight.outputs.is_member == 'true'
910+
&& vars.DISABLE_GB200_TESTS != 'true'
893911
&& (github.ref == 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' || needs.configure.outputs.needs_more_tests == 'true' || needs.configure.outputs.full_test_suite == 'true')
894912
&& (github.event.inputs.test_suite == '' || github.event.inputs.test_suite == 'all' || github.event.inputs.test_suite == 'functional-only' || contains('L1 L2', github.event.inputs.test_suite))
895913
name: gb200_${{ matrix.script }}
@@ -938,6 +956,7 @@ jobs:
938956
)
939957
&& !cancelled()
940958
&& needs.pre-flight.outputs.is_member == 'true'
959+
&& vars.DISABLE_GB200_TESTS != 'true'
941960
&& (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || needs.configure.outputs.full_test_suite == 'true')
942961
&& (github.event.inputs.test_suite == '' || github.event.inputs.test_suite == 'all' || github.event.inputs.test_suite == 'functional-only' || contains('L2', github.event.inputs.test_suite))
943962
name: gb200_${{ matrix.script }}
@@ -970,7 +989,7 @@ jobs:
970989
runner: ${{ matrix.runner }}
971990

972991
cicd-functional-tests-gb200-flaky:
973-
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite == 'all' && needs.pre-flight.outputs.is_member == 'true'
992+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite == 'all' && needs.pre-flight.outputs.is_member == 'true' && vars.DISABLE_GB200_TESTS != 'true'
974993
strategy:
975994
fail-fast: false
976995
max-parallel: 16
@@ -1038,6 +1057,7 @@ jobs:
10381057
EXPECT_L1: ${{ needs.configure.outputs.expect_l1 }}
10391058
EXPECT_L2: ${{ needs.configure.outputs.expect_l2 }}
10401059
IS_MEMBER: ${{ needs.pre-flight.outputs.is_member }}
1060+
DISABLE_GB200_TESTS: ${{ vars.DISABLE_GB200_TESTS }}
10411061
run: |
10421062
# NOTE: `gh run view` must NOT be wrapped in `|| echo 0`. Doing so swallows
10431063
# any failure (e.g. "failed to determine base repo" when git context is
@@ -1064,7 +1084,7 @@ jobs:
10641084
check_tier_skips "L0" "$EXPECT_L0"
10651085
check_tier_skips "L1" "$EXPECT_L1"
10661086
check_tier_skips "L2" "$EXPECT_L2"
1067-
if [[ "$IS_MEMBER" == "true" ]]; then
1087+
if [[ "$IS_MEMBER" == "true" && "$DISABLE_GB200_TESTS" != "true" ]]; then
10681088
check_tier_skips "gb200_L0" "$EXPECT_L0"
10691089
check_tier_skips "gb200_L1" "$EXPECT_L1"
10701090
check_tier_skips "gb200_L2" "$EXPECT_L2"

.github/workflows/link-check.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Link check
16+
17+
# Checks external (http/https) links in the docs so broken cross-repo / published
18+
# links (NVBug 6421302 class) are caught before merge and on a weekly cadence.
19+
#
20+
# Scope note: this job checks http/https URLs only (`--scheme`). Internal
21+
# cross-page links in the Fern docs use a `.md` extension while the source files
22+
# are `.mdx`, so filesystem-level checking of relative links would report ~600
23+
# false positives; that convention is out of scope here. GitHub links are NOT
24+
# excluded (GITHUB_TOKEN is supplied to avoid rate limits).
25+
26+
on:
27+
pull_request:
28+
schedule:
29+
# Weekly, Mondays 06:00 UTC
30+
- cron: "0 6 * * 1"
31+
workflow_dispatch:
32+
33+
permissions:
34+
contents: read
35+
36+
jobs:
37+
link-check:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Check links
44+
uses: lycheeverse/lychee-action@v2
45+
with:
46+
fail: true
47+
args: >-
48+
--no-progress
49+
--max-retries 3
50+
--retry-wait-time 10
51+
--scheme https
52+
--scheme http
53+
--accept '200..=299,401,403,429'
54+
--root-dir docs/fern
55+
--exclude 'github\.com/deepseek-ai/DeepSeek-V4'
56+
--exclude 'github\.com/NVIDIA-NeMo/Megatron-Bridge/stargazers'
57+
--exclude 'sched\.com'
58+
--exclude 'llama\.com'
59+
"docs/fern/**/*.mdx"
60+
"docs/**/*.md"
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.main.commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
adfb8ec7926215bfd0d5120aaf6b080de224d328
1+
58bf14e9e68915a5e0c7d70451620e6e713c07d5

3rdparty/Megatron-LM

Submodule Megatron-LM updated 57 files

docs/adding-new-models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ Use this checklist-style flow: scaffold → provider mapping → parameter mappi
2121

2222
Most GPT-style models (such as the Qwen and Llama families) can reuse the Megatron-Core GPT model by mapping their configuration. If the model requires custom building blocks (e.g., an attention variant, RoPE variant, or VLM modules), add a lightweight specialization similar to how 🤗 HuggingFace implements `modeling_xxx.py`.
2323

24-
- **Standard GPT-style models**: Implement a `Provider` and a `Bridge`. For example, see the [Llama provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_provider.py) and [Llama bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py).
24+
- **Standard GPT-style models**: Implement a `Provider` and a `Bridge`. For example, see the [Llama provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py) and [Llama bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py).
2525
- **Models with custom components**: If your model has custom operations or blocks (e.g., a unique attention mechanism), add a minimal modeling module in the same directory and reference it from the `Provider` (example forthcoming).
2626

2727

2828
## 2) Scaffold the model folder
2929

3030
Create a folder under `src/megatron/bridge/models/<your_model>/` and add:
3131

32-
- `<your_model>_provider.py`: builds a `TransformerConfig`-compatible provider (or a subclass of an existing provider) and exposes `.provide_distributed_model()`. For example: [Llama provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_provider.py), [Qwen provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen_provider.py), or [Qwen2 provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen2_provider.py).
32+
- `<your_model>_provider.py`: builds a `TransformerConfig`-compatible provider (or a subclass of an existing provider) and exposes `.provide_distributed_model()`. For example: [Llama provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py), [Qwen provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen3_bridge.py), or [Qwen2 provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen2_bridge.py).
3333
- `<your_model>_bridge.py`: architecture-specific bridge that maps HF config → provider and defines parameter mappings. For example: [Llama bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py), [Qwen3 bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen3_bridge.py), or [Qwen2 bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen2_bridge.py).
3434
- Optional: `README.md` with any model quirks. For example: [Llama README](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/README.md).
3535

docs/bridge-rl-integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Megatron Bridge provides a clean, parallelism-aware path to use 🤗 Hugging Fac
99
The examples mirror how NeMo-RL integrates Megatron Bridge:
1010

1111
- [nemo_rl/models/megatron/community_import.py](https://github.com/NVIDIA-NeMo/RL/blob/main/nemo_rl/models/megatron/community_import.py)
12-
- [nemo_rl/models/policy/megatron_policy_worker.py](https://github.com/NVIDIA-NeMo/RL/blob/main/nemo_rl/models/policy/megatron_policy_worker.py)
12+
- [nemo_rl/models/policy/megatron_policy_worker.py](https://github.com/NVIDIA-NeMo/RL/blob/main/nemo_rl/models/policy/workers/megatron_policy_worker.py)
1313

1414
- Local example script in this repo: [examples/rl/rlhf_with_bridge.py](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/examples/rl/rlhf_with_bridge.py)
1515

@@ -503,4 +503,4 @@ class MegatronBridgeAdapter:
503503

504504
- [Bridge with 🤗 Hugging Face](./bridge-guide.md) for HF↔Megatron conversion overview
505505
- [nemo_rl/models/megatron/community_import.py](https://github.com/NVIDIA-NeMo/RL/blob/main/nemo_rl/models/megatron/community_import.py) for import/export helpers
506-
- [nemo_rl/models/policy/megatron_policy_worker.py](https://github.com/NVIDIA-NeMo/RL/blob/main/nemo_rl/models/policy/megatron_policy_worker.py) for end-to-end RL integration (training, logprobs, generation, refit)
506+
- [nemo_rl/models/policy/megatron_policy_worker.py](https://github.com/NVIDIA-NeMo/RL/blob/main/nemo_rl/models/policy/workers/megatron_policy_worker.py) for end-to-end RL integration (training, logprobs, generation, refit)
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
11
{"uri": "https://www.llama.com/models/llama-3/"}
2-
{"uri": "https://docs.nvidia.com/megatron-core/developer-guide/latest/api-guide/context_parallel.html"}
3-
{"uri": "https://docs.nvidia.com/megatron-core/developer-guide/latest/api-guide/dist_optimizer.html"}
4-
{"uri": "https://docs.nvidia.com/megatron-core/developer-guide/latest/api-guide/tensor_parallel.html"}

docs/documentation.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,13 @@ Example:
8888

8989
```{code-block} json
9090
:caption: Example: versions1.json
91-
:emphasize-lines: 9,10
9291
9392
[
9493
{
9594
"preferred": true,
9695
"version": "latest",
9796
"url": "https://docs.nvidia.com/nemo/megatron-bridge/latest/"
9897
},
99-
{
100-
101-
"version": "#.#.#",
102-
"url": "https://docs.nvidia.com/nemo/megatron-bridge/#.#.#/"
103-
},
10498
{
10599
106100
"version": "0.1.0",

docs/fern/versions/0.4.2/pages/adding-new-models.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Use this checklist-style flow: scaffold → provider mapping → parameter mappi
1919

2020
Most GPT-style models (such as the Qwen and Llama families) can reuse the Megatron-Core GPT model by mapping their configuration. If the model requires custom building blocks (e.g., an attention variant, RoPE variant, or VLM modules), add a lightweight specialization similar to how 🤗 HuggingFace implements `modeling_xxx.py`.
2121

22-
- **Standard GPT-style models**: Implement a `Provider` and a `Bridge`. For example, see the [Llama provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_provider.py) and [Llama bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py).
22+
- **Standard GPT-style models**: Implement a `Provider` and a `Bridge`. For example, see the [Llama provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py) and [Llama bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py).
2323
- **Models with custom components**: If your model has custom operations or blocks (e.g., a unique attention mechanism), add a minimal modeling module in the same directory and reference it from the `Provider` (example forthcoming).
2424

2525
## 2) Scaffold the model folder
2626

2727
Create a folder under `src/megatron/bridge/models/&lt;your_model&gt;/` and add:
2828

29-
- `&lt;your_model&gt;_provider.py`: builds a `TransformerConfig`-compatible provider (or a subclass of an existing provider) and exposes `.provide_distributed_model()`. For example: [Llama provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_provider.py), [Qwen provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen_provider.py), or [Qwen2 provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen2_provider.py).
29+
- `&lt;your_model&gt;_provider.py`: builds a `TransformerConfig`-compatible provider (or a subclass of an existing provider) and exposes `.provide_distributed_model()`. For example: [Llama provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py), [Qwen provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen3_bridge.py), or [Qwen2 provider](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen2_bridge.py).
3030
- `&lt;your_model&gt;_bridge.py`: architecture-specific bridge that maps HF config → provider and defines parameter mappings. For example: [Llama bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/llama_bridge.py), [Qwen3 bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen3_bridge.py), or [Qwen2 bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/qwen/qwen2_bridge.py).
3131
- Optional: `README.md` with any model quirks. For example: [Llama README](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/models/llama/README.md).
3232

0 commit comments

Comments
 (0)