xref: /aosp_15_r20/external/executorch/README.md (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1*523fa7a6SAndroid Build Coastguard Worker# ExecuTorch
2*523fa7a6SAndroid Build Coastguard Worker
3*523fa7a6SAndroid Build Coastguard Worker**ExecuTorch** is an end-to-end solution for enabling on-device inference
4*523fa7a6SAndroid Build Coastguard Workercapabilities across mobile and edge devices including wearables, embedded
5*523fa7a6SAndroid Build Coastguard Workerdevices and microcontrollers. It is part of the PyTorch Edge ecosystem and
6*523fa7a6SAndroid Build Coastguard Workerenables efficient deployment of PyTorch models to edge devices.
7*523fa7a6SAndroid Build Coastguard Worker
8*523fa7a6SAndroid Build Coastguard WorkerKey value propositions of ExecuTorch are:
9*523fa7a6SAndroid Build Coastguard Worker
10*523fa7a6SAndroid Build Coastguard Worker- **Portability:** Compatibility with a wide variety of computing platforms,
11*523fa7a6SAndroid Build Coastguard Worker  from high-end mobile phones to highly constrained embedded systems and
12*523fa7a6SAndroid Build Coastguard Worker  microcontrollers.
13*523fa7a6SAndroid Build Coastguard Worker- **Productivity:** Enabling developers to use the same toolchains and Developer
14*523fa7a6SAndroid Build Coastguard Worker  Tools from PyTorch model authoring and conversion, to debugging and deployment
15*523fa7a6SAndroid Build Coastguard Worker  to a wide variety of platforms.
16*523fa7a6SAndroid Build Coastguard Worker- **Performance:** Providing end users with a seamless and high-performance
17*523fa7a6SAndroid Build Coastguard Worker  experience due to a lightweight runtime and utilizing full hardware
18*523fa7a6SAndroid Build Coastguard Worker  capabilities such as CPUs, NPUs, and DSPs.
19*523fa7a6SAndroid Build Coastguard Worker
20*523fa7a6SAndroid Build Coastguard WorkerFor a comprehensive technical overview of ExecuTorch and step-by-step tutorials,
21*523fa7a6SAndroid Build Coastguard Workerplease visit our documentation website [for the latest release](https://pytorch.org/executorch/stable/index.html) (or the [main branch](https://pytorch.org/executorch/main/index.html)).
22*523fa7a6SAndroid Build Coastguard Worker
23*523fa7a6SAndroid Build Coastguard WorkerCheck out the [Getting Started](https://pytorch.org/executorch/stable/getting-started-setup.html#quick-setup-colab-jupyter-notebook-prototype) page for a quick spin.
24*523fa7a6SAndroid Build Coastguard Worker
25*523fa7a6SAndroid Build Coastguard WorkerCheck out the examples of [Llama](./examples/models/llama/README.md), [Llava](./examples/models/llava/README.md) and [other models](./examples/README.md) running on edge devices using ExecuTorch.
26*523fa7a6SAndroid Build Coastguard Worker
27*523fa7a6SAndroid Build Coastguard Worker
28*523fa7a6SAndroid Build Coastguard Worker**[UPDATE - 10/24]** We have added support for running [Llama 3.2 Quantized 1B/3B](./examples/models/llama/README.md) models via ExecuTorch.
29*523fa7a6SAndroid Build Coastguard Worker
30*523fa7a6SAndroid Build Coastguard Worker## Feedback
31*523fa7a6SAndroid Build Coastguard Worker
32*523fa7a6SAndroid Build Coastguard WorkerWe welcome any feedback, suggestions, and bug reports from the community to help
33*523fa7a6SAndroid Build Coastguard Workerus improve our technology. Please use the [PyTorch
34*523fa7a6SAndroid Build Coastguard WorkerForums](https://discuss.pytorch.org/c/executorch) for discussion and feedback
35*523fa7a6SAndroid Build Coastguard Workerabout ExecuTorch using the **ExecuTorch** category, and our [GitHub
36*523fa7a6SAndroid Build Coastguard Workerrepository](https://github.com/pytorch/executorch/issues) for bug reporting.
37*523fa7a6SAndroid Build Coastguard Worker
38*523fa7a6SAndroid Build Coastguard WorkerWe recommend using the latest release tag from the
39*523fa7a6SAndroid Build Coastguard Worker[Releases](https://github.com/pytorch/executorch/releases) page when developing.
40*523fa7a6SAndroid Build Coastguard Worker
41*523fa7a6SAndroid Build Coastguard Worker## Contributing
42*523fa7a6SAndroid Build Coastguard Worker
43*523fa7a6SAndroid Build Coastguard WorkerSee [CONTRIBUTING.md](CONTRIBUTING.md) for details about issues, PRs, code
44*523fa7a6SAndroid Build Coastguard Workerstyle, CI jobs, and other development topics.
45*523fa7a6SAndroid Build Coastguard Worker
46*523fa7a6SAndroid Build Coastguard WorkerTo connect with us and other community members, we invite you to join PyTorch Slack community by filling out this [form](https://docs.google.com/forms/d/e/1FAIpQLSeADnUNW36fjKjYzyHDOzEB_abKQE9b6gqqW9NXse6O0MWh0A/viewform). Once you've joined, you can:
47*523fa7a6SAndroid Build Coastguard Worker* Head to the `#executorch-general` channel for general questions, discussion, and community support.
48*523fa7a6SAndroid Build Coastguard Worker* Join the `#executorch-contributors` channel if you're interested in contributing directly to project development.
49*523fa7a6SAndroid Build Coastguard Worker
50*523fa7a6SAndroid Build Coastguard Worker
51*523fa7a6SAndroid Build Coastguard Worker## Directory Structure
52*523fa7a6SAndroid Build Coastguard Worker
53*523fa7a6SAndroid Build Coastguard Worker```
54*523fa7a6SAndroid Build Coastguard Workerexecutorch
55*523fa7a6SAndroid Build Coastguard Worker├── backends                        #  Backend delegate implementations.
56*523fa7a6SAndroid Build Coastguard Worker├── build                           #  Utilities for managing the build system.
57*523fa7a6SAndroid Build Coastguard Worker├── codegen                         #  Tooling to autogenerate bindings between kernels and the runtime.
58*523fa7a6SAndroid Build Coastguard Worker├── configurations
59*523fa7a6SAndroid Build Coastguard Worker├── docs                            #  Static docs tooling.
60*523fa7a6SAndroid Build Coastguard Worker├── examples                        #  Examples of various user flows, such as model export, delegates, and runtime execution.
61*523fa7a6SAndroid Build Coastguard Worker├── exir                            #  Ahead-of-time library: model capture and lowering APIs.
62*523fa7a6SAndroid Build Coastguard Worker|   ├── _serialize                  #  Serialize final export artifact.
63*523fa7a6SAndroid Build Coastguard Worker|   ├── backend                     #  Backend delegate ahead of time APIs
64*523fa7a6SAndroid Build Coastguard Worker|   ├── capture                     #  Program capture.
65*523fa7a6SAndroid Build Coastguard Worker|   ├── dialects                    #  Op sets for various dialects in the export process.
66*523fa7a6SAndroid Build Coastguard Worker|   ├── emit                        #  Conversion from ExportedProgram to ExecuTorch execution instructions.
67*523fa7a6SAndroid Build Coastguard Worker|   ├── operator                    #  Operator node manipulation utilities.
68*523fa7a6SAndroid Build Coastguard Worker|   ├── passes                      #  Built-in compiler passes.
69*523fa7a6SAndroid Build Coastguard Worker|   ├── program                     #  Export artifacts.
70*523fa7a6SAndroid Build Coastguard Worker|   ├── serde                       #  Graph module
71*523fa7a6SAndroid Build Coastguard Workerserialization/deserialization.
72*523fa7a6SAndroid Build Coastguard Worker|   ├── verification                #  IR verification.
73*523fa7a6SAndroid Build Coastguard Worker├── extension                       #  Extensions built on top of the runtime.
74*523fa7a6SAndroid Build Coastguard Worker|   ├── android                     #  ExecuTorch wrappers for Android apps.
75*523fa7a6SAndroid Build Coastguard Worker|   ├── apple                       #  ExecuTorch wrappers for iOS apps.
76*523fa7a6SAndroid Build Coastguard Worker|   ├── aten_util                   #  Converts to and from PyTorch ATen types.
77*523fa7a6SAndroid Build Coastguard Worker|   ├── data_loader                 #  1st party data loader implementations.
78*523fa7a6SAndroid Build Coastguard Worker|   ├── evalue_util                 #  Helpers for working with EValue objects.
79*523fa7a6SAndroid Build Coastguard Worker|   ├── gguf_util                   #  Tools to convert from the GGUF format.
80*523fa7a6SAndroid Build Coastguard Worker|   ├── kernel_util                 #  Helpers for registering kernels.
81*523fa7a6SAndroid Build Coastguard Worker|   ├── memory_allocator            #  1st party memory allocator implementations.
82*523fa7a6SAndroid Build Coastguard Worker|   ├── module                      #  A simplified C++ wrapper for the runtime.
83*523fa7a6SAndroid Build Coastguard Worker|   ├── parallel                    #  C++ threadpool integration.
84*523fa7a6SAndroid Build Coastguard Worker|   ├── pybindings                  #  Python API for executorch runtime.
85*523fa7a6SAndroid Build Coastguard Worker|   ├── pytree                      #  C++ and Python flattening and unflattening lib for pytrees.
86*523fa7a6SAndroid Build Coastguard Worker|   ├── runner_util                 #  Helpers for writing C++ PTE-execution
87*523fa7a6SAndroid Build Coastguard Workertools.
88*523fa7a6SAndroid Build Coastguard Worker|   ├── testing_util                #  Helpers for writing C++ tests.
89*523fa7a6SAndroid Build Coastguard Worker|   ├── training                    #  Experimental libraries for on-device training
90*523fa7a6SAndroid Build Coastguard Worker├── kernels                         #  1st party kernel implementations.
91*523fa7a6SAndroid Build Coastguard Worker|   ├── aten
92*523fa7a6SAndroid Build Coastguard Worker|   ├── optimized
93*523fa7a6SAndroid Build Coastguard Worker|   ├── portable                    #  Reference implementations of ATen operators.
94*523fa7a6SAndroid Build Coastguard Worker|   ├── prim_ops                    #  Special ops used in executorch runtime for control flow and symbolic primitives.
95*523fa7a6SAndroid Build Coastguard Worker|   ├── quantized
96*523fa7a6SAndroid Build Coastguard Worker├── profiler                        #  Utilities for profiling runtime execution.
97*523fa7a6SAndroid Build Coastguard Worker├── runtime                         #  Core C++ runtime.
98*523fa7a6SAndroid Build Coastguard Worker|   ├── backend                     #  Backend delegate runtime APIs.
99*523fa7a6SAndroid Build Coastguard Worker|   ├── core                        #  Core structures used across all levels of the runtime.
100*523fa7a6SAndroid Build Coastguard Worker|   ├── executor                    #  Model loading, initialization, and execution.
101*523fa7a6SAndroid Build Coastguard Worker|   ├── kernel                      #  Kernel registration and management.
102*523fa7a6SAndroid Build Coastguard Worker|   ├── platform                    #  Layer between architecture specific code and portable C++.
103*523fa7a6SAndroid Build Coastguard Worker├── schema                          #  ExecuTorch PTE file format flatbuffer
104*523fa7a6SAndroid Build Coastguard Workerschemas.
105*523fa7a6SAndroid Build Coastguard Worker├── scripts                         #  Utility scripts for size management, dependency management, etc.
106*523fa7a6SAndroid Build Coastguard Worker├── devtools                        #  Model profiling, debugging, and introspection.
107*523fa7a6SAndroid Build Coastguard Worker├── shim                            #  Compatibility layer between OSS and Internal builds
108*523fa7a6SAndroid Build Coastguard Worker├── test                            #  Broad scoped end-to-end tests.
109*523fa7a6SAndroid Build Coastguard Worker├── third-party                     #  Third-party dependencies.
110*523fa7a6SAndroid Build Coastguard Worker├── util                            #  Various helpers and scripts.
111*523fa7a6SAndroid Build Coastguard Worker```
112*523fa7a6SAndroid Build Coastguard Worker
113*523fa7a6SAndroid Build Coastguard Worker## License
114*523fa7a6SAndroid Build Coastguard WorkerExecuTorch is BSD licensed, as found in the LICENSE file.
115