# ExecuTorch | |
Executorch is a PyTorch inference API for Edge Devices. | |
## Instructions | |
A prebuilt tar is included. | |
## Build | |
To build executorch you will require `cmake` and `python3`. You will also require `torch`. | |
```shell | |
# get executorch git | |
git clone --branch viable/strict https://github.com/pytorch/executorch.git /tmp/executorch | |
cd /tmp/executorch && git submodule sync && git submodule update --init | |
# copy missing files (monkey patch) | |
# We require these files for building execu | |
ls /usr/local/lib/python3.10/dist-packages/torchgen/packaged/ATen/native/ | |
# This is a workaround for now | |
mkdir -p /usr/lib/python3/dist-packages/torchgen/packaged/ATen/native/ | |
cp /usr/local/lib/python3.10/dist-packages/torchgen/packaged/ATen/native/* /usr/lib/python3/dist-packages/torchgen/packaged/ATen/native/ | |
``` | |
Run this Python Code | |
```python | |
import sysconfig | |
lib_path = sysconfig.get_paths()["purelib"] | |
print(lib_path) | |
``` | |
Copy the LIB PATH into this `CMAKE_PREFIX_PATH` value | |
```shell | |
cd /tmp/executorch; CMAKE_PREFIX_PATH={lib_path} EXECUTORCH_BUILD_XNNPACK=ON bash ./install_executorch.sh --pybind xnnpack; echo "build completed" | |
``` | |
Wait for build to complete. | |