This is the port of tensorflowlite as external library
Please refer to the README.md
as well as the documentation in the doc/
subdirectory of the main unikraft repository.
TensorFlowLite interpreter depends on the following libraries, that need to
be added to Makefile
in this order:
pthreads
, e.g.pthread-embedded
libcxx
libcxxabi
libc
, e.g.newlib
libunwind
libcompilerrt
libgemmlowp
libflatbuffers
libfarmhash
libeigen
libfft2
TensorFlowLite needs a filesystem which should contain one or more tflite models. Therefore, the filesystem needs to be created before running the VM.
Mounting the filesystem is a transparent operation. All you have to do is to provide the right Qemu parameters in order for Unikraft to mount the filesystem. We will use the 9pfs support for filesystems and for this you will need to use the following parameters:
-fsdev local,id=myid,path=<some directory>,security_model=none \
-device virtio-9p-pci,fsdev=myid,mount_tag=rootfs,disable-modern=on,disable-legacy=off
You should also use vfs.rootdev=rootfs
(set by default) to specify the 9pfs mounting
tag to Unikraft. To enable 9pfs, you'll need to select the following
menu options, all under Library Configuration
(this should be already done by the
tflite
config file):
uk9p: 9p client
vfscore: VFS Core Interface
→vfscore: Configuration
→Automatically mount a root filesysytem
→Default root filesystem
→9PFS
Alternatively, and perhaps easier, is to use the qemu-guest script here:
kvm-guest -k build/helloworld_kvm-x86_64 -e rootfs -a "vfs.rootdev=fs0 --" -m 1024
Currently, main.cpp
contains a minimal example for loading a tflite model and
printing the interpreter state. The sample program will try to load the model from
mobilenet_v1_1.0_224.tflite
(this model and other models from the same family can
be downloaded from here)