Once I draw a 1024*1024 image, the program crashes
The limit is 1024 * 768
My device is i9-13900KF, 4090
Is there any way to solve it?
What exactly do you mean with crashing? Is there any error message? does the same model with the same settings work in the stable-diffusion.cpp example application?
When I input 1024*1024, it just disappeared without any warning or error.I don't know how to use C++,I am a novice in coding,sry
I have the exact same issue, very simple steps:
- Start up the example in this repo
- Use Cuda12.win
- Load for example https://huggingface.co/second-state/stable-diffusion-v1-5-GGUF
- Load model, prompt anything (without changing resolution)
- Click Create image-> Crash If I change the resolution for example 512x512, no crash.
The program '[30440] ImageCreationUI.exe' has exited with code 3221226505 (0xc0000409). This is the log from my app that has the same crash: STABLE DIFFUSION [Debug]: stable-diffusion.cpp:163 - Using CUDA backend
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:163 - Using CUDA backend
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:163 - Using CUDA backend
STABLE DIFFUSION [Info]: stable-diffusion.cpp:195 - loading model from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf'
STABLE DIFFUSION [Info]: stable-diffusion.cpp:195 - loading model from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf'
STABLE DIFFUSION [Info]: stable-diffusion.cpp:195 - loading model from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf'
STABLE DIFFUSION [Info]: model.cpp:885 - load I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf using gguf format
STABLE DIFFUSION [Info]: model.cpp:885 - load I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf using gguf format
STABLE DIFFUSION [Info]: model.cpp:885 - load I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf using gguf format
STABLE DIFFUSION [Debug]: model.cpp:902 - init from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf'
STABLE DIFFUSION [Debug]: model.cpp:902 - init from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf'
STABLE DIFFUSION [Debug]: model.cpp:902 - init from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf'
STABLE DIFFUSION [Info]: stable-diffusion.cpp:242 - Version: SD 1.x
STABLE DIFFUSION [Info]: stable-diffusion.cpp:242 - Version: SD 1.x
STABLE DIFFUSION [Info]: stable-diffusion.cpp:242 - Version: SD 1.x
STABLE DIFFUSION [Info]: stable-diffusion.cpp:275 - Weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:275 - Weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:275 - Weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:276 - Conditioner weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:276 - Conditioner weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:276 - Conditioner weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:277 - Diffusion model weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:277 - Diffusion model weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:277 - Diffusion model weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:278 - VAE weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:278 - VAE weight type: q4_0
STABLE DIFFUSION [Info]: stable-diffusion.cpp:278 - VAE weight type: q4_0
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:280 - ggml tensor size = 400 bytes
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:280 - ggml tensor size = 400 bytes
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:280 - ggml tensor size = 400 bytes
STABLE DIFFUSION [Debug]: clip.hpp:171 - vocab size: 49408
STABLE DIFFUSION [Debug]: clip.hpp:171 - vocab size: 49408
STABLE DIFFUSION [Debug]: clip.hpp:171 - vocab size: 49408
STABLE DIFFUSION [Debug]: clip.hpp:182 - trigger word img already in vocab
STABLE DIFFUSION [Debug]: clip.hpp:182 - trigger word img already in vocab
STABLE DIFFUSION [Debug]: clip.hpp:182 - trigger word img already in vocab
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - clip params backend buffer size = 66.62 MB(VRAM) (196 tensors)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - clip params backend buffer size = 66.62 MB(VRAM) (196 tensors)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - clip params backend buffer size = 66.62 MB(VRAM) (196 tensors)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - unet params backend buffer size = 1270.08 MB(VRAM) (686 tensors)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - unet params backend buffer size = 1270.08 MB(VRAM) (686 tensors)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - unet params backend buffer size = 1270.08 MB(VRAM) (686 tensors)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - vae params backend buffer size = 159.68 MB(VRAM) (248 tensors)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - vae params backend buffer size = 159.68 MB(VRAM) (248 tensors)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1111 - vae params backend buffer size = 159.68 MB(VRAM) (248 tensors)
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:417 - loading weights
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:417 - loading weights
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:417 - loading weights
STABLE DIFFUSION [Debug]: model.cpp:1698 - loading tensors from I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf
STABLE DIFFUSION [Debug]: model.cpp:1698 - loading tensors from I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf
STABLE DIFFUSION [Debug]: model.cpp:1698 - loading tensors from I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf
STABLE DIFFUSION [Info]: stable-diffusion.cpp:516 - total params memory size = 1496.38MB (VRAM 1496.38MB, RAM 0.00MB): clip 66.62MB(VRAM), unet 1270.08MB(VRAM), vae 159.68MB(VRAM), controlnet 0.00MB(VRAM), pmid 0.00MB(VRAM)
STABLE DIFFUSION [Info]: stable-diffusion.cpp:516 - total params memory size = 1496.38MB (VRAM 1496.38MB, RAM 0.00MB): clip 66.62MB(VRAM), unet 1270.08MB(VRAM), vae 159.68MB(VRAM), controlnet 0.00MB(VRAM), pmid 0.00MB(VRAM)
STABLE DIFFUSION [Info]: stable-diffusion.cpp:516 - total params memory size = 1496.38MB (VRAM 1496.38MB, RAM 0.00MB): clip 66.62MB(VRAM), unet 1270.08MB(VRAM), vae 159.68MB(VRAM), controlnet 0.00MB(VRAM), pmid 0.00MB(VRAM)
STABLE DIFFUSION [Info]: stable-diffusion.cpp:520 - loading model from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf' completed, taking 1.58s
STABLE DIFFUSION [Info]: stable-diffusion.cpp:520 - loading model from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf' completed, taking 1.58s
STABLE DIFFUSION [Info]: stable-diffusion.cpp:520 - loading model from 'I:\LvsSdModels\stable-diffusion-v1-5-pruned-emaonly-Q4_0.gguf' completed, taking 1.58s
STABLE DIFFUSION [Info]: stable-diffusion.cpp:550 - running in eps-prediction mode
STABLE DIFFUSION [Info]: stable-diffusion.cpp:550 - running in eps-prediction mode
STABLE DIFFUSION [Info]: stable-diffusion.cpp:550 - running in eps-prediction mode
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:594 - finished loaded file
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:594 - finished loaded file
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:594 - finished loaded file
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:1535 - txt2img 1024x1024
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:1535 - txt2img 1024x1024
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:1535 - txt2img 1024x1024
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:1230 - prompt after extract and remove lora: "Anime girl jumping"
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:1230 - prompt after extract and remove lora: "Anime girl jumping"
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:1230 - prompt after extract and remove lora: "Anime girl jumping"
STABLE DIFFUSION [Info]: stable-diffusion.cpp:682 - Attempting to apply 0 LoRAs
STABLE DIFFUSION [Info]: stable-diffusion.cpp:682 - Attempting to apply 0 LoRAs
STABLE DIFFUSION [Info]: stable-diffusion.cpp:682 - Attempting to apply 0 LoRAs
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1235 - apply_loras completed, taking 0.00s
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1235 - apply_loras completed, taking 0.00s
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1235 - apply_loras completed, taking 0.00s
STABLE DIFFUSION [Debug]: conditioner.hpp:329 - parse 'Anime girl jumping' to [['Anime girl jumping', 1], ]
STABLE DIFFUSION [Debug]: conditioner.hpp:329 - parse 'Anime girl jumping' to [['Anime girl jumping', 1], ]
STABLE DIFFUSION [Debug]: conditioner.hpp:329 - parse 'Anime girl jumping' to [['Anime girl jumping', 1], ]
STABLE DIFFUSION [Debug]: clip.hpp:311 - token length: 77
STABLE DIFFUSION [Debug]: clip.hpp:311 - token length: 77
STABLE DIFFUSION [Debug]: clip.hpp:311 - token length: 77
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - clip compute buffer size: 1.40 MB(VRAM)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - clip compute buffer size: 1.40 MB(VRAM)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - clip compute buffer size: 1.40 MB(VRAM)
STABLE DIFFUSION [Debug]: conditioner.hpp:457 - computing condition graph completed, taking 96 ms
STABLE DIFFUSION [Debug]: conditioner.hpp:457 - computing condition graph completed, taking 96 ms
STABLE DIFFUSION [Debug]: conditioner.hpp:457 - computing condition graph completed, taking 96 ms
STABLE DIFFUSION [Debug]: conditioner.hpp:329 - parse '' to [['', 1], ]
STABLE DIFFUSION [Debug]: conditioner.hpp:329 - parse '' to [['', 1], ]
STABLE DIFFUSION [Debug]: conditioner.hpp:329 - parse '' to [['', 1], ]
STABLE DIFFUSION [Debug]: clip.hpp:311 - token length: 77
STABLE DIFFUSION [Debug]: clip.hpp:311 - token length: 77
STABLE DIFFUSION [Debug]: clip.hpp:311 - token length: 77
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - clip compute buffer size: 1.40 MB(VRAM)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - clip compute buffer size: 1.40 MB(VRAM)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - clip compute buffer size: 1.40 MB(VRAM)
STABLE DIFFUSION [Debug]: conditioner.hpp:457 - computing condition graph completed, taking 12 ms
STABLE DIFFUSION [Debug]: conditioner.hpp:457 - computing condition graph completed, taking 12 ms
STABLE DIFFUSION [Debug]: conditioner.hpp:457 - computing condition graph completed, taking 12 ms
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1368 - get_learned_condition completed, taking 162 ms
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1368 - get_learned_condition completed, taking 162 ms
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1368 - get_learned_condition completed, taking 162 ms
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1391 - sampling using Euler A method
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1391 - sampling using Euler A method
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1391 - sampling using Euler A method
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1428 - generating image: 1/1 - seed 10990
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1428 - generating image: 1/1 - seed 10990
STABLE DIFFUSION [Info]: stable-diffusion.cpp:1428 - generating image: 1/1 - seed 10990
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:798 - Sample
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:798 - Sample
STABLE DIFFUSION [Debug]: stable-diffusion.cpp:798 - Sample
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - unet compute buffer size: 8360.93 MB(VRAM)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - unet compute buffer size: 8360.93 MB(VRAM)
STABLE DIFFUSION [Debug]: ggml_extend.hpp:1062 - unet compute buffer size: 8360.93 MB(VRAM) The program '[23928] LyricVideoStudio.win.exe' has exited with code 3221226505 (0xc0000409).
Edit: I got bit better error message when I used the pverload with parameters (_diffusionModel!.TextToImage(prompt, newTp.Parameters)):
338|2025-02-06T19:02:47.5174260+00:00|ERROR|25|MainPage|AppDomain.CurrentDomain.FirstChanceException, stack: at StableDiffusion.NET.Native.
Edit x2: 1920x1024 does not crash, but it hogged all my memory from GPU (I have done 1920x1080 images before with Comfy without issues, with Flux 1 schell, but probably that's another topic) Literally everything else goes, like 1025x1024
Looking at that stack trace I'm pretty sure that's an issue in stable-diffusion.cpp in which case I can't help. Please try the same model with the reference application over there (https://github.com/leejet/stable-diffusion.cpp/releases).
Actually right after commenting here, the integration started to crash on all resolutions, app restart did not work. I tried one other c# "wrapper" for the cpp code and that did not crash. I'll try with the latest cpp release later this today. How up-to-date this is with cpp version? I noticed the cpp version does not need everything to be converted to .gguf, so I'm thinking should I just use cpp dll's directly?
OK, looks like there's issue with the latest .cpp: CUDA error: no kernel image is available for execution on the device current device: 0, in function ggml_cuda_compute_forward at D:\a\stable-diffusion.cpp\stable-diffusion.cpp\ggml\src\ggml-cuda\ggml-cuda.cu:2174 So, pretty much this: https://github.com/leejet/stable-diffusion.cpp/issues/554
This is the last stable diffusion cpp release that works for me: https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-b5f4932 After that, the cuda-dll-release size dropped dramatically and probably does not have all necessary files... (I tried with sd3.5)
How up-to-date this is with cpp version?
The current Backend-Packages are using https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-dcf91f9
OK, looks like there's issue with the latest .cpp: CUDA error: no kernel image is available for execution on the device
This should be fixed with https://github.com/leejet/stable-diffusion.cpp/commit/4fe83d52cf4506ea4fb87ccd5ed02efe69dc4167, but it seems like they dropped support for older architectures (< 2000 series) in https://github.com/leejet/stable-diffusion.cpp/commit/2535ad5a437478da00bc9b6d08dc6b36d1fc2e44