stable diffusion not work in WASM
Hello, I compile this project to wasm, but when I run it crash.
@ggerganov any chance you could give us some pointers? :) Much obliged.
Hard to tell - could be some problem with the WASM code. It's not very well tested.
Try this patch and see what happens:
diff --git a/src/ggml.c b/src/ggml.c
index d2a9dab..8a11f7c 100644
--- a/src/ggml.c
+++ b/src/ggml.c
@@ -12260,9 +12260,7 @@ static void ggml_compute_forward_soft_max_f32(
}
}
- assert(sum > 0.0);
-
- sum = 1.0/sum;
+ sum = sum > 0.0 ? 1.0/sum : 1.0;
ggml_vec_scale_f32(nc, dp, sum);
#ifndef NDEBUG
yes, it work, but other error occur.
@Joinhack , if you're using Emscripten then try adding these flags and values during compilation:
-s INITIAL_MEMORY=1000MB -s MAXIMUM_MEMORY=4GB -s STACK_SIZE=11524288 -s ALLOW_MEMORY_GROWTH
This should get around the memory limitations. Example Script: https://github.com/rahuldshetty/ggml.js/blob/master/build-ggml.sh
thanks.