[feat] Add DeepSpeed ZeRO-3 LoRA checkpoint save support#10124
[feat] Add DeepSpeed ZeRO-3 LoRA checkpoint save support#10124kimberlykang wants to merge 1 commit intohiyouga:mainfrom
Conversation
- Override save_model() for PEFT adapter with ZeRO-3 compatibility - Use direct all_gather on ds_tensor to avoid GatheredParameters INFLIGHT issues - Add _save_checkpoint() to measure checkpoint saving time - Handle both DeepSpeed and non-DeepSpeed PEFT saves
Summary of ChangesHello @kimberlykang, 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 significantly enhances the model saving capabilities within the training framework, specifically targeting LoRA adapters used with DeepSpeed ZeRO-3. It introduces a robust mechanism to correctly gather and save partitioned LoRA parameters, bypassing previous compatibility issues. Additionally, it improves observability by measuring and logging the time taken for checkpoint saves, ensuring a more efficient and reliable training workflow for large language models. Highlights
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 introduces support for saving LoRA checkpoints with DeepSpeed ZeRO-3, which is a great addition. The implementation correctly gathers partitioned parameters before saving. It also adds a useful feature to time and log the duration of checkpoint saving.
My review includes two main points:
- A high-severity issue regarding device placement during parameter gathering, which could impact performance.
- A medium-severity suggestion to refactor the model saving logic to reduce code duplication and improve maintainability.
Overall, the changes are valuable and address an important compatibility issue. Addressing the feedback will make the implementation more robust and maintainable.
What does this PR do?
Fixes # (issue)
Before submitting