Skip to content

Conversation

@lzws
Copy link
Collaborator

@lzws lzws commented Jan 30, 2026

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @lzws, 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 and integrates the Qwen-Image-Edit-2511-Lightning model, enhancing the image editing pipeline with a new, optimized flow-matching scheduler. The changes include updating documentation to reflect the new model and providing practical Python examples for its inference, catering to both standard and low VRAM setups, ensuring users can easily leverage its capabilities.

Highlights

  • New Model Integration: Integrated the lightx2v/Qwen-Image-Edit-2511-Lightning model, expanding the available image editing capabilities.
  • Specialized Timestep Scheduler: Introduced a new set_timesteps_qwen_image_lightning method within the FlowMatchScheduler to support the specific timestep scheduling requirements of the new Lightning model, potentially enabling faster or more efficient inference.
  • Comprehensive Documentation and Examples: Updated README.md and docs/ files to include the new model. Added dedicated inference examples for both standard and low VRAM environments, demonstrating how to use the Qwen-Image-Edit-2511-Lightning model with its LoRA adapter and specialized scheduler.

🧠 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
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 support for the Qwen-Image-Edit-2511-Lightning model. This includes adding a new FlowMatchScheduler template, implementing the corresponding timestep logic, and providing new example inference scripts for both standard and low VRAM environments. The documentation in README.md and model detail files has also been updated to reflect these additions.

My review identifies a critical issue in the low VRAM example script where the low VRAM configuration is defined but not applied, which would prevent it from running in the intended mode. I've also suggested a few minor refactorings to improve code clarity and maintainability in the new scheduler logic and the example scripts. Overall, the changes are a good addition, and after addressing the critical issue, this PR should be ready to merge.

Comment on lines +19 to +23
model_configs=[
ModelConfig(model_id="Qwen/Qwen-Image-Edit-2511", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors"),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors"),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),
],
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The vram_config dictionary is defined but never used. To enable low VRAM optimizations, you need to pass this configuration to each ModelConfig instance. Without this, the script will not run in low VRAM mode as intended.

Suggested change
model_configs=[
ModelConfig(model_id="Qwen/Qwen-Image-Edit-2511", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors"),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors"),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),
],
model_configs=[
ModelConfig(model_id="Qwen/Qwen-Image-Edit-2511", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors", **vram_config),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors", **vram_config),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors", **vram_config),
],

Comment on lines +79 to +90
base_shift = math.log(3)
max_shift = math.log(3)
# Sigmas
sigma_start = sigma_min + (sigma_max - sigma_min) * denoising_strength
sigmas = torch.linspace(sigma_start, sigma_min, num_inference_steps + 1)[:-1]
# Mu
if exponential_shift_mu is not None:
mu = exponential_shift_mu
elif dynamic_shift_len is not None:
mu = FlowMatchScheduler._calculate_shift_qwen_image(dynamic_shift_len, base_shift=base_shift, max_shift=max_shift)
else:
mu = 0.8
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 calculation for mu when dynamic_shift_len is provided can be simplified. Since base_shift and max_shift are both math.log(3), the call to _calculate_shift_qwen_image will always return math.log(3). You can directly assign this value to mu and remove the now-unused base_shift and max_shift variables for better readability and maintainability.

        # Sigmas
        sigma_start = sigma_min + (sigma_max - sigma_min) * denoising_strength
        sigmas = torch.linspace(sigma_start, sigma_min, num_inference_steps + 1)[:-1]
        # Mu
        if exponential_shift_mu is not None:
            mu = exponential_shift_mu
        elif dynamic_shift_len is not None:
            mu = math.log(3)
        else:
            mu = 0.8

model_id="lightx2v/Qwen-Image-Edit-2511-Lightning",
origin_file_pattern="Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors"
)
pipe.load_lora(pipe.dit, lora, alpha=8/64)
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 LoRA alpha value is calculated as 8/64. While correct, using a simplified fraction 1/8 or the direct float value 0.125 would be clearer and avoid an unnecessary division operation.

Suggested change
pipe.load_lora(pipe.dit, lora, alpha=8/64)
pipe.load_lora(pipe.dit, lora, alpha=0.125)

model_id="lightx2v/Qwen-Image-Edit-2511-Lightning",
origin_file_pattern="Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors"
)
pipe.load_lora(pipe.dit, lora, alpha=8/64)
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 LoRA alpha value is calculated as 8/64. While correct, using a simplified fraction 1/8 or the direct float value 0.125 would be clearer and avoid an unnecessary division operation.

Suggested change
pipe.load_lora(pipe.dit, lora, alpha=8/64)
pipe.load_lora(pipe.dit, lora, alpha=0.125)

@Artiprocher Artiprocher merged commit 5f1d5ad into modelscope:main Feb 2, 2026
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.

2 participants