Setup Custom ComfyUI Server on Cloud VM (GCP) from Scratch: Step-by-Step Guide 2024

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to my video tutorial where we will dive into creating our own custom confy UI server on Google Cloud platform for quite some time I have been eager to explore stable diffusion for a personal project of mine however I'm working on an Arm based M1 Mac and while it is possible to generate images the lack of GPU support makes the process agonizingly slow and killing all the fun of the learning let's do a quick comparation to illustrate the difference between using a custom server and using a non GPU local machine on the left you're looking at my local setup on my M1 Pro with 16 GB of RAM and on the right you can see my confy VM server powered by an Nvidia T4 GPU let's kick off the image generation process on both as you can see the Mac struggles while the server breezes through the task and now now let's try with sdxl and 1024 images as you can see when we run comp UI on our server it takes only 1 minute to finish an sdxl image but if we try the same scenario with our local M1 Puro it takes approximately 55 minutes to finish and generate one image so disparity grows on Mac with the complexity of workflow and it is painfully slow uh I remember experimenting with control Nets and once I had to wait almost like 2 hours so it is not feasible you can't really learn stable diffusion with such slow setup but confi server it is impressing fast it can handle even the most demanding workflows with ease and financially it it's quite efficient too if you run it about 4 hours a day uh it will cost roughly $40 a month plus it's fully customizable it won't drain your laptop's battery it downlands models without hugging your internet and it is remarkably straightforward to manage it let me show it to you so let's say we want to shut down the Sur we'll open the it term and then we will just kind of say stop it's stopped let's check if it's really stopped it says it's reconnecting uh it will fail of course let's just open it in here in another window it fails to open yeah it fails to open and then if we want to start our server again all we have to do is to say start config machine so it started um now it will take approximately 1 minute to actually start the config server inside the VM let's go back to our browser and as you can see we can really really simply manage your server we can shut it down really easily and we can start it really easily and we also have a third option let's say if you want to use confi server with your tablets or with your mobile phone where you don't have access to a command line basically what you can do is go to uh Google Cloud console and you will see you will go to comput engine and then VM instances and you see here your VM and all you have to do is to stop it and it will stop the server and you can just start it will start the server and the best part with the automation scripts I prepared setting everything up takes less than 15 minutes and in this video I will walk you through every step of the process you can find all the instructions and all the code cipit in the confi on cloud repo link is in the description so let's get started on building your own custom confi server on gcp first thing we got to do before setting up the confi server is to create a Linux based virtual machine on gcp here you see all the steps we will follow through this section after setting up the VM we will also ensure your local computer can securely access the VM using Google's Cloud SDK gcloud and final step in this section involves installing pytorch with Cuda support on your virtual machine to Leverage The GPU for stable diffusion computations and code synip for each step can be found in the confi on cloud repo here you can see first step is to create a new gcp account I I created a new one so we can do everything together from scratch once you create an account first step is to actually uh start your fear trial let me choose turkey you also have to add your payment details start free now I added my billing account so now I'm a paid user let's say startup let's say these ones they are not really important and and developer and now we are officially logged into our paid accounts let's go to compute engine and enable it after comput engine is enabled the next step is to go to quotas and limits and increase your GP quot from from 0 to 1 however at first it doesn't show you these compute engine cotas that's why I found a work around so let's go back to compute engine and then you all you have to do is just create a very very simple machine which we will delete later on just say create instance and it should be instance one just like I created don't touch anything and just say create and it will take 2 minutes to create a new instance after we have instance you can go to quot and limits and then now we can see all the uh settings here all the configurations there and we can just search gpus all regions edit quos our new value will be one they're asking for a like basic reasoning why do we need a GPU let's say I have a startup which works with machine application this is why I need I need the GPU and let's say done let's say next it is asking for details I just going to put my phone number here submit request and if everything is okay it we will get an email which will tell us that our request for GPU is approved so now we have to wait for that let's go back to Compu engine and delete this other VM we created we'll just stop it at first VM stopped and then let's delete the VM okay now we have a GPU code of one and we can finally create our config IVM inside the compute engine let's click create new instance let's name our VM conf as for the region we will choose Europe Central 2 2B we will select gpus immedia T4 will automatically add it and then we will say let's make it custom we want six virtual CPUs and 16 GB of RAM and then we'll choose spot VM this will diminish lots of cost here and then we will change the boot dis we will be using Hub 2 I will use SSD persistent dis but you guys can use uh the normal one there's almost $7 difference between them per month and the size must be at least 100 GB the initial setup with the popular checkpoints and popular extensions will take approximately 80 GB of memory so we need that extra 10 20 GB for our pictures we will allow HTTP and https go to Advanced options go to networking we will add Port 8188 Network tag here and for the network interfaces we'll go here you guys have to click this one Reserve static external IP address I already have one here so I will select this one and that's all we can create it as you can see it's finished and it looks like it is working I want to go to VI Network details firewall and I want to check port 8188 and here we can see our confy VM if you guys don't have this fire rule here uh you can just create a firewall Rule and name it as port 8188 and as a tag also put the same name 8188 here will be zero if you want to access only from specific IP addresses you can change this one and then for the TCP we want to put 8188 again so we will allow access only from this TCP port and you can create it I already have it so I don't have to do that and as you can see we got a green tick here which means we finally created our VM which we can use to log in and install necessary libraries and then install the config server and and then everything will be ready but to do these things first we need a way to access this VM this is why we need to install Google's command line interface and if you go to the confy on VM repo you can see these three lines which don't LS the Google Cloud command line interface and then extracts it and then runs the installation file let's do that so I go to iterm or you can use the terminal I already have the file here but I will just go create another folder copy this here it don't on the installer you can unit with this line and then we have a Google Cloud SDK folder if you run this command it will install the Google Cloud SDK I don't have to run it because I already have it in my local computer the result is basically installing this common line tool gcloud and with the use of gcloud you can simply control your gcp accounts you can add new machines you can delete machines you can stop them you can control wi query and Etc so this is why we needed that after installing the gcloud we need to authenticate it here so it asks me to authenticate through the browser right now I'm using this account I will just kind of say yes continue and I will allow it and it's you're now authenticated with gcloud command line interface let's go back to our repo next we will do G CL in it as you can see here my account a project name let's select one we will select four and this is the project idid we have I guess yeah my first project and the ID is Studios camp for one I selected that one no and it is finished now let's go back to our repo we have to generate new SSH key payers when I run this command here it will generate me new SSH key payers in the directory of SSH so I already have that I don't I will not do that now let's go to SS folder and if I list it you will see two keys here confy VM key pvm key and then confy VM key. public so all you have to do is to run this command and it will automatically generate these two files in these directories and now we have to authenticate our VM with the use of these new sssh key payers so we have to go to sssh directory we are already in this directory and then we will say gcloud compute add new SSH key payers and add the public key it added this public key to our confy VM and let's try to connect and we've successfully added sssh payers and connected to our VM for the first time was the hard part now all we have to do is to install confy UI server let's go back to our config on cloud repo and just paste all these comments here right now it's installing all the essential packages as well as cona and Cuda it will also install NVIDIA drivers and then the next comment will be installation of confy UI as well as check checkpoints extensions first installation file is finished it didn't accept the second one yet what we need to do is to do source. bashrc this will activate the con cond environment also let's check if NVIDIA drivers are indeed installed by checking Nvidia SMI and they're installed and as you can see here everything is okay everything is working well let's run this install. SSH file which will install the configu server into the VM it looks like it's finished let's check if everything is working well yeah it is ready so right now we have a comi server and we are free to use it however we like and if I want to shut down the server I have two options first one is to go to compute engine and stop the VM the second option is to take this command just exit from here and stop the conm it's stopped let's check it won load and let's start it virtual machine started let's visit the page again it might take a minute to start it yeah and we are back so everything is working well you have a comy UI server which you can really easily shut down and boot it again and it will cost you only about $35 per month and if your workflow ever gets really complicated you can scale up your compute engine you can add other gpus you can increase your RAM you can increase your virtual CPUs which is really nice because when we start learning something we don't know how much we dive into that new thing I created this because I needed this and hopefully it will be useful for you guys too thanks for watching my video and please feel free to comment I wish you have a nice and confy image Generations
Info
Channel: NS
Views: 3,535
Rating: undefined out of 5
Keywords:
Id: PZwnbBaJH3I
Channel Id: undefined
Length: 19min 18sec (1158 seconds)
Published: Tue Feb 06 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.