Skip to content

Commit a4b56b7

Browse files
committed
Update base for Update on "Update pytorch nightly pin to 03/13"
## Context Updating PyTorch nightly pin to 03/13 to capture dynamic shape support in ATen Vulkan (pytorch/pytorch#121598). Previous upate was to 03/12 (#2370) so this should not be a risky change. Also, according to PyTorch nightly HUD (https://hud.pytorch.org/hud/pytorch/pytorch/nightly) this 03/13 nightly is all green while 03/12 nightly had some failures. Differential Revision: [D54870270](https://our.internmc.facebook.com/intern/diff/D54870270) [ghstack-poisoned]
2 parents ad9f186 + 9b22596 commit a4b56b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2096
-317
lines changed

.github/workflows/app-build.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/apple.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Apple
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release/*
8+
pull_request:
9+
paths:
10+
- .ci/docker/**
11+
- .github/workflows/app-build.yml
12+
- install_requirements.sh
13+
- backends/apple/**
14+
- build/build_apple_frameworks.sh
15+
- build/create_frameworks.sh
16+
- build/test_ios_ci.sh
17+
- examples/demo-apps/**
18+
- extension/apple/**
19+
- extension/module/**
20+
workflow_dispatch:
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
test-demo-ios:
28+
name: test-demo-ios
29+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
30+
with:
31+
runner: macos-latest-xlarge
32+
python-version: '3.11'
33+
submodules: 'true'
34+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
35+
timeout: 90
36+
script: |
37+
WORKSPACE=$(pwd)
38+
pushd "${WORKSPACE}/pytorch/executorch"
39+
BUILD_TOOL=cmake
40+
41+
.ci/scripts/setup-conda.sh
42+
43+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
44+
GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
45+
.ci/scripts/setup-macos.sh "${BUILD_TOOL}"
46+
47+
# Build and test iOS Demo App
48+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
49+
build/test_ios_ci.sh
50+
51+
popd
52+
53+
build-frameworks-ios:
54+
name: build-frameworks-ios
55+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
56+
with:
57+
runner: macos-latest-xlarge
58+
python-version: '3.11'
59+
submodules: 'true'
60+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
61+
upload-artifact: executorch.zip
62+
timeout: 90
63+
script: |
64+
WORKSPACE=$(pwd)
65+
pushd "${WORKSPACE}/pytorch/executorch"
66+
BUILD_TOOL=cmake
67+
VERSION="0.1.0"
68+
OUTPUT="executorch-${VERSION}"
69+
70+
.ci/scripts/setup-conda.sh
71+
72+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
73+
GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
74+
.ci/scripts/setup-macos.sh "${BUILD_TOOL}"
75+
76+
# Install CoreML Backend Requirements
77+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
78+
backends/apple/coreml/scripts/install_requirements.sh
79+
80+
# Install MPS Backend Requirements
81+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
82+
backends/apple/mps/install_requirements.sh
83+
84+
# Build iOS Frameworks
85+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
86+
build/build_apple_frameworks.sh --output="${OUTPUT}" --coreml --mps --portable --xnnpack
87+
88+
# Bundle iOS Frameworks
89+
cp LICENSE "${OUTPUT}"
90+
zip -r "${RUNNER_TEMP}/artifacts/${OUTPUT}.zip" "${OUTPUT}"
91+
92+
popd

backends/apple/coreml/quantizer/coreml_quantizer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
#
33
# Please refer to the license found in the LICENSE file in the root directory of the source tree.
44

5-
from coremltools.optimize.torch.quantization._coreml_quantizer import CoreMLQuantizer
5+
from coremltools.optimize.torch.quantization._coreml_quantizer import ( # noqa: FLAKE8 F401
6+
CoreMLQuantizer,
7+
)

backends/apple/coreml/scripts/generate_test_models.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ cd "$EXECUTORCH_ROOT_PATH"
2323
MODELS=("add" "mul" "mv3")
2424
for MODEL in "${MODELS[@]}"
2525
do
26-
# TODO: Don't use the script in examples directory.
27-
python3 -m examples.apple.coreml.scripts.export_and_delegate --model_name "$MODEL" --save_processed_bytes
26+
# TODO: Don't use the script in examples directory.
27+
python3 -m examples.apple.coreml.scripts.export --model_name "$MODEL" --save_processed_bytes
2828
mv -f "$MODEL""_coreml_all.pte" "$COREML_DIR_PATH/runtime/test/models"
2929
mv -f "$MODEL""_coreml_all.bin" "$COREML_DIR_PATH/runtime/test/models"
3030
done

backends/apple/coreml/setup.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ This is a tutorial for setting up the Core ML backend.
1111
```
1212
cd executorch
1313
14-
./backends/apple/coreml/scripts/install_requirements.sh
14+
./backends/apple/coreml/scripts/install_requirements.sh
1515
16-
```
16+
```
1717

18-
3. Run the example script to validate that the **Core ML** backend is set up correctly.
18+
3. Run the example script to validate that the **Core ML** backend is set up correctly.
1919

2020
```
2121
cd executorch
2222
2323
# Saves add_coreml_all.pte in the current directory if successful.
2424
25-
python3 -m examples.apple.coreml.scripts.export_and_delegate --model_name add
25+
python3 -m examples.apple.coreml.scripts.export --model_name add
2626
2727
```
2828

@@ -66,6 +66,6 @@ coreml_backend.xcframework
6666
- Accelerate.framework
6767
- CoreML.framework
6868
- libsqlite3.tbd
69-
```
69+
```
7070

71-
6. The target could now run a **Core ML** delegated **Program**.
71+
6. The target could now run a **Core ML** delegated **Program**.

backends/apple/coreml/test/test_coreml_quantizer.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,26 @@
22
#
33
# Please refer to the license found in the LICENSE file in the root directory of the source tree.
44

5+
from typing import Tuple
6+
57
import numpy as np
68
import pytest
7-
from typing import Tuple
89

910
import torch
10-
from torch._export import capture_pre_autograd_graph
11-
from torch.ao.quantization.quantize_pt2e import convert_pt2e, prepare_pt2e, prepare_qat_pt2e
12-
13-
from executorch.backends.apple.coreml.quantizer.coreml_quantizer import CoreMLQuantizer
1411

1512
from coremltools.optimize.torch.quantization.quantization_config import (
1613
LinearQuantizerConfig,
1714
QuantizationScheme,
1815
)
1916

17+
from executorch.backends.apple.coreml.quantizer.coreml_quantizer import CoreMLQuantizer
18+
from torch._export import capture_pre_autograd_graph
19+
from torch.ao.quantization.quantize_pt2e import (
20+
convert_pt2e,
21+
prepare_pt2e,
22+
prepare_qat_pt2e,
23+
)
24+
2025

2126
class TestCoreMLQuantizer:
2227
@staticmethod

0 commit comments

Comments
 (0)