Bug 8031 - [ModelScope][容器镜像]PASD_v2_image_super_resolutions模型依赖的diffusers python包版本过高不兼容,导致模型运行失败
Summary: [ModelScope][容器镜像]PASD_v2_image_super_resolutions模型依赖的diffusers python包版本过高不兼...
Status: NEW
Alias: None
Product: Anolis OS 8
Classification: Anolis OS
Component: Images&Installations (show other bugs) Images&Installations
Version: 8.8
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: zhongling
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-24 11:20 UTC by bolong_tbl
Modified: 2024-01-24 11:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bolong_tbl alibaba_cloud_group 2024-01-24 11:20:05 UTC
Description of problem:
镜像默认提供的diffusers python包版本过高,无法import AdaGroupNorm,导致PASD_v2_image_super_resolutions模型运行失败,ModelScope社区Ubuntu镜像无该问题。

Version-Release number of selected component (if applicable):
镜像地址:registry.openanolis.cn/openanolis/modelscope:1.10.0-an8
Anolis镜像diffuser版本:0.24.0
Ubuntu镜像diffuser版本:0.21.4

How reproducible:


Steps to Reproduce:
1. 启动容器docker run -it registry.openanolis.cn/openanolis/modelscope:1.10.0-an8
2. 根据ModelScope官网,找到PASD_v2_image_super_resolutions模型对应的代码范例(code example):

import cv2
import torch
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

input_location = 'http://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/results/output_test_pasd/0fbc3855c7cfdc95.png'
prompt = ''
output_image_path = 'result.png'

input = {
    'image': input_location,
    'prompt': prompt,
    'upscale': 2,
    'fidelity_scale_fg': 1.0,
    'fidelity_scale_bg': 1.0
}
pasd = pipeline(Tasks.image_super_resolution_pasd, model='damo/PASD_v2_image_super_resolutions')
output = pasd(input)[OutputKeys.OUTPUT_IMG]
cv2.imwrite(output_image_path, output)
print('pipeline: the output image path is {}'.format(output_image_path))

3. 执行代码范例

Actual results:


Traceback (most recent call last):
  File "/cache/integration_tests/workspace/test_PASD_v2_image_super_resolutions.py", line 19, in 
    pasd = pipeline(Tasks.image_super_resolution_pasd, model='damo/PASD_v2_image_super_resolutions')
  File "/opt/conda/lib/python3.8/site-packages/modelscope/pipelines/builder.py", line 170, in pipeline
    return build_pipeline(cfg, task_name=task)
  File "/opt/conda/lib/python3.8/site-packages/modelscope/pipelines/builder.py", line 65, in build_pipeline
    return build_from_cfg(
  File "/opt/conda/lib/python3.8/site-packages/modelscope/utils/registry.py", line 215, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
RuntimeError: ImageSuperResolutionPASDPipeline: Failed to import modelscope.models.cv.image_super_resolution_pasd_v2.controlnet because of the following error (look up to see its traceback):
cannot import name 'AdaGroupNorm' from 'diffusers.models.attention' (/opt/conda/lib/python3.8/site-packages/diffusers/models/attention.py)

Expected results:
执行不报错

Additional info:

可通过降diffusers版本解决