diff --git a/tests/pipelines/test_animal_recognition.py b/tests/pipelines/test_animal_recognition.py index 8b856396..3a31afed 100644 --- a/tests/pipelines/test_animal_recognition.py +++ b/tests/pipelines/test_animal_recognition.py @@ -7,7 +7,7 @@ from modelscope.utils.test_utils import test_level class AnimalRecognitionTest(unittest.TestCase): - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run(self): animal_recognition = pipeline( Tasks.animal_recognition, diff --git a/tests/pipelines/test_automatic_speech_recognition.py b/tests/pipelines/test_automatic_speech_recognition.py index 1843d5dd..88ebcdbd 100644 --- a/tests/pipelines/test_automatic_speech_recognition.py +++ b/tests/pipelines/test_automatic_speech_recognition.py @@ -1,13 +1,10 @@ # Copyright (c) Alibaba, Inc. and its affiliates. import os import shutil -import sys -import tarfile import unittest from typing import Any, Dict, Union import numpy as np -import requests import soundfile from modelscope.outputs import OutputKeys diff --git a/tests/pipelines/test_base.py b/tests/pipelines/test_base.py index 9b3ed385..b60813c8 100644 --- a/tests/pipelines/test_base.py +++ b/tests/pipelines/test_base.py @@ -1,7 +1,7 @@ # Copyright (c) Alibaba, Inc. and its affiliates. import unittest -from typing import Any, Dict, List, Tuple, Union +from typing import Any, Dict, Union import numpy as np from PIL import Image @@ -9,9 +9,7 @@ from PIL import Image from modelscope.outputs import OutputKeys from modelscope.pipelines import Pipeline, pipeline from modelscope.pipelines.builder import PIPELINES, add_default_pipeline_info -from modelscope.utils.constant import Tasks from modelscope.utils.logger import get_logger -from modelscope.utils.registry import default_group logger = get_logger() diff --git a/tests/pipelines/test_body_2d_keypoints.py b/tests/pipelines/test_body_2d_keypoints.py index 3ff00926..e22925a6 100644 --- a/tests/pipelines/test_body_2d_keypoints.py +++ b/tests/pipelines/test_body_2d_keypoints.py @@ -1,12 +1,8 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os -import os.path as osp -import pdb import unittest import cv2 import numpy as np -import torch from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline diff --git a/tests/pipelines/test_builder.py b/tests/pipelines/test_builder.py index baef5a6f..6caa2cb1 100644 --- a/tests/pipelines/test_builder.py +++ b/tests/pipelines/test_builder.py @@ -2,20 +2,15 @@ import os import unittest -from asyncio import Task -from typing import Any, Dict, List, Tuple, Union - -import numpy as np -import PIL +from typing import Any, Dict, List, Union from modelscope.fileio import io from modelscope.models.base import Model from modelscope.pipelines import Pipeline, pipeline -from modelscope.pipelines.builder import PIPELINES, add_default_pipeline_info +from modelscope.pipelines.builder import PIPELINES from modelscope.utils.constant import (ConfigFields, Frameworks, ModelFile, Tasks) from modelscope.utils.logger import get_logger -from modelscope.utils.registry import default_group logger = get_logger() diff --git a/tests/pipelines/test_cmdssl_video_embedding.py b/tests/pipelines/test_cmdssl_video_embedding.py index dd06305a..694ebf40 100644 --- a/tests/pipelines/test_cmdssl_video_embedding.py +++ b/tests/pipelines/test_cmdssl_video_embedding.py @@ -1,16 +1,9 @@ # Copyright (c) Alibaba, Inc. and its affiliates. # !/usr/bin/env python -import os.path as osp -import shutil -import tempfile import unittest -import cv2 - -from modelscope.fileio import File -from modelscope.msdatasets import MsDataset from modelscope.pipelines import pipeline -from modelscope.utils.constant import ModelFile, Tasks +from modelscope.utils.constant import Tasks from modelscope.utils.test_utils import test_level diff --git a/tests/pipelines/test_csanmt_translation.py b/tests/pipelines/test_csanmt_translation.py index c43011fc..699270d6 100644 --- a/tests/pipelines/test_csanmt_translation.py +++ b/tests/pipelines/test_csanmt_translation.py @@ -1,10 +1,7 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import shutil import unittest -from modelscope.hub.snapshot_download import snapshot_download from modelscope.pipelines import pipeline -from modelscope.pipelines.nlp import TranslationPipeline from modelscope.utils.constant import Tasks from modelscope.utils.test_utils import test_level diff --git a/tests/pipelines/test_face_detection.py b/tests/pipelines/test_face_detection.py index 23fda2c5..d4872e0a 100644 --- a/tests/pipelines/test_face_detection.py +++ b/tests/pipelines/test_face_detection.py @@ -1,16 +1,14 @@ # Copyright (c) Alibaba, Inc. and its affiliates. import os.path as osp -import tempfile import unittest import cv2 import numpy as np -from modelscope.fileio import File from modelscope.msdatasets import MsDataset from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline -from modelscope.utils.constant import ModelFile, Tasks +from modelscope.utils.constant import Tasks from modelscope.utils.test_utils import test_level diff --git a/tests/pipelines/test_face_image_generation.py b/tests/pipelines/test_face_image_generation.py index 92ab7a87..fc2c58cc 100644 --- a/tests/pipelines/test_face_image_generation.py +++ b/tests/pipelines/test_face_image_generation.py @@ -23,7 +23,7 @@ class FaceGenerationTest(unittest.TestCase): cv2.imwrite('result.png', result[OutputKeys.OUTPUT_IMG]) print(f'Output written to {osp.abspath("result.png")}') - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_modelhub(self): seed = 10 face_generation = pipeline( diff --git a/tests/pipelines/test_face_recognition.py b/tests/pipelines/test_face_recognition.py index ea987a72..20e05f65 100644 --- a/tests/pipelines/test_face_recognition.py +++ b/tests/pipelines/test_face_recognition.py @@ -1,16 +1,11 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os.path as osp -import tempfile import unittest -import cv2 import numpy as np -from modelscope.fileio import File -from modelscope.msdatasets import MsDataset from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline -from modelscope.utils.constant import ModelFile, Tasks +from modelscope.utils.constant import Tasks from modelscope.utils.test_utils import test_level @@ -19,7 +14,7 @@ class FaceRecognitionTest(unittest.TestCase): def setUp(self) -> None: self.model_id = 'damo/cv_ir101_facerecognition_cfglint' - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_face_compare(self): img1 = 'data/test/images/face_recognition_1.png' img2 = 'data/test/images/face_recognition_2.png' diff --git a/tests/pipelines/test_general_image_classification.py b/tests/pipelines/test_general_image_classification.py index 58775df1..8a814f4a 100644 --- a/tests/pipelines/test_general_image_classification.py +++ b/tests/pipelines/test_general_image_classification.py @@ -7,7 +7,7 @@ from modelscope.utils.test_utils import test_level class GeneralImageClassificationTest(unittest.TestCase): - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_ImageNet(self): general_image_classification = pipeline( Tasks.image_classification, @@ -15,7 +15,7 @@ class GeneralImageClassificationTest(unittest.TestCase): result = general_image_classification('data/test/images/bird.JPEG') print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_Dailylife(self): general_image_classification = pipeline( Tasks.image_classification, @@ -23,7 +23,7 @@ class GeneralImageClassificationTest(unittest.TestCase): result = general_image_classification('data/test/images/bird.JPEG') print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 2, 'skip test in current test level') def test_run_Dailylife_default(self): general_image_classification = pipeline(Tasks.image_classification) result = general_image_classification('data/test/images/bird.JPEG') diff --git a/tests/pipelines/test_general_recognition.py b/tests/pipelines/test_general_recognition.py index 0e1117d9..0b32e1f5 100644 --- a/tests/pipelines/test_general_recognition.py +++ b/tests/pipelines/test_general_recognition.py @@ -7,7 +7,7 @@ from modelscope.utils.test_utils import test_level class GeneralRecognitionTest(unittest.TestCase): - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run(self): general_recognition = pipeline( Tasks.general_recognition, diff --git a/tests/pipelines/test_generative_multi_modal_embedding.py b/tests/pipelines/test_generative_multi_modal_embedding.py index ccca8f4e..d8593abb 100644 --- a/tests/pipelines/test_generative_multi_modal_embedding.py +++ b/tests/pipelines/test_generative_multi_modal_embedding.py @@ -2,8 +2,6 @@ import unittest -import numpy as np - from modelscope.models import Model from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks @@ -19,7 +17,7 @@ class GEMMMultiModalEmbeddingTest(unittest.TestCase): 'captioning': False } - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run(self): generative_multi_modal_embedding_pipeline = pipeline( Tasks.generative_multi_modal_embedding, model=self.model_id) diff --git a/tests/pipelines/test_image2image_generation.py b/tests/pipelines/test_image2image_generation.py index dceb61c6..81aae81e 100644 --- a/tests/pipelines/test_image2image_generation.py +++ b/tests/pipelines/test_image2image_generation.py @@ -1,14 +1,10 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os.path as osp -import shutil import unittest from torchvision.utils import save_image -from modelscope.fileio import File -from modelscope.msdatasets import MsDataset from modelscope.pipelines import pipeline -from modelscope.utils.constant import ModelFile, Tasks +from modelscope.utils.constant import Tasks from modelscope.utils.test_utils import test_level diff --git a/tests/pipelines/test_image2image_translation.py b/tests/pipelines/test_image2image_translation.py index 8380af75..fd2f8063 100644 --- a/tests/pipelines/test_image2image_translation.py +++ b/tests/pipelines/test_image2image_translation.py @@ -1,12 +1,8 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os.path as osp -import shutil import unittest -from modelscope.fileio import File -from modelscope.msdatasets import MsDataset from modelscope.pipelines import pipeline -from modelscope.utils.constant import ModelFile, Tasks +from modelscope.utils.constant import Tasks from modelscope.utils.test_utils import test_level diff --git a/tests/pipelines/test_image_color_enhance.py b/tests/pipelines/test_image_color_enhance.py index 62ffbcb9..c8ea5f9c 100644 --- a/tests/pipelines/test_image_color_enhance.py +++ b/tests/pipelines/test_image_color_enhance.py @@ -1,5 +1,4 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os import os.path as osp import unittest diff --git a/tests/pipelines/test_image_colorization.py b/tests/pipelines/test_image_colorization.py index 14090363..1a02cffb 100644 --- a/tests/pipelines/test_image_colorization.py +++ b/tests/pipelines/test_image_colorization.py @@ -1,11 +1,9 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os import os.path as osp import unittest import cv2 -from modelscope.msdatasets import MsDataset from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline from modelscope.pipelines.base import Pipeline @@ -25,7 +23,7 @@ class ImageColorizationTest(unittest.TestCase): cv2.imwrite('result.png', result[OutputKeys.OUTPUT_IMG]) print(f'Output written to {osp.abspath("result.png")}') - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_modelhub(self): image_colorization = pipeline( Tasks.image_colorization, model=self.model_id) diff --git a/tests/pipelines/test_image_instance_segmentation.py b/tests/pipelines/test_image_instance_segmentation.py index 22e86631..cd08d669 100644 --- a/tests/pipelines/test_image_instance_segmentation.py +++ b/tests/pipelines/test_image_instance_segmentation.py @@ -4,8 +4,8 @@ import unittest from modelscope.hub.snapshot_download import snapshot_download from modelscope.models import Model -from modelscope.models.cv.image_instance_segmentation import ( - CascadeMaskRCNNSwinModel, get_img_ins_seg_result) +from modelscope.models.cv.image_instance_segmentation import \ + CascadeMaskRCNNSwinModel from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline from modelscope.pipelines.cv import ImageInstanceSegmentationPipeline diff --git a/tests/pipelines/test_image_portrait_enhancement.py b/tests/pipelines/test_image_portrait_enhancement.py index 64b84db6..834fcfdb 100644 --- a/tests/pipelines/test_image_portrait_enhancement.py +++ b/tests/pipelines/test_image_portrait_enhancement.py @@ -5,7 +5,6 @@ import unittest import cv2 -from modelscope.msdatasets import MsDataset from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline from modelscope.pipelines.base import Pipeline @@ -27,7 +26,7 @@ class ImagePortraitEnhancementTest(unittest.TestCase): else: raise Exception('Testing failed: invalid output') - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_modelhub(self): face_enhancement = pipeline( Tasks.image_portrait_enhancement, model=self.model_id) diff --git a/tests/pipelines/test_image_style_transfer.py b/tests/pipelines/test_image_style_transfer.py index d16895ff..964e47ac 100644 --- a/tests/pipelines/test_image_style_transfer.py +++ b/tests/pipelines/test_image_style_transfer.py @@ -1,16 +1,12 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os.path as osp -import tempfile import unittest import cv2 -from modelscope.fileio import File from modelscope.hub.snapshot_download import snapshot_download from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline -from modelscope.pipelines.base import Pipeline -from modelscope.utils.constant import ModelFile, Tasks +from modelscope.utils.constant import Tasks from modelscope.utils.test_utils import test_level @@ -31,7 +27,7 @@ class ImageStyleTransferTest(unittest.TestCase): style='data/test/images/style_transfer_style.jpg') cv2.imwrite('result_styletransfer1.png', result[OutputKeys.OUTPUT_IMG]) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_modelhub(self): image_style_transfer = pipeline( Tasks.image_style_transfer, model=self.model_id) diff --git a/tests/pipelines/test_image_super_resolution.py b/tests/pipelines/test_image_super_resolution.py index c2b930f0..8cf9e46f 100644 --- a/tests/pipelines/test_image_super_resolution.py +++ b/tests/pipelines/test_image_super_resolution.py @@ -1,11 +1,9 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os import os.path as osp import unittest import cv2 -from modelscope.msdatasets import MsDataset from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline from modelscope.pipelines.base import Pipeline @@ -25,7 +23,7 @@ class ImageSuperResolutionTest(unittest.TestCase): cv2.imwrite('result.png', result[OutputKeys.OUTPUT_IMG]) print(f'Output written to {osp.abspath("result.png")}') - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_modelhub(self): super_resolution = pipeline( Tasks.image_super_resolution, model=self.model_id) diff --git a/tests/pipelines/test_key_word_spotting.py b/tests/pipelines/test_key_word_spotting.py index 5b7d20d0..17640934 100644 --- a/tests/pipelines/test_key_word_spotting.py +++ b/tests/pipelines/test_key_word_spotting.py @@ -1,12 +1,10 @@ # Copyright (c) Alibaba, Inc. and its affiliates. import os import shutil -import tarfile import unittest from typing import Any, Dict, List, Union import numpy as np -import requests import soundfile from modelscope.outputs import OutputKeys diff --git a/tests/pipelines/test_named_entity_recognition.py b/tests/pipelines/test_named_entity_recognition.py index 21a62d80..5ba93f49 100644 --- a/tests/pipelines/test_named_entity_recognition.py +++ b/tests/pipelines/test_named_entity_recognition.py @@ -32,7 +32,7 @@ class NamedEntityRecognitionTest(unittest.TestCase): print() print(f'pipeline2: {pipeline2(input=self.sentence)}') - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_model_from_modelhub(self): model = Model.from_pretrained(self.model_id) tokenizer = NERPreprocessor(model.model_dir) diff --git a/tests/pipelines/test_nli.py b/tests/pipelines/test_nli.py index f477fb37..1e259a2e 100644 --- a/tests/pipelines/test_nli.py +++ b/tests/pipelines/test_nli.py @@ -44,7 +44,7 @@ class NLITest(unittest.TestCase): pipeline_ins = pipeline(task=Tasks.nli, model=self.model_id) print(pipeline_ins(input=(self.sentence1, self.sentence2))) - @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 2, 'skip test in current test level') def test_run_with_default_model(self): pipeline_ins = pipeline(task=Tasks.nli) print(pipeline_ins(input=(self.sentence1, self.sentence2))) diff --git a/tests/pipelines/test_object_detection.py b/tests/pipelines/test_object_detection.py index f3819ab7..de16aaa1 100644 --- a/tests/pipelines/test_object_detection.py +++ b/tests/pipelines/test_object_detection.py @@ -3,7 +3,6 @@ import unittest from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks -from modelscope.utils.logger import get_logger from modelscope.utils.test_utils import test_level @@ -30,7 +29,7 @@ class ObjectDetectionTest(unittest.TestCase): else: raise ValueError('process error') - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_human_detection(self): input_location = 'data/test/images/image_detection.jpg' model_id = 'damo/cv_resnet18_human-detection' diff --git a/tests/pipelines/test_ocr_detection.py b/tests/pipelines/test_ocr_detection.py index d1ecd4e4..a4201512 100644 --- a/tests/pipelines/test_ocr_detection.py +++ b/tests/pipelines/test_ocr_detection.py @@ -1,14 +1,5 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os.path as osp -import shutil -import sys -import tempfile import unittest -from typing import Any, Dict, List, Tuple, Union - -import cv2 -import numpy as np -import PIL from modelscope.pipelines import pipeline from modelscope.pipelines.base import Pipeline @@ -27,7 +18,7 @@ class OCRDetectionTest(unittest.TestCase): print('ocr detection results: ') print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_model_from_modelhub(self): ocr_detection = pipeline(Tasks.ocr_detection, model=self.model_id) self.pipeline_inference(ocr_detection, self.test_image) diff --git a/tests/pipelines/test_ofa_tasks.py b/tests/pipelines/test_ofa_tasks.py index 2b890e8b..ab10f573 100644 --- a/tests/pipelines/test_ofa_tasks.py +++ b/tests/pipelines/test_ofa_tasks.py @@ -39,7 +39,7 @@ class OfaTasksTest(unittest.TestCase): result = img_captioning({'image': image}) print(result[OutputKeys.CAPTION]) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_image_captioning_with_name(self): img_captioning = pipeline( Tasks.image_captioning, @@ -58,7 +58,7 @@ class OfaTasksTest(unittest.TestCase): result = ofa_pipe(input) print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_image_classification_with_name(self): ofa_pipe = pipeline( Tasks.image_classification, @@ -81,7 +81,7 @@ class OfaTasksTest(unittest.TestCase): result = ofa_pipe(input) print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_summarization_with_name(self): ofa_pipe = pipeline( Tasks.summarization, @@ -105,7 +105,7 @@ class OfaTasksTest(unittest.TestCase): result = ofa_pipe(input) print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_text_classification_with_name(self): ofa_pipe = pipeline( Tasks.text_classification, @@ -127,7 +127,7 @@ class OfaTasksTest(unittest.TestCase): result = ofa_pipe(input) print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_visual_entailment_with_name(self): ofa_pipe = pipeline( Tasks.visual_entailment, @@ -166,7 +166,7 @@ class OfaTasksTest(unittest.TestCase): self.save_img(image, result[OutputKeys.BOXES], osp.join('large_en_name_' + image_name + '.png')) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_visual_grounding_zh_with_name(self): model = 'damo/ofa_visual-grounding_refcoco_large_zh' ofa_pipe = pipeline(Tasks.visual_grounding, model=model) @@ -190,7 +190,7 @@ class OfaTasksTest(unittest.TestCase): result = ofa_pipe(input) print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_visual_question_answering_with_name(self): model = 'damo/ofa_visual-question-answering_pretrain_large_en' ofa_pipe = pipeline(Tasks.visual_question_answering, model=model) @@ -213,7 +213,7 @@ class OfaTasksTest(unittest.TestCase): result = img_captioning(image) print(result[OutputKeys.CAPTION]) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_visual_entailment_distilled_model_with_name(self): ofa_pipe = pipeline( Tasks.visual_entailment, @@ -235,7 +235,7 @@ class OfaTasksTest(unittest.TestCase): result = ofa_pipe(input) print(result) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_text_to_image_synthesis_with_name(self): model = 'damo/ofa_text-to-image-synthesis_coco_large_en' ofa_pipe = pipeline(Tasks.text_to_image_synthesis, model=model) diff --git a/tests/pipelines/test_person_image_cartoon.py b/tests/pipelines/test_person_image_cartoon.py index 660ba1df..8b5384ee 100644 --- a/tests/pipelines/test_person_image_cartoon.py +++ b/tests/pipelines/test_person_image_cartoon.py @@ -37,7 +37,7 @@ class ImageCartoonTest(unittest.TestCase): Tasks.image_portrait_stylization, model=model_dir) self.pipeline_inference(img_cartoon, self.test_image) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_modelhub(self): img_cartoon = pipeline( Tasks.image_portrait_stylization, model=self.model_id) diff --git a/tests/pipelines/test_sentence_similarity.py b/tests/pipelines/test_sentence_similarity.py index 7a30d779..d39f6783 100644 --- a/tests/pipelines/test_sentence_similarity.py +++ b/tests/pipelines/test_sentence_similarity.py @@ -1,5 +1,4 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import shutil import unittest from modelscope.hub.snapshot_download import snapshot_download diff --git a/tests/pipelines/test_skin_retouching.py b/tests/pipelines/test_skin_retouching.py index 54cdaa73..a10af416 100644 --- a/tests/pipelines/test_skin_retouching.py +++ b/tests/pipelines/test_skin_retouching.py @@ -1,5 +1,4 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import os import os.path as osp import unittest @@ -31,7 +30,7 @@ class SkinRetouchingTest(unittest.TestCase): skin_retouching = pipeline(Tasks.skin_retouching, model=model_dir) self.pipeline_inference(skin_retouching, self.test_image) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_modelhub(self): skin_retouching = pipeline(Tasks.skin_retouching, model=self.model_id) self.pipeline_inference(skin_retouching, self.test_image) diff --git a/tests/pipelines/test_task_oriented_conversation.py b/tests/pipelines/test_task_oriented_conversation.py index a2232180..18b93e95 100644 --- a/tests/pipelines/test_task_oriented_conversation.py +++ b/tests/pipelines/test_task_oriented_conversation.py @@ -125,7 +125,7 @@ class TaskOrientedConversationTest(unittest.TestCase): ] self.generate_and_print_dialog_response(pipelines) - @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') def test_run_with_model_from_modelhub(self): model = Model.from_pretrained(self.model_id) preprocessor = DialogModelingPreprocessor(model_dir=model.model_dir) diff --git a/tests/pipelines/test_text_classification.py b/tests/pipelines/test_text_classification.py index 332099e3..542568d1 100644 --- a/tests/pipelines/test_text_classification.py +++ b/tests/pipelines/test_text_classification.py @@ -1,5 +1,4 @@ # Copyright (c) Alibaba, Inc. and its affiliates. -import shutil import unittest from modelscope.models import Model diff --git a/tests/pipelines/test_text_error_correction.py b/tests/pipelines/test_text_error_correction.py index 0ccc003c..5a1890ce 100644 --- a/tests/pipelines/test_text_error_correction.py +++ b/tests/pipelines/test_text_error_correction.py @@ -39,7 +39,7 @@ class TextErrorCorrectionTest(unittest.TestCase): preprocessor=preprocessor) print(pipeline_ins(self.input)) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_model_name(self): pipeline_ins = pipeline( task=Tasks.text_error_correction, model=self.model_id) diff --git a/tests/pipelines/test_text_to_speech.py b/tests/pipelines/test_text_to_speech.py index 552098c0..46878c0a 100644 --- a/tests/pipelines/test_text_to_speech.py +++ b/tests/pipelines/test_text_to_speech.py @@ -7,11 +7,9 @@ import unittest import torch from scipy.io.wavfile import write -from modelscope.metainfo import Pipelines -from modelscope.models import Model from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline -from modelscope.utils.constant import Fields, Tasks +from modelscope.utils.constant import Tasks from modelscope.utils.logger import get_logger from modelscope.utils.test_utils import test_level @@ -22,7 +20,7 @@ logger = get_logger() class TextToSpeechSambertHifigan16kPipelineTest(unittest.TestCase): - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_pipeline(self): text = '今天北京天气怎么样?' model_id = 'damo/speech_sambert-hifigan_tts_zhcn_16k' diff --git a/tests/pipelines/test_video_multi_modal_embedding.py b/tests/pipelines/test_video_multi_modal_embedding.py index 943dbed9..b33ba56c 100644 --- a/tests/pipelines/test_video_multi_modal_embedding.py +++ b/tests/pipelines/test_video_multi_modal_embedding.py @@ -2,9 +2,6 @@ import unittest -import numpy as np - -from modelscope.models import Model from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks from modelscope.utils.logger import get_logger diff --git a/tests/pipelines/test_virtual_try_on.py b/tests/pipelines/test_virtual_try_on.py index 5c6cef51..1979c9b8 100644 --- a/tests/pipelines/test_virtual_try_on.py +++ b/tests/pipelines/test_virtual_try_on.py @@ -1,8 +1,6 @@ -import sys import unittest import cv2 -import numpy as np from PIL import Image from modelscope.outputs import OutputKeys @@ -18,7 +16,7 @@ class VirtualTryonTest(unittest.TestCase): cloth = Image.open('data/test/images/virtual_tryon_cloth.jpg') input_imgs = (masked_model, pose, cloth) - @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_run_with_model_name(self): pipeline_virtual_try_on = pipeline( task=Tasks.virtual_try_on, model=self.model_id) diff --git a/tests/pipelines/test_zero_shot_classification.py b/tests/pipelines/test_zero_shot_classification.py index ee0b5bae..7620a0ed 100644 --- a/tests/pipelines/test_zero_shot_classification.py +++ b/tests/pipelines/test_zero_shot_classification.py @@ -39,7 +39,7 @@ class ZeroShotClassificationTest(unittest.TestCase): f'pipeline2: {pipeline2(self.sentence,candidate_labels=self.labels,hypothesis_template=self.template)}' ) - @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') + @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') def test_run_with_model_from_modelhub(self): model = Model.from_pretrained(self.model_id) tokenizer = ZeroShotClassificationPreprocessor(model.model_dir)