Skip to content

Commit c209b70

Browse files
atalmanfacebook-github-bot
authored andcommitted
Adding m1 builds to torchaudio (#2421)
Summary: This PR adds M1 wheel builds for torchaudio Based on this PR: pytorch/vision#5948 And this Builder [script](https://github.com/pytorch/builder/blob/main/build_m1_domains.sh) Pull Request resolved: #2421 Reviewed By: mthrok Differential Revision: D36767469 Pulled By: atalman fbshipit-source-id: 9fc3b74b50ee669a230302fd27682702f83f63dc
1 parent 22a5d08 commit c209b70

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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 TorchAudio M1 wheels"
13+
runs-on: macos-m1-11
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 TorchAudio 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+
export BUILD_VERSION=0.14.0.dev$(date "+%Y%m%d")
30+
WHL_NAME=torchaudio-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
31+
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy cmake ninja libpng openjpeg wheel pkg-config
32+
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly
33+
conda run -p ${ENV_NAME} python3 -mpip install delocate
34+
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
35+
conda run -p ${ENV_NAME} delocate-wheel -v --ignore-missing-dependencies dist/${WHL_NAME}
36+
conda env remove -p ${ENV_NAME}
37+
- name: Test wheel
38+
shell: arch -arch arm64 bash {0}
39+
env:
40+
ENV_NAME: conda-test-env-${{ github.run_id }}
41+
PY_VERS: ${{ matrix.py_vers }}
42+
run: |
43+
. ~/miniconda3/etc/profile.d/conda.sh
44+
set -ex
45+
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy
46+
conda run -p ${ENV_NAME} python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/nightly
47+
conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl
48+
# Test torch is importable, by changing cwd and running import commands
49+
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchaudio;print('torchaudio version is ', torchaudio.__version__)"
50+
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchaudio;torchaudio.set_audio_backend('sox_io')"
51+
conda env remove -p ${ENV_NAME}
52+
- name: Upload wheel to GitHub
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: torchaudio-py${{ matrix.py_vers }}-macos11-m1
56+
path: dist/
57+
- name: Upload wheel to S3
58+
shell: arch -arch arm64 bash {0}
59+
env:
60+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}
61+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }}
62+
CHANNEL: nightly
63+
run: |
64+
for pkg in dist/*; do
65+
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
66+
done

0 commit comments

Comments
 (0)