PyTorch Raspberry Pi Installation notes 2021-01

I used RaspiOS Lite as base and did all compiling on a Raspberry Pi 8GB (running also works with less memory, but for compiling PyTorch you would need to reduce parallelism and this would increase the time it takes).

Note: I always install wheels system-wide (so sudo pip3 install <wheel>).

Install additional packages: sudo apt-get install python3-numpy python3-wheel python3-setuptools python3-future python3-yaml python3-six python3-requests python3-pip python3-pillow cmake jed libnuma-dev ninja-build ccache python3-typing-extensions screen git python3-protobuf python3-numpy python3-scipy python3-matplotlib llvm-dev python3-psutil cimg-dev jupyter-notebook ipython3 build-essential

PyTorch: The wheel below has been compiled using my usual instructions from the master branch (git rev 963f7629b591dc9750476faf1513bc7f1fb4d6de). It contains quantization fixes over PyTorch 1.7, so we want this. I also added a diff (see below) to enable NNPACK for batch size one. This is has been proposed in PyTorch PR 26711.

TorchVision: The wheel below has been compiled from git tag v0.8.1.

Audio: apt-get install libsox-dev python3-sklearn python3-numba python3-cffi
Compile torchaudio from master or use whl below (compiled from git rev cf11427643edc4bf7681c0e425f0409eb21a7d28).
sudo pip3 install librosa*whl Librosa has been rebuilt to not depend on a specific version of numba (from git master rev a53fa56bdb6695a994008d5b6ccd0100870a6036) plus the patch below.

Recompile libarm-compute20 and libarm-compute-dev on Buster from the Debian Bullseye sources after installing the build-dependencies or use the debs below.

ONNXRuntime install whl below. It has been built from a checkout of the v1.6.0 tag with the patch for acl 20.08 below. The command was ./build.sh --config RelWithDebInfo --build_shared_lib --parallel --enable_pybind --build_wheel --use_acl ACL_2002 --build_wheel --skip_tests

TVM has been built from the main branch (rev b8ac8d94dec93cdaaec436f9105ea9b2eef752d0) after changing the config to set USE_ARM_COMPUTE_LIB and USE_ARM_COMPUTE_LIB_GRAPH_RUNTIME to on. TVM needs XGBoost at runtime, the whl was compiled from the master branch (rev 60cfd14349a3ed4593de276525fba068adcaea53).

pip will install additional packages, I ended up with appdirs packaging SoundFile joblib pooch attrs synr audioread resampy