Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 81 additions & 1 deletion .github/workflows/build-m1-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
env:
ENV_NAME: conda-env-${{ github.run_id }}
PY_VERS: ${{ matrix.py_vers }}
CU_VERSION: cpu
USE_FFMPEG: true
USE_OPENMP: false
USE_CUDA: false
run: |
echo $PATH
. ~/miniconda3/etc/profile.d/conda.sh
Expand All @@ -46,6 +50,10 @@ jobs:
else
setup_build_version
fi
git submodule update --init --recursive
export SOURCE_ROOT_DIR=$(pwd)
export FFMPEG_ROOT="${SOURCE_ROOT_DIR}/third_party/ffmpeg"
. packaging/ffmpeg/build.sh
WHL_NAME=torchaudio-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy cmake ninja wheel pkg-config
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
Expand All @@ -70,7 +78,6 @@ jobs:
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchaudio;torchaudio.set_audio_backend('sox_io')"
conda env remove -p ${ENV_NAME}
- name: Upload wheel to GitHub
if: ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/nightly' || startsWith(github.event.ref, 'refs/tags/')) }}
uses: actions/upload-artifact@v3
with:
name: torchaudio-py${{ matrix.py_vers }}-macos11-m1
Expand All @@ -85,3 +92,76 @@ jobs:
for pkg in dist/*; do
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
done
build_conda:
name: "Build TorchAudio M1 conda packages"
runs-on: macos-m1-11
strategy:
matrix:
py_vers: [ "3.8", "3.9", "3.10" ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set CHANNEL (only for tagged pushes)
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }}
run: |
# reference ends with an RC suffix
if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then
echo "CHANNEL=test" >> "$GITHUB_ENV"
fi
- name: Install conda-build and purge previous artifacts
shell: arch -arch arm64 bash {0}
run: |
. ~/miniconda3/etc/profile.d/conda.sh
conda install -yq conda-build
conda build purge-all
- name: Build TorchAudio M1 conda package
shell: arch -arch arm64 bash {0}
env:
ENV_NAME: conda-env-${{ github.run_id }}
PYTHON_VERSION: ${{ matrix.py_vers }}
CU_VERSION: cpu
USE_FFMPEG: true
USE_OPENMP: false
USE_CUDA: false
run: |
. ~/miniconda3/etc/profile.d/conda.sh
set -ex
. packaging/pkg_helpers.bash

export CONDA_CHANNEL_FLAGS=""
if [[ $CHANNEL == "test" ]]; then
setup_cuda
setup_base_build_version
export CONDA_CHANNEL_FLAGS="pytorch-test"
etup_macos
else
setup_cuda
setup_build_version
setup_macos
fi
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
git submodule update --init --recursive
export SOURCE_ROOT_DIR=$(pwd)
export FFMPEG_ROOT="${SOURCE_ROOT_DIR}/third_party/ffmpeg"
. packaging/ffmpeg/build.sh
setup_conda_pytorch_constraint
setup_conda_cudatoolkit_constraint
setup_visual_studio_constraint
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchaudio
mkdir -p dist
cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/
- name: Upload package to GitHub
uses: actions/upload-artifact@v3
with:
name: torchaudio-py${{ matrix.py_vers }}-macos11-m1-conda
path: dist/
- name: Upload package to conda
if: ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/nightly' || startsWith(github.event.ref, 'refs/tags/')) }}
shell: arch -arch arm64 bash {0}
env:
CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
run: |
. ~/miniconda3/etc/profile.d/conda.sh
conda install -yq anaconda-client
set -x
anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 -u "pytorch-${CHANNEL}" --label main --no-progress --force
7 changes: 5 additions & 2 deletions packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,11 @@ setup_conda_pytorch_constraint() {
fi
# TODO: Remove me later, see https://github.com/pytorch/pytorch/issues/62424 for more details
if [[ "$(uname)" == Darwin ]]; then
# Use less than equal to avoid version conflict in python=3.6 environment
export CONDA_EXTRA_BUILD_CONSTRAINT="- mkl<=2021.2.0"
arch_name="$(uname -m)"
if [ "${arch_name}" != "arm64" ]; then
# Use less than equal to avoid version conflict in python=3.6 environment
export CONDA_EXTRA_BUILD_CONSTRAINT="- mkl<=2021.2.0"
fi
fi
}

Expand Down