Skip to content
Merged
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
50 changes: 49 additions & 1 deletion .github/workflows/build-m1-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print(torchvision.io.read_image('${PWD}/gallery/assets/dog1.jpg').shape)"
conda env remove -p ${ENV_NAME}
- name: Upload wheel to GitHub
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
uses: actions/upload-artifact@v3
with:
name: torchvision-py${{ matrix.py_vers }}-macos11-m1
Expand All @@ -71,3 +70,52 @@ jobs:
for pkg in dist/*; do
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
done
build_conda:
name: "Build TorchVision M1 conda packages"
runs-on: macos-m1
strategy:
matrix:
py_vers: [ "3.8", "3.9", "3.10" ]
steps:
- name: Checkout repository
uses: actions/checkout@v2

- 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 TorchVision 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
run: |
. ~/miniconda3/etc/profile.d/conda.sh
set -ex
. packaging/pkg_helpers.bash
setup_build_version
setup_conda_pytorch_constraint
export SOURCE_ROOT_DIR=$(pwd)
conda build -c defaults $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
mkdir -p dist
cp ~/miniconda3/conda-bld/osx-arm64/*.tar.bz2 dist/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test the conda package by running the smoke tests as we do above with the wheels?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@datumbox isn't it part of coda build process? I.e. it should execute commands defined in test section, i.e.:

test:
imports:
- torchvision
- torchvision.datasets
- torchvision.transforms
source_files:
- test
requires:
- pytest
- scipy
- jpeg

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will just try to import torchvision, torchvision.datasets and torchvision.transforms?
We should at least check that ops are properly present like we do for the wheels

          conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print(torchvision.io.read_image('${PWD}/gallery/assets/dog1.jpg').shape)"

- name: Upload package to GitHub
uses: actions/upload-artifact@v3
with:
name: torchvision-py${{ matrix.py_vers }}-macos11-m1-conda
path: dist/
- name: Upload package to conda
if: ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
shell: arch -arch arm64 bash {0}
env:
CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
UPLOAD_CHANNEL: nightly
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-${UPLOAD_CHANNEL}" --label main --no-progress --force