Nodes/ComfyUI-Zlycoris/Load LoRA (Z-Image Qwen TE)
ComfyUI Node

Load LoRA (Z-Image Qwen TE)

Make ai-toolkit text-encoder LoRAs actually stick to Qwen

By TripleHeadedMonkey·Created 7 months ago·Updated 7 months ago· 4
Load LoRA (Z-Image Qwen TE)
  • model
  • clip
  • MODEL
  • CLIP
lora_name
strength_model1.00
strength_clip1.00

If you've trained a Z-Image LoRA with Ostris's AI Toolkit, you've seen this failure: the adapter loads, the diffusion part works, and the text-encoder part silently does nothing. That's because AI Toolkit saves text-encoder LoRA weights with lora_te.model.layers... keys, while ComfyUI's Qwen encoder stores them as qwen3_4b.transformer.model.layers.... Different keys, same weights, and stock Load LoRA can't bridge the gap. This node exists purely to bridge it.

What it does

ZImageQwenTELoRALoader takes a normal MODEL and CLIP (the ComfyUI-native kind - you can wire it straight after your regular loaders), plus a LoRA from models/loras/, and splits the LoRA's state dict in two:

  1. The non-TE part (the diffusion/transformer weights) gets applied through ComfyUI's standard load_lora_for_models path, exactly like a normal loader.
  2. The lora_te.* part gets mapped onto the actual Qwen weights inside the CLIP's cond_stage_model. The node infers the Qwen key prefix from the live state dict, builds a lora_te.<path>qwen3_4b.transformer.<path> map, and applies it as patches on the CLIP wrapper. Keys with no match - like an lm_head that doesn't exist in the encoder - are skipped naturally.

It's Load LoRA, but with a translator for the text-encoder side.

The inputs that matter

  • model (MODEL), clip (CLIP) - your loaded Z-Image transformer and Qwen encoder.
  • lora_name - dropdown from models/loras/.
  • strength_model / strength_clip - default 1.0, range ±20. The TE strength is what the lora_te part gets; the model strength governs the diffusion half.

Outputs are MODEL and CLIP, ready for the sampler. The node clones the CLIP before patching, so it doesn't corrupt the original.

Why this matters for Z-Image

Z-Image's encoder is Qwen3-4B, and 4B is a real chunk of the model. TE LoRAs let you bend prompting behavior, style token interpretation, or bilingual handling without touching the diffusion weights. But every one of those LoRAs coming out of AI Toolkit (the standard trainer here - it had Z-Image Turbo support two days after release) hits the key-mismatch wall. This node is the removal of that wall. It's also a good example of the pack's general philosophy: it's not inventing new training, it's fixing the plumbing so what you already trained works.

Install

ComfyUI Manager (search ComfyUI-Zlycoris) or:

cd ComfyUI/custom_nodes
git clone https://github.com/TripleHeadedMonkey/ComfyUI-Zlycoris.git

Restart ComfyUI. Heavy first-install dependency list (transformers, diffusers, optimum, lycoris, ...) but no model files to fetch - bring your own LoRA.

Where people get burned

  • It needs a real Qwen encoder with .transformer.model.layers keys. If the node can't infer the prefix from the state dict, it raises a "Could not infer Qwen prefix" error. That happens when your CLIP isn't actually the Qwen3 TE - so check your text encoder loader before blaming the node.
  • TE failure is non-fatal. The diffusion half applies first; if the TE patch throws, it logs and keeps going. You get a model where the LoRA half-applied, which looks like "the LoRA is weak" when it's actually "the TE half died." Watch the console.
  • The strength_clip slider governs only the TE part - it's easy to crank the model strength and wonder why your style tweak didn't move. They're independent; check both.
  • If your LoRA wasn't trained by AI Toolkit with lora_te keys, this node has nothing to translate, and it'll behave like a normal loader. DiffSynth LoRAs need ZImageDiffSynthLoader; raw LyCORIS files need ZImageLoaderAndPatcher.
Categoryloaders

Inputs (5)

NameTypeDefaultDescription
modelMODEL
clipCLIP
lora_nameCOMBO0 options:
strength_modelFLOAT1.00-20–20
strength_clipFLOAT1.00-20–20

Outputs (2)

NameTypeDescription
MODELMODEL
CLIPCLIP