--- license: apache-2.0 base_model: Tongyi-MAI/Z-Image-Turbo tags: - lokr - lora - z-image - repro --- # Z-Image LoKr — diffusers loading repro **Random weights — not a functional adapter.** This file reproduces the key layout of a real Z-Image LoKr trained with an ai-toolkit/LyCORIS-style trainer (ComfyUI `diffusion_model.` key format), for reproducing https://github.com/huggingface/diffusers/issues/13221. `ZImagePipeline.load_lora_weights` / `lora_state_dict` fails on it with `ValueError: state_dict should be empty at this point` because `_convert_non_diffusers_z_image_lora_to_diffusers` has no handling for `lokr_w1` / `lokr_w2` keys. ```python from diffusers import ZImagePipeline from huggingface_hub import hf_hub_download path = hf_hub_download("scenario-labs/z-image-lokr-repro", "zimage_lokr_dummy.safetensors") ZImagePipeline.lora_state_dict(path) # raises ValueError on diffusers <= 0.39 / main ``` ## Layout (612 tensors, 30 layers) Mixed LoKr + plain LoRA: | module | format | layers | shapes | | --- | --- | --- | --- | | `attention.to_q/k/v` | LoKr | all 30 | `lokr_w1 [4,4]`, `lokr_w2 [960,960]`, scalar `alpha` | | `adaLN_modulation.0` | LoKr | all 30 | `lokr_w1 [4,4]`, `lokr_w2 [3840,64]`, scalar `alpha` | | `attention.to_out.0` | LoRA | 0–17 | `lora_A [32,3840]`, `lora_B [3840,32]` | | `attention.to_out.0` | LoKr | 18–29 | `lokr_w1 [4,4]`, `lokr_w2 [960,960]`, scalar `alpha` | | `feed_forward.w1/w2/w3` | LoRA | all 30 | rank 32 | The same file loads fine in current ComfyUI (which fuses `to_q/k/v` into `attention.qkv` and supports LoKr via `comfy/weight_adapter/lokr.py`).