We build a very simple, lightweight intent classifier. Aimed to be comfortably run in a Raspberry Pi 3b 🍓
The original pipeline can be found in this Colab Notebook
💡 We use a
LabelEncoder
which maps classes to integer indices
💡 We use
Spacy
to embed sentences into continuous vector space
We use sklearn-crfsuite to extract entities.
💡 To know more check its documentation!
Installing Spacy
can be challenging in an Raspberry Pi.
The advice is either to cross-compile or to use pre-built wheels.
Blis
and Spacy
wheels can be found here
Alternatively you can cross-compile / build your own:
Click to expand!
Building the blis
, spacy
or numpy
wheels in the RPI can be a painfully
slow process so to avoid the suffering a possible solution is to cross-compile
using docker buildx
.
The steps are as follows:
- Install buildx
You can use this script
- Run docker build (in a work-station, not in the RPI!):
docker buildx build --push \
--platform linux/arm/v7 \
-t jmrf/simple-nlu-rpi:cp37 \
-f Dockerfile .
-
Run the container (in the RPI)
docker run -it --entrypoint /bin/bash jmrf/numpy-rpi:py37-np1.21.6
In another terminal:
docker container ls # copy the container ID # Copy the wheels back to the target system docker cp <your-container-ID>:/numpy/dist/numpy-1.21.6-cp37-cp37m-linux_armv7l.whl . pip install numpy-1.21.6-cp37-cp37m-linux_armv7l.whl