wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

Adding the TensorFlow backend to wasi-nn

Open brianjjones opened this issue 3 years ago • 4 comments

Users will now be able to use either OpenVino or Tensorflow for their backend.

brianjjones avatar Mar 31 '22 01:03 brianjjones

Depends on #3978

brianjjones avatar Mar 31 '22 01:03 brianjjones

@abrown This is the latest Tensorflow backend for WASI-NN using runtime linking.

brianjjones avatar Mar 31 '22 02:03 brianjjones

This is still a work in progress, mostly because it adds considerable size to Wasmtime. For now I'd like to see this as an added optional feature of the wasi-nn crate, that users can choose to use. It works as intended, but as I said its quite large and slimming it down will take some time. Suggestions, concerns, etc welcomed.

brianjjones avatar Mar 31 '22 02:03 brianjjones

@brianjjones, I refactored the tf.js file in this commit. This should address some of the comments I made above. There is more refactoring that could/should be done in that area (fix the custom parsing, evaluate the use of Arcs) but hopefully that commit helps!

abrown avatar Sep 01 '22 18:09 abrown

TensorFlow's security model makes it challenging to support inside of wasi-nn. https://chromium.googlesource.com/external/github.com/tensorflow/tensorflow/+/HEAD/SECURITY.md

In addition, the SavedModel format assumes direct file system access and this is baked pretty deeply into the underlying Keras framework. It should be possible to read/write h5 format for byte stream, but it may break some of the functionality of more complicated models.

One last note-- in Python it should be possible to pass a virtualized filesystem, but this is not exposed cleanly through existing C interfaces.

geekbeast avatar May 03 '23 19:05 geekbeast