Skip to content

Commit

Permalink
[Fix] Fix CI for torch2.1.0 (#1418)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanqiNO1 authored Nov 20, 2023
1 parent fd5d062 commit a5db5be
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 56 deletions.
96 changes: 45 additions & 51 deletions .github/workflows/merge_stage_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,64 +232,58 @@ jobs:
coverage xml
coverage report -m
build_macos:
runs-on: macos-latest
strategy:
matrix:
python-version: [3.8]
torch: [1.6.0, 1.8.1, 1.13.0, 2.1.0]
include:
- torch: 1.6.0
torchvision: 0.7.0
- torch: 1.8.1
torchvision: 0.9.1
- torch: 1.13.0
torchvision: 0.14.0
- torch: 2.1.0
torchvision: 0.16.0
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Upgrade wheel
run: pip install wheel --upgrade
- name: Install PyTorch
run: pip install torch==${{ matrix.torch }} torchvision==${{ matrix.torchvision }}
- name: Build MMEngine from source
run: pip install -e . -v
- name: Install unit tests dependencies
run: |
pip install -r requirements/tests.txt
- name: Install mmcv
run: |
pip install openmim
mim install mmcv
if: ${{ matrix.torch > '1.8.0' || matrix.torch == '1.8.0' }}
# Distributed-related unit tests may fail in macOS
# Skip testing setup_env since it does not work in the current CI environment # TODO
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/ --ignore tests/test_utils/test_dl_utils/test_setup_env.py
coverage xml
coverage report -m
# build_macos:
# runs-on: macos-latest
# strategy:
# matrix:
# python-version: [3.8]
# torch: [1.6.0, 1.8.1, 1.13.0]
# include:
# - torch: 1.6.0
# torchvision: 0.7.0
# - torch: 1.8.1
# torchvision: 0.9.1
# - torch: 1.13.0
# torchvision: 0.14.0
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python 3.7
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Upgrade pip
# run: pip install pip --upgrade
# - name: Upgrade wheel
# run: pip install wheel --upgrade
# - name: Install PyTorch
# run: pip install torch==${{ matrix.torch }} torchvision==${{ matrix.torchvision }}
# - name: Build MMEngine from source
# run: pip install -e . -v
# - name: Install unit tests dependencies
# run: |
# pip install -r requirements/tests.txt
# - name: Install mmcv
# run: |
# pip install openmim
# mim install mmcv
# if: ${{ matrix.torch > '1.8.0' || matrix.torch == '1.8.0' }}
# # Distributed-related unit tests may fail in macOS
# # Skip testing setup_env since it does not work in the current CI environment # TODO
# - name: Run unittests and generate coverage report
# run: |
# coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/ --ignore tests/test_utils/test_dl_utils/test_setup_env.py
# coverage xml
# coverage report -m

build_windows:
runs-on: windows-2022
strategy:
matrix:
python-version: [3.7]
platform: [cpu, cu111]
torch: [1.8.1, 2.1.0]
torchvision: [0.9.1, 0.16.0]
torch: [1.8.1]
torchvision: [0.9.1]
include:
- python-version: 3.8
platform: cu117
torch: 2.0.0
torchvision: 0.15.1
- python-version: 3.8
platform: cu118
torch: 2.1.0
Expand Down Expand Up @@ -318,4 +312,4 @@ jobs:
- name: Run GPU unittests
# Skip testing distributed related unit tests since the memory of windows CI is limited
run: pytest tests/ --ignore tests/test_dist --ignore tests/test_optim/test_optimizer/test_optimizer_wrapper.py --ignore tests/test_model/test_wrappers/test_model_wrapper.py
if: ${{ matrix.platform == 'cu111' }}
if: ${{ matrix.platform == 'cu111' }} || ${{ matrix.platform == 'cu118' }}
8 changes: 5 additions & 3 deletions .github/workflows/pr_stage_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ jobs:
runs-on: windows-2022
strategy:
matrix:
torch: [2.1.0]
torchvision: [0.16.0]
python-version: [3.7]
platform: [cpu, cu111]
torch: [1.8.1]
torchvision: [0.9.1]
include:
- python-version: 3.8
platform: cu118
Expand Down Expand Up @@ -167,4 +169,4 @@ jobs:
- name: Run GPU unittests
# Skip testing distributed related unit tests since the memory of windows CI is limited
run: pytest tests/ --ignore tests/test_dist --ignore tests/test_optim/test_optimizer/test_optimizer_wrapper.py --ignore tests/test_model/test_wrappers/test_model_wrapper.py --ignore tests/test_hooks/test_sync_buffers_hook.py
if: ${{ matrix.platform == 'cu111' }}
if: ${{ matrix.platform == 'cu111' }} || ${{ matrix.platform == 'cu118' }}
1 change: 0 additions & 1 deletion requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dvclive
lion-pytorch
lmdb
mlflow
neptune
parameterized
pydantic==1.10.9
pytest
Expand Down
4 changes: 3 additions & 1 deletion tests/test_visualizer/test_vis_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from mmengine import Config
from mmengine.fileio import load
from mmengine.registry import VISBACKENDS
from mmengine.utils import digit_version
from mmengine.utils import digit_version, is_installed
from mmengine.visualization import (AimVisBackend, ClearMLVisBackend,
DVCLiveVisBackend, LocalVisBackend,
MLflowVisBackend, NeptuneVisBackend,
Expand Down Expand Up @@ -358,6 +358,8 @@ def test_close(self):
clearml_vis_backend.close()


@pytest.mark.skipif(
not is_installed('neptune'), reason='Neptune is not installed.')
class TestNeptuneVisBackend:

def test_init(self):
Expand Down

0 comments on commit a5db5be

Please sign in to comment.