diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Stable Diffusion ONNX requires cpu `onnxruntime` even if CUDA version is installed

Open Vijayabhaskar96 opened this issue 2 years ago • 6 comments

Describe the bug

The ONNX support doesn't work with CUDAExecutionProvider I installed onnxruntime-gpu Running import onnxruntime as ort ort.get_device() results GPU and ort.get_available_providers() results ['CPUExecutionProvider', 'TensorrtExecutionProvider', 'CUDAExecutionProvider'] but diffusers complains onnxruntime not installed and wants me to install the cpu version(pip install onnxruntime).

Reproduction

Install pip install onnxruntime-gpu

and run

from diffusers import StableDiffusionOnnxPipeline

pipe = StableDiffusionOnnxPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    revision="onnx",
    provider="CUDAExecutionProvider",
    use_auth_token=true,
)

Logs

No response

System Info

  • diffusers version: 0.3.0
  • Platform: Linux-5.10.133+-x86_64-with-Ubuntu-18.04-bionic
  • Python version: 3.7.13
  • PyTorch version (GPU?): 1.12.1+cu113 (True)
  • Huggingface_hub version: 0.9.1
  • Transformers version: 4.21.3
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Vijayabhaskar96 avatar Sep 10 '22 07:09 Vijayabhaskar96

Works for me. Could you please paste the exact error messages you get when you run the example? Thanks!

pcuenca avatar Sep 10 '22 20:09 pcuenca

Here is the Colab Notebook. replicating the error.

Vijayabhaskar96 avatar Sep 11 '22 13:09 Vijayabhaskar96

This is my PR trying to fix this issues: #440

SkyTNT avatar Sep 11 '22 14:09 SkyTNT

Oh, I see, I didn't understand it initially; it works for me because I have both packages installed.

Thanks @Vijayabhaskar96 and @SkyTNT, what do you think @anton-l ?

pcuenca avatar Sep 12 '22 21:09 pcuenca

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Oct 10 '22 15:10 github-actions[bot]

@anton-l is this solved now?

patrickvonplaten avatar Oct 11 '22 17:10 patrickvonplaten

Fixed in https://github.com/huggingface/diffusers/pull/440 :+1:

anton-l avatar Oct 12 '22 10:10 anton-l

Thanks!

patrickvonplaten avatar Oct 14 '22 17:10 patrickvonplaten