Add an initial wasi-nn implementation for Wasmtime (#2208)
* Add an initial wasi-nn implementation for Wasmtime This change adds a crate, `wasmtime-wasi-nn`, that uses `wiggle` to expose the current state of the wasi-nn API and `openvino` to implement the exposed functions. It includes an end-to-end test demonstrating how to do classification using wasi-nn: - `crates/wasi-nn/tests/classification-example` contains Rust code that is compiled to the `wasm32-wasi` target and run with a Wasmtime embedding that exposes the wasi-nn calls - the example uses Rust bindings for wasi-nn contained in `crates/wasi-nn/tests/wasi-nn-rust-bindings`; this crate contains code generated by `witx-bindgen` and eventually should be its own standalone crate * Test wasi-nn as a CI step This change adds: - a GitHub action for installing OpenVINO - a script, `ci/run-wasi-nn-example.sh`, to run the classification example
This commit is contained in:
8
.github/actions/install-openvino/README.md
vendored
Normal file
8
.github/actions/install-openvino/README.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# install-openvino
|
||||
|
||||
A GitHub action to install OpenVINO from a package repository. This is only necessary for `wasi-nn` support but there
|
||||
are enough steps here to package the functionality separately and avoid cluttering the CI.
|
||||
|
||||
Future improvements:
|
||||
- make this installer work for different OS/distributions (e.g. https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_windows.html)
|
||||
- it would be nice to output the install directory (i.e. `/opt/intel/openvino`)
|
||||
14
.github/actions/install-openvino/action.yml
vendored
Normal file
14
.github/actions/install-openvino/action.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: 'Install OpenVINO'
|
||||
description: 'Install OpenVINO binaries from a package repository; this is significantly faster than building from source'
|
||||
|
||||
inputs:
|
||||
version:
|
||||
description: 'The release version of OpenVINO to install'
|
||||
required: false
|
||||
default: '2020.4.287'
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- run: ${{ github.action_path }}/install.sh ${{ inputs.version }}
|
||||
shell: bash
|
||||
16
.github/actions/install-openvino/install.sh
vendored
Executable file
16
.github/actions/install-openvino/install.sh
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Retrieve OpenVINO checksum.
|
||||
wget https://apt.repos.intel.com/openvino/2020/GPG-PUB-KEY-INTEL-OPENVINO-2020
|
||||
echo '5f5cff8a2d26ba7de91942bd0540fa4d GPG-PUB-KEY-INTEL-OPENVINO-2020' > CHECKSUM
|
||||
md5sum --check CHECKSUM
|
||||
|
||||
# Add OpenVINO repository (deb).
|
||||
sudo apt-key add GPG-PUB-KEY-INTEL-OPENVINO-2020
|
||||
echo "deb https://apt.repos.intel.com/openvino/2020 all main" | sudo tee /etc/apt/sources.list.d/intel-openvino-2020.list
|
||||
sudo apt update
|
||||
|
||||
# Install OpenVINO package.
|
||||
sudo apt install -y intel-openvino-runtime-ubuntu18-$1
|
||||
Reference in New Issue
Block a user