stablediffusion-infinity icon indicating copy to clipboard operation
stablediffusion-infinity copied to clipboard

[Feature Request] Include the Onnx Pipeline using DirectML as an option

Open averad opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Issues with running on AMD Cards in Windows OS

Describe the solution you'd like As of Diffusers 0.6.0 the Diffusers Onnx Pipeline Supports Txt2Img, Img2Img and Inpainting for AMD cards using DirectML Would it be possible to include the Onnx Pipeline using DirectML as an option in SD-Infinity now that Img2Img and Inpainting are working?

Process to get Onnx Pipeline working

pip install diffusers
pip install transformers
pip install onnxruntime
pip install onnx
pip install torch
pip install onnxruntime-directml
git clone https://huggingface.co/runwayml/stable-diffusion-v1-5 --branch onnx --single-branch stable_diffusion_onnx
git clone https://huggingface.co/runwayml/stable-diffusion-inpainting --branch onnx --single-branch stable_diffusion_onnx_inpainting

Example Txt2Img

from diffusers import OnnxStableDiffusionPipeline
height=512
width=512
num_inference_steps=50
guidance_scale=7.5
prompt = "a photo of an astronaut riding a horse on mars"
negative_prompt="bad hands, blurry"
pipe = OnnxStableDiffusionPipeline.from_pretrained("./stable_diffusion_onnx", provider="DmlExecutionProvider")
mage = pipe(prompt, height, width, num_inference_steps, guidance_scale, negative_prompt).images[0] 
image.save("astronaut_rides_horse.png")

Describe alternatives you've considered

Additional context https://gist.github.com/averad/256c507baa3dcc9464203dc14610d674

averad avatar Oct 25 '22 00:10 averad