Skip to content

Commit

Permalink
[Fix] fix v1.0.0rc5 ci error (#1574)
Browse files Browse the repository at this point in the history
* fix test attention.

* revert change.

* move to change

* fix video restoration ut

* restrict opencv version.

* fix circleci opencv

* revert change in runtime.txt

* skip stylegan1 for python3.7

* close stylegan2 ut for python3.7

* fix ddpm stable diffusion ci error.

* fix attention
  • Loading branch information
liuwenran authored Jan 4, 2023
1 parent 58f0334 commit d9369cb
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
- run:
name: Install mmediting dependencies
command: |
pip install 'opencv-python!=4.7.0.68'
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0rc1'
Expand Down Expand Up @@ -102,6 +103,7 @@ jobs:
- run:
name: Install mmedit dependencies
command: |
docker exec mmedit pip install 'opencv-python!=4.7.0.68'
docker exec mmedit pip install -e /mmengine
docker exec mmedit pip install -U openmim
docker exec mmedit mim install 'mmcv >= 2.0.0rc1'
Expand Down
3 changes: 3 additions & 0 deletions tests/test_apis/test_inferencers/test_inference_functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import platform
import sys
import unittest

import pytest
Expand Down Expand Up @@ -215,6 +216,8 @@ def test_restoration_face_inference():
@pytest.mark.skipif(
'win' in platform.system().lower() and 'cu' in torch.__version__,
reason='skip on windows-cuda due to limited RAM.')
@pytest.mark.skipif(
sys.version_info < (3, 7), reason='skip because python version is old.')
def test_restoration_inference():
if torch.cuda.is_available():
device = torch.device('cuda', 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import sys

import pytest

from mmedit.apis.inferencers.video_restoration_inferencer import \
VideoRestorationInferencer
Expand All @@ -8,6 +11,8 @@
register_all_modules()


@pytest.mark.skipif(
sys.version_info < (3, 7), reason='skip because python version is old.')
def test_video_restoration_inferencer():
cfg = osp.join(
osp.dirname(__file__), '..', '..', '..', 'configs', 'basicvsr',
Expand All @@ -27,6 +32,8 @@ def test_video_restoration_inferencer():
assert inference_result is None


@pytest.mark.skipif(
sys.version_info < (3, 7), reason='skip because python version is old.')
def test_video_restoration_inferencer_input_dir():
cfg = osp.join(
osp.dirname(__file__), '..', '..', '..', 'configs', 'basicvsr',
Expand All @@ -47,6 +54,8 @@ def test_video_restoration_inferencer_input_dir():
assert inference_result is None


@pytest.mark.skipif(
sys.version_info < (3, 7), reason='skip because python version is old.')
def test_video_restoration_inferencer_window_size():
cfg = osp.join(
osp.dirname(__file__), '..', '..', '..', 'configs', 'basicvsr',
Expand All @@ -69,6 +78,8 @@ def test_video_restoration_inferencer_window_size():
assert inference_result is None


@pytest.mark.skipif(
sys.version_info < (3, 7), reason='skip because python version is old.')
def test_video_restoration_inferencer_max_seq_len():
cfg = osp.join(
osp.dirname(__file__), '..', '..', '..', 'configs', 'basicvsr',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_models/test_editors/test_ddpm/test_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def test_crossattention():

def test_Transformer2DModel_init():
with pytest.raises(Exception):
Transformer2DModel(in_channels=3, num_vector_embeds=3)
Transformer2DModel(in_channels=32, num_vector_embeds=4)

with pytest.raises(Exception):
Transformer2DModel()

Transformer2DModel(in_channels=3, use_linear_projection=True)
Transformer2DModel(in_channels=32, use_linear_projection=True)


def test_FeedForward():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_ddpm():

ddpm.set_timesteps(100)

predicted_variance = torch.tensor(1)
predicted_variance = torch.tensor(1.0)
ddpm._get_variance(t=0, predicted_variance=predicted_variance)
ddpm._get_variance(t=1, variance_type='fixed_large')
ddpm._get_variance(t=1, variance_type='fixed_large_log')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import platform
import sys

import pytest
import torch
Expand Down Expand Up @@ -101,6 +102,8 @@ def __call__(self, x, attention_mask):
@pytest.mark.skipif(
'win' in platform.system().lower(),
reason='skip on windows due to limited RAM.')
@pytest.mark.skipif(
sys.version_info < (3, 8), reason='skip because python version is old.')
def test_stable_diffusion():
StableDiffuser = MODELS.build(Config(model))
StableDiffuser.tokenizer = dummy_tokenizer()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import platform
import sys
from unittest import TestCase

import numpy as np
Expand Down Expand Up @@ -35,6 +36,9 @@ class TestStyleGAN1(TestCase):
@pytest.mark.skipif(
'win' in platform.system().lower() and 'cu' in torch.__version__,
reason='skip on windows-cuda due to limited RAM.')
@pytest.mark.skipif(
sys.version_info < (3, 8),
reason='skip because python version is old.')
def test_stylegan_cpu(self):
message_hub = MessageHub.get_instance('test-s1')
message_hub.update_info('iter', 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import platform
import sys
from unittest import TestCase

import pytest
Expand Down Expand Up @@ -39,6 +40,9 @@ def setup_class(cls):
@pytest.mark.skipif(
'win' in platform.system().lower() and 'cu' in torch.__version__,
reason='skip on windows-cuda due to limited RAM.')
@pytest.mark.skipif(
sys.version_info < (3, 8),
reason='skip because python version is old.')
def test_stylegan2_cpu(self):
accu_iter = 1
message_hub = MessageHub.get_instance('test-s2')
Expand Down

0 comments on commit d9369cb

Please sign in to comment.