The pre-built package is ./https://github.com/wangkuiyi/pytorch-rpi.zip
.
The steps to build it include:
- Log in to an NVIDIA Drive PX2 computer.
- Upgrade the system from Ubuntu 16.04 to Ubuntu 18.04 for a recent Python.
- Install Clang with
sudo apt-get install -y clang
. - Set environment variables:
export USE_CUDA=0 export USE_QNNPACK=0 export USE_PYTORCH_QNNPACK=0
- Run
./build_libtorch.sh
to build and pack the zip file.
- Install the latest Raspberry Pi OS (32-bit).
- Run
sudo apt update && sudo apt upgrade
. - Run
git clone [email protected]:ljk53/pytorch-rpi && cd pytorch-rpi
. - Run
LIBTORCH_VARIANT=armv7l-cxx11-abi-shared-without-deps ./build_libtorch.sh
.
- Install the latest 64-bit Ubuntu 20.04 for Raspberry Pi.
- Run
sudo apt update && sudo apt upgrade
. - Run
git clone [email protected]:ljk53/pytorch-rpi && cd pytorch-rpi
. - Run
MAX_JOBS=2 LIBTORCH_VARIANT=aarch64-cxx11-abi-shared-without-deps ./build_libtorch.sh
. Note: set the max number of concurrent build jobs to 2 to avoid running out of the RAM.