* This blog post is a summary of this video.

Installing and Using SDXL Turbo for Real-Time Image Generation

Author: Future Thinker @BenjiTime: 2024-03-22 19:15:00

Table of Contents

Updating Comfy UI for SDXL Turbo

In order to start working with sdxl turbo in comfy UI you'll need to update your comfy UI because there are new comfy nodes required for our sdxl turbo workflow. It's important to update your comfy UI as usual. Here's what you need to do: First go to the comfy UI manager and click on update comfy UI. Wait for the update to complete and then restart your comy UI. Once you're done, you'll notice two new nodes: SD Turbo turbo scheduler and case sampler. These nodes are crucial for working with sdxl turbo.

Now let's build our sdxl turbo workflow. We'll start with a load checkpoint node and then connect the SD turbo scheduler with the checkpoint model. This is a simple text to image workflow just like usual. We'll also need the sampler custom node to run the sampling steps. However, instead of using case sample we'll use the sampler custom to connect with our checkpoint model. We'll also need the positive and negative text prompts and so on. In the SD turbo scheduler we'll connect the sigmas to the sampler custom using the Green Dot. Additionally, we'll need to set a fixed seed number. Let's use a number and select fixed for the CFG. We'll set it as one because we only need a fast sampling step, we don't require multiple steps here. Then we'll connect the checkpoint models to the sampler custom using the purple dot. Let's tidy up the workflow nodes to keep things organized.

Installing New Comfy UI Nodes

You'll need to update your comfy UI because there are new comfy nodes required for our sdxl turbo workflow. It's important to update your comfy UI as usual. Here's what you need to do: First go to the comfy UI manager and click on update comfy UI. Wait for the update to complete and then restart your comy UI. Once you're done, you'll notice two new nodes: SD Turbo turbo scheduler and case sampler. These nodes are crucial for working with sdxl turbo.

Loading SDXL Turbo Checkpoint Model

We'll start with a load checkpoint node and then connect the SD turbo scheduler with the checkpoint model. This is a simple text to image workflow just like usual. We'll also need the sampler custom node to run the sampling steps. However, instead of using case sample we'll use the sampler custom to connect with our checkpoint model. We'll also need the positive and negative text prompts and so on. In the SD turbo scheduler we'll connect the sigmas to the sampler custom using the Green Dot. Additionally, we'll need to set a fixed seed number. Let's use a number and select fixed for the CFG. We'll set it as one because we only need a fast sampling step, we don't require multiple steps here. Then we'll connect the checkpoint models to the sampler custom using the purple dot. Let's tidy up the workflow nodes to keep things organized.

Building a Fast Text-to-Image Workflow

Next we'll add the text prompt positive prompt and negative prompt nodes to make things easier to recognize. Let's color code them green represents the positive prompt while red represents the negative prompt. We'll connect these two nodes together with the sampler custom. For the output we'll need a vae decode and we'll connect the checkpoint loader vae to the vae decode using the Red Dot. Let's tidy up the nodes to avoid clutter. We'll also need an empty latent image and since we only need to generate one image at a time we'll use a batch size of one. Then we'll connect the latent image with the sampler custom. Lastly we need to create another node for the sampler steps which is the K sampler select. These are the custom nodes required for sdxl Turbo and we'll set the CFG and steps in the SD turbo scheduler to one. The beauty of sdxl Turbo is that we only need one step to create images just like real-time prompt updating. Lastly we need to connect the preview image node here it's better to use the preview node instead of the save image node as it prevents your output folder from becoming flooded with images. When you find an image you like you can manually rightclick and save it.

Connecting Key Workflow Nodes

For the output we'll need a vae decode and we'll connect the checkpoint loader vae to the vae decode using the Red Dot. Let's tidy up the nodes to avoid clutter. We'll also need an empty latent image and since we only need to generate one image at a time we'll use a batch size of one. Then we'll connect the latent image with the sampler custom.

Adding Text Prompts

Next we'll add the text prompt positive prompt and negative prompt nodes to make things easier to recognize. Let's color code them green represents the positive prompt while red represents the negative prompt. We'll connect these two nodes together with the sampler custom.

Outputting Images

Lastly we need to connect the preview image node here it's better to use the preview node instead of the save image node as it prevents your output folder from becoming flooded with images. When you find an image you like you can manually rightclick and save it.

Generating Images in Real-Time

