- 
                Notifications
    You must be signed in to change notification settings 
- Fork 706
[Executorch][Recipes][Coreml] Add coreml backend recipes #13121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Executorch][Recipes][Coreml] Add coreml backend recipes #13121
Conversation
| 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13121
 Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 78 PendingAs of commit 4c34f87 with merge base 41d05fe ( This comment was automatically generated by Dr. CI and updates every 15 minutes. | 
| This PR needs a  | 
86e07ac    to
    0695ac8      
    Compare
  
    | @abhinaykukkadapu has imported this pull request. If you are a Meta employee, you can view this in D79654041. | 
| This pull request was exported from Phabricator. Differential Revision: D79654041 | 
Summary: Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow. Fixes pytorch#13100 Pull Request resolved: pytorch#13121 Test Plan: `python -m unittest backends/apple/coreml/test/test_coreml_recipes.py` Differential Revision: D79654041 Pulled By: abhinaykukkadapu
0695ac8    to
    a757493      
    Compare
  
    | CoreMLRecipeProvider, | ||
| CoreMLRecipeType, | ||
| ) | ||
| from executorch.backends.apple.coreml.test.test_torch_ops import _TEST_RUNTIME | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: rather than import from the other test, factor _TEST_RUNTIME out into a common test_util and use in both tests.
|  | ||
| return ExportRecipe( | ||
| name=recipe_type.value, | ||
| quantization_recipe=None, # TODO - add quantization recipe | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I have a PR updating CoreML docs that you might check out for quantization and available partitioner options: #13120
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@metascroy it might make sense for you to follow up on the recipes for quant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, @abhinaykukkadapu are the quant recipes coming in a future PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@metascroy If you want to follow up, i can leave it upto you as you have more context on quantization, or i can take it up if you don't have bandwidth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add the quantization recipe, I'm happy to review the quantize_ and PT2E recipes you add for CoreML
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@metascroy sure will add in a follow up diff, can we go ahead with these changes?
Summary: Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow. Fixes pytorch#13100 Pull Request resolved: pytorch#13121 Test Plan: `python -m unittest backends/apple/coreml/test/test_coreml_recipes.py` Differential Revision: D79654041 Pulled By: abhinaykukkadapu
cec4576    to
    1ecbd40      
    Compare
  
    Summary: Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow. Fixes pytorch#13100 Pull Request resolved: pytorch#13121 Test Plan: `python -m unittest backends/apple/coreml/test/test_coreml_recipes.py` Differential Revision: D79654041 Pulled By: abhinaykukkadapu
1ecbd40    to
    039aedd      
    Compare
  
    Summary: Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow. Fixes pytorch#13100 Pull Request resolved: pytorch#13121 Test Plan: `python -m unittest backends/apple/coreml/test/test_coreml_recipes.py` Differential Revision: D79654041 Pulled By: abhinaykukkadapu
039aedd    to
    742eda3      
    Compare
  
    Summary: Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow. Fixes pytorch#13100 Pull Request resolved: pytorch#13121 Test Plan: `python -m unittest backends/apple/coreml/test/test_coreml_recipes.py` Differential Revision: D79654041 Pulled By: abhinaykukkadapu
742eda3    to
    863bdaa      
    Compare
  
    Summary: Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow. Fixes pytorch#13100 Pull Request resolved: pytorch#13121 Test Plan: `python -m unittest backends/apple/coreml/test/test_coreml_recipes.py` Differential Revision: D79654041 Pulled By: abhinaykukkadapu
863bdaa    to
    8d00ffc      
    Compare
  
    2dc56a5    to
    e64572a      
    Compare
  
    Summary: Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow. Fixes pytorch#13100 Pull Request resolved: pytorch#13121 Test Plan: `python -m unittest backends/apple/coreml/test/test_coreml_recipes.py` Differential Revision: D79654041 Pulled By: abhinaykukkadapu
e64572a    to
    44c4954      
    Compare
  
    | @abhinaykukkadapu has imported this pull request. If you are a Meta employee, you can view this in D79654041. | 
Summary: Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow. Fixes pytorch#13100 Pull Request resolved: pytorch#13121 Test Plan: `python -m unittest backends/apple/coreml/test/test_coreml_recipes.py` Reviewed By: metascroy Differential Revision: D79654041 Pulled By: abhinaykukkadapu
| This pull request was exported from Phabricator. Differential Revision: D79654041 | 
44c4954    to
    4c34f87      
    Compare
  
    Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) ghstack-source-id: 302827577 Pull Request resolved: #13387
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Pull Request resolved: #13387 Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY ghstack-source-id: 302842396 @exported-using-ghexport Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/)
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Pull Request resolved: #13387 Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY ghstack-source-id: 302857006 @exported-using-ghexport Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/)
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Pull Request resolved: #13387 Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY ghstack-source-id: 302870102 @exported-using-ghexport Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/)
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Pull Request resolved: #13387 Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY TORCHAO_INT4_WEIGHT_ONLY_PER_CHANNEL TORCHAO_INT4_WEIGHT_ONLY_PER_GROUP TORCHAO_INT8_WEIGHT_ONLY_PER_CHANNEL TORCHAO_INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY ghstack-source-id: 303044428 @exported-using-ghexport Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/)
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY INT4_WEIGHT_ONLY_PER_CHANNEL INT4_WEIGHT_ONLY_PER_GROUP INT8_WEIGHT_ONLY_PER_CHANNEL INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/) [ghstack-poisoned]
Pull Request resolved: #13387 Fixing tests for stack that got reverted: #13265 Adds coreml quant recipes after FP32/16 recipes added in #13121 Recipes added: PT2E_INT8_STATIC PT2E_INT8_WEIGHT_ONLY TORCHAO_INT4_WEIGHT_ONLY_PER_CHANNEL TORCHAO_INT4_WEIGHT_ONLY_PER_GROUP TORCHAO_INT8_WEIGHT_ONLY_PER_CHANNEL TORCHAO_INT8_WEIGHT_ONLY_PER_GROUP CODEBOOK_WEIGHT_ONLY ghstack-source-id: 303126085 @exported-using-ghexport Differential Revision: [D80206542](https://our.internmc.facebook.com/intern/diff/D80206542/)
Summary
Adds coreml recipes as discussed similar to xnnpack backend recipes to use them for export flow.
Fixes #13100
Test plan
python -m unittest backends/apple/coreml/test/test_coreml_recipes.py