Skip to content

Commit b68864c

Browse files
atalmanfacebook-github-bot
authored andcommitted
Refactor M1 logic and fix version (#2438)
Summary: Refactor M1 logic These improvement introduced in following PR: pytorch/vision#6117 Pull Request resolved: #2438 Reviewed By: nateanl Differential Revision: D36896028 Pulled By: atalman fbshipit-source-id: 2ce360bfa78b2a7c77d5d4db800d487d171831a9
1 parent c05498c commit b68864c

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ jobs:
2626
echo $PATH
2727
. ~/miniconda3/etc/profile.d/conda.sh
2828
set -ex
29-
export BUILD_VERSION=0.14.0.dev$(date "+%Y%m%d")
29+
. packaging/pkg_helpers.bash
30+
setup_build_version
3031
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
32+
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy cmake ninja wheel pkg-config
33+
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly
3334
conda run -p ${ENV_NAME} python3 -mpip install delocate
3435
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+
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
37+
conda run -p ${ENV_NAME} DYLD_FALLBACK_LIBRARY_PATH="${ENV_NAME}/lib" delocate-wheel -v --ignore-missing-dependencies dist/${WHL_NAME}
3638
conda env remove -p ${ENV_NAME}
3739
- name: Test wheel
3840
shell: arch -arch arm64 bash {0}
@@ -43,18 +45,20 @@ jobs:
4345
. ~/miniconda3/etc/profile.d/conda.sh
4446
set -ex
4547
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
48+
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly
4749
conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl
4850
# Test torch is importable, by changing cwd and running import commands
4951
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchaudio;print('torchaudio version is ', torchaudio.__version__)"
5052
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchaudio;torchaudio.set_audio_backend('sox_io')"
5153
conda env remove -p ${ENV_NAME}
5254
- name: Upload wheel to GitHub
55+
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
5356
uses: actions/upload-artifact@v3
5457
with:
5558
name: torchaudio-py${{ matrix.py_vers }}-macos11-m1
5659
path: dist/
5760
- name: Upload wheel to S3
61+
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
5862
shell: arch -arch arm64 bash {0}
5963
env:
6064
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}

packaging/pkg_helpers.bash

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ setup_build_version() {
105105
# version.txt for some reason has `a` character after major.minor.rev
106106
# command below yields 0.10.0 from version.txt containing 0.10.0a0
107107
_VERSION_BASE=$( cut -f 1 -d a "$SCRIPT_DIR/../version.txt" )
108-
export BUILD_VERSION="$_VERSION_BASE.dev$(date "+%Y%m%d")$VERSION_SUFFIX"
108+
BUILD_VERSION="$_VERSION_BASE.dev$(date "+%Y%m%d")$VERSION_SUFFIX"
109109
else
110-
export BUILD_VERSION="$BUILD_VERSION$VERSION_SUFFIX"
110+
BUILD_VERSION="$BUILD_VERSION$VERSION_SUFFIX"
111111
fi
112+
export BUILD_VERSION
112113
}
113114

114115
# Set some useful variables for OS X, if applicable

0 commit comments

Comments
 (0)