[wip] sync with upstream zImage #17822
Conversation
Summary of ChangesHello @yhyang201, 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 synchronizes the Z-Image model integration with its upstream source by introducing distinct configurations for 'Turbo' and standard Z-Image models. It enhances the Z-Image pipeline with negative conditioning capabilities and refactors sampling parameters to provide separate defaults for each model variant, ensuring accurate model detection and configuration within the system. 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.
Code Review
This pull request introduces a new prepare_neg_cond_kwargs method in zimage.py and refactors sampling parameters in sample/zimage.py to distinguish between 'Turbo' and standard ZImage models. The changes in registry.py correctly reflect these new configurations. However, there is a critical issue in the prepare_neg_cond_kwargs method where positive prompt embeddings are used instead of negative ones, which will lead to incorrect model behavior. Additionally, the default negative prompt for the new ZImageSamplingParams could be clarified.
| def prepare_neg_cond_kwargs(self, batch, device, rotary_emb, dtype): | ||
| return { | ||
| "freqs_cis": self.get_freqs_cis( | ||
| batch.prompt_embeds[0], |
There was a problem hiding this comment.
The prepare_neg_cond_kwargs method is intended for negative conditioning, but it currently uses batch.prompt_embeds[0] to generate freqs_cis. This should be batch.negative_prompt_embeds[0] to correctly apply negative conditioning. Using positive prompt embeddings here will lead to incorrect model behavior and potentially degraded generation quality.
| batch.prompt_embeds[0], | |
| batch.negative_prompt_embeds[0], |
| num_inference_steps: int = 50 | ||
|
|
||
| num_frames: int = 1 | ||
| negative_prompt: str = " " |
There was a problem hiding this comment.
The negative_prompt for ZImageSamplingParams is set to a single space " ". This deviates significantly from the detailed default negative prompt in the base SamplingParams class. If the intention is to effectively disable negative prompting or use a minimal one, consider using None or an empty string "" for clarity, or add a comment explaining why a single space is specifically required for this model.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
| hf_model_paths=[ | ||
| "Tongyi-MAI/Z-Image", | ||
| ], | ||
| model_detectors=[ |
There was a problem hiding this comment.
could it works without these two model_detectors lines?
- fix CI formatting issues - bump torchada version - revert incorrect changes Signed-off-by: yafeng.li <yafeng.li@mthreads.com> [diffusion] model: sync with upstream z-Image (sgl-project#17822)
Motivation
Modifications
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci