Skip to content

[Bug] LoRA getting loaded four times in a row with z-image-turbo. #1071

@lastrosade

Description

@lastrosade

Git commit

0392273

Operating System & Version

Windows 11

GGML backends

HIP

Command-line arguments used

-t 6 --diffusion-model "\Models\checkpoints\z-image\z_image_turbo.q8_0.gguf" --llm "\Models\text_encoders\Qwen3-4B-Instruct-2507.q8_0.gguf" --vae "\Models\vae\flux_ae.safetensors" --embd-dir "\Models\embeddings" --lora-model-dir "\Models\LoRa" -o "\1765311742.png" -p "lora:z-image\characters\ShadowheartZIT_byKonan:1 Shadowheart, ultra realistic photo of an elf with black hair, a ponytail and green eyes. She is wearing a circlet and a dark dress with white patterns. She is standing in a forest." -n ", text, english text, web adress, censored, patreon username, multiple views" --cfg-scale 1 --scheduler discrete --sampling-method euler --steps 20 -H 1536 -W 832 --seed 1765311742 -b 1 --clip-skip 0 --easycache 0.2,0.15,0.95 --diffusion-fa --color --verbose

Steps to reproduce

Load a LoRA, with any z-image-turbo models.

What you expected to happen

The LoRA gets loaded one time.

What actually happened

The LoRA gets loaded four times.

Logs / error messages / stack trace

Full log
    mode: img_gen,
  output_path: "<redacted>\1765311843_Z-Image-Turbo_none_832x1536_1765311843.png",
  verbose: true,
  color: true,
  canny_preprocess: false,
  preview_method: none,
  preview_interval: 1,
  preview_path: "preview.png",
  preview_fps: 16,
  taesd_preview: false,
  preview_noisy: false
}
SDContextParams {
  n_threads: 6,
  model_path: "",
  clip_l_path: "",
  clip_g_path: "",
  clip_vision_path: "",
  t5xxl_path: "",
  llm_path: "<redacted>\Models\text_encoders\Qwen3-4B-Instruct-2507.q8_0.gguf",
  llm_vision_path: "",
  diffusion_model_path: "<redacted>\Models\checkpoints\z-image\z_image_turbo.q8_0.gguf",
  high_noise_diffusion_model_path: "",
  vae_path: "<redacted>\Models\vae\flux_ae.safetensors",
  taesd_path: "",
  esrgan_path: "",
  control_net_path: "",
  embedding_dir: "<redacted>\Models\embeddings",
  wtype: NONE,
  tensor_type_rules: "",
  lora_model_dir: "<redacted>\Models\LoRa",
  photo_maker_path: "",
  rng_type: cuda,
  sampler_rng_type: NONE,
  flow_shift: INF
  offload_params_to_cpu: false,
  control_net_cpu: false,
  clip_on_cpu: false,
  vae_on_cpu: false,
  diffusion_flash_attn: true,
  diffusion_conv_direct: false,
  vae_conv_direct: false,
  chroma_use_dit_mask: true,
  chroma_use_t5_mask: false,
  chroma_t5_mask_pad: 1,
  prediction: NONE,
  lora_apply_mode: auto,
  vae_tiling_params: { 0, 0, 0, 0.5, 0, 0 },
  force_sdxl_vae_conv_scale: false
}
SDGenerationParams {
  prompt: "<lora:z-image\characters\ShadowheartZIT_byKonan:1> Shadowheart, ultra realistic photo of an elf with black hair, a ponytail and green eyes. She is wearing a circlet and a dark dress with white patterns. She is standing in a forest.",
  negative_prompt: ", text, english text, web adress, censored, patreon username, multiple views",
  clip_skip: 0,
  width: 832,
  height: 1536,
  batch_count: 1,
  init_image_path: "",
  end_image_path: "",
  mask_image_path: "",
  control_image_path: "",
  ref_image_paths: [],
  control_video_path: "",
  auto_resize_ref_image: true,
  increase_ref_index: false,
  pm_id_images_dir: "",
  pm_id_embed_path: "",
  pm_style_strength: 20,
  skip_layers: [7, 8, 9],
  sample_params: (txt_cfg: 1.00, img_cfg: 1.00, distilled_guidance: 3.50, slg.layer_count: 3, slg.layer_start: 0.01, slg.layer_end: 0.20, slg.scale: 0.00, scheduler: discrete, sample_method: euler, sample_steps: 20, eta: 0.00, shifted_timestep: 0),
  high_noise_skip_layers: [7, 8, 9],
  high_noise_sample_params: (txt_cfg: 7.00, img_cfg: 7.00, distilled_guidance: 3.50, slg.layer_count: 3, slg.layer_start: 0.01, slg.layer_end: 0.20, slg.scale: 0.00, scheduler: NONE,
sample_method: NONE, sample_steps: 20, eta: 0.00, shifted_timestep: 0),
  easycache_option: "0.2,0.15,0.95",
  easycache: enabled (threshold=0.2, start=0.15, end=0.95),
  moe_boundary: 0.875,
  video_frames: 1,
  fps: 16,
  vace_strength: 1,
  strength: 0.75,
  control_strength: 0.9,
  seed: 1765311843,
  upscale_repeats: 1,
}
[DEBUG] stable-diffusion.cpp:160  - Using CUDA backend
[INFO ] stable-diffusion.cpp\ggml_extend.hpp:69   - ggml_cuda_init: GGML_CUDA_FORCE_MMQ:    no
[INFO ] stable-diffusion.cpp\ggml_extend.hpp:69   - ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
[INFO ] stable-diffusion.cpp\ggml_extend.hpp:69   - ggml_cuda_init: found 1 ROCm devices:
[INFO ] stable-diffusion.cpp\ggml_extend.hpp:69   -   Device 0: AMD Radeon RX 7900 XT, gfx1100 (0x1100), VMM: no, Wave Size: 32
[INFO ] stable-diffusion.cpp:235  - loading diffusion model from '<redacted>\Models\checkpoints\z-image\z_image_turbo.q8_0.gguf'
[INFO ] model.cpp:370  - load <redacted>\Models\checkpoints\z-image\z_image_turbo.q8_0.gguf using gguf format
[DEBUG] model.cpp:412  - init from '<redacted>\Models\checkpoints\z-image\z_image_turbo.q8_0.gguf'
[INFO ] stable-diffusion.cpp:282  - loading llm from '<redacted>\Models\text_encoders\Qwen3-4B-Instruct-2507.q8_0.gguf'
[INFO ] model.cpp:370  - load <redacted>\Models\text_encoders\Qwen3-4B-Instruct-2507.q8_0.gguf using gguf format
[DEBUG] model.cpp:412  - init from '<redacted>\Models\text_encoders\Qwen3-4B-Instruct-2507.q8_0.gguf'
[INFO ] stable-diffusion.cpp:296  - loading vae from '<redacted>\Models\vae\flux_ae.safetensors'
[INFO ] model.cpp:373  - load <redacted>\Models\vae\flux_ae.safetensors using safetensors format
[DEBUG] model.cpp:503  - init from '<redacted>\Models\vae\flux_ae.safetensors', prefix = 'vae.'
[INFO ] stable-diffusion.cpp:312  - Version: Z-Image
[INFO ] stable-diffusion.cpp:340  - Weight type stat:                      f32: 640  |    q8_0: 455
[INFO ] stable-diffusion.cpp:341  - Conditioner weight type stat:          f32: 145  |    q8_0: 253
[INFO ] stable-diffusion.cpp:342  - Diffusion model weight type stat:      f32: 251  |    q8_0: 202
[INFO ] stable-diffusion.cpp:343  - VAE weight type stat:                  f32: 244
[DEBUG] stable-diffusion.cpp:345  - ggml tensor size = 400 bytes
[DEBUG] stable-diffusion.cpp\llm.hpp:285  - merges size 151387
[DEBUG] stable-diffusion.cpp\llm.hpp:317  - vocab size: 151669
[DEBUG] stable-diffusion.cpp\llm.hpp:1134 - llm: num_layers = 36, vocab_size = 151936, hidden_size = 2560, intermediate_size = 9728
[INFO ] stable-diffusion.cpp:536  - Using flash attention in the diffusion model
[DEBUG] stable-diffusion.cpp\ggml_extend.hpp:1883 - qwen3 params backend buffer size =  4076.43 MB(VRAM) (398 tensors)
[DEBUG] stable-diffusion.cpp\ggml_extend.hpp:1883 - z_image params backend buffer size =  6272.77 MB(VRAM) (453 tensors)
[DEBUG] stable-diffusion.cpp\ggml_extend.hpp:1883 - vae params backend buffer size =  94.57 MB(VRAM) (138 tensors)
[DEBUG] stable-diffusion.cpp:684  - loading weights
[DEBUG] model.cpp:1351 - using 6 threads for model loading
[DEBUG] model.cpp:1373 - loading tensors from <redacted>\Models\checkpoints\z-image\z_image_turbo.q8_0.gguf
  |====================>                             | 453/1095 - 105.94it/s
[DEBUG] model.cpp:1373 - loading tensors from <redacted>\Models\text_encoders\Qwen3-4B-Instruct-2507.q8_0.gguf
  |======================================>           | 851/1095 - 116.23it/s
[DEBUG] model.cpp:1373 - loading tensors from <redacted>\Models\vae\flux_ae.safetensors
  |==================================================| 1095/1095 - 145.23it/s
[INFO ] model.cpp:1580 - loading tensors completed, taking 7.55s (process: 0.00s, read: 5.24s, memcpy: 0.00s, convert: 0.02s, copy_to_backend: 1.49s)
[DEBUG] stable-diffusion.cpp:716  - finished loaded file
[INFO ] stable-diffusion.cpp:788  - total params memory size = 10443.77MB (VRAM 10443.77MB, RAM 0.00MB): text_encoders 4076.43MB(VRAM), diffusion_model 6272.77MB(VRAM), vae 94.57MB(VRAM), controlnet 0.00MB(VRAM), pmid 0.00MB(VRAM)
[INFO ] stable-diffusion.cpp:856  - running in FLOW mode
[DEBUG] stable-diffusion.cpp:3152 - generate_image 832x1536
[INFO ] stable-diffusion.cpp:3183 - sampling using Euler method
[INFO ] stable-diffusion.cpp\denoiser.hpp:364  - get_sigmas with discrete scheduler
[INFO ] stable-diffusion.cpp:3296 - TXT2IMG
[DEBUG] stable-diffusion.cpp:1147 - lora z-image\characters\ShadowheartZIT_byKonan:1.00
[INFO ] stable-diffusion.cpp:1016 - apply lora at runtime
[INFO ] model.cpp:373  - load <redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors using safetensors format
[DEBUG] model.cpp:503  - init from '<redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors', prefix = 'lora.'
[INFO ] stable-diffusion.cpp\lora.hpp:40   - loading LoRA from '<redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors'
[DEBUG] model.cpp:1351 - using 6 threads for model loading
[DEBUG] model.cpp:1373 - loading tensors from <redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors
  |==================================================| 480/480 - 2242.99it/s
[INFO ] model.cpp:1580 - loading tensors completed, taking 0.22s (process: 0.00s, read: 0.00s, memcpy: 0.00s, convert: 0.00s, copy_to_backend: 0.00s)
[INFO ] model.cpp:373  - load <redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors using safetensors format
[DEBUG] model.cpp:503  - init from '<redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors', prefix = 'lora.'
[INFO ] stable-diffusion.cpp\lora.hpp:40   - loading LoRA from '<redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors'
[DEBUG] model.cpp:1351 - using 6 threads for model loading
[DEBUG] model.cpp:1373 - loading tensors from <redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors
  |==================================================| 480/480 - 2388.06it/s
[INFO ] model.cpp:1580 - loading tensors completed, taking 0.20s (process: 0.00s, read: 0.00s, memcpy: 0.00s, convert: 0.00s, copy_to_backend: 0.00s)
[DEBUG] stable-diffusion.cpp\ggml_extend.hpp:1883 - lora params backend buffer size =  162.19 MB(VRAM) (480 tensors)
[DEBUG] model.cpp:1351 - using 6 threads for model loading
[DEBUG] model.cpp:1373 - loading tensors from <redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors
  |==================================================| 480/480 - 2296.65it/s
[INFO ] model.cpp:1580 - loading tensors completed, taking 0.21s (process: 0.00s, read: 0.07s, memcpy: 0.00s, convert: 0.00s, copy_to_backend: 0.09s)
[DEBUG] stable-diffusion.cpp\lora.hpp:93   - finished loaded lora
[INFO ] model.cpp:373  - load <redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors using safetensors format
[DEBUG] model.cpp:503  - init from '<redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors', prefix = 'lora.'
[INFO ] stable-diffusion.cpp\lora.hpp:40   - loading LoRA from '<redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors'
[DEBUG] model.cpp:1351 - using 6 threads for model loading
[DEBUG] model.cpp:1373 - loading tensors from <redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors
  |==================================================| 480/480 - 2388.06it/s
