Skip to content

Commit d592925

Browse files
authored
Add M1 wheels binary builds (#5948)
1 parent 6aaa2b0 commit d592925

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build on M1
2+
on:
3+
pull_request:
4+
paths:
5+
- .github/workflows/build-m1-binaries.yml
6+
push:
7+
branches:
8+
- nightly
9+
workflow_dispatch:
10+
jobs:
11+
build_wheels:
12+
name: "Build TorchVision M1 wheels"
13+
runs-on: macos-m1
14+
strategy:
15+
matrix:
16+
py_vers: [ "3.8", "3.9", "3.10" ]
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
- name: Build TorchVision M1 wheel
21+
shell: arch -arch arm64 bash {0}
22+
env:
23+
ENV_NAME: conda-env-${{ github.run_id }}
24+
PY_VERS: ${{ matrix.py_vers }}
25+
run: |
26+
echo $PATH
27+
. ~/miniconda3/etc/profile.d/conda.sh
28+
set -ex
29+
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng openjpeg wheel pkg-config
30+
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly torch
31+
conda run -p ${ENV_NAME} python3 -mpip install delocate
32+
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
33+
conda env remove -p ${ENV_NAME}
34+
- name: Upload wheel to GitHub
35+
uses: actions/upload-artifact@v3
36+
with:
37+
name: torchvision-py${{ matrix.py_vers }}-macos11-m1
38+
path: dist/
39+
- name: Upload wheel to S3
40+
shell: arch -arch arm64 bash {0}
41+
env:
42+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}
43+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }}
44+
CHANNEL: nightly
45+
run: |
46+
for pkg in dist/*; do
47+
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
48+
done

0 commit comments

Comments
 (0)