Now let's go back to our workflow we need to refresh it and you'll notice that our checkpoint models are now available in the load checkpoint drop-down menu here. We have successfully loaded the sdxl turbo 1.0 checkpoint model. Now let's organize the layout of the workflow diagrams for better Clarity. Once that's done we can proceed with the Positive text prompt pumped. For this example let's keep it simple we'll use the prompt lion and try to generate some photos of African animals like a lion with a bear or maybe even a lion on a tree let's see how it turns out. Execute the text prompt but please note that the first time you load the checkpoint models it may take a while. Once it's done you can generate images in real time. To do that click on extra options and enable the autoq checkbox. This will allow you to see the images refreshing in real time on the right side of the interface. Now you can start typing different text prompts and the preview image will be generated based on your new prompt every second. You'll notice the cute size on the top menu switching between 1 and zero this indicates that the system is continuously checking for new text prompts and generating new images accordingly. Think of it as a shortcut listener in games that triggers actions in comy UI whenever you type a new text prompt. The system generates a new image almost instantly typically within 1 second or even half a second.

Writing and Updating Text Prompts

Now you can start typing different text prompts and the preview image will be generated based on your new prompt every second. You'll notice the cute size on the top menu switching between 1 and zero this indicates that the system is continuously checking for new text prompts and generating new images accordingly. Think of it as a shortcut listener in games that triggers actions in comy UI whenever you type a new text prompt. The system generates a new image almost instantly typically within 1 second or even half a second.

Exploring Different Image Styles

For this example let's keep it simple we'll use the prompt lion and try to generate some photos of African animals like a lion with a bear or maybe even a lion on a tree let's see how it turns out. Execute the text prompt but please note that the first time you load the checkpoint models it may take a while. Once it's done you can generate images in real time.

Enhancing SDXL Turbo Images

After we generate image and how can we enhance our sdxl turbo image because there's less detail in there so after that just like my thumbnails and the beginning of the intro image we can start from the sdxl turbo image like this it doesn't have a lot of detail it's just very low quality I should say because it's just one step uh sampling steps here then we will bring it to upscale image that I create so in this latent upscale image and also I'm using the 4X Ultra sharp upscaler to make a detailed image better quality from this base image. So in this checkpoint models I am using the ref VI it's basically realistic Visions in sdxl and here we have upscale latent by and I'm just upscaled by one so exactly the same size of the original image I just want to enhance the detail of it. So let it generate with more sampling step let's say I'm setting us 30 steps here and then using a normal case sampler and there you have it you got a very detailed more detail I should say but then it doesn't look like the same image as my original image from sdxl tur turbo yeah because we are setting the deno's strength as one so we have to set it back to 0.5 here and let's see our output yes we got it. So let's side by-side comparison here you see the sdxl turbo image is kind of well not really good quality I can say and then the hair and the dress is kind of blur and then compared with after latent upcal it improved a lot better look at the hair and then the pattern of the dress just help with the image to enhance it and the water surface the trees the leaves saw the details going on.

Upscaling for More Detail

So in this checkpoint models I am using the ref VI it's basically realistic Visions in sdxl and here we have upscale latent by and I'm just upscaled by one so exactly the same size of the original image I just want to enhance the detail of it. So let it generate with more sampling step let's say I'm setting us 30 steps here and then using a normal case sampler and there you have it you got a very detailed more detail I should say but then it doesn't look like the same image as my original image from sdxl tur turbo yeah because we are setting the deno's strength as one so we have to set it back to 0.5 here and let's see our output yes we got it.

Sharpening and Color Correction

I'm using the 4X Ultra sharp upscaler to make a detailed image better quality from this base image. So let's side by-side comparison here you see the sdxl turbo image is kind of well not really good quality I can say and then the hair and the dress is kind of blur and then compared with after latent upcal it improved a lot better look at the hair and then the pattern of the dress just help with the image to enhance it and the water surface the trees the leaves saw the details going on.

FAQ

Q: How do I update Comfy UI for SDXL Turbo?
A: You need to install the new SD Turbo and Sampler Custom nodes in Comfy UI Manager, then load the SDXL Turbo checkpoint model in Models > Checkpoint Models.

Q: What are the key nodes needed for SDXL Turbo?
A: The key nodes are SD Turbo Scheduler, Sampler Custom, Checkpoint Loader VAE, and VAE Decode. You connect these together to build the text-to-image workflow.

Q: How does real-time image generation work?
A: Enable the Auto Queue option to continuously check for updated text prompts every second and generate new images instantly based on the text.

Q: Can I enhance the basic SDXL Turbo images?
A: Yes, you can upscale or sharpen the images in Comfy UI using nodes like Latent Upscaler and Ultra Sharp to add more detail.