The WasmEdge extension will be deprecated soon and be replaced by the WasmEdge-Image plug-in, WasmEdge-Tensorflow plug-in, and WasmEdge-TensorflowLite plug-in.
The WasmEdge is a high performance WebAssembly runtime optimized for server side applications. This project provides WasmEdge tools accessing with Tensorflow C library.
wget -qO- https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -e all -v 0.12.1
We provide a simple tool for showing the tensors information of TensorFlow-Lite models. Take the bird v1 tflite model for example.
./show-tflite-tensor lite-model_aiy_vision_classifier_birds_V1_3.tflite
The output will be as following:
Input tensor nums: 1
Input tensor name: module/hub_input/images_uint8
dimensions: [1 , 224 , 224 , 3]
data type: UInt8
tensor byte size: 150528
Output tensor nums: 1
Output tensor name: module/prediction
dimensions: [1 , 965]
data type: UInt8
tensor byte size: 965
git clone https://github.com/second-state/WasmEdge-tensorflow-tools.git
cd WasmEdge-tensorflow-tools
git checkout 0.12.1
WasmEdge will try to use the latest LLVM release to create our nightly build. If you want to build from source, you may need to install these dependencies by yourself or using our docker images which provides several Linux distribution support.
Repository on dockerhub wasmedge/wasmedge
You can use the following commands to get our latest docker image:
docker pull wasmedge/wasmedge # Equals to wasmedge/wasmedge:latest
The followings are available tags of docker images to build and run WasmEdge-Tensorflow-Tools
:
tag name | arch | based operating system | LLVM version | ENVs | compatibility | comments |
---|---|---|---|---|---|---|
latest |
x86_64 | Ubuntu 20.04 LTS | 12.0.0 | CC=clang, CXX=clang++ | Ubuntu 20.04+ | This is for CI, will always use the latest Ubuntu release |
ubuntu-build-gcc |
x86_64 | Ubuntu 20.04 LTS | 12.0.0 | CC=gcc, CXX=g++ | Ubuntu 20.04+ | This is for CI, will always use the latest Ubuntu release |
ubuntu-build-clang |
x86_64 | Ubuntu 20.04 LTS | 12.0.0 | CC=clang, CXX=clang++ | Ubuntu 20.04+ | This is for CI, will always use the latest Ubuntu release |
manylinux2014_x86_64 |
x86_64 | CentOS 7, 7.9.2009 | 12.0.0 | CC=gcc, CXX=g++ | Ubuntu 16.04+, CentOS 7+ | This is for developers who familiar with CentOS on x86_64 architecture |
# Tools and libraries
sudo apt install -y \
software-properties-common \
cmake \
libboost-all-dev
# WasmEdge supports both clang++ and g++ compilers
# You can choose one of them for building this project
# If you prefer GCC
sudo apt install -y gcc g++
# Else you can choose clang
sudo apt install -y clang-12
WasmEdge-Tensorflow-Tools
depends on WasmEdge-core
, WasmEdge-image
, and WasmEdge-tensorflow
.
You have to prepare the WasmEdge-core
, WasmEdge-image
, and the WasmEdge-tensorflow
before you build WasmEdge-Tensorflow-Tools
.
We provides two options for setting up the WasmEdge-core
:
# After pulling our WasmEdge docker image
docker run -it --rm \
-v <path/to/your/WasmEdge-tensorflow/source/folder>:/root/WasmEdge-tensorflow-tools \
wasmedge/wasmedge:latest
# In docker
cd /root/WasmEdge-tensorflow-tools
mkdir -p build && cd build
# In docker
cmake -DCMAKE_BUILD_TYPE=Release .. && make
You can also specify the WasmEdge-image
by assigning WASMEDGE_IMAGE_PATH
, and the WasmEdge-tensorflow
by assigning WASMEDGE_TENSORFLOW_PATH
. The dependencies not assigned will be fetched with the default versions automatically.
# In docker
cmake \
-DWASMEDGE_CORE_PATH=<path/to/WasmEdge/source> \
-DWASMEDGE_IMAGE_PATH=<path/to/WasmEdge-image/source> \
-DWASMEDGE_TENSORFLOW_PATH=<path/to/WasmEdge-tensorflow/source> \
-DCMAKE_BUILD_TYPE=Release .. && make
The executable build/tools/wasmedge-tensorflow
is the runner for executing WASM or compiled WASM.
The executable build/tools/wasmedge-tensorflow-lite
is the runner for executing WASM or compiled WASM with only TensorFlow-lite host functions supported.