TFlite examples #482
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TFlite examples | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'info' | |
push: | |
branches: [ '*' ] | |
paths: | |
- ".github/workflows/tflite.yml" | |
- "tflite-birds_v1-image/**" | |
pull_request: | |
branches: [ '*' ] | |
paths: | |
- ".github/workflows/tflite.yml" | |
- "tflite-birds_v1-image/**" | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install apt-get packages | |
run: | | |
echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc | |
sudo ACCEPT_EULA=Y apt-get update | |
sudo ACCEPT_EULA=Y apt-get upgrade | |
sudo apt-get install wget git curl software-properties-common build-essential | |
- name: Install Rust target for wasm | |
run: | | |
rustup target add wasm32-wasi | |
- name: Install WasmEdge + WASI-NN + TFLite | |
run: | | |
VERSION=0.13.4 | |
TFVERSION=2.12.0 | |
curl -s -L -O --remote-name-all https://github.com/second-state/WasmEdge-tensorflow-deps/releases/download/TF-2.12.0-CC/WasmEdge-tensorflow-deps-TFLite-TF-$TFVERSION-CC-manylinux2014_x86_64.tar.gz | |
tar -zxf WasmEdge-tensorflow-deps-TFLite-TF-$TFVERSION-CC-manylinux2014_x86_64.tar.gz | |
rm -f WasmEdge-tensorflow-deps-TFLite-TF-$TFVERSION-CC-manylinux2014_x86_64.tar.gz | |
sudo mv libtensorflowlite_c.so /usr/local/lib | |
sudo mv libtensorflowlite_flex.so /usr/local/lib | |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -v $VERSION --plugins wasi_nn-tensorflowlite -p /usr/local | |
- name: Example | |
run: | | |
cd tflite-birds_v1-image/rust | |
cargo build --target wasm32-wasi --release | |
cd .. | |
wasmedge compile rust/target/wasm32-wasi/release/wasmedge-wasinn-example-tflite-bird-image.wasm wasmedge-wasinn-example-tflite-bird-image.wasm | |
wasmedge --dir .:. wasmedge-wasinn-example-tflite-bird-image.wasm lite-model_aiy_vision_classifier_birds_V1_3.tflite bird.jpg | |