Skip to content

Commit 1576f32

Browse files
committed
Another attempt
1 parent 9cbe26a commit 1576f32

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.ci/scripts/utils.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,24 @@ install_pytorch_and_domains() {
6363
git submodule update --init --recursive
6464

6565
SYSTEM_NAME=$(uname)
66-
PLATFORM=$(python -c 'import sysconfig; print(sysconfig.get_platform().replace("-", "_").replace(".", "_"))')
67-
PYTHON_VERSION=$(python -c 'import platform; v = platform.python_version_tuple(); print(f"{v[0]}{v[1]}")')
66+
# The platform version needs to match MACOSX_DEPLOYMENT_TARGET used to build the wheel
67+
PLATFORM=$(python -c 'import sysconfig; platform=sysconfig.get_platform(); platform[1]="14_0"; print("_".join(platform))')
68+
PYTHON_VERSION=$(python -c 'import platform; v=platform.python_version_tuple(); print(f"{v[0]}{v[1]}")')
6869
TORCH_RELEASE=$(cat version.txt)
6970
TORCH_SHORT_HASH=${TORCH_VERSION:0:7}
70-
TORCH_WHEEL_NAME="torch-${TORCH_RELEASE}%2Bgit${TORCH_SHORT_HASH}-cp${PYTHON_VERSION}-cp${PYTHON_VERSION}-${PLATFORM}.whl"
7171
TORCH_WHEEL_PATH="cached_artifacts/pytorch/executorch/pytorch_wheels/${SYSTEM_NAME}/${PYTHON_VERSION}"
72+
TORCH_WHEEL_NAME="torch-${TORCH_RELEASE}%2Bgit${TORCH_SHORT_HASH}-cp${PYTHON_VERSION}-cp${PYTHON_VERSION}-${PLATFORM}.whl"
7273

74+
CACHE_TORCH_WHEEL="https://gha-artifacts.s3.us-east-1.amazonaws.com/${TORCH_WHEEL_PATH}/${TORCH_WHEEL_NAME}"
7375
# Cache PyTorch wheel is only needed on MacOS, Linux CI already has this as part
7476
# of the Docker image
7577
if [[ "${SYSTEM_NAME}" == "Darwin" ]]; then
76-
pip install "https://gha-artifacts.s3.us-east-1.amazonaws.com/${TORCH_WHEEL_PATH}/${TORCH_WHEEL_NAME}" || TORCH_WHEEL_NOT_FOUND=1
78+
pip install "${CACHE_TORCH_WHEEL}" || TORCH_WHEEL_NOT_FOUND=1
7779
fi
7880

7981
# Found no such wheel, we will build it from source then
8082
if [[ "${TORCH_WHEEL_NOT_FOUND:-0}" == "1" ]]; then
81-
export USE_DISTRIBUTED=1
82-
# Then build and install PyTorch
83-
python setup.py bdist_wheel
83+
USE_DISTRIBUTED=1 MACOSX_DEPLOYMENT_TARGET=14.0 python setup.py bdist_wheel
8484
pip install "$(echo dist/*.whl)"
8585

8686
# Only AWS runners have access to S3
@@ -90,6 +90,8 @@ install_pytorch_and_domains() {
9090
aws s3 cp "${WHEEL_PATH}" "s3://gha-artifacts/${TORCH_WHEEL_PATH}/${WHEEL_NAME}"
9191
done
9292
fi
93+
else
94+
echo "Use cached wheel at ${CACHE_TORCH_WHEEL}"
9395
fi
9496

9597
# Grab the pinned audio and vision commits from PyTorch

0 commit comments

Comments
 (0)