Skip to content

TFlite examples

TFlite examples #608

Workflow file for this run

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/**"
merge_group:
jobs:
build:
runs-on: ubuntu-latest
container:
image: ubuntu:20.04
steps:
- uses: actions/checkout@v4
- name: Install apt-get packages
run: |
ACCEPT_EULA=Y apt-get update
ACCEPT_EULA=Y apt-get upgrade -y
apt-get install -y wget git curl software-properties-common build-essential
env:
DEBIAN_FRONTEND: noninteractive
- name: Install Rust target for wasm
uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-wasip1
- 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
mv libtensorflowlite_c.so /usr/local/lib
mv libtensorflowlite_flex.so /usr/local/lib
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v $VERSION --plugins wasi_nn-tensorflowlite -p /usr/local
- name: Example
run: |
cd tflite-birds_v1-image/rust
cargo build --target wasm32-wasip1 --release
cd ..
wasmedge compile rust/target/wasm32-wasip1/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