Skip to content

[Bug] Crash if option --lora-apply-mode immediately but the LoRA file is not present #1019

@akleine

Description

@akleine

Git commit

2034588

Operating System & Version

Ubuntu 24.04

GGML backends

CUDA

Command-line arguments used

build/bin/sd -m ~/SD_models/sd1/epicrealism_naturalSinRC1VAE.safetensors --lora-apply-mode immediately -p "half portrait of a man, wearing blue shirt, dark backgroundlora:anyxxxxxxx:1"

Steps to reproduce

build/bin/sd -m ~/SD_models/sd1/epicrealism_naturalSinRC1VAE.safetensors --lora-apply-mode immediately -p "half portrait of a man, wearing blue shirt, dark backgroundlora:anyxxxxxxx:1"
Run above command but don't give access to any LoRA.
This situation could easy arise by typo etc.

What you expected to happen

The exception of missing LoRA should be catched and continued without LoRA as usual.

If using --lora-apply-mode at_runtime everything is okay as expected:

INFO ] stable-diffusion.cpp:316 - Version: SD 1.x
.....
[INFO ] stable-diffusion.cpp:854 - running in eps-prediction mode
[INFO ] stable-diffusion.cpp:3062 - sampling using Euler A method
[INFO ] denoiser.hpp:364 - get_sigmas with discrete scheduler
[INFO ] stable-diffusion.cpp:3172 - TXT2IMG
[INFO ] stable-diffusion.cpp:1122 - apply at runtime
[WARN ] stable-diffusion.cpp:933 - can not find anyxxxxxxx.safetensors or anyxxxxxxx.ckpt for lora anyxxxxxxx
[WARN ] stable-diffusion.cpp:933 - can not find anyxxxxxxx.safetensors or anyxxxxxxx.ckpt for lora anyxxxxxxx
[WARN ] stable-diffusion.cpp:933 - can not find anyxxxxxxx.safetensors or anyxxxxxxx.ckpt for lora anyxxxxxxx
[INFO ] stable-diffusion.cpp:1127 - apply_loras completed, taking 0.00s
[INFO ] stable-diffusion.cpp:2810 - get_learned_condition completed, taking 66 ms
[INFO ] stable-diffusion.cpp:2921 - generating image: 1/1 - seed 42
|==================================================| 20/20 - 3.43it/s
[INFO ] stable-diffusion.cpp:2962 - sampling completed, taking 5.84s
[INFO ] stable-diffusion.cpp:2970 - generating 1 latent images completed, taking 5.85s
[INFO ] stable-diffusion.cpp:2973 - decoding 1 latents
[INFO ] stable-diffusion.cpp:2983 - latent 1 decoded, taking 0.42s
[INFO ] stable-diffusion.cpp:2987 - decode_first_stage completed, taking 0.42s
[INFO ] stable-diffusion.cpp:3280 - generate_image completed in 6.34s
save result PNG image to 'output.png' (success)

What actually happened

see below:

Logs / error messages / stack trace

.......
[INFO ] stable-diffusion.cpp:316 - Version: SD 1.x
[INFO ] stable-diffusion.cpp:344 - Weight type stat: f16: 1130
[INFO ] stable-diffusion.cpp:345 - Conditioner weight type stat: f16: 196
[INFO ] stable-diffusion.cpp:346 - Diffusion model weight type stat: f16: 686
[INFO ] stable-diffusion.cpp:347 - VAE weight type stat: f16: 248
|==================================================| 1130/1130 - 2810.95it/s
[INFO ] model.cpp:1566 - loading tensors completed, taking 0.40s (process: 0.00s, read: 0.08s, memcpy: 0.00s, convert: 0.00s, copy_to_backend: 0.12s)
[INFO ] stable-diffusion.cpp:740 - total params memory size = 1969.78MB (VRAM 1969.78MB, RAM 0.00MB): text_encoders 235.06MB(VRAM), diffusion_model 1640.25MB(VRAM), vae 94.47MB(VRAM), controlnet 0.00MB(VRAM), pmid 0.00MB(VRAM)
[INFO ] stable-diffusion.cpp:854 - running in eps-prediction mode
[INFO ] stable-diffusion.cpp:3062 - sampling using Euler A method
[INFO ] denoiser.hpp:364 - get_sigmas with discrete scheduler
[INFO ] stable-diffusion.cpp:3172 - TXT2IMG
[INFO ] stable-diffusion.cpp:1119 - apply lora immediately
[INFO ] stable-diffusion.cpp:963 - attempting to apply 1 LoRAs
[WARN ] stable-diffusion.cpp:933 - can not find anyxxxxxxx.safetensors or anyxxxxxxx.ckpt for lora anyxxxxxxx
./1crash.sh: Zeile 3: 6633 Speicherzugriffsfehler (Speicherabzug geschrieben) build/bin/sd -m ~/SD_models/sd1/epicrealism_naturalSinRC1VAE.safetensors --lora-apply-mode immediately -p "half portrait of a man, wearing blue shirt, dark backgroundlora:anyxxxxxxx:1"

"Speicherzugriffsfehler" stands for "core dumped".

Additional context / environment details

No response

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