开发者社区 > ModelScope模型即服务 > 计算机视觉 > 正文

cv_diffusion_text-to-image-synthesis_tiny 无法生成可用图片

图片和代码信息被吞掉了,所以发在这里。 原帖:https://developer.aliyun.com/ask/489145

image.png

生成图片的效果如上图。

代码

import cv2 from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks

text2image = pipeline(Tasks.text_to_image_synthesis, 'damo/cv_diffusion_text-to-image-synthesis_tiny') result = text2image({'text': '中国山水画'})

cv2.imwrite('result.png', result['output_imgs'][0])

环境 - Ubuntu 22.04 - Python 3.9.16 - T4 GPU

Log 2023-03-03 02:57:26,928 - modelscope - INFO - PyTorch version 1.13.1 Found. 2023-03-03 02:57:26,931 - modelscope - INFO - Loading ast index from /home/hysts/.cache/modelscope/ast_indexer 2023-03-03 02:57:26,964 - modelscope - INFO - Loading done! Current index file version is 1.3.2, with md5 854e410f5d06d85f558e291ae3a56af2 and a total number of 754 components indexed 2023-03-03 02:57:29,404 - modelscope - INFO - Model revision not specified, use the latest revision: v1.0.0 2023-03-03 02:57:29,752 - modelscope - INFO - File configuration.json already in cache, skip downloading! 2023-03-03 02:57:29,752 - modelscope - INFO - File diffusion_config.json already in cache, skip downloading! 2023-03-03 02:57:29,753 - modelscope - INFO - File model_config.json already in cache, skip downloading! 2023-03-03 02:57:29,753 - modelscope - INFO - File pytorch_model.bin already in cache, skip downloading! 2023-03-03 02:57:29,753 - modelscope - INFO - File README.md already in cache, skip downloading! 2023-03-03 02:57:29,753 - modelscope - INFO - File vocab.txt already in cache, skip downloading! 2023-03-03 02:57:32,282 - modelscope - INFO - initiate model from /home/hysts/.cache/modelscope/hub/damo/cv_diffusion_text-to-image-synthesis_tiny INFO:modelscope:initiate model from /home/hysts/.cache/modelscope/hub/damo/cv_diffusion_text-to-image-synthesis_tiny 2023-03-03 02:57:32,283 - modelscope - INFO - initiate model from location /home/hysts/.cache/modelscope/hub/damo/cv_diffusion_text-to-image-synthesis_tiny. INFO:modelscope:initiate model from location /home/hysts/.cache/modelscope/hub/damo/cv_diffusion_text-to-image-synthesis_tiny. 2023-03-03 02:57:32,284 - modelscope - INFO - initialize model from /home/hysts/.cache/modelscope/hub/damo/cv_diffusion_text-to-image-synthesis_tiny INFO:modelscope:initialize model from /home/hysts/.cache/modelscope/hub/damo/cv_diffusion_text-to-image-synthesis_tiny 2023-03-03 02:57:48,500 - modelscope - WARNING - No preprocessor field found in cfg. WARNING:modelscope:No preprocessor field found in cfg. 2023-03-03 02:57:48,500 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file. WARNING:modelscope:No val key and type key found in preprocessor domain of configuration.json file. 2023-03-03 02:57:48,500 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '/home/hysts/.cache/modelscope/hub/damo/cv_diffusion_text-to-image-synthesis_tiny'}. trying to build by task and model information. WARNING:modelscope:Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '/home/hysts/.cache/modelscope/hub/damo/cv_diffusion_text-to-image-synthesis_tiny'}. trying to build by task and model information. 2023-03-03 02:57:48,500 - modelscope - WARNING - No preprocessor key ('diffusion-text-to-image-synthesis', 'text-to-image-synthesis') found in PREPROCESSOR_MAP, skip building preprocessor. WARNING:modelscope:No preprocessor key ('diffusion-text-to-image-synthesis', 'text-to-image-synthesis') found in PREPROCESSOR_MAP, skip building preprocessor.

展开
收起
游客lknxiqb5uhkrc 2023-03-03 16:00:18 1118 0
1 条回答
写回答
取消 提交回答
  • 貌似预览的效果和实际发出来有出入。。。

    代码在这里

    import cv2
    from modelscope.pipelines import pipeline
    from modelscope.utils.constant import Tasks
    
    text2image = pipeline(Tasks.text_to_image_synthesis, 'damo/cv_diffusion_text-to-image-synthesis_tiny')
    result = text2image({'text': '中国山水画'})
    
    cv2.imwrite('result.png', result['output_imgs'][0])
    
    2023-03-03 16:01:31
    赞同 展开评论 打赏

包含图像分类、图像生成、人体人脸识别、动作识别、目标分割、视频生成、卡通画、视觉评价、三维视觉等多个领域

热门讨论

热门文章

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载