Conversation
Replace calls to `_get_sp_group_from_device_mesh` with direct access to `sequence_parallel._sp_group` in sequence parallel attention tests. This simplifies the test setup by using the already initialized group stored in the module, improving code clarity and reducing redundancy.
Add additional imports and a try-except block to verify that the 'kernels-test/flattened-build' kernel can be successfully loaded in the current environment before proceeding with the test. This prevents test failures due to environment-specific loading issues and provides a more informative skip message.
- Add new entry for ep/sp FSDP MoE finetuning in README table - Update ep_fsdp_qwen3_moe.py script to include ulysses_size parameter for enhanced parallelism configuration
Summary of ChangesHello @meichangsu1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the distributed training cookbook by documenting and enabling sharded parallelism (sp) for FSDP MoE finetuning configurations. It updates the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the cookbook by adding an example for EP/SP FSDP MoE finetuning. The changes involve adding a new entry to the README.md table and modifying the corresponding script to enable sequence parallelism. My review includes a suggestion to fix the markdown table formatting and clarify the new entry to avoid confusion with an existing one. I've also recommended making the sequence parallelism size configurable via an environment variable in the example script for better flexibility.
| | --------------------------------- | --------------- | ------------------------------------------------- | | ||
| | 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) | |
There was a problem hiding this comment.
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.
| | 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) | |
| # 4 gpus, dp=2, ep=2 | ||
| dp_size = 2 | ||
| ep_size = 2 | ||
| ulysses_size = 2 |
There was a problem hiding this comment.
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.
| ulysses_size = 2 | |
| ulysses_size = int(os.environ.get('ULYSSES_SIZE', 2)) |
No description provided.