Skip to content

Commit 1b593ad

Browse files
authored
Recipe and Input class definitions with e2e export (#10034)
Based on the discussion in #9027 This PR adds the executorch.export API and all the supporting components required for it. At a high level the executorch.export API takes in a model, example inputs and a recipe, then underneath the hood executes all the steps required to export, quantize and lower the model based on the recipe. The pipeline consists of a staged setup where each major step in the process such as Export, Quantization etc. is listed as a separate stage and a chain of these is formed and then executed. The result of this will be that we'll get a PTE file which can then be executed on device. The major new components added in this PR are: - class definition for ExportSession and ExportRecipe - Definitions for each stage in the process - executorch.export API which will return a session object that the user can then use to get access to the PTE file, run the model via pybindings, print delegation info etc.
1 parent d67fb52 commit 1b593ad

File tree

7 files changed

+963
-2
lines changed

7 files changed

+963
-2
lines changed

export/TARGETS

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
2+
3+
oncall("executorch")
4+
5+
python_library(
6+
name = "recipe",
7+
srcs = [
8+
"recipe.py",
9+
],
10+
deps = [
11+
"//caffe2:torch",
12+
"//executorch/exir/backend:backend_api",
13+
"//executorch/exir:pass_manager",
14+
"//executorch/devtools/backend_debug:delegation_info",
15+
]
16+
)
17+
18+
python_library(
19+
name = "export",
20+
srcs = [
21+
"export.py",
22+
],
23+
deps = [
24+
":recipe",
25+
"//executorch/runtime:runtime",
26+
]
27+
)
28+
29+
python_library(
30+
name = "lib",
31+
srcs = [
32+
"__init__.py",
33+
],
34+
deps = [
35+
":export",
36+
":recipe",
37+
],
38+
)

export/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
"""
8+
ExecuTorch export module.
9+
10+
This module provides the tools and utilities for exporting PyTorch models
11+
to the ExecuTorch format, including configuration, quantization, and
12+
export management.
13+
"""
14+
15+
# pyre-strict
16+
17+
from .export import export, ExportSession
18+
from .recipe import ExportRecipe
19+
20+
__all__ = [
21+
"ExportRecipe",
22+
"ExportSession",
23+
"export",
24+
]

0 commit comments

Comments
 (0)