Conversation
Summary of ChangesHello @Artiprocher, 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 framework's capability to train large models by integrating DeepSpeed ZeRO Stage 3. The changes streamline model initialization and state loading for distributed environments, refactor gradient checkpointing for cleaner code, and adjust VAE feature handling. These updates collectively aim to improve memory efficiency and scalability for training, particularly on NPU setups, and are supported by updated documentation and configuration examples. 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
Activity
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 DeepSpeed ZeRO Stage 3, which is a significant enhancement for training large models. The changes for this are well-implemented across model loading, training execution, and configuration. I've also noticed a substantial refactoring of gradient checkpointing logic into a centralized utility function, which greatly improves code clarity and maintainability. Additionally, there are several documentation updates and new example scripts that will be very helpful for users. I found a couple of potential issues, one related to an unused function parameter and another that could lead to a runtime error due to inconsistent return values in a function. Overall, this is a great contribution.
| @@ -511,7 +511,7 @@ def forward(self, x, feat_cache=None, feat_idx=[0], first_chunk=False): | |||
| x_shortcut = self.avg_shortcut(x, first_chunk) | |||
| return x_main + x_shortcut | |||
There was a problem hiding this comment.
The forward method of Up_ResidualBlock has inconsistent return values. The else branch was updated to return three values (x_main, feat_cache, feat_idx), but this if branch still returns only one value. This will likely cause an UnpackingError at the call site in Decoder3d_38.forward (line 916), which expects three return values.
| return x_main + x_shortcut | |
| return x_main + x_shortcut, feat_cache, feat_idx |
|
|
||
|
|
||
| def load_model(model_class, path, config=None, torch_dtype=torch.bfloat16, device="cpu", state_dict_converter=None, use_disk_map=False, module_map=None, vram_config=None, vram_limit=None): | ||
| def load_model(model_class, path, config=None, torch_dtype=torch.bfloat16, device="cpu", state_dict_converter=None, use_disk_map=False, module_map=None, vram_config=None, vram_limit=None, state_dict=None): |
There was a problem hiding this comment.
The state_dict parameter is added to the function signature but it appears to be unused. It gets unconditionally overwritten later in the function (e.g., on lines 39, 41, 46, 48) without its initial value ever being checked. If the intention is to allow passing a pre-loaded state dictionary, the logic should be updated to use this parameter when it's provided. Otherwise, it should be removed to avoid confusion.
No description provided.