-
https://pytorch.org/executorch/main/llm/getting-started.html
-
(Prerequisites) Export the model to
.pte
following torch.export() ⇒ Edge Compilation -
Create a file called main.cpp with the following contents
- The
Module
class handles loading the .pte file and preparing for execution.- has the forward signature and expectes
Evalue
tensor
- has the forward signature and expectes
// Load the exported nanoGPT program, which was generated via the previous
// steps.
Module model("nanogpt.pte", Module::LoadMode::MmapUseMlockIgnoreErrors);
-
The ExecuTorch
EValue
class provides a wrapper around tensors and other ExecuTorch data types.