95 releases (63 stable)

new 23.0.1 Jul 22, 2024
22.0.0 Jun 20, 2024
21.0.1 May 22, 2024
20.0.2 May 7, 2024
0.25.0 Mar 16, 2021

#1399 in WebAssembly

Download history 351/week @ 2024-04-04 511/week @ 2024-04-11 1128/week @ 2024-04-18 478/week @ 2024-04-25 523/week @ 2024-05-02 309/week @ 2024-05-09 950/week @ 2024-05-16 411/week @ 2024-05-23 212/week @ 2024-05-30 214/week @ 2024-06-06 271/week @ 2024-06-13 422/week @ 2024-06-20 233/week @ 2024-06-27 159/week @ 2024-07-04 217/week @ 2024-07-11 359/week @ 2024-07-18

1,023 downloads per month
Used in 5 crates (4 directly)

Apache-2.0 WITH LLVM-exception

3MB
40K SLoC

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.

Dependencies

~22–65MB
~1M SLoC