Run Stable Diffusion with GPUs for cheap on vast.ai

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this video I'm going to show you my setup to create stable diffusion uh web UI in the cloud in a GPU instance on the cloud and to easily access that locally in your computer without any lags and without paying a hundred dollars okay let's go so the tool we need to use are the website we need to use is vast.ai vas.ai is a Marketplace for gpus where you can run gpus in the hour in the minute is really cheap compared to Cloud providers like Amazon okay and a good GPU that you can use for stable division web UI stable division let's go to stable division first table division this is the UI you need to use if you want to run image to image models uh text to image models and all the things with Laura with control net this is where I need to use and you will need to download some model I have some scripts that I can share to you after that where you can also download specific model without doing too many manual steps okay so first you need an instance to an uh vas.i if you don't have a GPU locally this is a good GPU for gamers you should know this GPU I think okay and it cost 20 cents an hour it says they are saying 25 cents but the market rate is more around 18 or 70 cents an hour after you create an account let's try to create an instance with this GPU here I go into console if you go after getting an account you should add some credits and after adding some credits the number of instances should be zeros it should be blank here so what you need to do is to create an instance you click on create and if you want to run stable diffusion you need to edit the image config and you need to specify a Docker container containing stable diffusion for our purposes I'm using stable diffusion web UI automatic 8.0.1 okay and you select this one okay after you select this one you specify the number of gigabytes you need to when you create an instance if you want to experiment with all the model you will need more gigabyte if you just have a specific workflow in mind you can specify the number of gigabytes here and you can try to minimize the cost because of course we are paying for the storage at the hour so it would be one sense an hour for one gigabyte don't forget to kill the the instance if you want to minimize the price okay and okay so you specify the number of gigabytes I've also a filter called uh yeah you can go crazy on the filters but okay uh GPU Ram I like to have gpus with more than 15 gigabytes of RAM because I know it's really rare that to model needs more than 15 gigabytes of RAM 1516 and I just want to be comfortable and run any workflow I want so I am using a 16 gigabytes okay when you filter that this is a type of gpus you have but here it's like 36 dollar cents an hour it's still expensive you can go and filter by price is this AutoZone mechanism is not great I don't understand uh how it works but I know that when the price is cheaper I understand okay and no it's more around 15 cents an hour and know what you need to do what you need to do is there is a few things first there is interruptible and On Demand if you just want to try something for like one hour you can just use interruptible and you will have the instance and until someone will outbeat you and try to use it and steal your instance because they have a better price so there is two ways you see like it's here it's like one cent so now it's almost free so if you just want to try something for like 10 minutes you you use interruptible if you are here from few hours on demand so you will not be interrupted by someone but look interruptible it's like almost cheap so cheap but it can be removed in any in any time but usually usually interoperable will will be on for a few hours no worries okay but let's let's say that it does not exist and we use on demand then you see the price 15 cents an hour then first if you don't want any lags or if you want to minimize lag and there is instances at the same price you need to look into the area here it's Quebec are you close to Quebec yes no uh here is fuku Fukushima Fukushima Japan okay uh and are you close to Fukushima if you are yes you rent it um I know it might be stored it no it's not filtered by your IP okay so let's say I want to select the one from no I don't like this a 4000 I'm not comfortable with this one I'm more comfortable with the one I was showing in the beginning which is 30 90. you want to select this one then there's a few things you need to check uh usually you don't care about the CPUs just check this is like not uh really bad Jeep CPU but normally there is no issues with CPUs then you need to look at the download and upload upload usually you don't upload too much maybe maybe if you are training in the instance you need to upload but here we are mostly going to create images and uploading images it's really fast and the download speed you don't want to wait too many times to download like five or ten minutes or 10 models I think we are in a good shape here for this one the price is okay reliability is okay usually more than 95 percent is okay for me 99.75 percent is okay and you need to check what do you need to check yeah I think that's pretty much it yeah 32 cars okay you need to check uh yeah I think I think there is nothing else to check okay then you click on rent oh yeah you need to check the price there is two two ways to set the price is increasing that's the best runner the price of the instance and then there is a perchica byte uh so you here we are paying two sensors gigabytes this is expensive maybe this one is less expensive or this one yeah this one is like Alpha cents per gigabyte okay and there is also the internet price here it's like three cents every time you don't know the model maybe it's expensive and this one is like 10 cents or one cents one cents some instances this is zero let's see if I found a zero here no whoa okay you got the ID let's use this one I click on runs requesting punching and when you are wrenching if depending of if someone or has already tried to create the stable diffusion web UI automatic project in this instance it will be you can already click on open otherwise you will need to wait and GC should not take long because you will need to download the code and do some pip install and all this stuff in Python and it can take between two minutes and 10 minutes and you just need to wait maybe I'm not sure you are paying while you are waiting but good to know okay but just for the demo I'm going to use a previously defined instance and okay oh we will see it's really fast connecting connection no it's not working yet okay let's say let's use this one you have open Button the open Button will open the UI directly which is what you want White nope not directly uh what's going on okay loading and this is a UI and something to create and you can already generate images like this yep something to create okay image of a foreign cyborg and something like that okay something fun and it will use my GPU as you can see here this is the ram that is being used 14 okay I have really big GPU and okay and this is the image I want and then I'm not going to do a tutorial but I can do another tutorial about this UI but this is my image and this is working fine okay and as you can see I have multiple models here okay no let's talk about the model after no maybe you say okay great I can go into the web UI but I want to modify the code inside the instance how can you do that you have this button called SSH connect with SSH first you need to configure the SSH so you have a profile you have an account here and you can specify your SSH public key and you have some tutorials in order to know how to create a SSH key but when you create a SSH key it will be presenting you folder like this and you can do cut ignsa.bab this is my public key dot Pub for public and you copy that and you just paste that in here which is exactly the same you said the SSH key after you set the SSH key uh you can go into your instance and you can click on connect with SSH here and you have the direct SSH connection here you copied you paste and you are inside the instance okay and just to know where the code lives you need to be inside the workspace stable diffusion web UI and this is where the code is leaving for catching for interacting with the UI or adding models or adding Styles stuff like that okay you can SSH you can do everything you want you can easily stop the instance by doing that there's also this feature where you can this feature is nice is wait close okay I'm just going to explain this feature yes so this feature if you create a new instance let's say the first instance is doing something or it's not available because it's not available anymore and you just want to copy the workspace from instance a to instance B you can use this tool and it will copy things in this folder to the folder of this other instance okay and you have also another feature which is nice which is you can interact with the cloud so for me for example I have black bass or Amazon so I have a black based personal and let's use Amazon S3 so you can upload everything into a SV bucket everything that you have been doing or you can download everything from the SV bucket to this instance you can do that I'm not doing that for this tutorial but uh you can do that if you want to okay and um the thing is when every time you create a new project you will not have all the models here and you will not have for example control Nets you will have a limited number of models in your control net here I have two models let's see yeah if I open so this is a previous instance that is configured for my workflow and see the instance we are trying to configure the new one and I want I want to I just want to show you that the number of model is really limited when you first clone the instance you only have one model and you only have one control net and you want more than one control net depending of the workflow you are trying to reproduce or you are trying to try and downloading models is it's doable but it takes time and it's better to have one script doing everything and this is an example of script that is able to download multiple models in one time it will be present in the link of the video what you can do is you can copy the entire script and this cable will download all the model I need for a specific workflow as defined here you can also Define the models like this you just need a name and a URL to download the model um okay cat workflow I copy everything I go I don't know let's say you are here you create a file V create create workflow dot pi you copy everything hmm I cannot copy what okay this is theme I don't remember them sometimes okay and then I can call create and it will download all my model I think the models are have already been downloaded so that's why this is keeping oh this is keeping because oh this is not the correct one so the correct one is this one okay let's do it again so remove create workflow let's do that on the new instance not containing the model otherwise you will not see the changes and if I want to connect to the new instance I do that SSH here okay this is the new SSH command a new instance the first time USA some stuff from do you authorize this milk tea here or yeah yes okay uh okay and no you want to create this create workflow dot pi and you want to um copy the code here okay this is one way I will show you another way for doing that because some maybe you don't want the terminal you don't want to use the terminal for doing that I know you can create your model K2 offloaded by it will download uh delivery and V2 and other models afterwards and the speed is quite fast right 80 megabytes per second okay and what else yes you can download model but here you see maybe you don't like the terminal and you prefer vs code and vs code as a feature like remote Explorer and what you can do is you can do you can SSH so here here is my my command for this document I I did oh no I've I lost my command this is a command for SSH what you do is you go into the remote Explorer I think there is a remote Explorer Library you need to install if you want to modify things on yes you need to install that then you have access to remote Explorer and you can have a vs code session connected to the instance and then it is as if you are working locally okay so you create you click on plus here you paste your command you click enter it specifies config refresh and you should have a new here a new SSH URL and you click here connecting current window or connecting your window let's do a window and it will try to get to SSH connection and it should work and let's see okay SSH connection okay and here what you want to do is you connect you can open the folder containing the workspace the path is workspace it's a bit to use slash workspace work base slash stable diffusion web UI and then you click on okay and then you have access to chat text type because when you open a folder you do a new message connection maybe okay and this is the folder where you can do you can see the code base and you can see for example if I see is it in this instance where I was creating the no let's do that on on the new on the new instance because here you can find the this one you can find the outputs normally uh let's try find the outputs outputs no no there's no outputs okay I have it yeah outputs and the image here is present here also if you want so you can also interact with the files you are catching from here and you can copy them yeah okay because sometimes you are generating something new and you want to have access to the previous things and the best way to do that is to go here okay grades SSH connection makes sense or the new models are present in this new instance normally if I refresh that V2 which was not present before so I can select delivered V2 and generate the polar bear with this better model okay I have a different seed so it's different one and you need to check um if you want to find models you need to browse around this and and find the model what I did let's say I want to Edge slider I click here um then you copy you click on copy link address and then you need to know where to save the model so this is a textual inversion so you need to save that inside the specific folder and you can directly download that somewhere in your models actually okay great I think that's it for the demo of vas.ai you can create an account I am not let's remove the so after you are done with your artwork because yes this is Art somehow you can close shutdown so you can either stop your instance if you know you are going back like let's say tomorrow you are working every day or after work and you want to do some art to just stop the instance and then you start the instance when you're back and if you don't want to use instance for a few weeks you can just destroy it and don't pay for the storage because you are still paying for storage even after you this you stop but if you destroy you destroy you are paying for nothing and I'm also going to stop this one no I will keep it on I will do some Arts okay thanks for watching and have a good one
Info
Channel: Simon Moisselin
Views: 7,850
Rating: undefined out of 5
Keywords:
Id: NvG1gnauJGQ
Channel Id: undefined
Length: 21min 22sec (1282 seconds)
Published: Sun Jun 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.