Skip to content

update npu fsdp example#8308

Merged
addsubmuldiv merged 2 commits intomodelscope:mainfrom
addsubmuldiv:npu_fsdp_example_update
Mar 13, 2026
Merged

update npu fsdp example#8308
addsubmuldiv merged 2 commits intomodelscope:mainfrom
addsubmuldiv:npu_fsdp_example_update

Conversation

@addsubmuldiv
Copy link
Copy Markdown
Collaborator

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Write the detail information belongs to this PR.

Experiment results

Paste your experiment result here(if needed).

Copilot AI review requested due to automatic review settings March 12, 2026 09:28
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 updates the NPU FSDP example configuration for Qwen3 LoRA training. The primary goal is to enhance stability and prevent synchronization issues during model loading on NPU devices by adjusting a key FSDP parameter and providing clear guidance within the training script.

Highlights

  • FSDP Configuration Update: The fsdp_cpu_ram_efficient_loading parameter in fsdp.json was set to false to address potential timeout issues during model loading on NPU devices.
  • NPU FSDP Guidance: Informative comments were added to train.sh explaining the recommendation to disable cpu_ram_efficient_loading for NPU with Transformers versions 5.0 and above to prevent inter-card desynchronization.

🧠 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.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates an FSDP example for NPU training. The change disables fsdp_cpu_ram_efficient_loading in the JSON configuration and adds a comment to the corresponding shell script explaining that this is to avoid timeout issues on NPUs. The changes are localized to the specific example and appear to be a targeted fix for the described environment.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Ascend/NPU Qwen3 LoRA+FSDP training example to avoid a known first-synchronization hang by disabling RAM-efficient FSDP loading and documenting the rationale in the training script.

Changes:

  • Add guidance in train.sh recommending disabling FSDP CPU RAM efficient loading for Transformers v5+ on NPU to avoid first sync timeouts.
  • Flip fsdp_cpu_ram_efficient_loading from true to false in the example fsdp.json config.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
examples/ascend/train/qwen3/qwen3_lora_fsdp/train.sh Adds explanatory comment about disabling CPU RAM efficient loading to avoid NPU desync/timeouts.
examples/ascend/train/qwen3/qwen3_lora_fsdp/fsdp.json Disables fsdp_cpu_ram_efficient_loading in the example FSDP config to match the recommended workaround.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@@ -1,4 +1,7 @@
# hardware: Atlas 900 A2
# For NPU, in Transformers versions 5.0 and above, it is recommended to disable
# cpu_ram_efficient_loading in fsdp.json to avoid timeout issues at the first
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The new header comment refers to disabling cpu_ram_efficient_loading, but the actual Accelerate/FSDP config key in fsdp.json is fsdp_cpu_ram_efficient_loading. Please align the comment with the exact key name to avoid confusion when users try to apply this workaround.

Suggested change
# cpu_ram_efficient_loading in fsdp.json to avoid timeout issues at the first
# fsdp_cpu_ram_efficient_loading in fsdp.json to avoid timeout issues at the first

Copilot uses AI. Check for mistakes.
@@ -1,4 +1,7 @@
# hardware: Atlas 900 A2
# For NPU, in Transformers versions 5.0 and above, it is recommended to disable
# cpu_ram_efficient_loading in fsdp.json to avoid timeout issues at the first
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

Trailing whitespace at the end of this comment line (after "first"). Please remove it to avoid churn in future diffs and keep formatting clean.

Suggested change
# cpu_ram_efficient_loading in fsdp.json to avoid timeout issues at the first
# cpu_ram_efficient_loading in fsdp.json to avoid timeout issues at the first

Copilot uses AI. Check for mistakes.
@Jintao-Huang
Copy link
Copy Markdown
Collaborator

thanks

@addsubmuldiv addsubmuldiv merged commit 267a1b4 into modelscope:main Mar 13, 2026
2 of 3 checks passed
Jintao-Huang pushed a commit that referenced this pull request Mar 13, 2026
* update npu fsdp example

* fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants