Skip to content

Commit 0ad58f9

Browse files
committed
Detect qwen image loras
1 parent 40b44ea commit 0ad58f9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docs/Model Support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ Parameters and usage is the same as any other normal model.
430430
- Or, for limited memory space, GGUF versions <https://huggingface.co/city96/Qwen-Image-gguf/tree/main>
431431
- Or a distilled version here <https://huggingface.co/Comfy-Org/Qwen-Image_ComfyUI/blob/main/non_official/diffusion_models/qwen_image_distill_full_fp8_e4m3fn.safetensors>
432432
- This uses CFG=1, Steps=15 or so.
433+
- There's also a "Lightning" lora <https://huggingface.co/lightx2v/Qwen-Image-Lightning/blob/main/Qwen-Image-Lightning-8steps-V1.0.safetensors> for the base model, CFG=1 Steps=8
433434
- Save it to `diffusion_models`
434435
- The text encoder is Qwen 2.5 VL 7B (LLM), and will be automatically downloaded.
435436
- It has its own VAE, and will be automatically downloaded.

src/Text2Image/T2IModelClassSorter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ bool isFluxLora(JObject h)
105105
bool isChroma(JObject h) => h.ContainsKey("distilled_guidance_layer.in_proj.bias") && h.ContainsKey("double_blocks.0.img_attn.proj.bias");
106106
bool isOmniGen(JObject h) => h.ContainsKey("time_caption_embed.timestep_embedder.linear_2.weight") && h.ContainsKey("context_refiner.0.attn.norm_k.weight");
107107
bool isQwenImage(JObject h) => h.ContainsKey("time_text_embed.timestep_embedder.linear_1.bias");
108+
bool isQwenImageLora(JObject h) => h.ContainsKey("transformer_blocks.0.attn.add_k_proj.lora_down.weight") && h.ContainsKey("transformer_blocks.0.img_mlp.net.0.proj.lora_down.weight");
108109
// ====================== Stable Diffusion v1 ======================
109110
Register(new() { ID = "stable-diffusion-v1", CompatClass = "stable-diffusion-v1", Name = "Stable Diffusion v1", StandardWidth = 512, StandardHeight = 512, IsThisModelOfClass = (m, h) =>
110111
{
@@ -485,6 +486,10 @@ JToken GetEmbeddingKey(JObject h)
485486
{
486487
return false; // TODO?
487488
}});
489+
Register(new() { ID = "qwen-image/lora", CompatClass = "qwen-image", Name = "Qwen Image LoRA", StandardWidth = 1328, StandardHeight = 1328, IsThisModelOfClass = (m, h) =>
490+
{
491+
return isQwenImageLora(h);
492+
}});
488493
// ====================== Everything below this point does not autodetect, it must match through ModelSpec or be manually set ======================
489494
// General Stable Diffusion variants
490495
Register(new() { ID = "stable-diffusion-v1/vae", CompatClass = "stable-diffusion-v1", Name = "Stable Diffusion v1 VAE", StandardWidth = 512, StandardHeight = 512, IsThisModelOfClass = (m, h) => { return false; } });

0 commit comments

Comments
 (0)