Text to image: running Stable diffusion on AMD GPU/Windows. Step by step guide

preview_player
Показать описание
Detailed guide on running stable diffusion on Windows with accelerations from AMD GPU.
👉ⓢⓤⓑⓢⓒⓡⓘⓑⓔ Thank you for watching! please consider to subscribe. thank you!
👉🏽Update: 3/21/23: due to Pytorch upgrade, if you have issues, please install 1.13 pytorch by:
Step by step guide to run Stable diffusion AI text to image on AMD GPU and Windows.

Affiliate links: buy on Amazon

Some download links are included below. (based on comments, also added detailed commands)
1:20 Install Git
3:13 Install Python (miniconda)
5:43 Conda virtual environment
conda create --name sd39new python=3.9 -y
conda activate sd39new
8:30 Install python packages.
** added. pytorch version 1.13.1
pip install diffusers==0.10.2
pip install transformers==4.25.1
pip install onnxruntime==1.13.1
pip install onnx==1.13.0
11:47 DirectML package install
20:08 Run the model to turn text into image!
run following in python console:
from diffusers import StableDiffusionOnnxPipeline
prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt).images[0]
27:30 final output (example)

Thank you for watching!
Рекомендации по теме
Комментарии
Автор

This worked, thanks, but it was tricky trying to copy the commands by reading them off the screen. You should post all of the commands used in the video in the description for ease of use for future viewers. Also, where do we go to learn more about what adjustments we can make during generation?

drtimv
Автор

First of all, great tutorial, very much appreciate it. I am a very novice user and struggled for a while with many errors and just want to share my advice on how I eventually had success. Use the Python 3.9 version of miniConda, I had initially tried 3.10 because I already had python 3.10.8 on my computer. I ended up uninstalling it all and just have miniConda 3.9 now. There are two steps that were not mentioned directly in the video but if your paying attention you can see in the notes. First I had to downgrade numpy to 1.23.0 as you end up getting 1.24.1 currently when following the directions, this was important for me. I used the command: pip3 install --upgrade numpy==1.23.0 when in the environment to achieve this, though I do not believe it is necessary to use pip3 specifically when in an environment. Second is to make sure you also: pip install accelerate. Other than that follow the steps very closely it will work. Get yourself notepad++ for saving the Python Scripts, as you see Tech-Practice doing. Watch the simple tricks video as well so you can make sure you've implemented those changes first go around.
These videos are a great help, I myself tried automatic1111 initially only to eventually realize I couldn't use it in Windows with an AMD GPU. I then tried installing Manjaro Linux and getting it to work there but as someone with no experience in Linux I couldn't accomplish much as any guides I could find expect you to have some Linux knowledge and there are no instructions that are detailed and slow enough to follow like these ones are. Keep up the great work, I'll be trying to follow the videos to make use of other models next.

TerenceThyr
Автор

amazing! it really worked! was struggling to find a working version for amd and this video made it really easy

Neo-wczg
Автор

So, firstly, thank you. I tried following a few other tutorials a few months ago and I ended up failing and/or getting lost at some point. With your tutorial, I actually got this working. I also followed your tutorial for updating to latest directml, and am using your webUI as well.

I have a 5800X + 4x8GB 3866MHz + PowerColor Liquid Devil 6800 XT and I'm getting 2.83it/s and 17-18 seconds per image. Performance seems OK, I think?

Guess I'll move on to your alternate models tutorial and trying that next.

KTHR
Автор

1:25 my dude turned into a cyborg ahahah

styliejoker
Автор

Hi, im at the last step and it gives me this error when i try to generate the image: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Unexpected input data type. Actual: (tensor(double)), expected: (tensor(float))" Do you know how to fix this?

zilda
Автор

dear @Tech-Practice
thanks for the tutorial. I am having problems and I suppose it is due to some step that I am missing. When I get to the part of converting the model to onnx it gives me a path error, and there I realize that there is no source model to convert. Is there a previous video to follow before applying the steps detailed in this video? Thanks in advance for your answer

BarZodiacoRosario
Автор

I got this message error:
ERROR: Could not find a version that satisfies the requirement deffusers (from versions: none)
ERROR: No matching distribution found for deffusers

alanluna
Автор

hey i did everything completly like u but its using my CPU instead of my GPU.
how can i let it use my GPU?

PATnKAYch
Автор

hi @Tech-Practice, very nice guide, I appreciate it very much, I wanted to use this application but with amd gpu I couldn't find how to make it work. I had an error at minute 19:48 "ModuleNotFoundError: No module named 'torch'", I was able to solve it with "pip install torchvision", greetings and I will continue with the other videos to be able to use it well.

rulocez
Автор

I'm having trouble getting it to run, even with your UI. Get this when running the image command

image = pipe(prompt).images[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\\.conda\envs\sd39new\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_onnx_stable_diffusion.py", line 250, in __call__
latents = latents *
File "C:\Users\\.conda\envs\sd39new\lib\site-packages\numpy\__init__.py", line 284, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'float'

Cewelowic
Автор

From 18:35 to 20:08, can you please explain what the Output Path is and why there are 2 folders, 1 called 'stable_diffusion-onnx' and 1 called

Cyanoh
Автор

HELP! I've gotten all the way to 12:00 but I can't figure out how to find the directml 3.9 install link - all I could locate is the 3.8 and now I'm dead in the water...I assume it won't work without the 3.9, am I right? Also, while navigating, you really should take into consideration that some people like me are damn near computer illiterate and maybe try to slow down a bit so they don't have to go back 100 times to figure out what what you're clicking and where you're going...so frustrating...can you please provide *step by step* instructions on exactly where I need to go to find the 3.9 directml public package? I am very, very slow with computer navigation...thank you.

robertcronin
Автор

when will they create a u.i interface for amd?

Smarglenargle
Автор

I recieved the following error when trying to run my prompt:

Traceback (most recent call last):

File "<stdin>", line 1, in <module>
NameError: name 'pipe' is not defined

Any help would be greatly appreciated as I'm out of my depth with this.

michaelc
Автор

Is there a way to convert a ckpt model downloaded from somewhere else? I'd love to use some of CivitAi models, but when trying to convert locally it gives errors and requires the model's json... Thanks so much for doing this tutorial! Watched your GUI tutorial too! Instant sub!

ArchangelAries
Автор

I got stuck at the whl file :( It's asking me which app I would like to open te file in :(

SpacenSpooks
Автор

doesn't work for me - had python installed before, uninstalled it, installed conda, and when i open conda, it closes itself after half a second
i guess its back to cpu for me

YetAnotherYoutuber
Автор

Help. when doing the DirectML package install, I get the error "not a supported wheel on this platform". Im running Win10 with AMD CPU & GPU. Please advice.

VergilSlade
Автор

Wow! amazing video! so descriptive and easy to follow! Just 1 question though, version 2 of stable diffusion just came out, is it possible to install that version yet? and if so, would love another video on it! i think the option to generate images in 768x768 (which v2 now locally supports) as well as the inbuilt upscaler would really help a lot of people. Thanks again for your amazing vid

elliotpascoe
welcome to shbcf.ru