[Diffusion][Feat] support LoKr #21214
Conversation
Signed-off-by: Lancer <maruixiang6688@gmail.com>
Summary of ChangesHello, 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 integrates support for LoKr (Low-Rank Kronecker Product) adapters into the SGLang framework, specifically for diffusion models. The primary goal is to enable the use of this efficient fine-tuning method, which differs from standard LoRA by performing permanent merges of weights. The changes include robust detection and conversion of LoKr state dictionaries, a new mechanism for applying these merged weights, and safeguards to prevent incompatible mixing of LoKr and traditional LoRA on model layers. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for LoKr adapters in the diffusion model pipeline. The changes are well-structured, adding detection, conversion, and application logic for LoKr weights, including support for distributed environments. The implementation is robust, with checks for mixing adapter types and handling permanent merges. I have one suggestion to improve code clarity and follow PyTorch idioms more closely.
|
/tag-and-rerun-ci |
|
@mickqian PTAL |
Motivation
**[03-23 20:38:54] Rank 0: LoRA adapter(s)Tongyi-MAI/z-image-turbo-flow-dpo applied to 0 layers (targets: all, strengths: 1.00)**Add LoKr (Low-Rank Kronecker Product) adapter support for diffusion models in SGLang.
**[03-23 23:30:49] Rank 0: LoRA adapter(s) Tongyi-MAI/z-image-turbo-flow-dpo applied to 180 layers (targets: all, strengths: 1.00)**Modifications
Accuracy Tests
Prompt 1:
A professional realistic photograph of a woman standing by a window, golden hour lighting, cinematic shadows, highly detailed, 8k resolution
Prompt 2:
woman, Asian ethnicity, white dress, looking away, long hair, outdoor setting, building facade, plants, serene expression, elegance, side profile, standing, daylight, soft focus, pastel colors, fashion, youthful, casual elegance, architectural elements, natural light, tassel detail on dress
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci