Install XFormers in one click and run Stable Diffusion at least 1.5x faster

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so there's some really good news it turns out that if you have the right kind of GPU and the right kind of web UI then installing exformers is like change one line of code and then sit back and let the computer do everything and just recently I made a whole video where you have to go through all these steps and do all this nonsense and backflip here and backflip there in order to get it working so the fact that it's possible with just one change in the code is just like that's really nice okay so we're going to go through that process from scratch I uninstalled everything uninstalled the web UI I uninstalled python we hear Ground Zero nothing and we're going to get X form is working and it's going to be easy this time step one before you even start this you have to work out if you have the right GPU okay so on the guide it says you have to have a pascal Turing or ampere card to do the easy install if you don't have one of those gpus then you'll have to do it the long way I made a video for that if you want to see it um but how do we check this how do we know if that's what our GPU is well Pascal Turing and ampere they refer to what are called micro architectures which basically as Nvidia the company has like progressed through the years it's set up gpus in different ways and every few years it changes the way that it sets up gpus and that's considered a new micro architecture and they're not they're like not fully compatible with each other okay so how do you know what the micro architecture of your GPU is I found that this website was the best this article by this gentleman here and he just puts a summary of which gpus have which micro architectures basically if you have a 1000 series a 2000 series or a 3000 Series you're fine you can use it with the with the fast method so that's like really good now when I read the article I was like okay hang on hold up a sec can we trust this guy can we trust candy Tech I don't know but uh in the links they Source this database as the place where they got the information and this database from tech power up looks like pretty official and pretty good and if you really want to be really thorough for some reason you can also look up your GPU here my recommendation is just go to the architecture filter which it's called architecture here but technically they're talking about a micro architecture for the Nerds out there um and then you find the architecture that you suspect yours is like let's say you know I suspect I suspect I'm a 2000 Series so I'm like oh I suspect my architecture is um it's probably what did he say it's a probably Turing so if I'm touring here and then I can see if my GPU is listed here let's have a look so I'll go Ctrl alt delete task manager and I'll go to Performance I'll find my GPU RTX 270 is super okay so I'll just search that control F wow [Music] I'm not typing well today okay so look it looks like my GPU is right here and it's a turing so like that's good that's good news for me that means I can do the fast way again if your GPU is not one of these fancy ones then you're fresh out of luck you'll have to do the hard way which I went through before which is not actually too terrible um and by the way if you want to learn a bit more about micro architectures for God knows what reason I've Linked In the description some of the resources that I use to get a bit more information before starting this video okay now we can actually start installing things because we know we have the right GPU so first thing we're going to install this web UI we go code we go download zip and that's really fast we open it we extract all and we extract it to our C drive directly into our C drive this is because in the past I've had issues with paths being too long during the exformers install process now I don't know if that's still an issue maybe when you do the quick install that won't be an issue anymore but I don't want to take risks so I'm just going to put it in C and there's no downside to putting the web UI in C there's no real issue here so here's the web UI and I'm just going to rename it to just web UI because you know we're not taking any chances with path lengths here okay great so now we know path links are not going to be an issue I'm going to go grab my model my stable diffusion model I really happen to have it in documents SD models here's my model uh cut actually I'll just copy it because I might need this later copy see web UI and you put it in the model's stable diffusion here and it has to be called Model Dot ckpt this is the this is stable diffusion 1.4 by the way if you go to the website it actually shows you where you can download that now if you're not like me and you don't happen to have that model just lying around go to this dependencies link on the uh the main readme of the GitHub and there are some places where you can go to download that file you might have to sign up for a hugging face account and make it make an account and accept some licenses but that's what you go to down with the model just remember for the love of God to rename it to model Dot ckpt and put it inside the models directory right here next to this file so we've installed the web UI we've added the model to the correct directory that's all looking good now what we're going to do is we're going to make a small edit to allow exformers to work okay so the next what we're going to do is we're going to do a small edit we're going to open this file called launch.pi we're going to open it with just like a regular text editor we're just going to open it with Notepad okay and everything is going to look a little bit scary but don't worry too much just Ctrl f for command line like this find next here we go and then you'll find this line that says command line args equals blah blah blah and we're just going to add a new command line Arc here Dash Dax dash dash dash X formats and now great nice we'll save it and we know it's saved because the little star went away there but you know what just because we're careful with cautious people we're going to try that again and we're gonna again search command line five next and yep so this that change definitely got got in there and here it is great and that's basically all we need to do the last thing I'm going to do now is I'm just going to double click on this web UI dot bat and I'm gonna more info run anyway okay and we've run into this issue because I uninstalled python before we run into this issue where it's telling us that it couldn't launch python because of course we have we have no python on our computer right now so I'm just going to install python really quick this will be in the description so don't stress download python 3.10 um we're going to download the 64-bit installer because we have a 64-bit computer you almost certainly do as well but if you want to check you can go to system information and then it'll be here under the system type uh easy already downloaded always say this add python 3.10 to your path and then install now and again really fast process love installing python I've just been installing uninstalling python like every day basically I'm probably I'm probably considered a bot by their servers okay start off with successful beautiful okay so this time with a little bit of luck we won't get an error and okay nice it looks good it looks like what's happening is that we're installing torch and torch vision um which means that at least the computer has picked up the python two other things you need installed here are git and the right version of Cuda so if I open up command prompt and I type where git it'll show me that there's a git installed somewhere on my computer if you don't have that then all you have to go is just find this website here which I'll link click download for Windows and you're good to go the other thing I have installed is Cuda version 11.3 now other versions of Cuda are fine as well I've had someone in the YouTube comments say that Cuda 11.7 worked for X form is for them I had someone else say Cuda 11.8 was fine now we want to check our Cuda versions so open up command prompt again and we just type in this thing here NCC dash dash version and that'll give us information about our Nvidia stuff and we'll hit what we have here is Cuda 11.3 so like good stuff if you don't have any version of Kuda installed if you type in nvcc and you get some sort of weird error then you'll have to install Cuda luckily this isn't even that difficult either you go to Cuda 11.3 install or you know perhaps you want to go with if you can do a later version of Cuda you should so I'm choosing 11.3 maybe if you can do 11.8 you should try 11.8 where installing Cuda is concerned my advice would be to go to this link which is of course down there in the description and as long as your windows is like a reasonably new not crazy old windows then you just want to go through this process Windows architecture X ad664 which again system information because it says this that means that that's almost certainly appropriate for me um and then the version of Windows which is 10 and then do the XE and then download it and then just follow it along I'm going to cancel the download because it's huge and then just follow the wizard and you'll be able to install uh codon I would recommend doing 11.8 because that's the newest one it's going to give you the least grief okay so it looks like it looks like it's worked and we can tell that the exformers thing that we did also work because here it says launching web UI with arguments X formers so at least our exformers thing looks like it's worked so now we'll just go to this URL here localhost uh 80.6 and now we're going to just generate an image and we'll see how we go and judging by the speed at which that's working I'm pretty damn certain that X formers is working another thing that I'm going to do to confirm that xformas is working is I'm going to open up the command prompt I'm going to go nvidia.smi which is prints out basically your GPU usage stats so it's like okay we're using 3.6 gigabytes of GPU right now I'm going to keep that handy and then I'm going to you know I'm gonna do like a batch size of of five which would crash my computer if it wasn't using X formers and then I'm just going to generate I don't know like another another three images and while that's going on we're going to check out nvidia.smi and telling us that we're only using four gigabytes despite that huge batch size so if we weren't using X formers we'll be using something like seven gigabytes instead of four so this is like pretty definitive proof that we are using X formism there you have it that whole process took me slightly over half an hour maybe if you have to install git and Cuda as well it'll take you a tiny bit longer but that was really quick and that was really easy if you look at my last tutorial and if you try to follow along all those processes you'll understand what a big win this is so you know huge thanks to the guys at stable diffusion web UI for just like hammering out those changes and making our lives so much easier if you have any questions uh Chuck them in the YouTube comments so there's also a Discord you can ask technical questions of and big thanks to all the people who are harassing me in the YouTube comments last time to show everyone the easy version because otherwise I wouldn't have known about the easy version so all the abuse it's it's good keep it up
Info
Channel: koiboi
Views: 113,289
Rating: undefined out of 5
Keywords:
Id: ZVqalCax6MA
Channel Id: undefined
Length: 13min 27sec (807 seconds)
Published: Sat Oct 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.