PyTorch Model Conversion to ExecuTorch Format#
In this guideline we will show how to use the ExecuTorch AoT part to convert a PyTorch model to ExecuTorch format and delegate the model computation to eIQ Neutron NPU using the eIQ Neutron Backend.
First we will start with an example script converting the model. This example shows the CifarNet model preparation. It is the same model which is part of the example_cifarnet.
Run the
aot_neutron_compile.pyexample with thecifar10model. As theaot_neutron_compile.pyis already installed as part of the ExecuTorch installation we will run it from there
$ python -m examples.nxp.aot_neutron_compile --quantize \
--delegate --neutron_converter_flavor SDK_25_12 -m cifar10
It will generate you
cifar10_nxp_delegate.ptefile which can be used with the MXUXpresso SDKcifarnet_exampleproject.
The generated PTE file is used in the executorch_cifarnet example application, see example_application.