Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pip install -e .
| --------------------------------- | --------------- | ------------------------------------------------- |
| FSDP finetuning | transformers | [Script](cookbook/transformers/fsdp2.py) |
| FSDP MoE finetuning | transformers | [Script](cookbook/transformers/fsdp2_moe.py) |
| ep/sp FSDP MoE finetuning | transformers | [Script](cookbook/transformers/ep_fsdp_qwen3_moe.py) |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The markdown formatting for this line has incorrect padding, which misaligns the table. Please adjust the spacing to align with the other rows.

Additionally, this new entry makes the next line for EP MoE finetuning confusing, as both point to the same script. Since this script now has sequence parallelism enabled by default (ulysses_size = 2), the EP MoE finetuning entry is misleading. It would be clearer to update the existing line rather than adding a new one.

Suggested change
| ep/sp FSDP MoE finetuning | transformers | [Script](cookbook/transformers/ep_fsdp_qwen3_moe.py) |
| ep/sp FSDP MoE finetuning | transformers | [Script](cookbook/transformers/ep_fsdp_qwen3_moe.py) |

| EP MoE finetuning | transformers | [Script](cookbook/transformers/ep_fsdp_qwen3_moe.py) |
| pp/tp/cp finetuning | megatron | [Script](cookbook/megatron/tp.py) |
| pp/tp/cp MoE finetuning | megatron | [Script](cookbook/megatron/tp_moe.py) |
Expand Down
2 changes: 2 additions & 0 deletions cookbook/transformers/ep_fsdp_qwen3_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
# 4 gpus, dp=2, ep=2
dp_size = 2
ep_size = 2
ulysses_size = 2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding ulysses_size makes the script less flexible. It's better to make it configurable via an environment variable, similar to how NUM_LAYERS is handled in this file. This would allow users to easily enable or disable sequence parallelism without modifying the code.

Suggested change
ulysses_size = 2
ulysses_size = int(os.environ.get('ULYSSES_SIZE', 2))


device_mesh = DeviceMesh(
device_type=Platform.get_platform().device_prefix(),
mesh=np.arange(dp_size * ep_size).reshape(dp_size, ep_size),
mesh_dim_names=('dp', 'ep'),
ulysses_size=ulysses_size, # enable sp
)

twinkle.initialize(
Expand Down
Loading