PaddlePaddle / PaddleHub

Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)【安全加固,暂停交互,请耐心等待】
https://www.paddlepaddle.org.cn/hub
Apache License 2.0
12.74k stars 2.07k forks source link

da[0].save_uri_to_file TypeError #2287

Open notjiangjiu opened 1 year ago

notjiangjiu commented 1 year ago

版本、环境信息

1)PaddleHub和PaddlePaddle版本:PaddleHub 2.2.0,PaddlePaddle 2.4.2 2)系统环境:win10,python 3.9 3)使用模型:disco_diffusion_ernievil_base

test.py代码内容(使用示例代码):

import paddlehub as hub

module = hub.Module(name="disco_diffusion_ernievil_base") text_prompts = ["孤舟蓑笠翁,独钓寒江雪。"] da = module.generate_image(text_prompts=text_prompts, artist='齐白石', output_dir='./disco_diffusion_ernievil_base_out/')
da[0].save_uri_to_file('disco_diffusion_ernievil_base_out-result.png')

运行及报错内容:

╭─────────────────────────┬────────────────────────────────────────────────────────────╮ │ Argument │ Value │ ├─────────────────────────┼────────────────────────────────────────────────────────────┤ │ batch_name │ │ │ batch_size │ 1 │ │ clamp_grad │ True │ │ clamp_max │ 0.05 │ │ clip_denoised │ False │ │ clip_guidance_scale │ 5000 │ │ clip_models │ ['vit_b_16x'] │ │ cut_ic_pow │ 1 │ │ cut_icgray_p │ [0.2]400+[0]600 │ │ cut_innercut │ [4]400+[12]600 │ │ cut_overview │ [12]400+[4]600 │ │ cutn_batches │ 4 │ │ diffusion_model │ 512x512_diffusion_uncond_finetune_008100 │ │ diffusion_sampling_mode │ ddim │ │ display_rate │ 10 │ │ eta │ 0.8 │ │ fuzzy_prompt │ False │ │ init_image │ None │ │ init_scale │ 1000 │ │ n_batches │ 1 │ │ name_docarray │ disco_diffusion_ernievil_base.reverse_diffusion-4153915605 │ │ output_dir │ ./disco_diffusion_ernievil_base_out/ │ │ perlin_init │ False │ │ perlin_mode │ mixed │ │ rand_mag │ 0.05 │ │ randomize_class │ True │ │ range_scale │ 0 │ │ sat_scale │ 0 │ │ seed │ 4153915605 │ │ skip_steps │ 0 │ │ steps │ 250 │ │ text_prompts │ ['孤舟蓑笠翁,独钓寒江雪,由齐白石所作'] │ │ tv_scale │ 0 │ │ use_secondary_model │ True │ │ width_height │ [1280, 768] │ ╰─────────────────────────┴────────────────────────────────────────────────────────────╯ 2023-08-07 12:42:21,510 - disco_diffusion_ernievil_base.reverse_diffusion - INFO - preparing models... [2023-08-07 12:42:21,510] [ INFO] runner.py:33 - preparing models... Setting up [LPIPS] perceptual loss: trunk [vgg], v[0.1], spatial [off] Loading model from: D:\files\python_learn_aliyun\paddlehub2\paddlehub_py_3.9\lib\site-packages\paddle_lpips\weights\v0.1\vgg.pdparams 2023-08-07 12:42:46,164 - disco_diffusion_ernievil_base.reverse_diffusion - INFO - creating artwork... [2023-08-07 12:42:46,164] [ INFO] runner.py:194 - creating artwork... disco_diffusion_ernievil_base.reverse_diffusion-4153915605 Output() 0%| | 0/250 [07:50<?, ?it/s] Traceback (most recent call last): File "D:\files\python_learn_aliyun\paddlehub2\test.py", line 29, in da[0].save_uri_to_file('disco_diffusion_ernievil_base_out-result.png') TypeError: 'NoneType' object is not subscriptable