You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Alex Crichton 1cf0060bbc
Disable traps by default in `bindgen!` imports (#8310)
7 months ago
..
examples [WASI-NN] Add support for a ONNXruntime backend using ort (#7691) 8 months ago
spec@e2310b860d Require semicolons in WIT files in CI (#7174) 1 year ago
src Disable traps by default in `bindgen!` imports (#8310) 7 months ago
tests [WASI-NN] Add support for a ONNXruntime backend using ort (#7691) 8 months ago
Cargo.toml [WASI-NN] Add support for a ONNXruntime backend using ort (#7691) 8 months ago
LICENSE Add an initial wasi-nn implementation for Wasmtime (#2208) 4 years ago
README.md wasi-nn: adapt to new test infrastructure (#7679) 11 months ago
build.rs wasi-nn: turn it on by default (#2859) 4 years ago

README.md

wasmtime-wasi-nn

This crate enables support for the wasi-nn API in Wasmtime. Currently it contains an implementation of wasi-nn using OpenVINO™ but in the future it could support multiple machine learning backends. Since the wasi-nn API is expected to be an optional feature of WASI, this crate is currently separate from the wasi-common crate. This crate is experimental and its API, functionality, and location could quickly change.

Use

Use the Wasmtime APIs to instantiate a Wasm module and link in the wasi-nn implementation as follows:

let wasi_nn = WasiNnCtx::new()?;
wasmtime_wasi_nn::witx::add_to_linker(...);

Build

$ cargo build

To use the WIT-based ABI, compile with --features component-model and use wasmtime_wasi_nn::wit::add_to_linker.

Example

An end-to-end example demonstrating ML classification is included in examples: examples/classification-example contains a standalone Rust project that uses the wasi-nn APIs and is compiled to the wasm32-wasi target using the high-level wasi-nn bindings.