-
Notifications
You must be signed in to change notification settings - Fork 687
Add RaspberryPi Tutorials to deploy & infer llama model #15109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15109
Note: Links to docs will display an error until the docs builds have been completed. ❌ 10 New FailuresAs of commit 5062655 with merge base fca0f38 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
|
||
- **Python 3.10-3.12** (ExecuTorch requirement) | ||
- **conda** or **venv** for environment management | ||
- **CMake 3.29.6+** for cross-compilation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **CMake 3.29.6+** for cross-compilation | |
- **CMake 3.29.6+** |
|
||
### Target Device Requirements | ||
|
||
**Supported Devices**: **Raspberry Pi 4** and **Raspberry Pi 5** with **64-bit OS** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we restrict to 64-bit target os?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't tested on other hardware yet, It should work mostly
|
||
- **Minimum 4GB RAM** (8GB recommended for larger models) | ||
- **8GB+ storage** for model files and binaries | ||
- **64-bit Raspberry Pi OS** (Bullseye or newer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, and also why is this under memory reqs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed for llama I assume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we haven't done exhaustive per evals yet, better to leave out specific details out of this section for now..
Let me know what you both think about this, something as follows:
- RAM & Storage Varies by model size and optimization level
python3 --version # Should be 3.10-3.12 | ||
|
||
# Check required tools | ||
which cmake git md5sum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/which/hash?
mkdir ~/executorch-rpi && cd ~/executorch-rpi | ||
# Clone ExecuTorch repository | ||
git clone -b release/1.0 https://github.com/pytorch/executorch.git | ||
cd executorch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do all conditional.. i.e. a && b && c && d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cd executorch | ||
``` | ||
|
||
### Create Conda Environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we repeating ET setup here? Just point to the main one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just below this, I left the link to the main one
pip install --upgrade pip | ||
``` | ||
Refer to → {doc}`getting-started` for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
## Cross-Compilation Toolchain Setup | ||
Run the following automated cross compile script on your Linux host machine: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this reads off..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
## Model Preparation and Export | ||
### Download Llama Models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again can we point people to use standard llama tutorial to create an XNNPACK pte as opposed to repeating steps here?
sudo apt update | ||
# Install newer GLIBC packages | ||
sudo apt-get -t sid install libc6 libstdc++6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do we know that will be compatible with our toolchain?
./llama_main --model_path ./llama3_2.pte --tokenizer_path ./tokenizer.model --seq_len 128 --prompt "What is the meaning of life?" | ||
``` | ||
Happy Inferencing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happened to your script? why are we writing these steps again manually, may be I missed something..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two parts to this tutorials.
- Linux cross compilation on host: This is scripted with this PR
- All the Steps on RPI, involves moving required files from host machine onto RPI, and then ensuring basic environment is ok, then potentially trouble shoot if needed The tutorials gives step-by-step guidance on RPI (2nd step)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Sid. I left some comments..
docs/source/embedded-section.md
Outdated
|
||
- {doc}`tutorial-arm-ethos-u` — Export a simple PyTorch model for the ExecuTorch Ethos-U backend | ||
|
||
- {doc}`raspberry_pi_llama_tutorial` — Deploy a LLaMA model on a Raspberry Pi with the ExecuTorch Ethos-U backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no ethos-U backend on Raspberry Pi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this tutorial is not quite embedded I suppose it's running on Cortex-A based Raspberry Pi
So, I recommend also having another link in the https://docs-preview.pytorch.org/pytorch/executorch/15109/desktop-section.html
but also keep it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no ethos-U backend on Raspberry Pi
Fixes
# Run the Raspberry Pi setup script for Pi 5 | ||
examples/raspberry_pi/setup.sh pi5 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should protect in our CI as a fast follow-on. please create an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
### Host Machine Requirements | ||
|
||
**Operating System**: Linux x86_64 (Ubuntu 20.04+ or CentOS Stream 9+) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the host machine be MacOS if you're cross compiling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not support MacOs , unfortunately the required arm toolchain for RPi on host Mac is not supported
There are many good comments from Digant and Mergen, overall is reasonable |
Summary
[PLEASE REMOVE] See CONTRIBUTING.md's Pull Requests for ExecuTorch PR guidelines.
[PLEASE REMOVE] If this PR closes an issue, please add a
Fixes #<issue-id>
line.[PLEASE REMOVE] If this PR introduces a fix or feature that should be the upcoming release notes, please add a "Release notes: " label. For a list of available release notes labels, check out CONTRIBUTING.md's Pull Requests.
Test plan
[PLEASE REMOVE] How did you test this PR? Please write down any manual commands you used and note down tests that you have written if applicable.