Raspberry Pi setup

Run the next steps on a Raspberry Pi with 64-bit Raspberry Pi OS Trixie unless told to use the development machine.

Refer to Raspberry Pi’s getting started guide for initial set-up of a new Raspberry Pi.

You are recommended to SSH into your Pi from your development machine. If connecting over SSH, do so while also port-forwarding specific ports you will use for application demos:

    

        
        
ssh -L 8080:localhost:8080 -L 8090:localhost:8090 -L 8091:localhost:8091 <user>@<pi>

    

The port mapping is:

PortUsed for
8080benchmark results dashboard
8081reserved for Model Explorer on the development machine
8090GPT-2 text-generation demo
8091DistilBERT autocomplete demo

Install the tools and libraries needed to build Python 3.12.14:

    

        
        
sudo apt update
sudo apt install -y \
  git curl ca-certificates build-essential \
  libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
  libncurses-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
  libffi-dev liblzma-dev

    

If pyenv is not already installed on the Pi, install it:

    

        
        
curl -fsSL https://pyenv.run | bash

    

Clone the repo scripts onto the Pi if they are not already present:

    

        
        
git clone https://github.com/ArmDeveloperEcosystem/arm-courses-code-executorch.git ~/executorch_on_arm
cd ~/executorch_on_arm

    

Run the following check:

    

        
        
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
pyenv install -s 3.12.14
pyenv shell 3.12.14
python --version

    

The final command should print Python 3.12.14.

    

        
        
python -m venv ~/executorch_on_arm/.cpu_lab_venv
source ~/executorch_on_arm/.cpu_lab_venv/bin/activate
python --version
python -m pip install -r module-1-transformer-inference-with-xnnpack/requirements.txt

    

Keep this environment active for the remaining Raspberry Pi steps. If you open a new SSH session, activate .cpu_lab_venv before continuing.

Previous page Complete and continue