diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

[ONNX] Long prompt weight community pipeline rasies error when using LMS discrete scheduler

Open azuritecoin opened this issue 3 years ago • 0 comments

Describe the bug

When using ONNX with the custom pipeline lpw_stable_diffusion_onnx it raises a "unsupported operand" error. It's the same error as this other bug #967

Reproduction

from diffusers import OnnxStableDiffusionPipeline, DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler

model_path = "model/stable_diffusion_onnx"
scheduler = LMSDiscreteScheduler.from_pretrained(model_path, subfolder="scheduler")

pipe = OnnxStableDiffusionPipeline.from_pretrained(
    model_path, scheduler=scheduler, custom_pipeline="lpw_stable_diffusion_onnx")

images = pipe(
    "an astronaut riding a horse on Mars", height=512, width=512, num_inference_steps=25, guidance_scale=7.5).images

images[0].save("output.png")

Logs

D:\test_stable_diff\virtualenv\lib\site-packages\huggingface_hub\file_download.py:588: FutureWarning: `cached_download` is the legacy way to download files from the HF hub, please consider upgrading to `hf_hub_download`
  warnings.warn(
Traceback (most recent call last):
  File "D:\test_stable_diff\lpw_onnx.py", line 16, in <module>
    images = pipe(
  File "D:\test_stable_diff\virtualenv\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\sam/.cache\huggingface\modules\diffusers_modules\git\lpw_stable_diffusion_onnx.py", line 617, in __call__
    latents = latents * self.scheduler.init_noise_sigma
TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'Tensor'

System Info

  • diffusers version: 0.8.0.dev0
  • Platform: Windows-10-10.0.19044-SP0
  • Python version: 3.10.8
  • PyTorch version (GPU?): 1.13.0+cpu (False)
  • Huggingface_hub version: 0.10.1
  • Transformers version: 4.24.0
  • Using GPU in script?: no
  • Using distributed or parallel set-up in script?: no

azuritecoin avatar Nov 21 '22 23:11 azuritecoin