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.73k stars 2.07k forks source link

根据paddlehub的stable diffusion操作报错 #2014

Closed TIMESTICKING closed 2 years ago

TIMESTICKING commented 2 years ago

windows 11 python 3.7.9 cuda 10.1 ---------------------------------packages paddle-bfloat 0.1.7 paddle2onnx 1.0.0 paddlefsl 1.1.0 paddlehub 2.3.0 paddlenlp 2.4.0 paddlepaddle 2.3.2 paddlepaddle-gpu 2.3.2

hub run stable_diffusion --text_prompts "in the morning light,Overlooking TOKYO city by greg rutkowski and thomas kinkade,Trending on artstation." --output_dir I:\test
h:\program_files\python37\lib\site-packages\paddlenlp\transformers\image_utils.py:213: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.
  resample=Image.BILINEAR,
h:\program_files\python37\lib\site-packages\paddlenlp\transformers\image_utils.py:379: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.
  resample=Image.NEAREST,
h:\program_files\python37\lib\site-packages\paddlenlp\transformers\ernie_vil\feature_extraction.py:65: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.
  resample=Image.BICUBIC,
h:\program_files\python37\lib\site-packages\paddlenlp\transformers\clip\feature_extraction.py:64: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.
  resample=Image.BICUBIC,
W0912 21:26:09.928313 20836 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.6, Runtime API Version: 10.2
W0912 21:26:09.936313 20836 gpu_resources.cc:91] device: 0, cuDNN Version: 7.6.
Traceback (most recent call last):
  File "h:\program_files\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "h:\program_files\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "H:\program_files\python37\Scripts\hub.exe\__main__.py", line 7, in <module>
  File "h:\program_files\python37\lib\site-packages\paddlehub\commands\utils.py", line 78, in execute
    status = 0 if com['_entry']().execute(sys.argv[idx:]) else 1
  File "h:\program_files\python37\lib\site-packages\paddlehub\commands\run.py", line 56, in execute
    result = module._run_func(argv[1:])
  File "h:\program_files\python37\lib\site-packages\paddlehub\compat\paddle_utils.py", line 221, in runner
    return func(*args, **kwargs)
  File "h:\program_files\python37\lib\site-packages\paddlehub\module\module.py", line 58, in _wrapper
    return func(*args, **kwargs)
  File "C:\Users\Lee\.paddlehub\modules\stable_diffusion\module.py", line 280, in run_cmd
    output_dir= args.output_dir)
  File "h:\program_files\python37\lib\site-packages\paddlehub\compat\paddle_utils.py", line 221, in runner
    return func(*args, **kwargs)
  File "C:\Users\Lee\.paddlehub\modules\stable_diffusion\module.py", line 170, in generate_image
    text_input = tokenize(prompts)
  File "C:\Users\Lee\.paddlehub\modules\stable_diffusion\clip\clip\utils.py", line 63, in tokenize
    result[i, :len(tokens)] = paddle.Tensor(np.array(tokens))
  File "h:\program_files\python37\lib\site-packages\paddle\fluid\dygraph\varbase_patch_methods.py", line 786, in __setitem__
    return self.__setitem_varbase__(item, value)
ValueError: (InvalidArgument) The type of data we are trying to retrieve does not match the type of data currently contained in the container.
  [Hint: Expected dtype() == paddle::experimental::CppTypeToDataType<T>::Type(), but received dtype():5 != paddle::experimental::CppTypeToDataType<T>::Type():7.] (at ..\paddle\phi\core\dense_tensor.cc:137)
  [operator < set_value > error]
rainyfly commented 2 years ago

你好,这边已收到反馈,看报错是数据类型不匹配导致的,我们复现一下,你可以先在aistudio上试试看,https://aistudio.baidu.com/aistudio/projectdetail/4512600

TIMESTICKING commented 2 years ago

你好,这边已收到反馈,看报错是数据类型不匹配导致的,我们复现一下,你可以先在aistudio上试试看,https://aistudio.baidu.com/aistudio/projectdetail/4512600

好的,请问你们有结果了吗

rainyfly commented 2 years ago

C:\Users\Lee.paddlehub\modules\stable_diffusion\clip\clip\utils.py , 你要不打开一下这个文件,在58行后面加一句print(np.array(all_tokens[0]).dtype),看看数据类型是什么,如果不是int64, 可以把58行这句result = paddle.zeros((len(all_tokens), context_length), dtype='int64')里的数据类型给改成上面打印出的数据类型来保持一致

TIMESTICKING commented 2 years ago

C:\Users\Lee.paddlehub\modules\stable_diffusion\clip\clip\utils.py , 你要不打开一下这个文件,在58行后面加一句print(np.array(all_tokens[0]).dtype),看看数据类型是什么,如果不是int64, 可以把58行这句result = paddle.zeros((len(all_tokens), context_length), dtype='int64')里的数据类型给改成上面打印出的数据类型来保持一致

谢谢!问题解决了!