You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ff05882
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/bridge-guide.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -292,7 +292,7 @@ Or with a helper script:
292
292
293
293
Megatron-LM training checkpoints do not normally contain the Bridge
294
294
`run_config.yaml` required by this export command. See
295
-
[Export Megatron-LM checkpoints without a Bridge run config](megatron-lm-to-megatron-bridge.md#export-megatron-lm-checkpoints-without-a-bridge-run-config)
295
+
[Best-effort export of an existing Megatron-LM checkpoint](megatron-lm-to-megatron-bridge.md#best-effort-export-of-an-existing-megatron-lm-checkpoint)
296
296
for the configuration generation and validation workflow.
Copy file name to clipboardExpand all lines: docs/fern/versions/nightly/pages/bridge-guide.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -260,7 +260,7 @@ Or with a helper script:
260
260
261
261
Megatron-LM training checkpoints do not normally contain the Bridge
262
262
`run_config.yaml` required by this export command. See
263
-
[Export Megatron-LM checkpoints without a Bridge run config](megatron-lm-to-megatron-bridge.md#export-megatron-lm-checkpoints-without-a-bridge-run-config)
263
+
[Best-effort export of an existing Megatron-LM checkpoint](megatron-lm-to-megatron-bridge.md#best-effort-export-of-an-existing-megatron-lm-checkpoint)
264
264
for the configuration generation and validation workflow.
Copy file name to clipboardExpand all lines: docs/fern/versions/nightly/pages/megatron-lm-to-megatron-bridge.mdx
+42-11Lines changed: 42 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ Megatron Bridge is Python-first: configure models, data, and training via typed
6
6
7
7
`scripts/translate_mlm_to_bridge.py` translates bidirectionally between Megatron-LM `pretrain_gpt.py` CLI arguments and Megatron Bridge `run_recipe.py` Hydra overrides. It is useful for running loss-correlation experiments between the two frameworks and for migrating existing MLM configs.
8
8
9
+
This script provides best-effort configuration translation only. It does not establish semantic equivalence, convert checkpoint weights, or emit the serialized `run_config.yaml` stored in a Bridge-native checkpoint. Do not rename its output to `run_config.yaml` or place it in an MLM checkpoint: the generated overrides or Python recipe are starting points for a new Bridge run, not checkpoint metadata. Review every skipped and unknown argument before using the output.
10
+
9
11
### MLM → Bridge (default direction)
10
12
11
13
```bash
@@ -87,9 +89,20 @@ uv run python scripts/translate_mlm_to_bridge.py --reverse \
|`--mtp-hybrid-override-pattern P`|`model.mtp_hybrid_override_pattern=P`| Separate MLM MTP pattern |
99
+
|`--mtp-use-repeated-layer`|`model.mtp_use_repeated_layer=true`| One physical MTP layer reused across prediction depths |
100
+
|`--sft-tokenizer-prompt-format P`|`tokenizer.tokenizer_prompt_format=P`| Bridge exposes the MCore SFT compatibility alias at load time |
90
101
|`--mock-data`|`dataset.mock=true`| Use synthetic data (no files needed) |
91
102
92
-
Flags not present in Bridge (e.g., `--use-mcore-models`, `--use-flash-attn`) are silently skipped with a comment. `--mock-data` translates to `dataset.mock=true`. Unknown flags are listed in a separate section so you can handle them manually.
103
+
Flags not present in Bridge (e.g., `--use-mcore-models`, `--use-flash-attn`) are omitted and listed in a comment. `--mock-data` translates to `dataset.mock=true`. Unknown flags are listed separately so you can handle them manually.
104
+
105
+
Megatron-LM `--spec` values are intentionally not copied into generated configuration as arbitrary import targets. A recognized Mamba or Hybrid spec helps the translator identify the provider family, but a standalone Hybrid recipe still requires an explicit layer pattern. Review and select any Bridge stack specification in trusted Python code.
93
106
94
107
> **Activation function CLI overrides**: `model.activation_func` can now be set via Hydra CLI string override (e.g. `model.activation_func=silu`, `model.activation_func=gelu`). The string is resolved to the callable in `TransformerConfig.finalize()`. This makes `--swiglu` → `model.gated_linear_unit=true model.activation_func=silu` round-trippable from the CLI.
Copy file name to clipboardExpand all lines: docs/megatron-lm-to-megatron-bridge.md
+42-12Lines changed: 42 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ Megatron Bridge is Python-first: configure models, data, and training via typed
6
6
7
7
`scripts/translate_mlm_to_bridge.py` translates bidirectionally between Megatron-LM `pretrain_gpt.py` CLI arguments and Megatron Bridge `run_recipe.py` Hydra overrides. It is useful for running loss-correlation experiments between the two frameworks and for migrating existing MLM configs.
8
8
9
+
This script provides best-effort configuration translation only. It does not establish semantic equivalence, convert checkpoint weights, or emit the serialized `run_config.yaml` stored in a Bridge-native checkpoint. Do not rename its output to `run_config.yaml` or place it in an MLM checkpoint: the generated overrides or Python recipe are starting points for a new Bridge run, not checkpoint metadata. Review every skipped and unknown argument before using the output.
10
+
9
11
### MLM → Bridge (default direction)
10
12
11
13
```bash
@@ -87,9 +89,20 @@ uv run python scripts/translate_mlm_to_bridge.py --reverse \
|`--mtp-hybrid-override-pattern P`|`model.mtp_hybrid_override_pattern=P`| Separate MLM MTP pattern |
99
+
|`--mtp-use-repeated-layer`|`model.mtp_use_repeated_layer=true`| One physical MTP layer reused across prediction depths |
100
+
|`--sft-tokenizer-prompt-format P`|`tokenizer.tokenizer_prompt_format=P`| Bridge exposes the MCore SFT compatibility alias at load time |
90
101
|`--mock-data`|`dataset.mock=true`| Use synthetic data (no files needed) |
91
102
92
-
Flags not present in Bridge (e.g., `--use-mcore-models`, `--use-flash-attn`) are silently skipped with a comment. `--mock-data` translates to `dataset.mock=true`. Unknown flags are listed in a separate section so you can handle them manually.
103
+
Flags not present in Bridge (e.g., `--use-mcore-models`, `--use-flash-attn`) are omitted and listed in a comment. `--mock-data` translates to `dataset.mock=true`. Unknown flags are listed separately so you can handle them manually.
104
+
105
+
Megatron-LM `--spec` values are intentionally not copied into generated configuration as arbitrary import targets. A recognized Mamba or Hybrid spec helps the translator identify the provider family, but a standalone Hybrid recipe still requires an explicit layer pattern. Review and select any Bridge stack specification in trusted Python code.
93
106
94
107
> **Activation function CLI overrides**: `model.activation_func` can now be set via Hydra CLI string override (e.g. `model.activation_func=silu`, `model.activation_func=gelu`). The string is resolved to the callable in `TransformerConfig.finalize()`. This makes `--swiglu` → `model.gated_linear_unit=true model.activation_func=silu` round-trippable from the CLI.
`from_pretrained()` loading, and at least one forward pass. These are structural
322
+
and runtime checks, not numerical-parity evidence. Compare source and exported
323
+
logits when a source-model baseline is available.
293
324
294
325
For MXFP8 parameter checkpoints, use hardware supported by the saved recipe
295
326
(normally Blackwell). The default BF16 export dequantizes Transformer Engine
@@ -300,7 +331,6 @@ native FP8 Hugging Face export currently supports blockwise FP8 parameters.
300
331
301
332
Below is a concise mapping from common `megatron-lm/megatron/training/arguments.py` flags to the new dataclass fields. If a field is not listed here (e.g., highly model-specific knobs), it typically lives under `model.*`, `optimizer.*`, `dataset.*`, or `tokenizer.*` with similar names.
Copy file name to clipboardExpand all lines: docs/training/checkpointing.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -312,8 +312,8 @@ The load default follows the actual source because the checkpoint restored on re
312
312
313
313
### Restore Behavior and Failure Modes
314
314
315
-
- If the dataloader state directory is **absent** (e.g. a checkpoint saved before this feature existed), the dataloader starts from the beginning and a message is logged.
316
-
- If the directory **exists** but the current rank's per-DP-rank file is **missing**, restore **raises**. This almost always means the data-parallel size changed since the checkpoint was saved; resuming would silently change the data order, so it fails loudly instead.
315
+
- If the dataloader state root or the selected `iter_N` directory is **absent** (e.g. the selected checkpoint was saved before this feature existed), the dataloader starts from the beginning and a message is logged. Other state generations under the same root do not change this behavior.
316
+
- If the selected `iter_N` directory **exists** but the current rank's per-DP-rank file is **missing**, restore **raises**. This almost always means the data-parallel size changed since the checkpoint was saved; resuming would silently change the data order, so it fails loudly instead.
0 commit comments