Skip to content

Conversation

@gushiqiao
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gushiqiao, 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 introduces comprehensive support for the Wan2.2-VACE-Fun-A14B model, a new iteration of the Video Appearance Change Editing (VACE) system. The changes primarily focus on integrating the model's specific configurations, enhancing its inference pipeline with sequence parallelism capabilities, and refining the overall model loading and execution infrastructure. This enables more efficient and robust operation of the VACE model, particularly in distributed environments, and updates the input requirements for the VACE task.

Highlights

  • New Model Configuration Files: Added six new JSON configuration files under configs/wan22_vace/a800/ for the Wan2.2-VACE-Fun-A14B model, supporting BF16 and INT8 precision, as well as configurations for parallel processing (cfg_parallel and cfg_sp_parallel).
  • Improved State Dict Loading Robustness: Modified lightx2v/common/ops/utils.py to gracefully handle cases where an expected attribute (actual_name) might not be present in the destination dictionary during state dict loading, preventing potential key errors.
  • New Runner Registration and Model Loading Enhancements: Registered the new wan2.2_moe_vace runner in lightx2v/infer.py and updated lightx2v/models/runners/wan/wan_runner.py to include FileNotFoundError checks for high and low noise model paths, improving model loading reliability. The WanVaceRunner and the new Wan22MoeVaceRunner now support LoRA configurations during model loading.
  • VACE Inference Logic Updates: Updated lightx2v/models/networks/wan/infer/causvid/transformer_infer.py and lightx2v/models/networks/wan/infer/vace/transformer_infer.py to ensure get_scheduler_values() and reset_infer_states() are called at the start of the infer method. Crucially, transformer_infer.py now includes logic to chunk the VACE context (c) for sequence parallelism, ensuring proper data distribution across parallel processes.
  • VACE Model Parallelism Integration: Integrated sequence parallelism pre- and post-processing steps into lightx2v/models/networks/wan/vace_model.py's _infer_cond_uncond method, allowing the VACE model to leverage distributed inference more effectively. The WanVaceModel constructor now accepts a model_type argument.
  • Updated VACE Task Argument Validation: Changed the required argument for the vace task in lightx2v/utils/utils.py from --src_video to --src_ref_images, aligning with the model's input requirements.
  • New Execution Scripts: Added run_wan22_moe_vace.sh and run_wan22_moe_vace_dist.sh scripts to demonstrate how to run the new wan2.2_moe_vace model in both single-node and distributed configurations.

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

@gushiqiao gushiqiao merged commit fae7b74 into main Jan 29, 2026
2 checks passed
@gushiqiao gushiqiao deleted the gsq/vace branch January 29, 2026 05:24
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 adds support for the Wan2.2-VACE-Fun-A14B model, including new configuration files, a new runner class Wan22MoeVaceRunner, and example run scripts. The changes also include several correctness and robustness improvements, such as better handling of missing weights, ensuring proper state initialization during inference, and adding support for sequence parallelism in VACE models.

My review focuses on a few key areas:

  • I've identified a critical issue in the newly added shell scripts where a trailing backslash will cause them to fail.
  • I've also pointed out an opportunity to refactor duplicated code for model path resolution to improve maintainability.

Overall, the changes are well-structured and add significant new functionality. Addressing the identified issues will improve the quality and robustness of the code.

--negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--src_video /path/to/post+depth.mp4 \
--src_ref_images /path/to/image.png \
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_vace.mp4\
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

There is a trailing backslash (\) at the end of this line. In a shell script, this escapes the newline character, causing the shell to expect more of the command on the next line. Since there is no next line for this command, it will likely result in a syntax error or hang, preventing the script from running correctly. Please remove the trailing backslash.

Suggested change
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_vace.mp4\
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_vace.mp4

--negative_prompt "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走" \
--src_video /path/to/post+depth.mp4 \
--src_ref_images /path/to/image.png \
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_vace_cfg_parallel.mp4\
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

Similar to the other script, there is a trailing backslash (\) at the end of this line. This will cause a syntax error because it escapes the newline and the shell expects more input for the torchrun command. Please remove the trailing backslash to fix the script.

Suggested change
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_vace_cfg_parallel.mp4\
--save_result_path ${lightx2v_path}/save_results/output_lightx2v_wan22_moe_vace_cfg_parallel.mp4

Comment on lines +199 to +216
super().__init__(config)
if self.config.get("dit_quantized", False) and self.config.get("high_noise_quantized_ckpt", None):
self.high_noise_model_path = self.config["high_noise_quantized_ckpt"]
elif self.config.get("high_noise_original_ckpt", None):
self.high_noise_model_path = self.config["high_noise_original_ckpt"]
else:
self.high_noise_model_path = os.path.join(self.config["model_path"], "high_noise_model")
if not os.path.isdir(self.high_noise_model_path):
raise FileNotFoundError(f"High Noise Model does not find")

if self.config.get("dit_quantized", False) and self.config.get("low_noise_quantized_ckpt", None):
self.low_noise_model_path = self.config["low_noise_quantized_ckpt"]
elif not self.config.get("dit_quantized", False) and self.config.get("low_noise_original_ckpt", None):
self.low_noise_model_path = self.config["low_noise_original_ckpt"]
else:
self.low_noise_model_path = os.path.join(self.config["model_path"], "low_noise_model")
if not os.path.isdir(self.low_noise_model_path):
raise FileNotFoundError(f"Low Noise Model does not find")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The logic for resolving high and low noise model paths in this __init__ method is identical to the one in Wan22MoeRunner. This code duplication can lead to maintenance issues.

To improve this, you could extract the common logic into a mixin class within lightx2v/models/runners/wan/wan_runner.py and have both Wan22MoeRunner and Wan22MoeVaceRunner inherit from it.

Example of a mixin in wan_runner.py:

class Wan22MoePathResolverMixin:
    def _resolve_moe_paths(self):
        if self.config.get("dit_quantized", False) and self.config.get("high_noise_quantized_ckpt", None):
            self.high_noise_model_path = self.config["high_noise_quantized_ckpt"]
        # ... rest of the logic for high_noise_model_path
        # ... and for low_noise_model_path

Then, you could update Wan22MoeRunner and Wan22MoeVaceRunner to use it:

# In wan_runner.py
class Wan22MoeRunner(WanRunner, Wan22MoePathResolverMixin):
    def __init__(self, config):
        super().__init__(config)
        self._resolve_moe_paths()

# In wan_vace_runner.py
class Wan22MoeVaceRunner(WanVaceRunner, Wan22MoePathResolverMixin):
    def __init__(self, config):
        super().__init__(config)
        self._resolve_moe_paths()

This would centralize the path resolution logic, making it easier to maintain.

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