-
Notifications
You must be signed in to change notification settings - Fork 1.1k
qwen-image-edit-2511-lightning #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @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 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. 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.
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.
| 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"), | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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), | |
| ], |
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.