How to Use SDXL Turbo in Comfy UI for Fast Image Generation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone welcome back we've got something exciting to talk about today sdxl turbo got released by stability AI a few days back in this video I will be exploring three different workflows on how to take advantage of the sdxl turbo model first I will talk about a straightforward text to image workflow where I will show you how to connect the nudes and demonstrate how you can generate an image using the model next I will switch to an image to image workflow and show you how to use image to image using the sdxl workflow finally I will demonstrate how you can take the low resolution image the 512 by 512 image produced by sdxl Turbo model and generate a high resolution image in a high res f workl for the last part of this video I will be showing you a new sdx L too UI I made using gradio and how you can download and use it on your own local machine I hope you find this tutorial helpful let's Jump Right In okay so first update your compy wide installation open a terminal and navigate to your comy installation folder you can go into your Explorer the top CLI on it and type in CMD this will open a terminal and you can go into update adding CD which it stands for change directory update is this folder alternately you can open the folder and then go in and type in CMD at the top and then you want to run the update comy u.b file in your term node you can just type in update comy u.b press enter and let it update once it's done goes out go back to your main comy UI folder you can do CD do dot or opening new terminal and navigate back there run compy the update will continue once compy UI has loaded you should be good on compy UI side however if you've install the comp UI manager and you have additional extensions you want to go into the manager option and then click on update all this will update the extensions that you install so click on update all wait for it to complete while you are waiting for the updates to complete it can go to the comy UI her page scroll down until you see comp examples click on it scroll until you see sdxl turo open the page and then you will see a link that says download the official sdxl turbo checkpoint click on it and it will start downloading in case when you click on it it opens the hugging face page click on the download button here it is almost 7 GB in size so you want to make sure you have enough space just quick heads up guys I am currently in a recovery phase from a recent call so you might have noticed that my voice is a little bit different or the audio sounds different I hope the audio level is correct and you able to hear me properly I appreciate your understanding I did not want to wait until next week to deliver this video so hopefully you can bear with me as we go through the video okay so once the terminal says that that update is completed lose out of the terminal and just wait for your sdxl turbo model to complete the download Once the download has completed you want to go into your comy UI folder confy UI go into models and then go into checkpoints and paste your sdxl turbo model here you can close out of your uh Explorer go into your terminal and restart comy UI okay so once comy UI opens back back up want to click on the refresh button and then make sure that you have the turbo model in your drop down list okay so here I have the text to image workflow I will show you how to do this from scratch then I have this image to image workflow that uses SD XL turo and then I have the high resolution fix here so let's get started and learn how to do it from a scratch for those of you who want the workflow you can go into the description below there will be GitHub link click on it and you will be able to download all three web flows so first we will need the L checkpoint so we'll leave this here the clip encoder or the positive prompt inste the negative prompt sdxl turbo does not make use of a guidance scale or negative pump so you can zero it out but simply removing the negative for you can also add a a conditioning zero out which will Bas Bally make this zero then you can join that into negative let's collapse look of these so these two are the negative clip encoder note then we have our positive at the top make sure the low checkpoint is pointing towards your sdxl turbo model then empti latent image and be the default one the sdxl turbo model was train on 512 by 512 but like the research paper says a higher image size work as well however the main point of using the turbo model is that it can generate Imes in low steps as low as one steps this means that the images generated by the turbo model will take little time as low as 0.1 seconds depending on your machine now if you add an empty latent image that is let's say 1024x 1024 that will increase time it takes all the model to generate an image so I would suggest you is sticking to 512 x 512 and then later on you can upscale it using the highest X weth now next the key sample will have to go instead we'll be using a custom key sample so click on the model drag out click on search and type in custom click on Sample custom okay positive will go into positive the negative will go into negative the empty blatant goes into latent M now all the model will need something in between which will determine the number of steps so as you can see here in this sampler custom node we do not have any field for the number of steps so click on the model drag it out click on search type in Turbo you will get SD turbo siga and this will output a sigma cck on it drag it into sigmas and finally we have sample so we can take sampler drag out and just use the key sampler select one and this is your default samples so you have Ula ancestral we to use the Ula ancestral option and uh you should have something like this so we have checkpoint goes into positive from the model goes into SD turbo Cula then we have the negative from which is being zeroed out we have our latent empty image and we have the key sample in and all of these inputs goes into the sampler custom node which will then output a latent space image okay so this output is still in the latent space so we'll have to go into the v d code and then bring V into the V code this will decode the image and give us something that we can work with all right so I changed the pop q a colorful monster cute pokon star and white background old CBE the P the image showing at the bottom here this is an extension I have which displays all the images I've generated at the bottom as well as the image showing here you don't see it don't worry it's not important what is important is that we have an image but it's not great so we'll have to go into this sample custom and try to understand what is happening the first thing that you will see is that we don't have the step count instead it is inside the SD turbo Sig by default we want to make sure that it is one you can go up to two but that is the maximum that the paper allows keep in mind that the paper is still under research so it's possible that it can go higher but as far as the current research is concerned single step is enough to generate a high quality image next the sample custom note want to make sure add noise is true CFG scale you want to make sure that this is as low as possible let's go to one again we are going to use the same noise is SE we on generate in this L you can see we have a clearer image so for sdxl turo model when you're changing the CFG scale you're basically telling the model how much contrast you want in your image if I go lower so let's say 0.5 and let me create duplicate of the load image and save this new version all right this is our first one uh the seven one then our will do one with CFG scale of 0.5 you can see now the image is less saturated it doesn't have that contrast that we have from here right so depending on what is the output that you're getting you may want to lower the CFG scale or increase it but just a little bit you don't want to go overboard as going two or 0.5 you want to make sure that you're within 0.8 to 1.2 now the model the sdxl turbo model is well trained to follow props as you can see here the quality of the image while it is good for 8 by2 by 52 image it's not exactly high quality as the research paper tells us here and we can change the seat here let's change the two q and generate a new one okay so I forgot to change my CFG scale part two one a try again so here you can see the output this is our first image this is our second image obviously we can play around with the positive promp and try to get a better image out of as the XL turbo model but I think the main point of using the sdxl trouble model is to create a batch just generate a batch of images 20 30 and then you go in and cherry pick the ones that is closely following your prop and and your particular star that you're looking for because remember that it is in sdxl mod model so it is Shain on pretty much all the stars that are available next let's try to see image to image okay so here I am inside the image to image workow and you may notice that this is pretty much the exact same image to image workflow and that you have as the configu example page that is because the image to image actually uses the default key sample don't need the custom one for it so I have an input image here I have my model loaded I have my positive pump I don't need a negative pump so we can clear that out minimize it the image goes into a VA and code the VA from the SD XL tuo goes into the VA and code note this will output the latent image send that over to the key sampler and of course you connect the model positive and negative as usual next let's try to send the C to one will we change the control all after generate effects just so that we can see the progression now the steps count that one is important so the way the image to image or sdxl model works is that when you have a d noise you multiply the D Noise by the steps count should end up with war or higher okay so if we go back to the research Pap who can see image to image when using sdxl turbo for image to image generation make sure that the number inference steps multiply by the strength that's going to be the deno in strength is larger or equal to one let's take a look at an example we said this as one CG has 1.0 in noising strength maximum this is pretty much similar to we are not going to use the load image at all click on generate okay so we got an image and it is completely different than the input image now if we want some influence from the input image we have to decrease the D noising strength so let's put it to 0.5 and in order for us to get one when we multiply 0.5 by the factor that factor will have to be two so two multiply by 0.5 is equal to one so we'll set the number of steps to tube and then click on QBE Pro now we can see that we are getting something so this is the original imager and this is a newly generated one so there is a different here but let's see we want more variety 0.5 is easy all we have to do is set the steps counted to bit so here I have a steps count as two and doo is in strength as 0.5 I get this result by go to 0.55 as you can see it's slightly different I increase the D noising strength a little bit more I'll get more variety but my steps count is still at two now this is 60 go to 65 and then at 70 we can see that the image changes now we don't have enough steps to take the reference image into consideration so we'll have to go and increase the steps and if we increase the steps to three still at 0.70 the generated image is now taking the reference image into consideration that with more variation and as you go up so let's say go 0.8 here still at the steps count three and you can see again we have the same problem will have to increase the number of steps which again increases the number of time it will take to generate an image so at this one you may be asking yourself why use sdxl tber when you can be using different model and option that you have so you want to make sure that if you're using sdxl turbo you are getting this benefit of having low time for each generation and you will have to play with the den noising strength the steps count by the way CFG scale leave it at one you don't want to go too high you don't want to go too low Okay so we've seen the image to image workflow and how to play around with the den noising strength and the steps count the final workflow is a high resolution workflow and this one does not use the sdxl turbo model but if here I wish to do an image to image workflow get an image I can sent this image to the high resolution work let me group it this part is going to be the high R fix and this can be your text to image or image to image well the bottom here is text to image the top one is image to image and can on the cube button click on the extra options and then it Cube let it generate once you have an image you can then connect this image to the upscale image using model image node input so let's say we connect this with there make sure to change your romp this is going to be your standard load upscale model at this point you can change your checkpoint so you don't have to use sdxl turbo as your checkpoint you can go for any each other checkpoint that you have so realistic Vision deliberate I am going to be using the aniverse checkpoint I'm going to upscale it by two times using a real ESL gun X2 and then the key sample I'm going to be using 20 stamps CFG scale can go higher now I can also play with usual the noising strength from the normal workflows okay so let's give this one a go so click on Q promp okay so it's completed here is the image to image workflow so input image we've got a 512x 512 output we are sending this output over to R upscaler in this case I'm using real ESR G how default like load model positive PRP negative PRP then including that uh New Image so when we multiply 52 by 2 we get 1024 so we have higher image you're dening that image by 0.5 using 20 steps CFG scale 6.5 and uh this is the output if I open it and you can see this is the input and this is the output so basically if you have a particular style that you want to generate but you want to generate as the old sdxl the the default one the sdxl base plus the refiner it usually take 2.5 to 2 minutes 30 seconds to all the way to 9 12 minutes sometimes depending on the number of steps what I'm adding in between like IB adapters or control net but with this can generate an image within a couple of seconds and keep on generating image sh would pick one any one that I want now we have it with the sdxl style and I can just use any highrise workflow but you have a valuable put in there plug it the image and then generate a high quality image from it so those were the three workflows we've seen the text to image image to image as well as the high resolution fix next I will show you this gradio application frontend user interface that I made so at the top we have the model selection so we're going to use turo and then as you can see here we only have the positive and click on generate this will use the workflow text to image workflow that we've seen in inside of confy but you don't have to mess up with the number of steps CMG scale or any of the other FS that are available there just put in your prop select the turbo model and then click on generate I go back into the confy UI terminal can see here um because I'm loading the checkpoint at the top again loading the model and I have a slow GPU here so it's going to take some time all right so it's finally puted the model and you can see by default I have it as one step basically it's doing one step for you and we get an image now this image is 512 by 512 I've just displayed it biger so 52 by 512 image here now if I go into the tab image to image now I have a little bit more to have the postive pro same can use the same image so you can click on it drag it over the tab and drop it on top of where it says drop image here this will lower the image then you have a slider for the denoising strength click on generate now that I'm looking at it maybe I should add the number of steps as well in case somebody wants to go a denoising strength of 0.95 they will require some more steps so I will do that next on the next video all right so we get pretty much the same thing finally we have the highr spe workflow and and in here there's a lot more that you can change so we have the positive BR negative BR you can select an upscaler you can also select a Downs scale factor so for example let's say you use a real ESL gun X4 this will multiply the original image four times and if you down scale it by 0.5 and you achieve a 2X of scale there's the image input and then you can play around with the denoising the strength the CFG sampler so you can select from these ones on my next video I will show you how you can modify the list so you can add more these are the ones I use which is why I've added them but I will show you where you can get it and add it to your workflow there's also the scheduler you can select from one here and you have your generate button and your output on the right side at the top you can select any of the models as previously so I'll do an example here so I've selected a checkpoint I've added a positive FR left the negative front has black I'm using a 2x upscaler so I will put the down scale factor to one it will do 1 multip by 2 we are going to get 2x if I put it as 0.5 do 0.5 multiply by two then I will get only one x sub scale basically in new resolution up scale the bottom one we have dising strength 0.5 steps has 20 CG as six sample ular ancestral schuer is normal Theon generate wait for it to complete it's done so let me the new image this is the original image and this is the high res fix image so exactly the same thing just in a I would say friendly user interface that you can use you don't have to worry about the connection the nodes just install the server and it will take care of the rest I will leave a link in the description below it's going to be a GitHub repo page and uh you can download the entire project there including the workflows so your project will look this you will have an appy file a requirements.txt file then the workflows will be here so text image image to image and high fix you don't have to use it it's just an option those of you who want a simplified UI so my next video will be on How I build this I'm currently making uh writing the code for a different project but should be up by next week and there's also one thing that I'm noted it would be nice to have like button here that says send this image over to image image and then maybe another button that says send to highis fix I will probably do this next week when I've recovered a little bit more with that guys I hope this video was helpful to you you were able to learn something and maybe enjoy it a little bit so thank you for watching until this very end click on the live button let me know that you like this video if you have any questions or any feedback for fure future videos or even this video let me know in the comments down below if you want to watch similar videos click on the Subscribe button helps me and I will see you in the next one I want to take a moment to say a big thank you to all of you who subscribe uh right now my total subscribers is 26 the last video I was at 7 so that's 19 subscribers big thank you to all of you one thing I've noted is that under recent subscribers when I click on see all I don't see all 26 subscribers now I am guessing that these are only the channels name and so if somebody has a Gmail YouTube account but does not have a channel so I'm going to show up here as it says your channel and then at the top there's also a quick text that says only includes users who have made their subscription public so in case you don't find your name here it's probably because your subscription page is not public or um maybe you don't have a YouTube channel that's why it's not Shing here but nevertheless I want to say a big thank you to all of you who subscribe thank you
Info
Channel: Code Crafters Corner
Views: 2,921
Rating: undefined out of 5
Keywords: SDXL Turbo, Comfy UI, Text-to-Image, Image-to-Image, High-Res Fix, Fast Image Generation, Gradio UI, Workflow Tutorial
Id: FUjBB-2qEUM
Channel Id: undefined
Length: 24min 9sec (1449 seconds)
Published: Sat Dec 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.