[INFO ] model.cpp:1580 - loading tensors completed, taking 0.20s (process: 0.00s, read: 0.00s, memcpy: 0.00s, convert: 0.00s, copy_to_backend: 0.00s)
[INFO ] stable-diffusion.cpp:1157 - apply_loras completed, taking 0.89s
[DEBUG] stable-diffusion.cpp:1158 - prompt after extract and remove lora: " Shadowheart, ultra realistic photo of an elf with black hair, a ponytail and green eyes. She is wearing a circlet and a dark dress with white patterns. She is standing in a forest."
[DEBUG] stable-diffusion.cpp\conditioner.hpp:1701 - parse '<|im_start|>user
Shadowheart, ultra realistic photo of an elf with black hair, a ponytail and green eyes. She is wearing a circlet and a dark dress with white patterns. She is standing in a forest.<|im_end|>
<|im_start|>assistant
' to [['<|im_start|>user
', 1], [' Shadowheart, ultra realistic photo of an elf with black hair, a ponytail and green eyes. She is wearing a circlet and a dark dress with white patterns. She is standing in a
forest.', 1], ['<|im_end|>
<|im_start|>assistant
', 1], ]
[DEBUG] stable-diffusion.cpp\llm.hpp:259  - split prompt "<|im_start|>user
" to tokens ["<|im_start|>", "user", "─è", ]
[DEBUG] stable-diffusion.cpp\llm.hpp:259  - split prompt " Shadowheart, ultra realistic photo of an elf with black hair, a ponytail and green eyes. She is wearing a circlet and a dark dress with white patterns. She is standing in a forest." to tokens ["─áShadow", "heart", ",", "─áultra", "─árealistic", "─áphoto", "─áof", "─áan", "─áelf", "─áwith", "─áblack", "─áhair", ",", "─áa", "─ápony", "tail", "─áand", "─ágreen", "─áeyes", ".", "─áShe", "─áis", "─áwearing", "─áa", "─ácirc", "let", "─áand", "─áa", "─ádark", "─ádress", "─áwith", "─áwhite", "─ápatterns", ".", "─áShe", "─áis", "─ástanding", "─áin", "─áa", "─áforest", ".", ]
[DEBUG] stable-diffusion.cpp\llm.hpp:259  - split prompt "<|im_end|>
<|im_start|>assistant
" to tokens ["<|im_end|>", "─è", "<|im_start|>", "assistant", "─è", ]
[DEBUG] stable-diffusion.cpp\ggml_extend.hpp:1697 - qwen3 compute buffer size: 5.36 MB(VRAM)
[DEBUG] stable-diffusion.cpp\conditioner.hpp:1914 - computing condition graph completed, taking 371 ms
[INFO ] stable-diffusion.cpp:2927 - get_learned_condition completed, taking 1263 ms
[INFO ] stable-diffusion.cpp:3038 - generating image: 1/1 - seed 1765311843
[INFO ] stable-diffusion.cpp:1519 - EasyCache enabled - threshold: 0.200, start_percent: 0.15, end_percent: 0.95
[DEBUG] stable-diffusion.cpp\ggml_extend.hpp:1697 - z_image compute buffer size: 896.10 MB(VRAM)
  |==================================================| 20/20 - 1.81s/it
[INFO ] stable-diffusion.cpp:1862 - EasyCache skipped 8/20 steps (1.67x estimated speedup)
[INFO ] stable-diffusion.cpp:3080 - sampling completed, taking 36.46s
[INFO ] stable-diffusion.cpp:3091 - generating 1 latent images completed, taking 36.61s
[INFO ] stable-diffusion.cpp:3094 - decoding 1 latents
[DEBUG] stable-diffusion.cpp\ggml_extend.hpp:1697 - vae compute buffer size: 8113.22 MB(VRAM)
[DEBUG] stable-diffusion.cpp:2297 - computing vae decode graph completed, taking 1.37s
[INFO ] stable-diffusion.cpp:3104 - latent 1 decoded, taking 1.37s
[INFO ] stable-diffusion.cpp:3108 - decode_first_stage completed, taking 1.37s
[INFO ] stable-diffusion.cpp:1128 - diffusion_lora_models:
[INFO ] stable-diffusion.cpp\lora.hpp:724  - (480 / 480) LoRA tensors have been applied, lora_file_path = <redacted>\Models\LoRa/z-image\characters\ShadowheartZIT_byKonan.safetensors
[INFO ] stable-diffusion.cpp:3404 - generate_image completed in 39.26s

Additional context / environment details

Also tested with Chroma and SDXL, can only reproduce with z-image-turbo.
Tested with multiples LoRAs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions