-
-
Notifications
You must be signed in to change notification settings - Fork 363
How To Use SDXL On RunPod Tutorial Auto Installer and Refiner and Amazing Native Diffusers Based Gradio
How To Use SDXL On RunPod Tutorial. Auto Installer & Refiner & Amazing Native Diffusers Based Gradio
Full tutorial link > https://www.youtube.com/watch?v=gTdPRm-R-14
You don't have a good GPU or don't want to use weak Google Colab? Here how to install and use Stable Diffusion XL (SDXL) on RunPod. How to download and install it step by step. I am also providing an auto installer script. On RunPod with a cheap RTX3090 GPU it works super fast. The shared Gradio APP is based on native diffusers so working very fast and correct.
Source GitHub Readme File
Automatic Installer Script File
https://www.patreon.com/posts/auto-sdxl-runpod-85845581
Our Discord server
https://bit.ly/SECoursesDiscord
If I have been of assistance to you and you would like to show your support for my work, please consider becoming a patron on 🥰
https://www.patreon.com/SECourses
Technology & Science: News, Tips, Tutorials, Tricks, Best Applications, Guides, Reviews
https://www.youtube.com/playlist?list=PL_pbwdIyffsnkay6X91BWb9rrfLATUMr3
Playlist of #StableDiffusion Tutorials, Automatic1111 and Google Colab Guides, DreamBooth, Textual Inversion / Embedding, LoRA, AI Upscaling, Pix2Pix, Img2Img
https://www.youtube.com/playlist?list=PL_pbwdIyffsmclLl0O144nQRnezKlNdx3
00:00:00 How to install and use SDXL on RunPod Tutorial
00:01:12 Which Pod you should pick for SDXL with which settings
00:02:26 How to use auto installer script to install SDXL on RunPod
00:03:16 How to do manual installation of SDXL on RunPod step by step
00:03:47 How to accept terms of services of SDXL repository
00:05:24 How to download / clone SDXL repository
00:07:40 How to run SDXL after installation
00:08:15 How to use SDXL Gradio UI interface for generating images
00:09:03 SDXL base output vs refined output comparison
00:09:32 How to delete your Pod to not spend any money
00:09:48 How to try prompts of Midjourney and do comparison with SDXL
00:10:25 Advanced settings tab of SDXL gradio interface for batch size, refiner strength and CFG value
00:12:00 Number of steps 100 experiment
00:12:29 Where the generated images are saved/stored
00:14:00 More image comparison between SDXL and Midjourney
00:15:18 How to turn off display of non-refiner / base model images
00:16:43 Explanation of SDXL Refiner strength and refiner
-
00:00:00 Greetings everyone, in this video I will show you how to run Stable Diffusion XL on RunPod
-
00:00:07 as you are seeing here, seeing here and I will do some comparison with Midjourney generated
-
00:00:15 images.
-
00:00:16 I will also show you the difference between non-refiner and what happens when we use refiner
-
00:00:25 steps.
-
00:00:26 Moreover, I will explain how to generate as many as images you want and also how to generate
-
00:00:33 bigger batch size images like generating 8 images at the same time.
-
00:00:39 How to use refiner strength.
-
00:00:42 How to use steps and how to use cfg scale.
-
00:00:45 So for this tutorial I prepared a very detailed github readme file.
-
00:00:50 All of the instructions and commands are written here.
-
00:00:54 I will update this file as it be necessary, moreover the link of this file will be in
-
00:01:00 the description of the video and also in the comment section of the video.
-
00:01:05 So I have both auto installer script and also manual installation steps.
-
00:01:11 Let's login into our RunPod account, click this link.
-
00:01:14 If you don't have an account, just sign up.
-
00:01:16 If you have account login.
-
00:01:18 Go to community cloud, from here select your internet speed very high.
-
00:01:23 This is important because we are going to download a lot of files.
-
00:01:27 You can use any GPU which has over 20 GB.
-
00:01:31 For demonstration I will pick 1 RTX 3090.
-
00:01:35 Very important thing is customize deployment and increase volume disk size to 200 GB.
-
00:01:42 Also from templates type stable and select RunPod fast Stable Diffusion and hit continue,
-
00:01:49 hit deploy.
-
00:01:51 Let's call this machine as manual installation.
-
00:01:56 Let's also start another machine.
-
00:01:58 For this machine I will use RTX A6000.
-
00:02:02 This is 59 cents, the other one was 29 cents, but this machine has 48 GB VRAM.
-
00:02:10 So let's also customize deployment, select volume disk 200 GB.
-
00:02:16 Also our template is selected, continue and deploy.
-
00:02:20 Let's name this machine as auto install SD XL.
-
00:02:25 Auto installer script is very easy to use, go to this link.
-
00:02:30 From here download this attached SH file, click it, it will download the SH file.
-
00:02:36 Once the RunPods are started, you will see connect button enabled here.
-
00:02:42 Patiently wait them to download the necessary files.
-
00:02:47 Both of the pods are now ready.
-
00:02:49 Let's begin with automatic installation connect, connect to jupyter lab, wait until jupyter
-
00:02:55 lab interface loads, click this upload files icon, select the downloaded file.
-
00:03:02 You see the downloaded file is uploaded here, start a new terminal, copy the link here,
-
00:03:08 copy it, paste the command here, it will automatically install everything for you.
-
00:03:13 You don't need to do anything else.
-
00:03:16 Let's continue with manual installation because we will execute a lot of commands, connect,
-
00:03:21 connect to jupyter lab.
-
00:03:22 So the manual installation is explained here.
-
00:03:26 You need to have Hugging Face account.
-
00:03:29 If you don't have a Hugging Face account, just click join, register from here.
-
00:03:35 Once you have your account, click login from here.
-
00:03:38 Now you need to accept terms and conditions of these two repositories.
-
00:03:44 I will show you click and open them.
-
00:03:47 So here the first repository, how you are going to accept, you see they have researcher
-
00:03:52 early access agreement, go to the very bottom and in here fill as you wish.
-
00:03:58 I will fill as an example NA and I accept the above license agreement, submit application.
-
00:04:04 Then we need to generate our Hugging Face access token.
-
00:04:07 So open this link.
-
00:04:08 Here, generate a new token, test, I will make as a read, generate token and copy it.
-
00:04:15 After you copied it, paste it into a text file like this.
-
00:04:20 Now we can begin executing the commands below.
-
00:04:24 So open a new terminal, copy the first one, paste and hit enter, copy the next one, paste
-
00:04:31 and hit enter, then copy the next one, paste and hit enter.
-
00:04:35 Of course, you are waiting the commands here to be completed.
-
00:04:38 Copy this one, paste and hit enter, copy this one, paste hit enter, copy this one, paste
-
00:04:46 hit enter.
-
00:04:47 Okay, then let's continue.
-
00:04:49 This is a repository that I have edited to provide you the Gradio interface that is very
-
00:04:56 easy to use, very convenient to use and supporting refiner of SDXL.
-
00:05:02 For automatic installation you don't need to do anything.
-
00:05:05 It will install everything.
-
00:05:06 Manual installation is installing the requirements right now.
-
00:05:10 Once you see like this, it means that the previous execution has been completed and
-
00:05:15 you can continue copy, paste hit enter, copy paste hit enter, copy, paste hit enter.
-
00:05:23 Okay, this step is very important.
-
00:05:26 This will clone the SD XL version 0.9 into our workspace.
-
00:05:33 However, for this to be working, we need to edit this URL.
-
00:05:37 So copy it in the notepad file, paste it.
-
00:05:41 So copy your hugging face token and replace this part.
-
00:05:46 Also here, you need to write your Hugging Face username.
-
00:05:50 So my username is here.
-
00:05:52 I will copy it from here and I will paste it here, then copy the command and execute
-
00:05:58 it in this screen.
-
00:06:00 So you will see that it will start downloading all of the SD XL files into this folder.
-
00:06:10 You need to wait here patiently because it will download about 100 gigabytes of files.
-
00:06:16 That is why selecting high speed Pod is very important.
-
00:06:21 These files will permanently remain on your workspace as long as you keep your RunPod.
-
00:06:27 As long as you don't delete your RunPod.
-
00:06:30 First repository cloning has been completed.
-
00:06:33 You will get a message like this.
-
00:06:35 Then we will continue.
-
00:06:38 Copy this.
-
00:06:39 This will delete all of the .safetensors files because we will use .binary files with our
-
00:06:45 Gradio interface.
-
00:06:46 And since this is running on cloud, you don't have anything to worry.
-
00:06:52 Copy paste and hit enter.
-
00:06:54 Why I am doing this?
-
00:06:55 Because I am opening extra space in our pod.
-
00:06:58 So then copy this command, hit enter, then copy this, hit enter.
-
00:07:04 And we also need to modify this link copy from here.
-
00:07:10 We need to copy the username and we need to copy the access token.
-
00:07:17 Then copy the command like this and copy paste and hit enter and wait this one to be cloned
-
00:07:23 as well.
-
00:07:24 This repository is smaller than the previous one, so it won't take as long as this one.
-
00:07:31 Both of the installations have been completed both manual and also automatic.
-
00:07:37 Of course, automatic was fully automatic.
-
00:07:39 Then for running it after installation, all you need to do is running this command.
-
00:07:47 Also I have put the run command here.
-
00:07:49 They are basically same.
-
00:07:50 So let's start our SD XL Gradio application.
-
00:07:54 Moreover, if you don't want to use refiner, just set this enable refiner to false.
-
00:08:01 Okay, let's copy.
-
00:08:02 Let's copy paste it in both of the RunPods.
-
00:08:05 You see it is loading the pipeline as you are seeing right now in both of the RunPods.
-
00:08:12 I am going to open is the manual one.
-
00:08:15 So this is our interface.
-
00:08:17 Enter your positive prompt here, enter your negative prompt here, set the number of images
-
00:08:23 that you want to generate from here.
-
00:08:25 Let's begin with this prompt.
-
00:08:28 I will compare it with latest version of Midjourney copy text paste prompt here.
-
00:08:35 Let's delete the unnecessary part like this.
-
00:08:38 I'm not going to use any negative prompt, just hit generate and this is the automatic
-
00:08:43 RunPod.
-
00:08:44 So the difference is that automatic RunPod has a better GPU, manual RunPod has a weaker
-
00:08:51 GPU.
-
00:08:52 During the image generation, it is going to use all of your GPU.
-
00:08:55 The GPU memory used is like this.
-
00:08:59 Okay, we got the results.
-
00:09:02 So this is our result.
-
00:09:03 The left one is the one without refiner.
-
00:09:07 The right one is the one with refiner.
-
00:09:10 So let's open in a new tab like this.
-
00:09:13 The native resolution is 1024 by 1024.
-
00:09:17 This is without refiner and this is with refiner.
-
00:09:22 Also this is another image generated in the other pod.
-
00:09:25 So this is without refiner and this is with refiner.
-
00:09:28 I think there is a significant improvement with refiner.
-
00:09:31 Now I will delete the manual installation Pod to not waste my money and I will continue
-
00:09:38 with automatic installation to show you more examples.
-
00:09:42 And this was the Midjourney art.
-
00:09:44 So it is up to your taste.
-
00:09:46 Let's try this prompt, copy it, paste into prompt.
-
00:09:50 Okay, looking good.
-
00:09:51 I am not using any negative prompts and this is affecting my results.
-
00:09:55 Maybe let's add some low quality.
-
00:09:58 On the jupyterlab, you can see the progress.
-
00:10:01 It is 5 it per second right now with batch size 1.
-
00:10:05 Okay, and here we got our result.
-
00:10:08 So let's open new tab and let's also open this new tab.
-
00:10:13 Okay.
-
00:10:14 This is 512 resolution and this is 1024.
-
00:10:19 Let's add some more negatives.
-
00:10:21 Okay.
-
00:10:22 I have written some simple negative prompts.
-
00:10:25 In the advanced setting.
-
00:10:27 You will have batch size.
-
00:10:28 So people were asking me what is number of images and what is images here.
-
00:10:33 This is batch size.
-
00:10:35 If I make this 4, it will generate 4 images at the same time.
-
00:10:41 If I set this 4, it will generate 4 times images with the batch size here.
-
00:10:47 So it will be 16 images as a beginning.
-
00:10:50 Let's try with batch size 4, refiner strength and steps are default.
-
00:10:56 And this is the CFG scale.
-
00:10:57 You can also change it.
-
00:10:59 You can also change the refiner strength and the number of steps that you want to use for
-
00:11:05 generating images.
-
00:11:06 Let's hit generate and let's see how our pod performs when generating 4 images at the same
-
00:11:14 time.
-
00:11:15 This is the GPU memory used as you are seeing right now.
-
00:11:17 Now our it per second is 1.33, but we need to multiply it with 4.
-
00:11:24 So it is basically 6.2 it per second.
-
00:11:27 This is without refiner.
-
00:11:29 Now the refiner step is coming up.
-
00:11:31 Okay.
-
00:11:32 With refiner, it was 1.22 it per second.
-
00:11:37 We got the results.
-
00:11:38 Let's check it out.
-
00:11:39 Okay.
-
00:11:40 Here are results.
-
00:11:41 On the right we see the images generated with refiner on the left without refiner.
-
00:11:48 I think the results are pretty good.
-
00:11:51 Let's see.
-
00:11:52 Let's open.
-
00:11:53 So this is the result we got.
-
00:11:54 Refiner is making huge improvement as you're seeing.
-
00:11:58 Okay.
-
00:11:59 Let's try this prompt.
-
00:12:00 Copy text, open a notepad file, delete the unnecessary part like this, copy it, paste
-
00:12:07 into here and let's set number of images to 10 and I will set the batch size back to 1
-
00:12:15 and let's also increase number of steps to 100.
-
00:12:20 Okay.
-
00:12:21 Let's hit generate.
-
00:12:22 This time it will generate 10 images, but 1 by 1.
-
00:12:26 You can see the progress here.
-
00:12:28 While generating images let me show you where the generated images are saved.
-
00:12:33 Enter inside Stable Diffusion XL Demo folder in here, enter inside Stable Diffusion XL
-
00:12:41 Demo.
-
00:12:42 In here you will see outputs and all of the generated images will be saved here.
-
00:12:48 The saved images are the images after refiner steps.
-
00:12:52 So with double clicking, you can open them.
-
00:12:54 You can also download entire folder as an archive, but using RunPodCTL would be much
-
00:13:02 better for you.
-
00:13:03 In this tutorial, I have shown how to use RunPodCTL.
-
00:13:06 Open it.
-
00:13:07 This is a pretty long tutorial.
-
00:13:10 Look for the chapters where you want to learn.
-
00:13:12 Just look at the description of the tutorial.
-
00:13:14 You will see the chapters here and just click the chapter that you want to go.
-
00:13:19 During the image generation, the images will not be displayed here.
-
00:13:24 However, if you want to see them, go to the outputs folder and in the very bottom you
-
00:13:30 will see the last generated images.
-
00:13:32 You can double click them, open them, or you can right click and download them if you wish
-
00:13:38 like this.
-
00:13:39 Click download.
-
00:13:40 I already have two tutorials for SD XL for Google Colab and for local installation and
-
00:13:47 usage as well.
-
00:13:48 I also added the links of these 2 tutorials to the readme file as well like this.
-
00:13:54 Okay.
-
00:13:55 The images were generated.
-
00:13:57 I think the quality is amazing.
-
00:14:00 Let's look at them in the new tab.
-
00:14:02 Okay.
-
00:14:03 I am opening them like this.
-
00:14:04 Right click open new image and I will compare with the midjourney as well.
-
00:14:10 Let's decide which one is the best one.
-
00:14:13 Okay.
-
00:14:14 They are all looking pretty amazing if you ask me.
-
00:14:18 Okay.
-
00:14:19 Let's close.
-
00:14:20 Close.
-
00:14:21 This is also a good one.
-
00:14:22 Let's close.
-
00:14:23 This is also a nice one.
-
00:14:24 Okay.
-
00:14:25 So this image is generated by midjourney which you pay a decent amount of money every month.
-
00:14:33 You are seeing here the mid-journey image and these are SD XL version 0.9.
-
00:14:40 Not even the officially version 1 and the quality is amazing.
-
00:14:47 Let's compare these two like this.
-
00:14:49 Let's decide which one is looking best.
-
00:14:52 Okay.
-
00:14:53 I can't decide which one is the best.
-
00:14:56 Maybe let's compare this post.
-
00:14:58 So copy image open paint .net.
-
00:15:02 Let's make the double size like this on the left we see the Stable Diffusion X large image.
-
00:15:09 So on the left we have Stable Diffusion X large which is free to use on the right we
-
00:15:15 have midjourney latest version.
-
00:15:18 Let's say you want to turn off non refiner images.
-
00:15:22 What you need to do is go to your Stable Diffusion X large demo folder, in here you will see
-
00:15:29 app7.py.
-
00:15:30 Open it.
-
00:15:32 In this file you will find this section.
-
00:15:36 Okay.
-
00:15:37 In here all you need to do is comment out here once you did comment out this line of
-
00:15:45 code it won't display images anymore.
-
00:15:48 CTRL-s and save or you can save it from here save Python file.
-
00:15:53 After saving the file restart your pod which will be easiest way for your restart pod.
-
00:15:59 Once pod has been restarted click Jupyterlab again you will get this until pod has been
-
00:16:06 restarted.
-
00:16:07 Copy the run command from here again open a new terminal copy paste and hit enter.
-
00:16:13 The initial loading doesn't take too much time so it is not a problem to restart pod.
-
00:16:19 This time let's try this prompt copy text I will copy the prompt here.
-
00:16:25 The restart has been completed click the radio app copy paste the prompt let's also copy
-
00:16:31 our previous negative prompts let's generate 4 images.
-
00:16:34 Generate.
-
00:16:35 You can watch the progress from here as you are seeing right now.
-
00:16:39 It is doing 5 it per second when batch size is 1.
-
00:16:43 So what about refiner strength.
-
00:16:46 What is it doing when you set steps 50 and refiner step 30 percent it will do 15 refiner
-
00:16:55 steps and 50 original steps.
-
00:16:57 So if you make this 100 it will do 100 steps to generate initial image then 30 steps to
-
00:17:05 generate the refined image.
-
00:17:08 This is what does refiner steps do.
-
00:17:10 So this is why 50 steps are used for initial generation and 15 steps are used for refiner
-
00:17:17 image generation.
-
00:17:18 Ok the images have been generated.
-
00:17:21 This is SDXL.
-
00:17:23 You see non-refiner images are not shown anymore.
-
00:17:28 Let's compare with the midjourney.
-
00:17:30 So this was Midjourney image.
-
00:17:31 This is Midjourney and this is Stable Diffusion X large.
-
00:17:36 Let's open a new tab.
-
00:17:37 Ok Stable Diffusion X large and here we got the Midjourney.
-
00:17:41 This is all for today.
-
00:17:43 I hope you have enjoyed.
-
00:17:44 Please support me on Patreon.
-
00:17:46 This is tremendously important for me.
-
00:17:49 You will find the link here.
-
00:17:51 Also you can join our YouTube channel and support me.
-
00:17:54 Please like subscribe leave a comment.
-
00:17:56 I am replying all of the comments.
-
00:17:59 You can also click here and star my github repository, fork it and watch it.
-
00:18:05 It will also help me.
-
00:18:06 Hopefully see you in another amazing tutorial.
