92 releases (60 stable)

new 21.0.1 May 22, 2024
20.0.2 May 7, 2024
19.0.2 Apr 11, 2024
19.0.0 Mar 20, 2024
0.25.0 Mar 16, 2021

#1331 in WebAssembly

Download history 286/week @ 2024-02-04 264/week @ 2024-02-11 570/week @ 2024-02-18 635/week @ 2024-02-25 255/week @ 2024-03-03 469/week @ 2024-03-10 571/week @ 2024-03-17 152/week @ 2024-03-24 492/week @ 2024-03-31 539/week @ 2024-04-07 272/week @ 2024-04-14 1337/week @ 2024-04-21 355/week @ 2024-04-28 435/week @ 2024-05-05 333/week @ 2024-05-12 1041/week @ 2024-05-19

2,191 downloads per month
Used in 5 crates (4 directly)

Apache-2.0 WITH LLVM-exception

2.5MB
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–68MB
~1M SLoC