wasmtime
wasmtime copied to clipboard
Adding the TensorFlow backend to wasi-nn
Users will now be able to use either OpenVino or Tensorflow for their backend.
Depends on #3978
@abrown This is the latest Tensorflow backend for WASI-NN using runtime linking.
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, 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!
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.