Skip to content

Commit 36f295f

Browse files
authored
[docs] refactor: group training feature examples (#3898)
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
1 parent 66fe258 commit 36f295f

16 files changed

Lines changed: 53 additions & 40 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Training Feature Examples
2+
3+
This directory groups examples that focus on training-system features rather than model families or checkpoint conversion.
4+
5+
## Contents
6+
7+
| Directory | Focus |
8+
|-----------|-------|
9+
| `decentralized_pg/` | Explicit process-group construction and `use_decentralized_pg=True` training runs |
10+
| `long_context/` | Long-context training launch examples |
11+
| `resiliency/` | Fault tolerance and straggler detection examples |
12+
13+
Run commands from the repository root so relative paths in the child READMEs and launch scripts resolve correctly.

examples/decentralized_pg/README.md renamed to examples/training_features/decentralized_pg/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Just use an existing recipe and enable decentralized process groups:
2525

2626
```bash
2727
# 8 GPUs: TP2 x PP2 x DP2
28-
uv run python -m torch.distributed.run --nproc_per_node=8 examples/decentralized_pg/pretrain_qwen3_simple.py
28+
uv run python -m torch.distributed.run --nproc_per_node=8 examples/training_features/decentralized_pg/pretrain_qwen3_simple.py
2929

3030
# 4 GPUs: TP2 x PP2 x DP1
31-
uv run python -m torch.distributed.run --nproc_per_node=4 examples/decentralized_pg/pretrain_qwen3_simple.py
31+
uv run python -m torch.distributed.run --nproc_per_node=4 examples/training_features/decentralized_pg/pretrain_qwen3_simple.py
3232
```
3333

3434
The key is just two lines:
@@ -53,14 +53,14 @@ For full control over process groups:
5353

5454
```bash
5555
# 8 GPUs: TP2 x PP2 x DP2
56-
uv run python -m torch.distributed.run --nproc_per_node=8 examples/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py
56+
uv run python -m torch.distributed.run --nproc_per_node=8 examples/training_features/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py
5757

5858
# 4 GPUs: TP2 x PP2 x DP1
59-
uv run python -m torch.distributed.run --nproc_per_node=4 examples/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py \
59+
uv run python -m torch.distributed.run --nproc_per_node=4 examples/training_features/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py \
6060
--tp-size 2 --pp-size 2
6161

6262
# 2 GPUs: TP2 x PP1 x DP1
63-
uv run python -m torch.distributed.run --nproc_per_node=2 examples/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py \
63+
uv run python -m torch.distributed.run --nproc_per_node=2 examples/training_features/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py \
6464
--tp-size 2 --pp-size 1
6565
```
6666

examples/decentralized_pg/pretrain_qwen3_eval_cp.py renamed to examples/training_features/decentralized_pg/pretrain_qwen3_eval_cp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@
5454
----------
5555
# 8 GPUs: TP2 x PP2 x CP_train=1 x CP_eval=2 (default; shows bubble-shrink win)
5656
uv run python -m torch.distributed.run --nproc_per_node=8 \\
57-
examples/decentralized_pg/pretrain_qwen3_eval_cp.py
57+
examples/training_features/decentralized_pg/pretrain_qwen3_eval_cp.py
5858
5959
# 8 GPUs, longer seq for the cleanest Step 7b speedup demo (~1.78x at PP=2):
6060
uv run python -m torch.distributed.run --nproc_per_node=8 \\
61-
examples/decentralized_pg/pretrain_qwen3_eval_cp.py \\
61+
examples/training_features/decentralized_pg/pretrain_qwen3_eval_cp.py \\
6262
--num-layers 8 --seq-length 16384
6363
6464
# 8 GPUs at PP=4 (largest bubble win, ~1.88x):
6565
uv run python -m torch.distributed.run --nproc_per_node=8 \\
66-
examples/decentralized_pg/pretrain_qwen3_eval_cp.py \\
66+
examples/training_features/decentralized_pg/pretrain_qwen3_eval_cp.py \\
6767
--tp-size 1 --pp-size 4 --num-layers 8 --seq-length 16384
6868
6969
# 4 GPUs: TP2 x PP1 x CP_train=1 x CP_eval=2 (no bubble; expect Step 7b regression)
7070
uv run python -m torch.distributed.run --nproc_per_node=4 \\
71-
examples/decentralized_pg/pretrain_qwen3_eval_cp.py \\
71+
examples/training_features/decentralized_pg/pretrain_qwen3_eval_cp.py \\
7272
--tp-size 2 --pp-size 1 --cp-train 1 --cp-eval 2
7373
7474
Prerequisites

examples/decentralized_pg/pretrain_qwen3_simple.py renamed to examples/training_features/decentralized_pg/pretrain_qwen3_simple.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
How to Run
2828
----------
2929
# 8 GPUs: TP2 x PP2 x DP2
30-
uv run python -m torch.distributed.run --nproc_per_node=8 examples/decentralized_pg/pretrain_qwen3_simple.py
30+
uv run python -m torch.distributed.run --nproc_per_node=8 examples/training_features/decentralized_pg/pretrain_qwen3_simple.py
3131
3232
# 4 GPUs: TP2 x PP2 x DP1
33-
uv run python -m torch.distributed.run --nproc_per_node=4 examples/decentralized_pg/pretrain_qwen3_simple.py
33+
uv run python -m torch.distributed.run --nproc_per_node=4 examples/training_features/decentralized_pg/pretrain_qwen3_simple.py
3434
"""
3535

3636
import torch

examples/decentralized_pg/pretrain_qwen3_vl_simple.py renamed to examples/training_features/decentralized_pg/pretrain_qwen3_vl_simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
How to Run
2828
----------
2929
# 8 GPUs: EP8
30-
uv run python -m torch.distributed.run --nproc_per_node=8 examples/decentralized_pg/pretrain_qwen3_vl_simple.py
30+
uv run python -m torch.distributed.run --nproc_per_node=8 examples/training_features/decentralized_pg/pretrain_qwen3_vl_simple.py
3131
"""
3232

3333
import torch

examples/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py renamed to examples/training_features/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
How to Run
3838
----------
3939
# 8 GPUs: TP2 x PP2 x DP2
40-
uv run python -m torch.distributed.run --nproc_per_node=8 examples/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py
40+
uv run python -m torch.distributed.run --nproc_per_node=8 examples/training_features/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py
4141
4242
# 4 GPUs: TP2 x PP2 x DP1
43-
uv run python -m torch.distributed.run --nproc_per_node=4 examples/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py \
43+
uv run python -m torch.distributed.run --nproc_per_node=4 examples/training_features/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py \
4444
--tp-size 2 --pp-size 2
4545
4646
# 2 GPUs: TP2 x PP1 x DP1
47-
uv run python -m torch.distributed.run --nproc_per_node=2 examples/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py \
47+
uv run python -m torch.distributed.run --nproc_per_node=2 examples/training_features/decentralized_pg/pretrain_qwen3_with_decentralized_pg.py \
4848
--tp-size 2 --pp-size 1
4949
"""
5050

File renamed without changes.

examples/long_context/qwen3_600m_sft_yarn_128k.sh renamed to examples/training_features/long_context/qwen3_600m_sft_yarn_128k.sh

File renamed without changes.

examples/resiliency/README.md renamed to examples/training_features/resiliency/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@ Examples demonstrating Megatron-Bridge resiliency features powered by [nvidia-re
2121
Detects slow-performing GPUs during training using NVRx straggler detection.
2222

2323
```bash
24-
uv run python -m torch.distributed.run --nproc_per_node=2 examples/resiliency/straggler_detection/straggler_detection_example.py
24+
uv run python -m torch.distributed.run --nproc_per_node=2 examples/training_features/resiliency/straggler_detection/straggler_detection_example.py
2525
```
2626

2727
Or use the launch script:
2828

2929
```bash
30-
./examples/resiliency/straggler_detection/run_straggler_detection.sh
30+
./examples/training_features/resiliency/straggler_detection/run_straggler_detection.sh
3131
```
3232

3333
### Fault Tolerance
3434

3535
Enables automatic hang detection and job restart using the `ft_launcher`.
3636

3737
```bash
38-
./examples/resiliency/fault_tolerance/run_fault_tolerance.sh
38+
./examples/training_features/resiliency/fault_tolerance/run_fault_tolerance.sh
3939
```
4040

4141
To test fault recovery with simulated failures:
4242

4343
```bash
44-
./examples/resiliency/fault_tolerance/run_fault_tolerance.sh --simulate-fault
44+
./examples/training_features/resiliency/fault_tolerance/run_fault_tolerance.sh --simulate-fault
4545
```
4646

4747
Note: Fault simulation requires careful timing - the fault must trigger after a checkpoint is saved but before training completes. See the `--simulate-fault` option in `fault_tolerance_example.py` for details.

examples/resiliency/fault_tolerance/fault_tolerance_example.py renamed to examples/training_features/resiliency/fault_tolerance/fault_tolerance_example.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@
4646
--nnodes=1 --nproc-per-node=2 \\
4747
--ft-rank_section_timeouts=setup:600,step:180,checkpointing:420 \\
4848
--ft-rank_out_of_section_timeout=300 \\
49-
examples/resiliency/fault_tolerance/fault_tolerance_example.py
49+
examples/training_features/resiliency/fault_tolerance/fault_tolerance_example.py
5050
5151
# With fault simulation:
5252
uv run ft_launcher ... --max-restarts=3 \\
53-
examples/resiliency/fault_tolerance/fault_tolerance_example.py --simulate-fault
53+
examples/training_features/resiliency/fault_tolerance/fault_tolerance_example.py --simulate-fault
5454
5555
# Or use the launch script:
56-
./examples/resiliency/fault_tolerance/run_fault_tolerance.sh
57-
./examples/resiliency/fault_tolerance/run_fault_tolerance.sh --simulate-fault
56+
./examples/training_features/resiliency/fault_tolerance/run_fault_tolerance.sh
57+
./examples/training_features/resiliency/fault_tolerance/run_fault_tolerance.sh --simulate-fault
5858
5959
Documentation:
6060
- Megatron-Bridge: https://docs.nvidia.com/nemo/megatron-bridge/latest/training/resiliency.html

0 commit comments

Comments
 (0)