Open wuxianjun666 opened 10 months ago
can not delete sd_ctx->sd; when delete sd_ctx->sd, it should delete GGMLModule many times, because there are many struct succeed GGMLModule, but always gets stuck here,
Can you provide more information, such as the operating system you're using, the compiler version, the command-line arguments you're using, and the corresponding output?
Can you provide more information, such as the operating system you're using, the compiler version, the command-line arguments you're using, and the corresponding output?
I run in windows10, and the command is "cmake .. and cmake --build ." the output is:
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/bin/nvcc.exe
the error happened in when i finished generate image and save it, it begin to delete ctx->sd, but the program gets stuck. The stuck position is in the function ~GGMLModule(), because the unet, vae, clip all succeed the struct GGMLModule, so the function ~GGMLModule() will run many time. so i add some print in the function "void free_params_buffer()" when run the code "LOG_DEBUG("params_ctx != NULL, BEGIN TO free .........");" the program gets stuck. there is the screenshot
Can you provide more information, such as the operating system you're using, the compiler version, the command-line arguments you're using, and the corresponding output?
So I had to eliminate this function so it would run fine and not get stuck.
Also this error occurs on Ubuntu 22.04.3 whenever Lora is used.
build/bin/sd -m models/Stable-diffusion/v1-5-pruned-emaonly.safetensors --lora-model-dir models/Lora -v -p "a cute cat<lora:lcm-lora-sdv1-5:1>" --cfg-scale 1 --steps 4
[DEBUG] ggml_extend.hpp:601 - unet compute buffer size: 560.71 MB
|==================================================| 4/4 - 2.54s/it
[INFO ] stable-diffusion.cpp:1247 - sampling completed, taking 11.80s
[INFO ] stable-diffusion.cpp:1255 - generating 1 latent images completed, taking 11.94s
[INFO ] stable-diffusion.cpp:1257 - decoding 1 latents
[DEBUG] ggml_extend.hpp:601 - vae compute buffer size: 1665.00 MB
[DEBUG] stable-diffusion.cpp:1076 - computing vae [mode: DECODE] graph completed, taking 8.78s
[INFO ] stable-diffusion.cpp:1267 - latent 1 decoded, taking 8.78s
[INFO ] stable-diffusion.cpp:1271 - decode_first_stage completed, taking 8.78s
[INFO ] stable-diffusion.cpp:1288 - txt2img completed in 20.78s
save result image to 'output.png'
Segment fault(core dumped)
yes,when i do not use lora, it is normal
I found out what the problem is, in lora.hpp, comment out(注释) this line of code and it works!
in ggml_extend.hpp, the destructor function ~GGMLModule(), ~GGMLModule() noexcept(false){ LOG_DEBUG("BEGIN TO SUPER RELEASE ........."); free_params_buffer(); LOG_DEBUG("SUPER RELEASE FINISHED........."); }
It always gets stuck here. because of this function: free_params_buffer(); there ara many things succeed GGMLModule(), such as LoraModel, AutoEncoderKL, UNetModel, FrozenCLIPEmbedderWithCustomWords