Skip to content

Commit

Permalink
[fbsync] [M1] Install "jpeg<=9b" rather than OpenJpeg (#6122)
Browse files Browse the repository at this point in the history
Summary:
Explicitly set PATH to point to `conda` binary, otherwise libjpeg detection logic does not work
Pin libjpeg to the same version on x86 and m1
Add simple tests that jpeg can be decoded by a generated wheel

Reviewed By: NicolasHug

Differential Revision: D36931836

fbshipit-source-id: d8a3bcc4f7ec513b95cd325e33bdf2aa695500e4
  • Loading branch information
jdsgomes authored and facebook-github-bot committed Jun 6, 2022
1 parent f634923 commit 9eaed44
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/build-m1-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ jobs:
PY_VERS: ${{ matrix.py_vers }}
run: |
. ~/miniconda3/etc/profile.d/conda.sh
# Needed for JPEG library detection as setup.py detects conda presence by running `shlex.which('conda')`
export PATH=~/miniconda3/bin:$PATH
set -ex
. packaging/pkg_helpers.bash
setup_build_version
WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng openjpeg wheel pkg-config
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng "jpeg<=9b" wheel pkg-config
conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly
conda run -p ${ENV_NAME} python3 -mpip install delocate
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
Expand All @@ -49,6 +51,7 @@ jobs:
# Test torch is importable, by changing cwd and running import commands
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print('torchvision version is ', torchvision.__version__)"
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchvision;print('Is torchvision useable?', all(x is not None for x in [torch.ops.image.decode_png, torch.ops.torchvision.roi_align]))"
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
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit 9eaed44

Please sign in to comment.