Skip to content

Test CoreML support when building wheels #9647

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

Merged
merged 11 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .ci/scripts/test_model.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,22 @@ test_model_with_coreml() {

"${PYTHON_EXECUTABLE}" -m examples.apple.coreml.scripts.export --model_name="${MODEL_NAME}" --compute_precision "${DTYPE}"
EXPORTED_MODEL=$(find "." -type f -name "${MODEL_NAME}*.pte" -print -quit)
# TODO:

if [ -n "$EXPORTED_MODEL" ]; then
EXPORTED_MODEL_WITH_DTYPE="${EXPORTED_MODEL%.pte}_${DTYPE}.pte"
mv "$EXPORTED_MODEL" "$EXPORTED_MODEL_WITH_DTYPE"
EXPORTED_MODEL="$EXPORTED_MODEL_WITH_DTYPE"
echo "Renamed file path: $EXPORTED_MODEL"
echo "OK exported model: $EXPORTED_MODEL"
else
echo "No .pte file found"
echo "[error] failed to export model: no .pte file found"
exit 1
fi

# Run the model
if [ "${should_test}" = true ]; then
echo "Installing requirements needed to build coreml_executor_runner..."
backends/apple/coreml/scripts/install_requirements.sh

echo "Testing exported model with coreml_executor_runner..."
local out_dir=$(mktemp -d)
COREML_EXECUTOR_RUNNER_OUT_DIR="${out_dir}" examples/apple/coreml/scripts/build_executor_runner.sh
Expand Down
10 changes: 4 additions & 6 deletions .ci/scripts/wheel/test_macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
model=Model.Mv3,
backend=Backend.XnnpackQuantizationDelegation,
),
# Enable this once CoreML is suppported out-of-the-box
# https://github.com/pytorch/executorch/issues/9019
# test_base.ModelTest(
# model=Model.Mv3,
# backend=Backend.CoreMlTest,
# )
test_base.ModelTest(
model=Model.Mv3,
backend=Backend.CoreMlTest,
),
]
)
3 changes: 3 additions & 0 deletions .github/workflows/build-wheels-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
paths:
- .ci/**/*
- .github/workflows/build-wheels-linux.yml
- examples/**/*
- pyproject.toml
- setup.py
push:
branches:
- nightly
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build-wheels-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
paths:
- .ci/**/*
- .github/workflows/build-wheels-macos.yml
- examples/**/*
- pyproject.toml
- setup.py
push:
branches:
- nightly
Expand Down Expand Up @@ -57,6 +60,8 @@ jobs:
pre-script: ${{ matrix.pre-script }}
post-script: ${{ matrix.post-script }}
package-name: ${{ matrix.package-name }}
runner-type: macos-m1-stable
# Meta's macOS runners do not have Xcode, so use GitHub's runners.
runner-type: macos-latest-xlarge
setup-miniconda: true
smoke-test-script: ${{ matrix.smoke-test-script }}
trigger-event: ${{ github.event_name }}
Loading