79 releases (47 stable)

new 18.0.1 Feb 20, 2024
17.0.1 Feb 7, 2024
17.0.0 Jan 25, 2024
16.0.0 Dec 20, 2023
0.25.0 Mar 16, 2021

#1363 in WebAssembly

Download history 2384/week @ 2023-11-01 2341/week @ 2023-11-08 1474/week @ 2023-11-15 1890/week @ 2023-11-22 3162/week @ 2023-11-29 4349/week @ 2023-12-06 3274/week @ 2023-12-13 2065/week @ 2023-12-20 1693/week @ 2023-12-27 1074/week @ 2024-01-03 509/week @ 2024-01-10 345/week @ 2024-01-17 596/week @ 2024-01-24 573/week @ 2024-01-31 378/week @ 2024-02-07 870/week @ 2024-02-14

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

Apache-2.0 WITH LLVM-exception

1.5MB
21K 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

~23–36MB
~679K SLoC