0:00 welcome to episode two of our comfy UI 0:02 tutorial Series in this video I will…
- User
0:00 welcome to episode two of our comfy UI 0:02 tutorial Series in this video I will 0:04 show you the basics of nodes and 0:06 workflows helping you get started with 0:08 building your own projects even if you 0:11 don't plan to create your own workflows 0:13 maybe you download workflows from others 0:15 and need to make changes so it can be 0:18 useful to have an idea of how things 0:20 work in episode one I demonstrated how Overview of Nodes and Workflows 0:23 to install and generate your first image 0:26 using stable diffusion if you haven't 0:29 installed comy UI or downloaded the 0:31 model yet please check out that episode 0:33 first this is a basic stable diffusion 0:36 workflow that can generate an image from 0:38 text often referred to as text to image 0:42 uh to help you understand how it works 0:44 more easily I'll provide a simple 0:46 analogy that will give you an idea of 0:48 why it requires numerous nodes and steps 0:50 to function properly I added some notes 0:53 around the nodes to make it easier now 0:55 imagine you're designing a custom cake 0:57 at a bakery first you choose a skilled 1:00 Baker the model who specializes in the 1:03 type of cake you want in this case our 1:06 Baker is the Juggernaut model then you 1:09 give the baker detailed instructions on 1:11 what you want in the cake such as 1:14 vanilla flavor strawberries and whipped 1:16 cream this is called the positive prompt 1:19 and what to avoid like uh nuts chocolate 1:23 this is called the negative prompt the 1:25 baker starts preparing the cake by 1:27 mixing the ingredients and baking it 1:28 this is what the k sampler node does 1:31 then you decide on the size of the cake 1:33 perhaps an 8 in round cake this is where 1:37 we use the empty latent image node where 1:40 we specify the width and height using 1:43 pixels once the cake is baked the baker 1:46 decorates it and prepares it for serving 1:48 in this workflow we use the vae decode 1:51 node for that step finally you take the 1:53 completed cake home and display it on 1:55 your dining table we use the save image 1:58 node for that step did this analogy help 2:00 you understand better the workflow let's 2:02 review it quickly we select the baker 2:05 you give the baker detailed instructions 2:06 on what you want in the cake and what to 2:08 avoid the baker starts preparing the 2:10 cake by mixing the ingredients and 2:12 baking it you decide on the size of the 2:15 cake um once the cake is baked the baker 2:17 decorates it and prepares it for serving 2:19 finally you take the completed cake home 2:22 and display it on your dining table ComfyUI Menu 2:24 let's talk a little bit about um the 2:27 interface uh the Q prompt button adds 2:30 the current workflow to the queue uh 2:32 which prepares your setup for image 2:34 Generation Um it's like hitting start on 2:37 a task list by checking extra options it 2:40 reveals more advanced settings for 2:42 generating images such as the number of 2:44 images to create at once the batch count 2:47 or automatic queuing when parameters 2:50 change the save button saves the current 2:53 workflow so you can load it later it's 2:54 like saving a document on your computer 2:57 the load button loads a previously saved 2:59 workflow restoring it to your current 3:01 session this is useful for reusing 3:04 workflows the refresh button updates or 3:07 reloads the current view or settings 3:09 ensuring you see the most recent changes 3:12 the clear button clears the current 3:13 workflow resetting it to a blank State 3:16 the load default button loads the 3:19 default settings returning the interface 3:21 to its original state the reset view 3:23 button resets the layout or arrangement 3:26 of the interface elements to their 3:27 default positions the manager button 3:30 opens the comfy UI manager which is a 3:32 management interface for um detail 3:36 control over your projects settings and 3:38 custom nodes the share button allows you 3:40 to share the current project or workflow 3:42 with others on different websites so 3:45 save your current workflow by clicking 3:47 save give it a name and store it 3:50 somewhere on your drive then click the 3:52 clear button to remove everything from 3:54 the screen and start fresh the area The Interfaces and Nodes Explained 3:57 where you add nodes in comfy UI is 3:59 commonly referred to as the canvas or 4:01 node canvas this is the main workspace 4:04 where you can create connect and manage 4:07 various nodes to build your workflows 4:10 you can add a new node by either double 4:12 clicking for example you can search for 4:14 load um and select load checkpoint which 4:17 will add that node to the canvas uh you 4:19 can left click on it and move it around 4:22 and the second option is to rightclick 4:24 on the canvas then go to add 4:27 node and from the list select it from 4:31 the loaders 4:33 category I can select the same node load 4:36 checkpoint to select different nodes 4:38 simply click on them if you press the 4:40 alt button and then left click and drag 4:43 it will drag a copy of that node 4:45 alternatively you can use control plus C 4:47 for copy and Control Plus V for 4:50 paste if you right click on a note you 4:52 have access to uh more options and 4:55 settings you can also remove the node 4:58 using the remove option or simply press 5:01 the delete key uh while the node is 5:04 selected sometimes you need to resize a 5:06 node to make it look better you can do 5:09 this by dragging from the bottom right 5:11 corner resizing from other Corners won't 5:13 work only that corner will allow you to 5:16 resize here you have the node name and 5:19 in front of it there is a small circle 5:22 when you click on it it will make the 5:23 node smaller this action is often 5:26 referred to as collapsing the node 5:29 collapsing a node reduces it to um a 5:32 more compact form which helps in 5:35 managing and organizing the workspace 5:36 more efficiently especially when dealing 5:38 with complex 5:40 workflows here are also some shortcuts 5:43 you can use to select nodes remember 5:45 these three control keys alt control and 5:50 shift knowing these three keys is 5:52 usually sufficient for most software out 5:54 there if one key doesn't work try 5:56 another that is what I do since I can 5:59 not remember all the shortcuts uh many 6:02 programs have hidden features accessible 6:05 through these keys to select a single 6:07 node simply click on it if you want to 6:10 move the node to a different position 6:12 click on the Node and drag it to the 6:14 desired location to select multiple 6:16 nodes hold down the shift key and click 6:18 on each node you want to select 6:21 individually you can also select 6:23 multiple nodes by holding down the 6:25 control key and then dragging to create 6:28 a selection box that encompasses is all 6:30 the nodes you want to select release the 6:32 mouse button to select all nodes within 6:34 the box once multiple nodes are selected 6:37 hold down the shift key then click and 6:40 drag any of the selected nodes to move 6:42 all selected nodes together let's clear 6:45 the canvas and uh let me show you a few 6:47 more things about the nodes I will add a 6:50 few different nodes so I can explain 6:52 what several key elements are composed 6:54 of uh we have the node name um that 6:57 identifies the function or operation of 6:59 the node uh for most nodes you can guess 7:02 what they do from their names for 7:04 example if load is in the name um it 7:07 probably loads something like a 7:08 checkpoint model in this case case 7:10 sampler may not be obvious from its name 7:12 but you can think of it as a family of 7:14 Samplers um to make it easier to 7:16 remember consider K sampler as a key 7:18 component save image does exactly what 7:21 it says it saves the image to your 7:22 computer 7:23 automatically then you have the inputs 7:27 connection points where data or signals 7:29 are received from other nodes for 7:31 example K sampler has many inputs uh 7:34 load checkpoint doesn't have any inputs 7:36 and save image has one input called 7:39 images next there are the outputs 7:42 connection points where data or signals 7:45 are sent to other nodes K sampler has 7:48 only one output named latent load 7:51 checkpoint has three outputs and save 7:54 image doesn't have any outputs so you 7:56 cannot add more nodes after the image is 7:58 saved and then have parameters or 8:00 settings uh these are configurable 8:02 options within the node that um control 8:05 Its Behavior um and 8:07 processing for example K sampler uh has 8:10 settings like seed steps and CFG that 8:13 you can adjust um for save image you can 8:17 change the prefix value of the image 8:20 name so that it starts with whatever 8:22 value you add there by the way you can 8:25 move this menu from the top left corner 8:27 where those tiny dots are located 8:30 the connections between nodes and comfy 8:31 UI are called links but you can call 8:34 them whatever you like cables spaghetti 8:38 these links enable data or signals to 8:41 flow from the output of one node to the 8:43 input of another allowing for the 8:45 creation of a functional workflow so if 8:49 I want to create a link between these 8:51 two nodes I look at the connection 8:53 points that usually have the same name 8:55 and color for example here uh both nodes 8:58 have um connection points named model 9:02 and the color is purple this allows me 9:04 to drag from purple to purple however if 9:08 I try to drag to a different color it 9:11 doesn't let me create the connection so 9:13 uh I will drag it to the um purple 9:16 connection point and when I release the 9:18 mouse uh the connection is made now you 9:20 can see the link has the same color as 9:22 the connection points now if you look at 9:25 these two points they may look similar 9:27 but in fact one is yellow and the other 9:29 is orange additionally their names are 9:32 clip and positive therefore you cannot 9:35 make a connection between these two 9:37 different types of points if you want an 9:39 idea of what node you can place there 9:42 you can drag and release the mouse 9:44 somewhere on the canvas a menu will 9:46 appear where you can add or search for a 9:48 node uh the menu also suggests nodes 9:51 that you can select for example if I 9:54 select the the clip text and code node 9:57 it creates that node and connects it in 9:59 one move when you delete that node um 10:01 the connection is also deleted so the 10:04 easiest way is to drag and release to 10:07 get one of the suggested nodes or search 10:09 for a node with a little practice you'll 10:11 learn which nodes connect with each 10:13 other for example with latent I can get 10:16 a vae decode node then from the vae 10:19 decode node I can connect the pink 10:21 output with the vae from load checkpoint 10:24 and so on as you can see um you cannot 10:26 connect to nodes of other colors to 10:29 unlink or disconnect a link from a node 10:32 you simply click on the connection point 10:33 and drag it away somewhere on the canvas 10:36 when you release the mouse the link will 10:38 will be disconnected you can also delete 10:41 uh a link by left clicking on the little 10:43 circle that appears on the link then 10:44 choosing delete you can also rightclick 10:47 on a node and go to Colors uh where you 10:52 can pick different colors to 10:53 differentiate nodes that are more 10:55 important additionally when you 10:57 rightclick you can change the title the 10:59 node for example you can rename it um to 11:03 exactly describe what it does you can 11:06 also change uh the shape of the node to 11:09 box round or card um a a combination of 11:13 both or you can leave it at the default 11:16 shape Additionally you can use the 11:18 resize option to um automatically adjust 11:21 the node to a smaller form let's clear 11:24 the workflow and start our text to image SDXL Workflow Creation + Explanation 11:26 workflow for stable diffusion from 11:28 scratch first let's start by loading our 11:30 model we'll use the load checkpoint node 11:32 for this task and this node is 11:34 straightforward it loads the pre-train 11:36 model uh the checkpoint that we'll be 11:39 using in our case we're using a model 11:41 called Juggernaut X you'll notice that 11:44 this node has three outputs model clip 11:46 and vae these outputs will be useful 11:48 shortly next I'll add the case sampler 11:51 node this node begins with random noise 11:54 and gradually turns it into um a clear 11:57 image by following specific instructions 11:59 and settings such as the number of steps 12:02 and how strongly the instructions guide 12:04 the process this helps create a final 12:07 high quality image I will create a link 12:09 between these two nodes connecting the 12:12 output from the model um output of the 12:15 low checkpoint node to the model input 12:17 of the K sampler node you see here we 12:20 have a clip output clip stands for 12:23 contrast of language image pre-training 12:25 uh which is a machine learning model 12:27 that can interpret both images and their 12:29 descriptions in natural language it 12:32 effectively Bridges the gap between 12:34 Visual and textual data to make an 12:37 analogy for what clip does it's like 12:39 having a bilingual person who can 12:41 understand both English and images when 12:43 they see an image they form a mental 12:45 summary when they read a description 12:48 they also form a summary they can then 12:51 compare these summaries to see if they 12:53 match so if I drag and release you can 12:56 see in the suggested nodes the clip text 12:58 en code option if I select that I now 13:01 get the clip text encode prompt where we 13:03 can input our text prompt now we need 13:05 both a positive prompt and a negative 13:07 prompt I can either hold down alt and 13:09 drag a copy of the clip text and code 13:12 node or I can search for the node 13:14 labeled prompt and add it so now that we 13:16 have both nodes I will connect them to 13:19 the load checkpoint node as well you 13:21 might wonder how the system 13:22 distinguishes between um the positive 13:25 and negative prompts when both nodes 13:27 look the same in the case sampler node 13:30 we have two inputs one for positive 13:32 prompt and another for negative prompt 13:35 by connecting each respective node to 13:37 these inputs the system understands 13:38 which prompt is positive and which is 13:40 negative um to quickly distinguish 13:42 between nodes many people assign colors 13:44 to them for example uh we can color the 13:48 uh positive prompt node in green and the 13:51 negative prompt node in red I will 13:54 quickly add a positive prompt and a 13:56 negative prompt so we can test them 13:58 later when the workflow is ready now 14:01 each checkpoint has some recommended 14:03 settings that we can use in the K 14:04 sampler as you saw in the first episode 14:07 when we got our settings from civid AI 14:09 where I downloaded this model I will add 14:12 those settings 14:13 here so we have another input here 14:16 called latent image if we drag and 14:19 release we can see options like vae 14:22 encode or empty latent image it took me 14:25 a while to understand this but 14:26 everything that happens in the case 14:28 sampler node revolves around the latent 14:30 space latent space represents hidden 14:32 features of data in a simplified 14:35 abstract form making it easier for 14:37 models to process everything that enters 14:40 this space must be latent if it's pixel 14:42 data we need to encode it first to 14:44 convert it into this simplified form so 14:47 if I have a photo made from pixels I 14:49 cannot input it directly into the case 14:51 sampler we need to use vae and code 14:54 first we'll explore this process in 14:57 another episode to create an imageo 14:59 image workflow however for text to image 15:02 we need an empty latent image even when 15:05 using text to generate an image the 15:07 system still requires a placeholder 15:09 image to work with and add noise on top 15:11 to perform its task effectively as you 15:14 can see we have width and height options 15:16 here since we are using an sdxl model we 15:19 can create a larger image such as a 1024 15:22 pixel image so basically most of the 15:25 workflow is complete we have the model 15:28 the prompts and um everything entering 15:31 the case sampler uh including the empty 15:34 image that allows us to choose the size 15:37 um theoretically the image exists in the 15:39 latent space um we just need to extract 15:43 it to view it remember I mentioned that 15:47 everything going into and out from the 15:49 latent space must be either latent or 15:51 converted to get pixels since we want to 15:54 visualize the pixels we use the load vae 15:57 decode node to extract the image from 16:00 the latent space A vae variational Auto 16:05 encoder decode node is a component in 16:08 machine learning models especially in 16:10 image processing that transforms latent 16:13 space 16:14 representations back into their original 16:16 visible form think of it like 16:18 compressing and decompressing a file the 16:21 vae um en code node um compresses the 16:24 image into a compact form latent space 16:28 and the vae decode node um decompresses 16:32 it back to the original image now I know 16:35 from the model description that 16:36 Juggernaut has vae baked in so I can 16:39 simply connect uh the vae from the 16:41 decoder to the vae from the load 16:44 checkpoint node but if you're using 16:46 another model that requires a separate 16:50 um vae file you'll need to search for a 16:53 node called load vae first download the 16:57 vae and place it into your model folder 17:00 then into the vae folder after 17:02 refreshing select the model from the 17:04 list and connect it to the vae decode in 17:08 my case I don't need this step so I'll 17:10 just connect it back to the model now 17:12 the final pixel image is here we just 17:15 need to save it we could use a preview 17:17 node if we want to preview the image 17:19 first um and then save it with a 17:22 rightclick however what I prefer to do 17:24 is use a save image note now that way 17:26 everything I generate is saved and I can 17:28 delete what I don't need later from the 17:30 output folder and that's it um let's 17:34 test it to see if it works by clicking 17:37 on Q 17:38 prompt um you'll notice each node gets a 17:41 green outline when the flow is active in 17:44 that area which is a good sign um at the 17:47 end we'll have our generated image all 17:50 from a workflow created from scratch now 17:54 you might ask why does it need so many 17:55 components to make a simple image I 17:57 might ask you back why do you need so 17:59 many Lego pieces to build a castle 18:01 consider a a real life example a desktop 18:04 PC you have the unit itself um then you 18:07 connect the power cable to the socket 18:09 connect the internet cable um to the 18:11 router which is connected to other 18:13 cables um and you also connect the the 18:16 mouse Monitor and maybe a printer all 18:18 these components are are necessary for 18:21 everything to function properly it's the 18:22 same concept here if you want control 18:24 over the workflow you need more 18:27 components to build exactly what you 18:28 want I was curious about what's inside 18:32 this latent image node so I tried adding 18:35 a preview image node however as you can 18:39 see we cannot connect them directly 18:42 because the latent image is not 18:43 pixel-based remember we need to decode 18:46 it first so I will use the vae decode 18:49 node and uh now I can connect the image 18:53 to the preview image node as you can see 18:57 I intentionally left the vae input 19:01 disconnected so you could observe what 19:03 happens when I run this workflow when I 19:05 cue The Prompt you'll notice the other 19:07 nodes turn green but this one remains 19:10 red with a little circle around the vae 19:13 input indicating this Branch uh was uh 19:16 interrupted here and to fix it we simply 19:19 uh connect the vae to vae and try again 19:21 this is how the latent image looks you 19:25 know if I right click on it I can um 19:27 open the image in a new tab and it 19:30 appears as a gray with subtle purple 19:32 Hues um matching the size we defined in 19:35 width and height you can do the same for 19:38 the generated image with a right click 19:40 you can open save or copy the image I'll 19:43 I'll delete this part since you know 19:45 we've seen what's there and um it's not 19:48 particularly 19:49 exciting let's change the width and 19:52 height to generate a landscape ratio 19:54 image I'll adjust the values accordingly 19:57 and also create a portrait ratio image 20:00 remember to keep it around 1024 pixels 20:03 larger images can capture more details 20:06 but if they're too big you might 20:09 encounter issues like duplicate heads or 20:13 slower processing speed when you're Arrange the Nodes to Create Nice UI 20:15 constructing a complex workflow you 20:17 might find it useful to visualize how 20:19 all the nodes are connected in such 20:21 cases a node called reroot can be very 20:25 handy think of a reroot node like a 20:27 cable organizer for your computer desk 20:29 instead of having all your cables 20:31 Tangled and messy the cable organizer 20:33 reroot Noe helps you manage and direct 20:35 each cable neatly to its destination 20:38 after completing the workflow you can 20:40 arrange it to fit better on your screen 20:42 and make it more comfortable for you for 20:45 example if you're used to interfaces 20:47 like automatic 1111 or Forge you can 20:49 organize it similarly um if that's more 20:53 convenient for you in Forge um we have 20:57 the stable diffusion checkpoint which is 20:59 equivalent to the load checkpoint node 21:01 in comfy UI similarly we have the 21:03 positive and negative prompt nodes which 21:06 we can also arrange under the checkpoint 21:08 if we prefer and resize them accordingly 21:11 then we have um the sampling method 21:14 steps CFG settings as well as the width 21:18 and height parameters all of which are 21:21 uh also present in comfy UI within the 21:23 case sampler node uh additionally 21:26 there's the empty latent image node for 21:28 setting the width and height let's 21:30 remove these reroute nodes and 21:32 concentrate on the vae code we can 21:34 collapse the nodes we don't adjust 21:36 settings for I'll place it on top to 21:39 mimic the layout in Forge and position 21:42 the save image node on the right similar 21:45 to how the preview is arranged in Forge 21:48 if you don't like how the cables look in 21:50 the background you can go to settings 21:51 and choose a different link render mode 21:53 such as straight uh then close the 21:55 settings next I'll go to the manager and 21:58 click 21:59 restart after the restart the links are 22:02 now straight I'll try moving a node to 22:04 see if the link stays straight you can 22:06 also group nodes together right click on 22:08 the canvas and select add group I 22:11 suggest resizing the group before moving 22:13 it close to the nodes any node that 22:16 touches or is within the group area will 22:18 stick to that group like a super strong 22:20 magnet that pulls in any node it gets 22:24 close to creating uh an organized bundle 22:28 then I can arrange the items within that 22:30 group as I like uh I can also rename the 22:33 group now I can move all items at once 22:36 just by selecting the group instead of 22:38 individual nodes after playing around 22:41 with it for a while I managed to make it 22:43 look like this now it almost 22:45 resembles a regular interface and 22:49 doesn't look so intimidating anymore 22:51 right to change the links back to the 22:53 default style go to settings choose 22:55 spline then close from the manager 22:58 restart start the interface and voila we 23:00 have spaghetti links 23:02 again now there are custom nodes that 23:04 can combine multiple nodes into one to 23:08 make the interface even clearer but 23:11 that's for another episode I hope you 23:13 enjoyed this video please leave a like 23:15 and a comment to support my channel 23:17 thank you and see you soon with a new 23:19 episode TRADUZIR PARA O PORTUGUES E REMOVENDO OS NUMEROS QUERO CRIAR UM AUDIO COLOQUE NA SEQUENCIA CERTA
- Assistant
- User
OK
- Assistant
Ótimo! Se precisar de mais alguma coisa ou tiver mais perguntas, sinta-se à vontade para perguntar. Estou aqui para ajudar!
- User
- Assistant