Skip to content
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

Enable CoreML by default on macOS wheel builds #9483

Merged
merged 7 commits into from
Mar 26, 2025
Merged

Conversation

jathu
Copy link
Contributor

@jathu jathu commented Mar 21, 2025

Summary

Context: #9481

  • Include the executorchcoreml pybinding in the builds
  • Remove separate installation option
  • Turn on CoreML by default for macOS builds
  • Add a dependency on coremltools for macOS

Test plan

CI

$ rm -rf cmake-out pip-out dist && ./install_executorch.sh
$ ./examples/models/llama/install_requirements.sh
$ .ci/scripts/test_llama.sh -model stories110M -build_tool cmake -dtype fp32 -mode coreml
$ .ci/scripts/test_llama.sh -model stories110M -build_tool cmake -dtype fp32 -mode xnnpack+custom+quantize_kv

cc @larryliu0820 @lucylq

Copy link

pytorch-bot bot commented Mar 21, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/9483

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 1 Pending

As of commit 6488b44 with merge base 265b9b7 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 21, 2025
@jathu jathu force-pushed the jathu/include-inmemoryfs branch from b69b9de to 40f1586 Compare March 21, 2025 02:49
@jathu jathu added module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch ciflow/trunk topic: not user facing labels Mar 21, 2025
@jathu jathu force-pushed the jathu/include-inmemoryfs branch 5 times, most recently from 899aaa9 to 4e1392f Compare March 21, 2025 03:40
@jathu jathu force-pushed the jathu/inmemoryfs-binding branch from a2189cd to 8401ea6 Compare March 21, 2025 03:42
@jathu jathu force-pushed the jathu/include-inmemoryfs branch 2 times, most recently from 4ca7508 to 1ec9fe8 Compare March 21, 2025 03:47
@jathu jathu force-pushed the jathu/inmemoryfs-binding branch from 8401ea6 to 3d18509 Compare March 21, 2025 03:51
@jathu jathu force-pushed the jathu/include-inmemoryfs branch from 1ec9fe8 to c953ad3 Compare March 21, 2025 03:52
@jathu jathu changed the title Use inmemoryfs built with CMake instead of extra wheel Use executorchcoreml built with CMake instead of extra wheel Mar 21, 2025
@jathu jathu force-pushed the jathu/inmemoryfs-binding branch 3 times, most recently from eaddcd2 to dc338bd Compare March 21, 2025 14:57
@jathu jathu force-pushed the jathu/include-inmemoryfs branch 2 times, most recently from c5b2718 to a43c12c Compare March 21, 2025 15:19
@jathu jathu force-pushed the jathu/inmemoryfs-binding branch 2 times, most recently from 5bc0bdc to 7e51d3a Compare March 25, 2025 00:11
@jathu jathu force-pushed the jathu/include-inmemoryfs branch 2 times, most recently from 962c878 to ab60961 Compare March 25, 2025 00:24
@jathu jathu force-pushed the jathu/inmemoryfs-binding branch 2 times, most recently from 1287a85 to 2f299ac Compare March 25, 2025 01:52
@jathu jathu force-pushed the jathu/include-inmemoryfs branch 2 times, most recently from 52ce71d to e7adb4c Compare March 25, 2025 15:01
@jathu jathu force-pushed the jathu/include-inmemoryfs branch 5 times, most recently from 9f1119a to 840151e Compare March 26, 2025 03:40
@jathu jathu force-pushed the jathu/include-inmemoryfs branch from ce38301 to 6c747a7 Compare March 26, 2025 15:05
@jathu
Copy link
Contributor Author

jathu commented Mar 26, 2025

I will update the docs on usage of the install script in another PR.

@jathu jathu marked this pull request as ready for review March 26, 2025 15:07
@jathu jathu force-pushed the jathu/include-inmemoryfs branch from 6c747a7 to 6488b44 Compare March 26, 2025 15:31
@mergennachin
Copy link
Contributor

This is awesome!

cc @YifanShenSZ @cymbalrush

@@ -67,6 +67,8 @@ dependencies=[
"sympy",
"tabulate",
"typing-extensions",
# Keep this version in sync with: ./backends/apple/coreml/scripts/install_requirements.sh
"coremltools==8.1; platform_system == 'Darwin'",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Niiice!

echo "${red}ExecuTorch: Failed to install coremltools."
exit 1
fi
cmake --build "$COREMLTOOLS_DIR_PATH/build" --parallel --target mlmodel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YifanShenSZ @cymbalrush -- any reason why we still need to build mlmodel target from source, instead of using directly from pip install coremltools?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be required any more but let me confirm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jathu

Okay, let's not block it, but create an GH issue to track this...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #9651

Copy link
Contributor

@cymbalrush cymbalrush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jathu jathu merged commit 46937eb into main Mar 26, 2025
169 of 172 checks passed
@jathu jathu deleted the jathu/include-inmemoryfs branch March 26, 2025 19:04
jathu added a commit that referenced this pull request Mar 26, 2025
### Summary

* After #9483, we should have
CoreML support out of the box for macOS
* Unfortunately, we still need
`backends/apple/coreml/scripts/install_requirements.sh` to use the
[coreml_executorch_runner](https://github.com/pytorch/executorch/tree/main/examples/apple/coreml/executor_runner)
(used for testing)
* I should have caught all the usage

### Test plan
Read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants