AMD GPU's are screaming fast at stable diffusion! How to install Automatic1111 on windows with AMD

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there fellow home labers and Engineers Fe engineer here if you're like me you may have uh taken a look and seen AI news over I don't know the past year and if you're also like me you may just not be willing to spend the money for Team Green yes those Nvidia graphics cards are amazing but they're prices are also pretty absurd and if you wanted to get a high-powered graphics card with a lot of vram with the idea of I'm going to do some AI work you may have also run into things online saying effectively if you do not have an Nvidia GPU you really can't do anything with AI and I'm here to tell you that is simply not the case we can in fact get stable diffusion up and running on AMD not only that yes I do have a 7900 XTX it is effectively one of the top-of-the-line AMD graphics cards currently out but I can get 20 22 23 24 iterations per second generating a 512 by 512 image in stable diffusion So today we're going to go through how to set up stable diffusion as of November 4th 2023 how to get it running on your AMD how to optimize it so that it is getting as many iterations per second as possible and I'm going to try to go over some of the potential problems you may face with that let's get into it if you wanted to get an idea of some of the images that you can generate with stable diffusion and with your AI on an AMD GPU I'm now going to Showcase a whole bunch of random images that I've created just over the past day these images can be used for anything that you want you can try and sell them on Etsy you can create children's books with them there's an awful lot of power and possibilities that you can do using stable diffusion and running AI to generate your own images the very first step to installing stable diffusion is not what you would think go over to AMD adrenaline Edition check for updates and make sure that you have the most upto-date driver AMD and Microsoft are putting significant amounts of energy and resources into competing with Nvidia on the AI stage and so with that these driver updates not every single one but frequently in the patch logs and update notes you will see something regarding AI they are working on it all the time and so with that having the most up-to-date driver will help to get the best performance out of your AMD graphics card when ites comes to running anything AI make sure that your driver is up to date the next thing when it comes to running Ai and stable diffusion on your AMD GPU there is an excellent article by AMD and it is effectively how to run an optimized version of automatic 1111 stable diffusion web UI on AMD gpus I'm not going to read this entire AR article but effectively it is talking about using Microsoft Olive with automatic 1111 and using that in order to get massive performance increases on AMD gpus and while you may look at this article the very first thing it tells you is install get for Windows and install miniconda for Windows when you install miniconda in ensure that the directory is added to path that is going to be one of the biggest pieces that people miss and make mistakes about make sure that you check the box to add the directory to path section number three generate and run all of optimized stable diffusion models with automatic 11-11 web UI on AMD gpus this is effectively what we're going to follow and then after this I'm going to teach you how to get around the problems that still end up happening if you follow along in the steps of what it says to do I have opened up an anaconda prompt this is using miniconda you can typically find it by typing into the search bar under windows or clicking on your Windows button and finding it that way way step number one it says to run the command cond create-- name and it says to use automatic 1111 Olive I'm just going to put SD for stable diffusion uncore Olive and then python equals 3.1.6 go ahead and hit enter it it's going to start collecting the packages and figuring out what all it needs and after that it's going to run the installer once cond has installed everything that it needs it will effectively tell you that in order to use it you need to pass the command cond activate sdore Olive so we'll run that so cond activate sdore Olive you will see on the left hand side we are now in the SD Olive environment the reason why you use this Anaconda is that effectively this creates a small virtual machine inside of your machine so you can set up an environment and then when you break things because you will you can effectively destroy it all very easily by simply destroying the entire environment and you don't necessarily run the risk of having stuff broken to a state where you cannot get it back if something absolutely terrible happens and you just cannot get it to work destroy the entire environment and restart when you run Anaconda it will typically put you inside of your username directory so you will be in something like C drive users back slash your username or your computer name for this I am actually going to make a directory stable diffusion test I'm going to CD into stable diffusion test so now I'm inside of that and then I'm going to continue following along with what the the guide says to do I'm going to run this get clone command this is why we installed get for Windows I'm simply going to get clone this entire piece this repository gets updated almost daily so I will tell you that chances are whenever you view this video it may look and act slightly differently hopefully it will be better and not worse so we've cloned that repository let's CD into it CD stable go into that and then it tells us to run get submodule update D- init D- recursive go ahead and run that that only takes a second or two and then what I have found is that this tends to be broken it says to run web UI dobat --nx d-bend direct ML and then you'll see that it's creating a virtual environment in inside of this folder it will go and run a bunch of installs so we'll be back as soon as this is done at the time of this recording every single time where I do this and try to install this from scratch I always end up getting this error and it says got an unexpected keyword argument socket options press any key to continue so let's press the any key and you will see that it just boots you straight out so let's go ahead and fix this the error regarding socket options is a known error and there is a fix that is coming for it but if you do run into it I will have code that you can paste in that should just fix it for you it's only two lines of code and effectively if you're using this Anaconda prompt it should should work for you and once you use that fix you should be able to use the web UI dobat Onyx backend directml hit enter for that it should pop up with something saying running on local URL and this local URL you can control click and it will open up a window but effectively what it will do is it will open up something like this and this is the automatic 1111 web user interface you'll notice we don't have any checkpoint files we don't have any stable diffusion models and in order to generate any image with stable diffusion you will need to get a model I'm going to go over some of the models that I really like as well as how to install them from start to finish not every model on hugging face will work not every single model will end up optimizing correctly with olive so I'm going to go over a few of the ones that I tend to like one of my favorite models is dream shaper I find that a lot of the images that I created I used dream shaper for and this model just seems to work really nicely for generating images of people so with that what we are going to do is we are going to copy the model name to our clipboard we are going to go over to stable diffusion go to the onnx tab and just paste and then hit the download button any of these models are usually two or three up to five six seven gigabytes so you are going to need to be a bit patient when it comes to downloading them as well as being a bit patient when it comes to you don't necessarily want to go and try to grab 50 models at a time once it finishes downloading I believe I already had it in my cache which is why it went so quickly you will see model saved and it got saved to this on nx- Olive dream shaper uh folder so what we are going to do now is we are going to actually optimize it if you don't try to optimize it and you click this reload button and you see dream shaper and you type in something into here hit generate you will very potentially get an error like this and it says on nx- Olive dream shaper text encoder model. NX failed load model dream shaper text encoder model. nnx failed file doesn't exist and you're going to very quickly say okay I don't know what that means what we're going to do is we're going to click over to the olive tab we are going to click on optimize o NX model we are going to again paste in that Lyon sdream shaper inside of here we are going to paste it again twice and then what we're going to do is remove the Lyon slash go ahead and remove that and then this is not a stable diffusion XEL model this is a normal stable diffusion model and so then we will just leave everything as it already sits and click the optimize model using olive when you click that you will see things start running in the background this will very potentially take quite a while you will see a lot of things that look like errors just go ahead let it continue while this is actually optimizing you may be confused in wondering gee is it done gee I don't know what's going on nothing is popping up and nothing is changing nothing says it's finished one of the keys is looking down here these two orange little blocks will spin around if those orange blocks are up there spinning it means it is in fact working it is doing stuff so just because nothing comes up on the screen be patient go get up get yourself a drink smoke a cigarette go get your mail play with your children do anything other than interrupt it do not cancel out while this is happening otherwise you have to sit here and do it all over again also if you do not have children feel free to go and try and make children while this is happening because let's be honest you have time after that is finished you will see something similar to the bottom to the following on the bottom optimization complete time taken 5 minutes and 10 seconds I told you it wasn't very fast and my computer honestly is effectively brand new and is about as high of a uh processing machine as you can get and so for it to take 5 minutes and 10 seconds it will very likely take you something similar if not longer so now that optimization is complete let's go back to where we had this before we're going to reload we're going to do dream shaper optimized click the generate button and you should see something like this a progress bar come across and you'll see we're hitting 21 iterations per second and the photo that it generated looks pretty good it's pretty similar to what we asked for it in fact does have a country Hillside Rolling Hills green grass water flowers and overall it has some really nice lighting properties to it of Shadows and things like that I hope this has helped folks get up and running with stable diffusion on AMD gpus you can get screaming fast performance out of your AMD gpus be sure to check out my channel more as I have a couple other videos coming out that we'll go over effectively how to find and fix some of the problems if you end up having any problems while running automatic 11-11 as well as some tips and tricks for how to get the most out of it with that again thank you very much thank you so much for watching my videos hbers and Engineers I create and edit all these videos on my own so any likes and subscribes will massively help out the channel and allow me to continue creating content to help people if you got value out of this please consider liking and subscribing to the channel to be notified when new content drops if there's something I've not covered but you would like to see a video on it please leave a comment down below and again a massive thank you to everyone I hope you have a great day
Info
Channel: FE-Engineer
Views: 16,873
Rating: undefined out of 5
Keywords: AI, AMD, GPU, Stable Diffusion, AI Image Generation, Windows 11, Windows 10, DirectML, Microsoft Olive, ONNX
Id: Db0HuRY2p84
Channel Id: undefined
Length: 17min 45sec (1065 seconds)
Published: Sat Nov 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.