From 615c443020ef37d44fca300c811a3aed4a4ee7a0 Mon Sep 17 00:00:00 2001 From: "shuying.shu" Date: Thu, 16 Feb 2023 11:13:53 +0000 Subject: [PATCH] [to #42322933] add test condition for GPU availablity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit damo/cv_diffusion_image-segmentation不支持cpu环境测试 Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11689517 --- tests/pipelines/test_ddpm_semantic_segmentation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/pipelines/test_ddpm_semantic_segmentation.py b/tests/pipelines/test_ddpm_semantic_segmentation.py index 554636c4..a5303098 100644 --- a/tests/pipelines/test_ddpm_semantic_segmentation.py +++ b/tests/pipelines/test_ddpm_semantic_segmentation.py @@ -1,6 +1,8 @@ # Copyright (c) Alibaba, Inc. and its affiliates. import unittest +import torch + from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks from modelscope.utils.demo_utils import DemoCompatibilityCheck @@ -15,6 +17,7 @@ class DDPMImageSemanticSegmentationTest(unittest.TestCase, self.model_id = 'damo/cv_diffusion_image-segmentation' @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') + @unittest.skipIf(not torch.cuda.is_available(), 'cuda unittest') def test_ddpm_image_semantic_segmentation(self): input_location = 'data/test/images/image_ffhq34_00041527.png'