diff --git a/.circleci/test.yml b/.circleci/test.yml index e2c22719cd..2cd5a7a5f8 100644 --- a/.circleci/test.yml +++ b/.circleci/test.yml @@ -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' @@ -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' diff --git a/tests/test_apis/test_inferencers/test_inference_functions.py b/tests/test_apis/test_inferencers/test_inference_functions.py index 9eed091a74..77bd685b3a 100644 --- a/tests/test_apis/test_inferencers/test_inference_functions.py +++ b/tests/test_apis/test_inferencers/test_inference_functions.py @@ -1,6 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import platform +import sys import unittest import pytest @@ -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) diff --git a/tests/test_apis/test_inferencers/test_video_restoration_inferencer.py b/tests/test_apis/test_inferencers/test_video_restoration_inferencer.py index 09be036fb4..3cf61486af 100644 --- a/tests/test_apis/test_inferencers/test_video_restoration_inferencer.py +++ b/tests/test_apis/test_inferencers/test_video_restoration_inferencer.py @@ -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 @@ -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', @@ -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', @@ -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', @@ -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', diff --git a/tests/test_models/test_editors/test_ddpm/test_attention.py b/tests/test_models/test_editors/test_ddpm/test_attention.py index c0b68d0d4f..7aae5e85ec 100644 --- a/tests/test_models/test_editors/test_ddpm/test_attention.py +++ b/tests/test_models/test_editors/test_ddpm/test_attention.py @@ -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(): diff --git a/tests/test_models/test_editors/test_ddpm/test_ddpm_scheduler.py b/tests/test_models/test_editors/test_ddpm/test_ddpm_scheduler.py index 23df9718a5..fe4c33126b 100644 --- a/tests/test_models/test_editors/test_ddpm/test_ddpm_scheduler.py +++ b/tests/test_models/test_editors/test_ddpm/test_ddpm_scheduler.py @@ -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') diff --git a/tests/test_models/test_editors/test_stable_diffusion/test_stable_diffusion.py b/tests/test_models/test_editors/test_stable_diffusion/test_stable_diffusion.py index f84f58a7ee..fb2fe3352d 100644 --- a/tests/test_models/test_editors/test_stable_diffusion/test_stable_diffusion.py +++ b/tests/test_models/test_editors/test_stable_diffusion/test_stable_diffusion.py @@ -1,5 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. import platform +import sys import pytest import torch @@ -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() diff --git a/tests/test_models/test_editors/test_stylegan1/test_stylegan1.py b/tests/test_models/test_editors/test_stylegan1/test_stylegan1.py index cac2273712..963f2c7eb4 100644 --- a/tests/test_models/test_editors/test_stylegan1/test_stylegan1.py +++ b/tests/test_models/test_editors/test_stylegan1/test_stylegan1.py @@ -1,5 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. import platform +import sys from unittest import TestCase import numpy as np @@ -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) diff --git a/tests/test_models/test_editors/test_stylegan2/test_stylegan2.py b/tests/test_models/test_editors/test_stylegan2/test_stylegan2.py index c28542e4a4..7d49699e04 100644 --- a/tests/test_models/test_editors/test_stylegan2/test_stylegan2.py +++ b/tests/test_models/test_editors/test_stylegan2/test_stylegan2.py @@ -1,5 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. import platform +import sys from unittest import TestCase import pytest @@ -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')