Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libjpeg-turbo #7672

Merged
merged 18 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 5 additions & 3 deletions .github/scripts/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ if [[ "${OS_TYPE}" == "macos" && $(uname -m) == x86_64 ]]; then
fi

echo '::group::Create build environment'
# See https://github.com/pytorch/vision/issues/7296 for ffmpeg
# 1. `libjpeg-turbo` is only available for macOS and Windows on the `defaults` conda channel. Thus, we need to pull it
# in from the `pytorch-nightly` channel on Linux
Copy link
Collaborator

Choose a reason for hiding this comment

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

Meaning, we can't just do conda install -c pytorch-nightly libjpeg-turbo, since that won't work for Windows and macOS: https://anaconda.org/pytorch-nightly/libjpeg-turbo/files

We could either set the channel based on the OS, or let conda figure it out automatically by proving both channels to the initial env creation.

I've opted for the latter for now. Let's see if CI is happy with it.

# 2. See https://github.com/pytorch/vision/issues/7296 for ffmpeg
conda create \
--name ci \
--quiet --yes \
--channel=defaults --channel=pytorch-nightly
python="${PYTHON_VERSION}" pip \
ninja cmake \
libpng jpeg \
libpng libjpeg-turbo \
'ffmpeg<4.3'
conda activate ci
pip install --progress-bar=off --upgrade setuptools

# See https://github.com/pytorch/vision/issues/6790
Expand Down
4 changes: 2 additions & 2 deletions packaging/pre_build_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ fi

if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then
# Install libpng from Anaconda (defaults)
conda install libpng "jpeg<=9b" -yq
conda install -yq ffmpeg=4.2 -c pytorch
conda install libpng -yq
conda install -yq ffmpeg=4.2 libjpeg-turbo -c pytorch

# Copy binaries to be included in the wheel distribution
if [[ "$OSTYPE" == "msys" ]]; then
Expand Down
6 changes: 3 additions & 3 deletions packaging/torchvision/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ requirements:
build:
- {{ compiler('c') }} # [win]
- libpng
- jpeg
- libjpeg-turbo
# NOTE: The only ffmpeg version that we build is actually 4.2
- ffmpeg >=4.2 # [not win]

Expand All @@ -28,7 +28,7 @@ requirements:
- requests
- libpng
- ffmpeg >=4.2 # [not win]
- jpeg
- libjpeg-turbo
- pillow >=5.3.0, !=8.3.*
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
Expand Down Expand Up @@ -62,7 +62,7 @@ test:
requires:
- pytest
- scipy
- jpeg
- libjpeg-turbo
- ca-certificates


Expand Down