Follow the workflow from model export to application testing
Use the same workflow for both the GPT-2 and DistilBERT models:
- Prepare a PyTorch model for export.
- Lower the exported model to two ExecuTorch artifacts: portable and XNNPACK.
- Inspect the lowered graph to see what XNNPACK delegated.
- Copy the artifacts to the Raspberry Pi.
- Benchmark PyTorch eager, portable ExecuTorch, and ExecuTorch with XNNPACK.
- Run the delegated artifact inside a small application demo.
- Compare the trade-offs.
As you work, pay attention to the engineering trade-offs: artifact size, target latency, delegated regions, fallback operators, application responsiveness, and production validation still needed.
Script layout
The scripts are split so the main PyTorch and ExecuTorch flow is easy to find:
aot prepare/export/lower models on the development machine
pi/ compare PyTorch and ExecuTorch on the Raspberry Pi
pi/core load `.pte` artifacts and turn model outputs into app behavior
_support shared setup, plotting, result writing, and HTML rendering
The AOT scripts show the ExecuTorch export and
lowering workflow. The pi/core files show how a .pte model is used
inside an application. The _support files keep the lab readable by
moving repeated utilities out of the main path.
If you are reading code while you work through the module, start with the files in aot, pi/benchmark_model.py, and pi/core. The serve_* scripts are small wrappers that launch the browser demos.
Development and target environments
| Environment | Responsibility | Main outputs |
|---|---|---|
| Development machine | Prepare, export, lower, inspect graphs | .pt2, .pte, metadata, Model Explorer notes |
| Raspberry Pi | Benchmark runtime paths and run demos | JSON/CSV results, plots, app behavior observations |
Course complete
Nice work
You completed Optimize and deploy AI inference with ExecuTorch on Arm.