Skip to content

Commit d058601

Browse files
jdsgomesNicolasHugdatumbox
authored andcommitted
[fbsync] ci: Update macos runner to self hosted (#6290)
Summary: Reviewed By: datumbox Differential Revision: D38154568 fbshipit-source-id: 2772603b48352bd1dec7569a2f69cf0fe4f128c1 Co-authored-by: Nicolas Hug <[email protected]> Co-authored-by: Vasilis Vryniotis <[email protected]>
1 parent 5ddae9e commit d058601

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

.github/workflows/build-m1-binaries.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
jobs:
1919
build_wheels:
2020
name: "Build TorchVision M1 wheels"
21-
runs-on: macos-m1
21+
runs-on: macos-m1-12
2222
strategy:
2323
matrix:
2424
py_vers: [ "3.8", "3.9", "3.10" ]
@@ -54,13 +54,12 @@ jobs:
5454
setup_build_version
5555
fi
5656
57-
WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
5857
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng jpeg wheel pkg-config
5958
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
6059
conda run -p ${ENV_NAME} python3 -mpip install delocate
6160
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
6261
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
63-
conda run -p ${ENV_NAME} DYLD_FALLBACK_LIBRARY_PATH="${ENV_NAME}/lib" delocate-wheel -v --ignore-missing-dependencies dist/${WHL_NAME}
62+
conda run -p ${ENV_NAME} DYLD_FALLBACK_LIBRARY_PATH="${ENV_NAME}/lib" delocate-wheel -v --ignore-missing-dependencies dist/*.whl
6463
conda env remove -p ${ENV_NAME}
6564
- name: Test wheel
6665
shell: arch -arch arm64 bash {0}
@@ -95,7 +94,7 @@ jobs:
9594
done
9695
build_conda:
9796
name: "Build TorchVision M1 conda packages"
98-
runs-on: macos-m1
97+
runs-on: macos-m1-12
9998
strategy:
10099
matrix:
101100
py_vers: [ "3.8", "3.9", "3.10" ]
@@ -139,9 +138,13 @@ jobs:
139138
140139
setup_conda_pytorch_constraint
141140
export SOURCE_ROOT_DIR=$(pwd)
142-
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
143-
mkdir -p dist
144-
cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/
141+
conda build \
142+
-c defaults \
143+
$CONDA_CHANNEL_FLAGS \
144+
--no-anaconda-upload \
145+
--python "$PYTHON_VERSION" \
146+
--output-folder=dist/ \
147+
packaging/torchvision
145148
- name: Upload package to GitHub
146149
uses: actions/upload-artifact@v3
147150
with:

.github/workflows/test-m1.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
jobs:
1515
tests:
1616
name: "Unit-tests on M1"
17-
runs-on: macos-m1
17+
runs-on: macos-m1-12
1818
strategy:
1919
matrix:
2020
py_vers: [ "3.8"]

packaging/pkg_helpers.bash

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,13 @@ setup_pip_pytorch_version() {
221221
setup_conda_pytorch_constraint() {
222222
if [[ -z "$PYTORCH_VERSION" ]]; then
223223
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch-nightly -c pytorch"
224+
PYTHON="python"
225+
# Check if we have python 3 instead and prefer that
226+
if python3 --version >/dev/null 2>/dev/null; then
227+
PYTHON="python3"
228+
fi
224229
export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | \
225-
python -c "import os, sys, json, re; cuver = os.environ.get('CU_VERSION'); \
230+
${PYTHON} -c "import os, sys, json, re; cuver = os.environ.get('CU_VERSION'); \
226231
cuver_1 = cuver.replace('cu', 'cuda') if cuver != 'cpu' else cuver; \
227232
cuver_2 = (cuver[:-1] + '.' + cuver[-1]).replace('cu', 'cuda') if cuver != 'cpu' else cuver; \
228233
print(re.sub(r'\\+.*$', '', \

0 commit comments

Comments
 (0)