mirror of
https://github.com/modelscope/modelscope.git
synced 2026-07-10 12:33:28 +02:00
明确受影响的模型(damo): ONE-PEACE-4B ModuleNotFoundError: MyCustomPipeline: MyCustomModel: No module named 'one_peace',缺少依赖。 cv_resnet50_face-reconstruction 不兼容tf2 nlp_automatic_post_editing_for_translation_en2de tf2.0兼容性问题,tf1.x需要 cv_resnet18_ocr-detection-word-level_damo tf2.x兼容性问题 cv_resnet18_ocr-detection-line-level_damo tf兼容性问题 cv_resnet101_detection_fewshot-defrcn 模型限制必须detection0.3+torch1.11.0" speech_dfsmn_ans_psm_48k_causal "librosa, numpy兼容性问题 cv_mdm_motion-generation "依赖numpy版本兼容性问题: File ""/opt/conda/lib/python3.8/site-packages/smplx/body_models.py"", cv_resnet50_ocr-detection-vlpt numpy兼容性问题 cv_clip-it_video-summarization_language-guided_en tf兼容性问题 Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/13744636 * numpy and pandas no version * modify compatible issue * fix numpy compatible issue * modify ci * fix lint issue * replace Image.ANTIALIAS to Image.Resampling.LANCZOS pillow compatible * skip uncompatible cases * fix numpy compatible issue, skip cases that can not compatbile numpy or tensorflow2.x * skip compatible cases * fix clip model issue * fix body 3d keypoints compatible issue
72 lines
2.6 KiB
Python
72 lines
2.6 KiB
Python
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
|
|
import cv2
|
|
|
|
from modelscope.hub.snapshot_download import snapshot_download
|
|
from modelscope.outputs import OutputKeys
|
|
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
|
|
|
|
logger = get_logger()
|
|
|
|
|
|
@unittest.skip('For need realesrgan')
|
|
class Text2360PanoramaImageTest(unittest.TestCase):
|
|
|
|
def setUp(self) -> None:
|
|
logger.info('start install xformers')
|
|
cmd = [
|
|
sys.executable, '-m', 'pip', 'install', 'xformers', '-f',
|
|
'https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html'
|
|
]
|
|
subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
logger.info('install xformers finished')
|
|
|
|
self.task = Tasks.text_to_360panorama_image
|
|
self.model_id = 'damo/cv_diffusion_text-to-360panorama-image_generation'
|
|
self.prompt = 'The living room'
|
|
self.upscale = False
|
|
self.refinement = False
|
|
|
|
self.input = {
|
|
'prompt': self.prompt,
|
|
'upscale': self.upscale,
|
|
'refinement': self.refinement,
|
|
}
|
|
|
|
@unittest.skipUnless(test_level() >= 3, 'skip test due to gpu oom')
|
|
def test_run_by_direct_model_download(self):
|
|
from modelscope.pipelines.cv import Text2360PanoramaImagePipeline
|
|
output_image_path = tempfile.NamedTemporaryFile(suffix='.png').name
|
|
cache_path = snapshot_download(self.model_id)
|
|
pipeline = Text2360PanoramaImagePipeline(cache_path)
|
|
pipeline.group_key = self.task
|
|
output = pipeline(inputs=self.input)[OutputKeys.OUTPUT_IMG]
|
|
cv2.imwrite(output_image_path, output)
|
|
print(
|
|
'pipeline: the output image path is {}'.format(output_image_path))
|
|
|
|
@unittest.skipUnless(test_level() >= 3, 'skip test due to gpu oom')
|
|
def test_run_with_model_from_modelhub(self):
|
|
from modelscope.pipelines.cv import Text2360PanoramaImagePipeline
|
|
output_image_path = tempfile.NamedTemporaryFile(suffix='.png').name
|
|
pipeline_ins = pipeline(
|
|
task=Tasks.text_to_360panorama_image,
|
|
model=self.model_id,
|
|
model_revision='v1.0.0')
|
|
output = pipeline_ins(inputs=self.input)[OutputKeys.OUTPUT_IMG]
|
|
cv2.imwrite(output_image_path, output)
|
|
print(
|
|
'pipeline: the output image path is {}'.format(output_image_path))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|