Skip to content

Commit

Permalink
Merge branch 'main' into Add-Allowed-Workflows-for-Retry-Bot
Browse files Browse the repository at this point in the history
  • Loading branch information
DanilBaibak committed Apr 4, 2023
2 parents e26df81 + 5c5a94d commit c7d2255
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 15 deletions.
27 changes: 22 additions & 5 deletions .github/scripts/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,26 @@ case $(uname) in
Darwin)
OS_TYPE=macos
;;
MSYS*)
OS_TYPE=windows
;;
*)
echo "Unknown OS type:" $(uname)
exit 1
;;
esac

echo '::group::Uninstall system JPEG libraries on macOS'
# The x86 macOS runners, e.g. the GitHub Actions native "macos-12" runner, has some JPEG libraries installed by default
# that interfere with our build. We uninstall them here and use the one from conda below.
if [[ "${OS_TYPE}" == "macos" && $(uname -m) == x86_64 ]]; then
echo '::group::Uninstall system JPEG libraries on macOS'
# The x86 macOS runners, e.g. the GitHub Actions native "macos-12" runner, has some JPEG libraries installed by
# default that interfere with our build. We uninstall them here and use the one from conda below.
JPEG_LIBS=$(brew list | grep jpeg)
echo $JPEG_LIBS
for lib in $JPEG_LIBS; do
brew uninstall --ignore-dependencies --force $lib || true
done
echo '::endgroup::'
fi
echo '::endgroup::'

echo '::group::Create build environment'
# See https://github.com/pytorch/vision/issues/7296 for ffmpeg
Expand Down Expand Up @@ -66,10 +69,24 @@ ltt install --progress-bar=off \
torch

if [[ $GPU_ARCH_TYPE == 'cuda' ]]; then
python3 -c "import torch; exit(not torch.cuda.is_available())"
python -c "import torch; exit(not torch.cuda.is_available())"
fi
echo '::endgroup::'

if [[ "${OS_TYPE}" == "windows" ]]; then
echo '::group::Install third party dependencies prior to TorchVision install on Windows'
# `easy_install`, i.e. `python setup.py` has problems downloading the dependencies due to SSL.
# Thus, we install them upfront with `pip` to avoid that.
# Instead of fixing the SSL error, we can probably maintain this special case until we switch away from the deprecated
# `easy_install` anyway.
python setup.py egg_info
# The requires.txt cannot be used with `pip install -r` directly. The requirements are listed at the top and the
# optional dependencies come in non-standard syntax after a blank line. Thus, we just extract the header.
sed -e '/^$/,$d' *.egg-info/requires.txt > requirements.txt
pip install --progress-bar=off -r requirements.txt
echo '::endgroup::'
fi

echo '::group::Install TorchVision'
python setup.py develop
echo '::endgroup::'
Expand Down
8 changes: 2 additions & 6 deletions .github/scripts/unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ set -euo pipefail

./.github/scripts/setup-env.sh

# Prepare conda
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda activate ci
# Activate conda environment
eval "$($(which conda) shell.bash hook)" && conda deactivate && conda activate ci

echo '::group::Install testing utilities'
pip install --progress-bar=off pytest pytest-mock pytest-cov
echo '::endgroup::'

echo '::group::Run unittests'
pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25
echo '::endgroup::'
51 changes: 51 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Tests on Windows

on:
pull_request:
push:
branches:
- nightly
- main
- release/*
workflow_dispatch:

jobs:
unittests:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runner: ["windows.4xlarge"]
gpu-arch-type: ["cpu"]
# FIXME: enable this as soon as nvjpeg is available on the Windows runner
# include:
# - python-version: "3.8"
# runner: windows.8xlarge.nvidia.gpu
# gpu-arch-type: cuda
# gpu-arch-version: "11.7"
fail-fast: false
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
with:
repository: pytorch/vision
runner: ${{ matrix.runner }}
timeout: 120
script: |
set -euxo pipefail
export PYTHON_VERSION=${{ matrix.python-version }}
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
# TODO: Port this to pytorch/test-infra/.github/workflows/windows_job.yml
export PATH="/c/Jenkins/Miniconda3/Scripts:${PATH}"
if [[ $GPU_ARCH_TYPE == 'cuda' ]]; then
# TODO: This should be handled by the generic Windows job the same as its done by the generic Linux job
export CUDA_HOME="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${{ matrix.gpu-arch-version }}"
export CUDA_PATH="${CUDA_HOME}"
fi
./.github/scripts/unittest.sh
9 changes: 5 additions & 4 deletions torchvision/models/video/mvit.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,10 @@ def mvit_v1_b(*, weights: Optional[MViT_V1_B_Weights] = None, progress: bool = T
@register_model()
@handle_legacy_interface(weights=("pretrained", MViT_V2_S_Weights.KINETICS400_V1))
def mvit_v2_s(*, weights: Optional[MViT_V2_S_Weights] = None, progress: bool = True, **kwargs: Any) -> MViT:
"""
Constructs a small MViTV2 architecture from
`Multiscale Vision Transformers <https://arxiv.org/abs/2104.11227>`__.
"""Constructs a small MViTV2 architecture from
`Multiscale Vision Transformers <https://arxiv.org/abs/2104.11227>`__ and
`MViTv2: Improved Multiscale Vision Transformers for Classification
and Detection <https://arxiv.org/abs/2112.01526>`__.
.. betastatus:: video module
Expand All @@ -785,7 +786,7 @@ def mvit_v2_s(*, weights: Optional[MViT_V2_S_Weights] = None, progress: bool = T
for more details about this class.
.. autoclass:: torchvision.models.video.MViT_V2_S_Weights
:members:
:members:
"""
weights = MViT_V2_S_Weights.verify(weights)

Expand Down

0 comments on commit c7d2255

Please sign in to comment.