Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class BenchmarkFilters:

BASE_URLS = {
"local": "http://localhost:3000",
"prod": "https://hud.pytorch.org",
"prod": "https://hud.pytorch.org", # @lint-ignore
}


Expand Down
8 changes: 6 additions & 2 deletions .ci/scripts/tests/test_get_benchmark_analysis_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ def setUp(self):
def test_init(self):
"""Test initialization of ExecutorchBenchmarkFetcher."""
self.assertEqual(self.fetcher.env, "prod")
self.assertEqual(self.fetcher.base_url, "https://hud.pytorch.org")
self.assertEqual(
self.fetcher.base_url, "https://hud.pytorch.org" # @lint-ignore
)
self.assertEqual(
self.fetcher.query_group_table_by_fields,
["model", "backend", "device", "arch"],
Expand All @@ -193,7 +195,9 @@ def test_init(self):

def test_get_base_url(self):
"""Test _get_base_url method."""
self.assertEqual(self.fetcher._get_base_url(), "https://hud.pytorch.org")
self.assertEqual(
self.fetcher._get_base_url(), "https://hud.pytorch.org" # @lint-ignore
)

# Test with local environment
local_fetcher = self.module.ExecutorchBenchmarkFetcher(env="local")
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ the code you're modifying and find an author who has more context. Ask them
for their help in the PR comments.

### Continuous Integration
See https://hud.pytorch.org/hud/pytorch/executorch/main for the current state of

See https://hud.pytorch.org/hud/pytorch/executorch/main for the current state of <!-- @lint-ignore -->
the CI (continuous integration) jobs. If `main` is broken, consider rebasing
your PR onto the `viable/strict` branch, which points to the most recent
all-green commit.
Expand Down
2 changes: 1 addition & 1 deletion backends/openvino/quantizer/quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def _get_unified_scales_root_quantizer_id(
"""
Identifies the earliest quantizer node ID based on the corresponding `nncf_node.node_id`
in the given NNCFGraph. This is required by the `_get_obs_or_fq_map` function.
Refer to: https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/pt2e/prepare.py#L291
Refer to: https://github.com/pytorch/ao/blob/main/torchao/quantization/pt2e/prepare.py

:param nncf_graph: The NNCFGraph instance.
:param quantizer_ids: The list of quantizer IDs to evaluate.
Expand Down
4 changes: 2 additions & 2 deletions backends/xnnpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,5 @@ create an issue on [github](https://www.github.com/pytorch/executorch/issues).

## See Also
For more information about the XNNPACK Backend, please check out the following resources:
- [XNNPACK Backend](https://pytorch.org/executorch/main/backends-xnnpack)
- [XNNPACK Backend Internals](https://pytorch.org/executorch/main/backends/xnnpack/backend-delegates-xnnpack-reference)
- [XNNPACK Backend](https://docs.pytorch.org/executorch/main/backends/xnnpack/xnnpack-overview.html)
- [XNNPACK Backend Internals](https://docs.pytorch.org/executorch/main/backends/xnnpack/xnnpack-arch-internals.html)
2 changes: 1 addition & 1 deletion docs/source/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ DOCSET_PUBLISHER_NAME = Publisher
# a.o. the download links, offline the HTML help workshop was already many years
# in maintenance mode). You can download the HTML help workshop from the web
# archives at Installation executable (see:
# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo @lint-ignore
# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
Expand Down
2 changes: 1 addition & 1 deletion docs/source/archive/backends-cadence-legacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ python3 -m examples.cadence.operators.quantized_<linear,conv1d>_op

***Small Model: RNNT predictor***:

The torchaudio [RNNT-emformer](https://pytorch.org/audio/stable/tutorials/online_asr_tutorial.html) model is an Automatic Speech Recognition (ASR) model, comprised of three different submodels: an encoder, a predictor and a joiner.
The torchaudio [RNNT-emformer](https://docs.pytorch.org/audio/stable/generated/torchaudio.pipelines.EMFORMER_RNNT_BASE_LIBRISPEECH.html) model is an Automatic Speech Recognition (ASR) model, comprised of three different submodels: an encoder, a predictor and a joiner.
The [predictor](https://github.com/pytorch/executorch/blob/main/examples/cadence/models/rnnt_predictor.py) is a sequence of basic ops (embedding, ReLU, linear, layer norm) and can be exported using:

```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/source/backends-cadence.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ In all cases the generated file is called `CadenceDemoModel.pte`.

***Speech/Audio Models***:

The torchaudio [RNNT-emformer](https://pytorch.org/audio/stable/tutorials/online_asr_tutorial.html) model is an Automatic Speech Recognition (ASR) model, comprised of three different submodels:
The torchaudio [RNNT-emformer](https://docs.pytorch.org/audio/stable/generated/torchaudio.pipelines.EMFORMER_RNNT_BASE_LIBRISPEECH.html) model is an Automatic Speech Recognition (ASR) model, comprised of three different submodels:

- **RNNT Predictor**: Sequence of basic ops (embedding, ReLU, linear, layer norm)
```bash
Expand Down
12 changes: 0 additions & 12 deletions docs/source/compiler-delegate-and-partitioner.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,6 @@ exported_program_backend_1 = to_backend(exported_program, backend_1_parititioner
exported_program_backend_1_and_2 = to_backend(exported_program_backend_1, backend_2_parititioner())
```

A more concrete example be found
[here](https://github.com/pytorch/executorch/blob/main/exir/backend/test/demos/test_xnnpack_qnnpack.py).
In this example,
qnnpack is one backend and xnnpack is another backend. We haven't open-sourced
these two backends delegates yet, and this example won't run out of box. It can
be used as a reference to see how it can be done.

This option is easy to try because usually all backends will implement their own
partitioner. However this option may get different results if we change the
order of to_backend call. If we want to have a better control on the nodes, like
which backend they should go, option 2 is better.

*Option 2: Have a partitioner which partitions for different backends*

Another option is to create a customized partitioner, say partitioner
Expand Down
6 changes: 3 additions & 3 deletions docs/source/getting-started-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ leverages PyTorch 2 compiler and export functionality
[AOTAutograd](https://pytorch.org/functorch/stable/notebooks/aot_autograd_optimizations.html),
[Quantization](https://pytorch.org/docs/main/quantization.html),
[dynamic shapes](https://pytorch.org/get-started/pytorch-2.0/#pytorch-2x-faster-more-pythonic-and-as-dynamic-as-ever),
[control flow](https://pytorch.org/docs/main/export.html#data-shape-dependent-control-flow),
[control flow](https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/export.html#data-shape-dependent-control-flow),
etc.) to prepare a PyTorch program for execution on devices.

Program preparation is often simply called AOT (ahead-of-time) because export, transformations and compilations to the program are performed before it is eventually run with the ExecuTorch runtime, written in C++. To have a lightweight runtime and small overhead in execution, we push work as much as possible to AOT.
Expand All @@ -33,14 +33,14 @@ Starting from the program source code, below are the steps you would go through

* Like all PyTorch use cases, ExecuTorch starts from model authoring, where standard `nn.Module` eager mode PyTorch programs are created.
* Export-specific helpers are used to represent advanced features like [control
flow](https://pytorch.org/docs/main/export.html#data-shape-dependent-control-flow)
flow](https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/export.html#data-shape-dependent-control-flow)
(for example, helper functions to trace both branches of if-else) and [dynamic
shapes](https://pytorch.org/get-started/pytorch-2.0/#pytorch-2x-faster-more-pythonic-and-as-dynamic-as-ever)
(for example, data dependent dynamic shape constraint).

### Export

To deploy the program to the device, engineers need to have a graph representation for compiling a model to run on various backends. With [`torch.export()`](https://pytorch.org/docs/main/export.html), an [EXIR](ir-exir.md) (export intermediate representation) is generated with ATen dialect. All AOT compilations are based on this EXIR, but can have multiple dialects along the lowering path as detailed below.
To deploy the program to the device, engineers need to have a graph representation for compiling a model to run on various backends. With [`torch.export()`](https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/export.html), an [EXIR](ir-exir.md) (export intermediate representation) is generated with ATen dialect. All AOT compilations are based on this EXIR, but can have multiple dialects along the lowering path as detailed below.

* _[ATen Dialect](ir-exir.md#aten-dialect)_. PyTorch Edge is based on PyTorch’s Tensor library ATen, which has clear contracts for efficient execution. ATen Dialect is a graph represented by ATen nodes which are fully ATen compliant. Custom operators are allowed, but must be registered with the dispatcher. It’s flatten with no module hierarchy (submodules in a bigger module), but the source code and module hierarchy are preserved in the metadata. This representation is also autograd safe.
* Optionally, _quantization_, either QAT (quantization-aware training) or PTQ (post training quantization) can be applied to the whole ATen graph before converting to Core ATen. Quantization helps with reducing the model size, which is important for edge devices.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/intro-how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This figure illustrates the three-step process of exporting a PyTorch program, c

ExecuTorch provides the following benefits to engineers who need to deploy machine learning models to an edge device:

* **Export that is robust and powerful.** Export uses [`torch.export()`](https://pytorch.org/docs/main/export.html), which uses the same technology used in PyTorch 2.x to capture PyTorch programs for fast execution. While eager mode is flexible and allows experimentation in Python, it may not work well if Python isn't available or cannot deliver efficient execution. The _Export Intermediate Representation (Export IR)_ that export flow generates can describe a wide range of dynamism in PyTorch models, including control flow and dynamic shapes, which makes it a powerful tool for fully capturing existing PyTorch models with little effort.
* **Export that is robust and powerful.** Export uses [`torch.export()`](https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/export.html), which uses the same technology used in PyTorch 2.x to capture PyTorch programs for fast execution. While eager mode is flexible and allows experimentation in Python, it may not work well if Python isn't available or cannot deliver efficient execution. The _Export Intermediate Representation (Export IR)_ that export flow generates can describe a wide range of dynamism in PyTorch models, including control flow and dynamic shapes, which makes it a powerful tool for fully capturing existing PyTorch models with little effort.
* **Operator standardization.** During the graph export process, the nodes in the graph represent operators such as addition, multiplication, or convolution. These operators are part of a small standardized list called the [Core ATen Op set](https://pytorch.org/docs/main/torch.compiler_ir.html#core-aten-ir). Most PyTorch programs can be decomposed into a graph using this small set of operators during export. Small list of standardized operators reduces the surface, needed to be covered, by third-party operator libraries as well as accelerator backends, in order to run models exported for ExecuTorch. ExecuTorch runtime ships with one such library, called portable operator library, that implements core ATen opset.
* **Standardization for compiler interfaces (aka delegates) and the OSS ecosystem.** In addition to the _Operator standardization_ above, ExecuTorch has a [standardized interface](compiler-delegate-and-partitioner.md) for delegation to compilers. This allows third-party vendors and compilers to implement interfaces and API entry points for compilation and execution of (either partial or full) graphs targeting their specialized hardware. This provides greater flexibility in terms of hardware support and performance optimization, as well as easier integration with the PyTorch open source ecosystem for on-device AI.
* **First-party Developer Tools** Due to the above standardization efforts, it was possible to build unified first-party [developer tools](devtools-overview.md) for ExecuTorch, where developers can export, compile, and deploy to a wide range of target devices—such as iOS, Android, and microcontrollers—using the same APIs, streamlining the process and increasing productivity. Additionally, ExecuTorch provides profiling and debugging functionality to easily inspect intermediate states, which are core parts of most developer workflows.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/ir-ops-set-definition.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Definition of the Core ATen Operator Set

This page provides the description and background of the Core ATen Operator Set (opset). This page is recommended reading for those developing a new kernel library or delegate for ExecuTorch. It is also recommended that one is familiar with [`torch.export`](https://pytorch.org/docs/main/export.html) as a prerequisite; in particular, the concepts of torch FX graphs, operator decomposition, and functionalization.
This page provides the description and background of the Core ATen Operator Set (opset). This page is recommended reading for those developing a new kernel library or delegate for ExecuTorch. It is also recommended that one is familiar with [`torch.export`](https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/export.html) as a prerequisite; in particular, the concepts of torch FX graphs, operator decomposition, and functionalization.

The list of operators that have been identified as a Core ATen operator can be found on the [IRs page of the PyTorch documentation website](https://pytorch.org/docs/main/torch.compiler_ir.html).

Expand Down
2 changes: 1 addition & 1 deletion docs/source/llm/export-llm-optimum.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ After verifying your model works correctly, deploy it to device:

## Performance

For performance benchmarks and on-device metrics, see the [Optimum ExecuTorch benchmarks](https://github.com/huggingface/optimum-executorch#-benchmarks-on-mobile-devices) and the [ExecuTorch Benchmark Dashboard](https://hud.pytorch.org/benchmark/llms?repoName=pytorch%2Fexecutorch).
For performance benchmarks and on-device metrics, see the [Optimum ExecuTorch benchmarks](https://github.com/huggingface/optimum-executorch#-benchmarks-on-mobile-devices) and the [ExecuTorch Benchmark Dashboard](https://hud.pytorch.org/benchmark/llms?repoName=pytorch%2Fexecutorch). <!-- @lint-ignore -->

## Additional Resources

Expand Down
4 changes: 2 additions & 2 deletions docs/source/using-executorch-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ In the above example, `"x"` corresponds to the parameter name in `Model.forward`

ExecuTorch uses the shape bounds both to optimize the model and to plan memory for model execution. For this reason, it is advised to set the dimension upper bounds to no higher than needed, as higher bounds increase memory consumption.

For more complex use cases, dynamic shape specification allows for mathematical relationships between dimensions. For more information on dynamic shape specification, see [Expressing Dynamism](https://pytorch.org/docs/stable/export.html#expressing-dynamism).
For more complex use cases, dynamic shape specification allows for mathematical relationships between dimensions. For more information on dynamic shape specification, see [Expressing Dynamism](https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/export.html#expressing-dynamism).

## Testing the Model

Expand Down Expand Up @@ -280,7 +280,7 @@ decode_ep = torch.export.export(DecodeWrapper(model), ...)

## Next Steps

The PyTorch and ExecuTorch export and lowering APIs provide a high level of customizability to meet the needs of diverse hardware and models. See [torch.export](https://pytorch.org/docs/main/export.html) and [Export API Reference](export-to-executorch-api-reference.rst) for more information.
The PyTorch and ExecuTorch export and lowering APIs provide a high level of customizability to meet the needs of diverse hardware and models. See [torch.export](https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/export.html) and [Export API Reference](export-to-executorch-api-reference.rst) for more information.

For advanced use cases, see the following:
- [Quantization Overview](quantization-overview.md) for information on quantizing models to reduce inference time and memory footprint.
Expand Down
18 changes: 2 additions & 16 deletions examples/arm/vgf_minimal_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,7 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# VGF Backend flow example\n",
"\n",
"This guide demonstrates the full flow for lowering a module using the VGF backend using ExecuTorch. \n",
"Tested on Linux x86_64. If something is not working for you, please raise a GitHub issue and tag Arm.\n",
"\n",
"Before you begin:\n",
"1. (In a clean virtual environment with a compatible Python version) Install executorch using `./install_executorch.sh`\n",
"2. Install MLSDK and Tosa using `examples/arm/setup.sh --disable-ethos-u-deps --enable-mlsdk-deps` (For further guidance, refer to https://docs.pytorch.org/executorch/main/tutorial-arm.html)\n",
"3. Export vulkan environment variables and add MLSDK components to PATH and LD_LIBRARY_PATH using `examples/arm/arm-scratch/setup_path.sh`\n",
"\n",
"With all commands executed from the base `executorch` folder.\n",
"\n",
"*Some scripts in this notebook produce long output logs: Configuring the 'Customizing Notebook Layout' settings to enable 'Output:scrolling' and setting 'Output:Text Line Limit' makes this more manageable*"
]
"source": "# VGF Backend flow example\n\nThis guide demonstrates the full flow for lowering a module using the VGF backend using ExecuTorch. \nTested on Linux x86_64. If something is not working for you, please raise a GitHub issue and tag Arm.\n\nBefore you begin:\n1. (In a clean virtual environment with a compatible Python version) Install executorch using `./install_executorch.sh`\n2. Install MLSDK and Tosa using `examples/arm/setup.sh --disable-ethos-u-deps --enable-mlsdk-deps` (For further guidance, refer to https://docs.pytorch.org/executorch/main/backends/arm-vgf/arm-vgf-overview.html)\n3. Export vulkan environment variables and add MLSDK components to PATH and LD_LIBRARY_PATH using `examples/arm/arm-scratch/setup_path.sh`\n\nWith all commands executed from the base `executorch` folder.\n\n*Some scripts in this notebook produce long output logs: Configuring the 'Customizing Notebook Layout' settings to enable 'Output:scrolling' and setting 'Output:Text Line Limit' makes this more manageable*"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -322,4 +308,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
2 changes: 1 addition & 1 deletion examples/llm_pte_finetuning/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ shuffle: True
batch_size: 1
```

Torchtune supports datasets using huggingface dataloaders, so custom datasets could also be defined. For examples on defining your own datasets, review the [torchtune docs](https://pytorch.org/torchtune/stable/basics/text_completion_datasets.html#loading-text-completion-datasets-from-hugging-face).
Torchtune supports datasets using huggingface dataloaders, so custom datasets could also be defined. For examples on defining your own datasets, review the [torchtune docs](https://meta-pytorch.org/torchtune/main/basics/text_completion_datasets.html#loading-text-completion-datasets-from-hugging-face).

### Loss

Expand Down
Loading