[RFC][Short] More on ExportRecipes #12553
Replies: 9 comments 15 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Do we have a proper way to check which stage the |
Beta Was this translation helpful? Give feedback.
-
Yes please |
Beta Was this translation helpful? Give feedback.
-
If you are designing this, please also look at export llm configs https://github.com/pytorch/executorch/blob/main/extension/llm/export/config/llm_config.py#L283 |
Beta Was this translation helpful? Give feedback.
-
I do not have strong opinion on that. The meaning of Beyond than your proposals, I would love to have the native support for devtools, particularly the etrecord generation. Currently we hide all details under |
Beta Was this translation helpful? Give feedback.
-
Why do people think |
Beta Was this translation helpful? Give feedback.
-
(2) the experimental cortex-m backend would be a great candidate as well. This will be favored more by embedded MCU developers, who may not have a ton of ML background and something more "plug and play" would be good |
Beta Was this translation helpful? Give feedback.
-
I think (3) and (5) are intertwined. For QAT, export_for_training is used which returns an ExportedProgram. It would then be something like prepare_for_qat() -> QAT performed outside of ET -> executorch.export/compile(qat_exported_program) And so you need to take in an ExportedProgram |
Beta Was this translation helpful? Give feedback.
-
Instead of accepting an In general I think the recipe should just take a nn.Module as input and the exportability of it is model's owners responsibility. The owner could be us, HuggingFace, or private models from end users. The recipe API can cover all these use-cases consistently. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This discussion outlines few proposals regarding the ExportRecipes (currently experimental). These requirements have emerged from various discussions, and I want to consolidate them here for further discussion and prioritization:
1. API Naming
There is potential confusion between
torch.export.export()
andexecutorch.export()
, especially since the latter encompasses additional functionalities such as quantization, lowering, and serialization. A previously proposed solution is to renameexecutorch.export(..) -> executorch.compile(..)
. This change could enhance clarity, but it may also be unnecessary. I would like to gather your thoughts on whether a renaming is warranted.2. Support for Additional Backend Recipes
Support additional backend recipes
3. QAT Quantization support
Currently, our recipes support Post-Training Quantization (PTQ). Should we extend this support to include Quantization-Aware Training (QAT)? Additionally, which backends currently support QAT, or we should at least transparently error out if QAT based recipe is passed?
4. Differentiating Calibration Inputs vs Example Inputs
The proposal is to add a new parameter, calibration_inputs, to the API alongside example_inputs. This parameter would explicitly indicate to users that the data provided in calibration_inputs is used for quantization purposes, while example_inputs are solely for export.
5. Support for
ExportedProgram
At present, the API requires an nn.Module and assumes that the export stage is always run within the scope of the recipe. The proposal is to decouple this to accept either an ExportedProgram or an nn.Module. This change would help use cases such as HuggingFace Optimum, where the ExportRecipe can be utilized for post export stages such as graph quantization, lowering. This would provide greater flexibility for models to use torch.export.export(...) in a manner that suits their needs but use recipes for just quantization and lowering.
6. Support to_edge -> to_backend -> to_executorch along with to_edge_transform_and_lower
Currently, the
executorch/export
supports only theto_edge_transform_and_lower
API. Is there a need to supportto_edge() -> to_backend() -> to_executorch()
?7. Modularization of ExportRecipe
Split current
ExportRecipe
into piece-meal recipes such asExportRecipe, QuantizationRecipe, LoweringRecipe
and have a root recipe for example:CompileRecipe
which takes all the above. This might require re-writing most of the currentExportRecipe
component, so not sure if this is needed, we may just get away with doing just (5) - Supporting ExportedProgram which skipstorch.export.export()
and SourceTransform stages which might be just sufficient.CC: @cbilgin, @mergennachin, @kimishpatel, @metascroy, @JacobSzwejbka, @guangy10, @digantdesai, @mcr229, @jackzhxng, @JakeStevens
Beta Was this translation helpful? Give feedback.
All reactions