ggml-backend.c:267: data != NULL && "failed to allocate buffer" #124
Unanswered
SSantiagoDev
asked this question in
Q&A
Replies: 1 comment
-
Looks like a memory error occurred while loading the vocab. Could you try the latest master code to see if the issue still persists? If it does, please provide your environment information, including OS version, compiler version, and so on. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an issue.
I tried many different models, but I don't think it is related because I receive the same message with all of them...
I tried many variations of the parameters as well.
I looked at the code as well, but far from a C/C++ expert...
I have an old GeForce 940MX with only 2 GB VRAM, so I wanted to try SD with your build.
Running on Windows 10.
This method (GGML_ASSERT) triggers the exit because of the malloc (I have 16 GB or RAM and more or less 50% of it available):
`static ggml_backend_buffer_t ggml_backend_cpu_alloc_buffer(ggml_backend_t backend, size_t size) {
size += TENSOR_ALIGNMENT; // malloc may return an address that is not aligned
void * data = malloc(size); // TODO: maybe use GGML_ALIGNED_MALLOC?
}`
Here is the output for the build and the execution:
PS D:\temp\AI\MiniSD\stable-diffusion.cpp\build> cmake ..
Use Flash Attention for memory optimization
CMake Deprecation Warning at ggml/CMakeLists.txt:1 (cmake_minimum_required):
CMake.
Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.
-- CMAKE_SYSTEM_PROCESSOR: AMD64
-- x86 detected
-- Configuring done (0.1s)
-- Generating done (0.4s)
-- Build files have been written to: D:/temp/AI/MiniSD/stable-diffusion.cpp/build
PS D:\temp\AI\MiniSD\stable-diffusion.cpp\build> cmake --build . --config Release
[ 8%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml-backend.c.obj
ggml-backend.c
D:\temp\AI\MiniSD\stable-diffusion.cpp\ggml\src\ggml-backend.c(494): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\temp\AI\MiniSD\stable-diffusion.cpp\ggml\src\ggml-backend.c(500): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\temp\AI\MiniSD\stable-diffusion.cpp\ggml\src\ggml-backend.c(521): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
See online help for details.
D:\temp\AI\MiniSD\stable-diffusion.cpp\ggml\src\ggml-backend.c(533): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\temp\AI\MiniSD\stable-diffusion.cpp\ggml\src\ggml-backend.c(652): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
[ 16%] Linking C static library ggml.lib
[ 41%] Built target ggml
[ 50%] Built target zip
[ 83%] Built target stable-diffusion
[ 91%] Linking CXX executable ....\bin\sd.exe
[100%] Built target sd
PS D:\temp\AI\MiniSD\stable-diffusion.cpp\build> .\bin\sd.exe -m ../v2-1_768-nonema-pruned.safetensors -p "A lovely cat" -v -o /output/output.png -H 256 -W 256 --steps 1 -b 1 --type q4_0
Option:
n_threads: 4
mode: txt2img
model_path: ../v2-1_768-nonema-pruned.safetensors
wtype: q4_0
vae_path:
taesd_path:
output_path: /output/output.png
init_img:
prompt: A lovely cat
negative_prompt:
cfg_scale: 7.00
width: 256
height: 256
sample_method: euler_a
schedule: default
sample_steps: 1
strength(img2img): 0.75
rng: cuda
seed: 42
batch_count: 1
System Info:
BLAS = 0
SSE3 = 1
AVX = 1
AVX2 = 1
AVX512 = 0
AVX512_VBMI = 0
AVX512_VNNI = 0
FMA = 1
NEON = 0
ARM_FMA = 0
F16C = 1
FP16_VA = 0
WASM_SIMD = 0
VSX = 0
[DEBUG] stable-diffusion.cpp:4448 - Using CPU backend
[INFO] stable-diffusion.cpp:4455 - Flash Attention enabled
[INFO] stable-diffusion.cpp:4458 - loading model from '../v2-1_768-nonema-pruned.safetensors'
[INFO] model.cpp:623 - load ../v2-1_768-nonema-pruned.safetensors using safetensors format
[DEBUG] model.cpp:689 - init from '../v2-1_768-nonema-pruned.safetensors'
[INFO] stable-diffusion.cpp:4480 - Stable Diffusion 2.x
[INFO] stable-diffusion.cpp:4486 - Stable Diffusion weight type: q4_0
[DEBUG] stable-diffusion.cpp:4488 - loading vocab
[DEBUG] stable-diffusion.cpp:603 - vocab size: 9870564930518827264
[DEBUG] stable-diffusion.cpp:4498 - ggml tensor size = 352 bytes
[DEBUG] stable-diffusion.cpp:1102 - clip params backend buffer size = 191.71 MB (893 tensors)
[DEBUG] stable-diffusion.cpp:2190 - unet params backend buffer size = 1274.37 MB (706 tensors)
GGML_ASSERT: D:\temp\AI\MiniSD\stable-diffusion.cpp\ggml\src\ggml-backend.c:267: data != NULL && "failed to allocate buffer"
PS D:\temp\AI\MiniSD\stable-diffusion.cpp\build>
Beta Was this translation helpful? Give feedback.
All reactions