Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Once I draw a 1024*1024 image, the program crashes #49

Open
MuZzzlen opened this issue Jan 10, 2025 · 7 comments
Open

Once I draw a 1024*1024 image, the program crashes #49

MuZzzlen opened this issue Jan 10, 2025 · 7 comments

Comments

@MuZzzlen
Copy link

The limit is 1024 * 768
My device is i9-13900KF, 4090
Is there any way to solve it?
image

@DarthAffe
Copy link
Owner

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?

@MuZzzlen
Copy link
Author

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

@mpulukkinen
Copy link

mpulukkinen commented Feb 6, 2025

I have the exact same issue, very simple steps:

  1. Start up the example in this repo
  2. Use Cuda12.win
  3. Load for example https://huggingface.co/second-state/stable-diffusion-v1-5-GGUF
  4. Load model, prompt anything (without changing resolution)
  5. 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.g____PInvoke|10_0(sd_ctx_t* __sd_ctx_native, Byte* __prompt_native, Byte* __negative_prompt_native, Int32 __clip_skip_native, Single __cfg_scale_native, Single __guidance_native, Int32 __width_native, Int32 __height_native, Sampler __sample_method_native, Int32 __sample_steps_native, Int64 __seed_native, Int32 __batch_count_native, sd_image_t* __control_cond_native, Single __control_strength_native, Single __style_strength_native, SByte __normalize_input_native, Byte* __input_id_images_path_native, Int32* __skip_layers_native, Int32 __skip_layers_count_native, Single __slg_scale_native, Single __skip_layer_start_native, Single __skip_layer_end_native)
at StableDiffusion.NET.Native.txt2img(sd_ctx_t* sd_ctx, String prompt, String negative_prompt, Int32 clip_skip, Single cfg_scale, Single guidance, Int32 width, Int32 height, Sampler sample_method, Int32 sample_steps, Int64 seed, Int32 batch_count, sd_image_t* control_cond, Single control_strength, Single style_strength, Boolean normalize_input, String input_id_images_path, Int32[] skip_layers, Int32 skip_layers_count, Single slg_scale, Single skip_layer_start, Single skip_layer_end) --> System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
at StableDiffusion.NET.Native.g____PInvoke|10_0(sd_ctx_t* __sd_ctx_native, Byte* __prompt_native, Byte* __negative_prompt_native, Int32 __clip_skip_native, Single __cfg_scale_native, Single __guidance_native, Int32 __width_native, Int32 __height_native, Sampler __sample_method_native, Int32 __sample_steps_native, Int64 __seed_native, Int32 __batch_count_native, sd_image_t* __control_cond_native, Single __control_strength_native, Single __style_strength_native, SByte __normalize_input_native, Byte* __input_id_images_path_native, Int32* __skip_layers_native, Int32 __skip_layers_count_native, Single __slg_scale_native, Single __skip_layer_start_native, Single __skip_layer_end_native)
at StableDiffusion.NET.Native.txt2img(sd_ctx_t* sd_ctx, String prompt, String negative_prompt, Int32 clip_skip, Single cfg_scale, Single guidance, Int32 width, Int32 height, Sampler sample_method, Int32 sample_steps, Int64 seed, Int32 batch_count, sd_image_t* control_cond, Single control_strength, Single style_strength, Boolean normalize_input, String input_id_images_path, Int32[] skip_layers, Int32 skip_layers_count, Single slg_scale, Single skip_layer_start, Single skip_layer_end)
Exception thrown: 'System.Runtime.InteropServices.SEHException' in StableDiffusion.NET.dll
An exception of type 'System.Runtime.InteropServices.SEHException' occurred in StableDiffusion.NET.dll but was not handled in user code
External component has thrown an exception.

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

@DarthAffe
Copy link
Owner

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).

@mpulukkinen
Copy link

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?

@mpulukkinen
Copy link

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: leejet/stable-diffusion.cpp#554

@mpulukkinen
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants