Skip to content

Conversation

@qzzz95
Copy link
Contributor

@qzzz95 qzzz95 commented Nov 13, 2025

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @qzzz95, 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 refines the Video Sparse Attention (VSA) integration and the WAN video pipeline by addressing dependency management, enhancing error handling for external packages, and improving the robustness of model weight updates. The changes ensure smoother operation, clearer error messages for missing dependencies, and more flexible handling of different model configurations during weight loading.

Highlights

  • Lazy Imports for Parallel Utilities: The get_sp_ulysses_group and get_sp_ring_world_size functions in video_sparse_attention.py are now lazy-loaded to prevent circular import issues, improving module dependency management.
  • Robust VSA Import and Error Handling: The import of vsa_core now includes a try-except block to gracefully handle cases where the vsa package or its dependencies are not fully installed. A clear RuntimeError is raised if video_sparse_attn is called when vsa_core is unavailable.
  • Lazy Import for get_vsa_kwargs: The get_vsa_kwargs function in pipelines/base.py is now lazy-imported within the get_attn_kwargs method, optimizing dependency loading only when Video Sparse Attention parameters are in use.
  • Safe State Dictionary Access: A has_any_key check was added in wan_video.py before accessing model_state_dict["patch_embedding.weight"] to prevent KeyError exceptions when the key might not be present.
  • New update_weights Method: A dedicated update_weights method has been introduced in wan_video.py to handle updating model components (DIT, DIT2, text encoder, VAE, image encoder) with robust checks for single vs. dual model configurations, preventing mismatches during weight loading.
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
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 introduces several fixes and improvements to the WAN pipeline. It resolves circular dependency issues by using lazy imports, makes the optional vsa dependency handling more robust with try-except blocks and runtime checks, and adds a new update_weights method to WanVideoPipeline for more flexible model weight loading. I've suggested one improvement to make the exception handling more specific.

@qzzz95 qzzz95 changed the title Dev/qz/fix wan pipeline Fix circular dependence Nov 13, 2025
@akaitsuki-ii akaitsuki-ii merged commit e3cf908 into main Nov 14, 2025
@akaitsuki-ii akaitsuki-ii deleted the dev/qz/fix_wan_pipeline branch November 14, 2025 08:28
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