0:00 welcome to episode three of our comfy UI tutorial Series in this episode I want to show you more tips on how to use the text to image workflow to generate images Explore More settings manage multiple workflows simultaneously and improve the interface for a cleaner look once your workflow is up and running in the last episode we created a simple text image sdxl workflow as you can see I loaded a juggernaut X model then The Prompt text is encoded so stable diffusion can understand it in case sampler is where the magic happens it uses an empty late an image then decodes it so we can see it and finally saves the image in the last step i' like to
0:46 talk a bit about case sampler and the settings available in this node a seed is a specific number that determines the starting point of the random process used by the model to generate an image using the same seed with the same settings will always always produce the same image while changing the seed will produce a different image even if all other settings remain the same think of the seed as a recipe number in a cookbook imagine you have a giant cookbook where every recipe is numbered if you want to make a particular dish you look up the recipe by its number the seed following the recipe exactly with the same ingredients and instructions
1:31 will always give you the same dish under the seed we have control after generation and as you can see it's currently set to randomize so if I click Q prompt after generation I get a different seed each time this allows me to generate images repeatedly with each iteration producing a different image due to the different seeds used the minimum seed value is zero and the maximum value is a very large number with such a wide range you can generate an enormous variety of images even using the same model and prompts the chance of generating the exact same image unintentionally twice is extremely low because of the vast number of possible seeds you can also change that option to
2:19 increment which means each time I hit the Q button the seed number will increase by one you can add multiple jobs to the queue similar to sending multiple jobs to a printer clicking The View Q button shows all the jobs currently running allowing you to cancel any job if needed and this feature is very useful for large workflows that take a lot of time as you can cancel jobs if previews show they're not what you want if you click on extra options you'll find the autoq checkbox when checked it will keep generating continuously once you click Q as you can see it's still generating uncheck the auto que opt option to stop automatically adding new jobs to the
3:06 queue we also have the option to decrement which will decrease the seed number by one each time after a generation most of the time I use randomize when I have something specific in mind I use fixed size and input any number before hitting Q then I can play with prompt until I get what I want this is the image result for that seed if I click Q again without changing anything neither the seed or the prompt nothing happens because there's no need to generate again in the command line You'll see that the prompt executed in0 seconds however if I make any changes like adding a space to The Prompt it recognizes it as different and will generate again obviously changing a simple space in the prompt won't alter
3:53 the result much for example let's change the eye color to green and try again the result is a robot with green eye I can keep experimenting and because the seed is fixed subtle changes in the prompt can lead to variations in the generation but keeping somehow similar this depends on the words used in The Prompt as some words can have more impact than others if I want a subtle variation I can change the number of steps or the CFG value for example if I change the steps from 30 to 32 I get a subtle variation changing it to 26 or 40 or any other number close to the original value results in another subtle
4:40 variation to change those values you have multiple options you can click on the value and an input field will pop up alternatively you can use it as a slider by clicking on the field and dragging left or right Additionally you can use the left and right arrows to adjust it keep in mind that the more steps you use the longer it will take to generate the image so we can do the same with the CFG value If instead of seven I use 6.5 I will get a subtle variation in the generation I can lower the value to six and get another variation keep in mind the lower you go the less contrast the image will have and it might look worse if your values are too far from the recommended settings for the model
5:27 you're using if I increase the CFG value I get more contrast in the image up to a certain point where the images start to look worse again so you have to find the sweet spot for the model I am using I get okay results between five and seven for CFG values but CFG doesn't directly change the contrast it's more like a side effect CFG stands for classifier free guidance if the CFG value is low the model has more freedom which might result in more diverse and creative outputs but they may not closely match the prompt if the CFG value is high the model is more strictly Guided by The Prompt leading to outputs that are more precise and closer to the
6:13 description but potentially less diverse if you rightclick on the case sampler nodes you have an option that says convert widget to input there you can see all the settings you can change like seed steps and so on that can be converted to input but what does that means let's select CFG from that list now we don't have that CFG value in the list but we do have an input here labeled CFG so I can drag a link from there and search for a node called primitive uh this primitive node allows you to input data into your workflow whether it's text or a number and it will adapt based on what is connected since it's connected to CFG it shows me
6:58 the CFG value there having the the value as a node can be useful if you want to use the same value in another node for example if you have another K sampler node and you don't want to manually input the same value into all the nodes you can just drag a link from this node and all the other nodes will take that input also because it's in a node I have another option called control after generate so I can change it to increment and each time I hit Q the CFG value will increase this is very useful for for quickly testing different uh values if I no longer need the input I can rightclick on K sampler and choose convert input to widget then I select convert CFG to widget we have only one
7:45 there because we converted only one but you can have any value from the node as an input if you want as you can see now the CFG is back in the case sampler node I will delete the Primitive node and this time I convert to scheduler to input now if I drag a link and add a primitive node again you can see it adapts to the scheduler values so I can change the values from there and test it with different uh settings I will convert it back to a widget and delete the Primitive node this time I want to show you something with the steps so I will add that as an input I will set it to increment after generation steps refer to the number of iterations or passes the model takes to generate or
8:31 refine an image each step incrementally improves the image based on the given prompts and parameters the more steps you use the more refined and detailed the final image tends to be but this also increases the computation time so if I add one step and press Q I get something but it's barely visible because there weren't enough steps to capture detailed results it's like an artist making only a few brush Strokes the painting will be rough and and lack detail the more steps you add the more details will start to appear but it will also take more time to generate those details as you can see at step 15 it's starting to get some decent results however as I increase the number of
9:17 steps the generation time also increases it takes under a second at Five Steps but over two seconds at 14 steps for this model it's recommended to use between 30 and 40 steps but more than that it only take more time and it doesn't increase the quality it might even get worse quality let's revert that input another thing you can do is test different Samplers and schedulers to see if one performs better than others a good starting point is to use the recommended settings for that model similar to what I showed you in the first episode with the models from civit AI on the empty latent image in addition to width and height you can also set the
10:04 batch size so if I set it to four there instead of generating one image it will generate four uh when it's ready you'll see in the bottom right corner one of four and if you click on that it will switch to the next image and continue in a loop however if you want a general view of all four Images at once you can use the x button in the top right to close the individual preview allowing you to see all four Images together you can click Click on each one again to view it individually if needed if you want to generate a large number of images more quickly running in batch can save time since it's faster than running them one by one this is the result for the eight batch images looking at the command line it took
10:49 almost 30 seconds for eight images however if I had done it one by one it would have taken around 35 seconds on my RTX 4090 I will reset them back to default and change the seed for from fix to randomize if you look at the save image node you can see it has a default prefix named comfy UI however you can change this to something else that makes more sense like robot um for example um this way all the series you do for robots will start with that name as you can see the prefix is now robot whereas for older ones it was comy UI so let's say you have a working workflow and you want the interface to be more organized similar to other UI
11:36 designs like automatic 1111 or Forge UI what I like to do is press control and then drag to select multiple nodes using shift and click allows you to add more nodes to the selection I usually don't select the save image node you'll see why in a moment right click and select the option called convert to group node this will create a special node that contains all the selected nodes give it a name like text to image in this case resize it to your liking and there you go now it looks much simpler with just two nodes if you want to change the order you can do that too and even more if I rightclick and go to manage group node I can find all the nodes listed on the
12:23 left for example if I want to move the prompts just after the checkpoints I can do that after clicking save the node order will have changed um accordingly um you can also hide the options you don't need which will not deactivate them but simply hide them from the node interface for example if I don't want the d noise option because I don't use it for text to image I can go to the K sampler widget and uncheck visible when I save that change the option disappears from the node check what each node has in terms of inputs widgets and outputs and optimize the interface so it suits your specific needs if you need to edit the workflow you can always go back to individual nodes by right-clicking and
13:08 choosing convert to nodes this might look messy initially but it allows you to see how the nodes are connected and makes it easier to edit the workflow you can also convert just two nodes like the positive and negative prompts to make the workflow look more organized this can be quite useful for focusing on specific parts of your workflow if you want you can convert all the nodes in your workflow when you run it you can see how each node loads uh on top however I prefer not to include the save image node within the group because the preview is too small and I couldn't find a way to make it bigger that's why I keep the save node out of the group if you want you can run multiple workflows at the same time Let Me Show
13:56 You by using control and selecting all the nodes then crl plus C to copy and Control Plus VV to paste I can create a duplicate of that workflow to differentiate it quickly I will change some words in the prompt for the second workflow um when I click Q prompt you can see that it loads the first workflow and then the second one however maybe you want uh the option to choose which one to run and which ones not to run so let's select all the nodes from uh the first workflow now if you you right click outside the nodes anywhere on the canvas you have the option to add group for selected nodes this will organize all the selected nodes into a group similar
14:44 to what we did in episode two if you right click on that group and choose edit group you can change its title to make it easier to identify we repeat the steps for the second workflow now you can move each workflow easily by selecting the group not the individual nodes but the cool thing you can do now is this right click on the group and choose bypass group nodes this allows you to temporarily skip a group of nodes in the workflow enabling or disabling their effects without deleting them so if I press Q you'll notice only the second workflow is running because the first one has been bypassed so I can now bypass the second workflow and if I want to enable the first one I choose the
15:31 option called set group nodes to always if I test it you'll see that only the first workflow is running to remove a group you can right click on it go to edit group and choose remove to delete the nodes simply select them all with control and press delete um I will delete the first group as well and basically we're back to the basic sdxl workflow you can also bypass nodes but not all nodes can be bypassed for example if you try to bypass a node like the negative prompt that is required it will show an error indicating that the node is missing and cannot be bypassed to enable the node again you can select the bypass option
16:19 again let me create a quick node um from an empty image I'll decode it and take a preview uh image from it then I'll bypass this preview node since it's not needed in the workflow it won't save the image but the rest of the workflow will work uh just fine so if I choose to bypass again to enable that node when I run the workflow it will generate that preview image let's delete those notes now uh we can have multiple case sampler nodes to generate more images at once if I select the case sampler node and use control plus C to copy and control+v to paste I get a duplicate then we can connect the links just like we did with the first one but there's a faster way instead of control+
17:07 V use contrl plus shift+ v to paste it with all the connections intact but what I want in this case is to have another case sampler node that also saves the image so what I can do is um select all three nodes K sampler vae decode and save image by shift clicking on them then with contrl plus shift plus v i can paste them with all the links intact and use shift to move them into place I could paste another one if I want you can have as many as you want or as many as your computer can handle then you can change the settings in the case sampler so you get different images based on the same prompt but let's say I want the middle one to have a different prompt like maybe I want it to have uh green eyes well you can do that I will
17:53 disconnect the positive and negative prompts then I can recreate those as text and code nodes or I can just copy and paste the original ones and then reconnect them as you would normally do and I can change the eyes from red to Green now I realized that at first all of this might seem complicated it's okay if you can't do it right away like anything it takes practice start by learning to create basic workflows like we did in the last episode and try to understand each node eventually it will all make sense if you you still can't do it just watch and let your brain pick up pieces from it in a few days something in your mind will just click and you'll
18:41 be able to move on to more advanced workflows it's okay if you make mistakes kyui will let you know what the problem is like in this case I didn't connect uh the negative prompt so I can fix that quickly now when I run the prompt I will get the middle one with green eyes and the other two with their original prompts as you can see see you can accomplish pretty complex tasks with just a few nodes over time we can expand and do even more I've seen people with 200 nodes in a workflow imagine being able to generate everything you need with just one click I'll delete the last part of the workflow let's say you're happy with this workflow that generates two different images at once using two different prompts now it's usually the
19:29 part where I simplify the interface I'll select all the nodes with control and drag all except the save image nodes then right click and choose convert to group node you give it a name and click okay then you can rearrange the nodes and look at how clean and simple it looks now so I have both prompts here and I can change the details I want in both prompts when I generate I can get two different robots at once how cool is that I can also change the prefix in the save image node like maybe V1 and V2 so in the output folder I can easily see which was generated with what prompt and each time you want to make changes to the workflow you can convert it back to nodes so you can see how each
20:15 node is connected that's all for today thank you for watching um leave a like or a comment if you found something useful um see you in the next episode where we'll probably learn about image to image and maybe how to use lur models [Music]