Commit 561ee80
committed
Update base for Update on "[Executorch][target recipes] Add target based recipes for lowering models to a target device"
This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.
See RFC: #13732
## Usage
```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe
# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```
## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
[recipe1, recipe2],
recipe_name="multi_backend_coreml_xnnpack_fp32"
)
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.
Fixes: #13732
Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
[ghstack-poisoned]1 parent f74e340 commit 561ee80
File tree
0 file changed
+0
-0
lines changed0 file changed
+0
-0
lines changed
0 commit comments