Skip to content

bytecodealliance/wasi-nn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wasi-nn

A Bytecode Alliance project

High-level bindings for writing wasi-nn applications

CI status

Introduction

This project provides high-level wasi-nn bindings for Rust and AssemblyScript. The basic idea: write your machine learning application in a high-level language using these bindings, compile it to WebAssembly, and run it in a WebAssembly runtime that supports the wasi-nn proposal, such as Wasmtime and WasmEdge.

NOTE: These bindings are experimental (use at your own risk) and subject to upstream changes in the wasi-nn specification.

Use

  • In Rust, download the crate from crates.io by adding wasi-nn = "0.6.0" as a Cargo dependency; more information in the Rust README.
  • In AssemblyScript, download the package from npmjs.com by adding "as-wasi-nn": "^0.3.0" as an NPM dependency; more information in the AssemblyScript README.
  • When you call Wasmtime, you'll need to pass the flag --wasi-modules=experimental-wasi-nn to enable the use use of wasi-nn.
  • For WasmEdge, you should install the wasi-nn plugin first.

Examples

This repository includes examples of using these bindings. See the Rust example and AssemblyScript example to walk through an end-to-end image classification using an AlexNet model. Currently the example uses OpenVino as the backend. If you are running Ubuntu, you can simply run the script to install the supported version.github/actions/install-openvino/install.sh. Otherwise you'll need to visit the Installation Guides and follow the instructions for your OS. The version of OpenVino currently supported is openvino_2022.1.0.643.

Once you have OpenVino installed, run them with:

To run examples in WasmEdge, consult this article: WasmEdge wasi-nn examples.

Related Links

License

This project is licensed under the Apache 2.0 license. See LICENSE for more details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

About

High-level bindings for wasi-nn system calls

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published