109 releases (stable)

new 27.0.0 Nov 20, 2024
26.0.1 Nov 5, 2024
26.0.0 Oct 22, 2024
25.0.3 Nov 5, 2024
0.25.0 Mar 16, 2021

#1480 in WebAssembly

Download history 339/week @ 2024-07-31 417/week @ 2024-08-07 485/week @ 2024-08-14 368/week @ 2024-08-21 347/week @ 2024-08-28 374/week @ 2024-09-04 301/week @ 2024-09-11 492/week @ 2024-09-18 600/week @ 2024-09-25 219/week @ 2024-10-02 831/week @ 2024-10-09 253/week @ 2024-10-16 318/week @ 2024-10-23 292/week @ 2024-10-30 402/week @ 2024-11-06 126/week @ 2024-11-13

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

Apache-2.0 WITH LLVM-exception

3MB
46K 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-wasip1 target using the high-level wasi-nn bindings.

Dependencies

~22–66MB
~1M SLoC