Closed proohit closed 3 years ago
Thanks for using our SSVM and WASI helper function in your project :-).
The Wasm execution is a sandbox, so users will need to map the path by theirselves. Hence, you can find that we map the __dirname
to virtual /
in our tutorial. And we always use /hello.txt
in the javascript side.
Could you try to change this line from const FILE_NAME: &str = "iris_knn.model";
to const FILE_NAME: &str = "/iris_knn.model";
and check the result?
Hello and thanks for your quick response. I was pretty sure that I tested this out and that it didn't work, but I've just tried it and adding a /
to the FILE_NAME
constant seemed to have worked. Thanks! :)
Hi, first of all thanks for your efforts on bringing wasi to ssvm. I know that this is in a very early stage, but maybe I can contribute by reporting my challenges while using ssvm-wasi-helper.
I have a very simple ML model, built and serialized with smartcore using serde and bincode. The idea is to serialize a pre-built model and load it in a WASM module for accessing and utilizing it.
Dumping and loading works fine when executing inside
main
withcargo run
. On the other hand, when using it viawasm-bindgen
and accessing it from nodejs, it panicks with following error:The ssvm binding files are in
pkg
, where I also put the model dump file. I tested the functionality ofssvm-wasi-helper
with the example functionscreate_file
andread_file
, which are working correctly and output ahello.txt
file inside pkg.Here's the loading code:
Additional info
node v15.14.0 cargo 1.50.0 (f04e7fab7 2021-02-04) Ubuntu 20.04 LTS