117 releases (stable)

new 31.0.0 Mar 20, 2025
30.0.2 Feb 25, 2025
29.0.1 Jan 21, 2025
28.0.1 Jan 14, 2025
0.25.0 Mar 16, 2021

#1776 in WebAssembly

Download history 340/week @ 2024-12-04 249/week @ 2024-12-11 282/week @ 2024-12-18 135/week @ 2024-12-25 94/week @ 2025-01-01 409/week @ 2025-01-08 616/week @ 2025-01-15 388/week @ 2025-01-22 266/week @ 2025-01-29 625/week @ 2025-02-05 326/week @ 2025-02-12 1020/week @ 2025-02-19 469/week @ 2025-02-26 508/week @ 2025-03-05 592/week @ 2025-03-12 701/week @ 2025-03-19

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

Apache-2.0 WITH LLVM-exception

3.5MB
49K 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

~23–65MB
~1M SLoC