Introduction
This project provides the examples of high-level wasi-nn bindings and WasmEdge-TensorFlow plug-ins on Rust programming language. Developers can refer to this project to write their machine learning application in a high-level language using the bindings, compile it to WebAssembly, and run it with a WebAssembly runtime that supports the wasi-nn proposal, such as WasmEdge.
Prerequisites
OpenVINO Installation
Developers should install the OpenVINO first before build and run WasmEdge with wasi-nn and the examples.
For this project, we use the version 2023.0.0
. Please refer to WasmEdge Docs and OpenVINOโข(2023)
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | sudo tee /etc/apt/sources.list.d/intel-openvino-2023.list
sudo apt update
sudo apt-get -y install openvino
ldconfig
Rust Installation
For building the WASM files from rust source, please refer to the Rust Official Site for the Rust installation.
After the installation, developers should add the wasm32-wasi
target.
rustup target add wasm32-wasi
wasi-nn
Rust Crate
Download the In Rust, download the crate from crates.io by adding wasi-nn = "0.4.0"
as a Cargo dependency.
For using WasmEdge-TensorFlow plug-ins, please download the crate from crates.io by adding wasmedge_tensorflow_interface = "0.3.0"
as a Cargo dependency.
WasmEdge Installation
You can refer to here to install WasmEdge.
For the examples with different wasi-nn backends or using the WasmEdge-Tensorflow plug-ins, please install with plug-ins and their dependencies:
- wasi-nn plug-in with OpenVINO backend
- wasi-nn plug-in with PyTorch backend
- wasi-nn plug-in with TensorFlow-Lite backend
- WasmEdge-Image plug-in
- WasmEdge-TensorFlow plug-in
- WasmEdge-TensorFlow-Lite plug-in
Examples
Related Links
License
This project is licensed under the Apache 2.0 license. See LICENSE for more details.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.