ComfyUI Tutorial Series: Ep02 - Nodes and Workflow Basics

pixaroma www.youtube.com

סיכום תמציתי

הסרטון הוא מדריך למשתמש ב-ComfyUI, המתמקד בהבנת עקרונות העבודה עם נודים (Nodes) וסביבות עבודה (Workflows).

  • הסרטון מסביר את הפונקציות של נודים שונים, חיבורים ביניהם, ואפשרויות התאמה אישית.
  • מודגמת יצירת סביבת עבודה בסיסית ליצירת תמונה מטקסט (Text-to-Image) באמצעות מודל SDXL.
  • ניתנים טיפים לארגון וסידור הנודים בממשק המשתמש ליצירת סביבת עבודה נוחה ויעילה יותר.

מבוא

הסרטון הוא חלק מסדרת הדרכה ל-ComfyUI, שמטרתה להציג את יסודות הנודים וסביבות העבודה. גם אם אין כוונה ליצור סביבות עבודה באופן עצמאי, הבנת העקרונות יכולה לסייע בשינוי סביבות עבודה קיימות שהורדו ממקורות אחרים. הסרטון משתמש באנלוגיה של הכנת עוגה בהתאמה אישית כדי להסביר את תהליך יצירת התמונה מטקסט, כאשר כל נוד מייצג שלב בתהליך האפייה.

סקירה של נודים וסביבות עבודה

הסרטון מסביר את הפונקציה של כל נוד בסביבת עבודה בסיסית ליצירת תמונה מטקסט: בחירת מודל (האופה), מתן הוראות מפורטות (הנחיות חיוביות ושליליות), הכנת העוגה (דגימת K), קביעת גודל העוגה (תמונה סמויה ריקה), קישוט והכנה להגשה (פענוח VAE), ותצוגת העוגה המוגמרת (שמירת תמונה).

תפריט ComfyUI

הסרטון עובר על הפונקציות השונות בתפריט ComfyUI: כפתור "Q Prompt" מוסיף את סביבת העבודה לתור ומכין אותה ליצירת תמונה, כפתור "Save" שומר את סביבת העבודה, כפתור "Load" טוען סביבת עבודה שמורה, כפתור "Refresh" מרענן את התצוגה, כפתור "Clear" מנקה את סביבת העבודה, כפתור "Load Default" טוען את הגדרות ברירת המחדל, כפתור "Reset View" מאפס את פריסת הממשק, כפתור "Manager" פותח את מנהל ComfyUI, וכפתור "Share" מאפשר שיתוף של סביבת העבודה.

הסברים על הממשקים והנודים

הסרטון מסביר כיצד להוסיף, לבחור, להעתיק, להסיר ולשנות גודל של נודים. ניתן להוסיף נוד על ידי לחיצה כפולה על הקנבס או על ידי לחיצה ימנית ובחירה מתוך רשימה. ניתן להעתיק נוד על ידי גרירה תוך כדי לחיצה על Alt או באמצעות Ctrl+C ו-Ctrl+V. ניתן לבחור מספר נודים על ידי לחיצה על Shift או Ctrl וגרירת תיבת בחירה. הסרטון גם מסביר את המבנה של נוד: שם הנוד, נקודות חיבור כניסה ויציאה, ופרמטרים/הגדרות. חיבורים בין נודים נקראים קישורים (Links) ומאפשרים זרימת נתונים. ניתן לשנות את צבע הנוד, הכותרת והצורה שלו.

יצירה + הסבר של סביבת עבודה SDXL

הסרטון מדגים יצירת סביבת עבודה ליצירת תמונה מטקסט באמצעות SDXL. השלבים כוללים: טעינת מודל באמצעות נוד "Load Checkpoint", הוספת נוד "K Sampler" שמתחיל מרעש אקראי והופך אותו לתמונה ברורה, חיבור פלט המודל לפלט ה-"K Sampler", הוספת נוד "Clip Text Encode" ליצירת הנחיות חיוביות ושליליות, חיבור הנחיות אלה ל-"K Sampler", הוספת נוד "Empty Latent Image" לקביעת גודל התמונה, הוספת נוד "VAE Decode" לחילוץ התמונה מהמרחב הלטנטי, ונוד "Save Image" לשמירת התמונה.

ארגון הנודים ליצירת ממשק משתמש נחמד

הסרטון מציג טיפים לארגון וסידור הנודים בממשק המשתמש. ניתן להשתמש בנוד "Reroute" כדי לארגן את החיבורים בין הנודים. ניתן לסדר את הנודים בצורה שמזכירה ממשקים אחרים כמו Automatic1111 או Forge. ניתן לקפל נודים כדי לצמצם את גודלם. ניתן לשנות את סגנון הקישורים בהגדרות. ניתן לקבץ נודים יחד באמצעות "Add Group" כדי להזיז אותם יחד ולשמור על סדר.

Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the Apple Store
Get it on Google Play

Transcript

YouTube Transcript Generator

0:00 welcome to episode two of our comfy UI tutorial Series in this video I will show you the basics of nodes and workflows helping you get started with building your own projects even if you don't plan to create your own workflows maybe you download workflows from others and need to make changes so it can be useful to have an idea of how things work in episode one I demonstrated how to install and generate your first image using stable diffusion if you haven't installed comy UI or downloaded the model yet please check out that episode first this is a basic stable diffusion workflow that can generate an image from text often referred to as text to image uh to help you understand how it works

0:46 more easily I'll provide a simple analogy that will give you an idea of why it requires numerous nodes and steps to function properly I added some notes around the nodes to make it easier now imagine you're designing a custom cake at a bakery first you choose a skilled Baker the model who specializes in the type of cake you want in this case our Baker is the Juggernaut model then you give the baker detailed instructions on what you want in the cake such as vanilla flavor strawberries and whipped cream this is called the positive prompt and what to avoid like uh nuts chocolate this is called the negative prompt the baker starts preparing the cake by mixing the ingredients and baking it this is what the k sampler node does

1:33 then you decide on the size of the cake perhaps an 8 in round cake this is where we use the empty latent image node where we specify the width and height using pixels once the cake is baked the baker decorates it and prepares it for serving in this workflow we use the vae decode node for that step finally you take the completed cake home and display it on your dining table we use the save image node for that step did this analogy help you understand better the workflow let's review it quickly we select the baker you give the baker detailed instructions on what you want in the cake and what to avoid the baker starts preparing the cake by mixing the ingredients and baking it you decide on the size of the cake um once the cake is baked the baker

2:19 decorates it and prepares it for serving finally you take the completed cake home and display it on your dining table let's talk a little bit about um the interface uh the Q prompt button adds the current workflow to the queue uh which prepares your setup for image Generation Um it's like hitting start on a task list by checking extra options it reveals more advanced settings for generating images such as the number of images to create at once the batch count or automatic queuing when parameters change the save button saves the current workflow so you can load it later it's like saving a document on your computer the load button loads a previously saved workflow restoring it to your current session this is useful for reusing

3:07 workflows the refresh button updates or reloads the current view or settings ensuring you see the most recent changes the clear button clears the current workflow resetting it to a blank State the load default button loads the default settings returning the interface to its original state the reset view button resets the layout or arrangement of the interface elements to their default positions the manager button opens the comfy UI manager which is a management interface for um detail control over your projects settings and custom nodes the share button allows you to share the current project or workflow with others on different websites so save your current workflow by clicking save give it a name and store it

3:52 somewhere on your drive then click the clear button to remove everything from the screen and start fresh the area where you add nodes in comfy UI is commonly referred to as the canvas or node canvas this is the main workspace where you can create connect and manage various nodes to build your workflows you can add a new node by either double clicking for example you can search for load um and select load checkpoint which will add that node to the canvas uh you can left click on it and move it around and the second option is to rightclick on the canvas then go to add node and from the list select it from the loaders category I can select the same node load

4:38 checkpoint to select different nodes simply click on them if you press the alt button and then left click and drag it will drag a copy of that node alternatively you can use control plus C for copy and Control Plus V for paste if you right click on a note you have access to uh more options and settings you can also remove the node using the remove option or simply press the delete key uh while the node is selected sometimes you need to resize a node to make it look better you can do this by dragging from the bottom right corner resizing from other Corners won't work only that corner will allow you to resize here you have the node name and in front of it there is a small circle when you click on it it will make the

5:26 node smaller this action is often referred to as collapsing the node collapsing a node reduces it to um a more compact form which helps in managing and organizing the workspace more efficiently especially when dealing with complex workflows here are also some shortcuts you can use to select nodes remember these three control keys alt control and shift knowing these three keys is usually sufficient for most software out there if one key doesn't work try another that is what I do since I can not remember all the shortcuts uh many programs have hidden features accessible through these keys to select a single node simply click on it if you want to

6:12 move the node to a different position click on the Node and drag it to the desired location to select multiple nodes hold down the shift key and click on each node you want to select individually you can also select multiple nodes by holding down the control key and then dragging to create a selection box that encompasses is all the nodes you want to select release the mouse button to select all nodes within the box once multiple nodes are selected hold down the shift key then click and drag any of the selected nodes to move all selected nodes together let's clear the canvas and uh let me show you a few more things about the nodes I will add a few different nodes so I can explain what several key elements are composed

6:57 of uh we have the node name um that identifies the function or operation of the node uh for most nodes you can guess what they do from their names for example if load is in the name um it probably loads something like a checkpoint model in this case case sampler may not be obvious from its name but you can think of it as a family of Samplers um to make it easier to remember consider K sampler as a key component save image does exactly what it says it saves the image to your computer automatically then you have the inputs connection points where data or signals are received from other nodes for example K sampler has many inputs uh load checkpoint doesn't have any inputs and save image has one input called images next there are the outputs

7:45 connection points where data or signals are sent to other nodes K sampler has only one output named latent load checkpoint has three outputs and save image doesn't have any outputs so you cannot add more nodes after the image is saved and then have parameters or settings uh these are configurable options within the node that um control Its Behavior um and processing for example K sampler uh has settings like seed steps and CFG that you can adjust um for save image you can change the prefix value of the image name so that it starts with whatever value you add there by the way you can move this menu from the top left corner

8:30 where those tiny dots are located the connections between nodes and comfy UI are called links but you can call them whatever you like cables spaghetti these links enable data or signals to flow from the output of one node to the input of another allowing for the creation of a functional workflow so if I want to create a link between these two nodes I look at the connection points that usually have the same name and color for example here uh both nodes have um connection points named model and the color is purple this allows me to drag from purple to purple however if I try to drag to a different color it doesn't let me create the connection so

9:16 uh I will drag it to the um purple connection point and when I release the mouse uh the connection is made now you can see the link has the same color as the connection points now if you look at these two points they may look similar but in fact one is yellow and the other is orange additionally their names are clip and positive therefore you cannot make a connection between these two different types of points if you want an idea of what node you can place there you can drag and release the mouse somewhere on the canvas a menu will appear where you can add or search for a node uh the menu also suggests nodes that you can select for example if I select the the clip text and code node it creates that node and connects it in

10:01 one move when you delete that node um the connection is also deleted so the easiest way is to drag and release to get one of the suggested nodes or search for a node with a little practice you'll learn which nodes connect with each other for example with latent I can get a vae decode node then from the vae decode node I can connect the pink output with the vae from load checkpoint and so on as you can see um you cannot connect to nodes of other colors to unlink or disconnect a link from a node you simply click on the connection point and drag it away somewhere on the canvas when you release the mouse the link will will be disconnected you can also delete uh a link by left clicking on the little circle that appears on the link then

10:47 choosing delete you can also rightclick on a node and go to Colors uh where you can pick different colors to differentiate nodes that are more important additionally when you rightclick you can change the title the node for example you can rename it um to exactly describe what it does you can also change uh the shape of the node to box round or card um a a combination of both or you can leave it at the default shape Additionally you can use the resize option to um automatically adjust the node to a smaller form let's clear the workflow and start our text to image workflow for stable diffusion from scratch first let's start by loading our model we'll use the load checkpoint node

11:34 for this task and this node is straightforward it loads the pre-train model uh the checkpoint that we'll be using in our case we're using a model called Juggernaut X you'll notice that this node has three outputs model clip and vae these outputs will be useful shortly next I'll add the case sampler node this node begins with random noise and gradually turns it into um a clear image by following specific instructions and settings such as the number of steps and how strongly the instructions guide the process this helps create a final high quality image I will create a link between these two nodes connecting the output from the model um output of the low checkpoint node to the model input

12:20 of the K sampler node you see here we have a clip output clip stands for contrast of language image pre-training uh which is a machine learning model that can interpret both images and their descriptions in natural language it effectively Bridges the gap between Visual and textual data to make an analogy for what clip does it's like having a bilingual person who can understand both English and images when they see an image they form a mental summary when they read a description they also form a summary they can then compare these summaries to see if they match so if I drag and release you can see in the suggested nodes the clip text en code option if I select that I now get the clip text encode prompt where we

13:05 can input our text prompt now we need both a positive prompt and a negative prompt I can either hold down alt and drag a copy of the clip text and code node or I can search for the node labeled prompt and add it so now that we have both nodes I will connect them to the load checkpoint node as well you might wonder how the system distinguishes between um the positive and negative prompts when both nodes look the same in the case sampler node we have two inputs one for positive prompt and another for negative prompt by connecting each respective node to these inputs the system understands which prompt is positive and which is negative um to quickly distinguish between nodes many people assign colors to them for example uh we can color the

13:51 uh positive prompt node in green and the negative prompt node in red I will quickly add a positive prompt and a negative prompt so we can test them later when the workflow is ready now each checkpoint has some recommended settings that we can use in the K sampler as you saw in the first episode when we got our settings from civid AI where I downloaded this model I will add those settings here so we have another input here called latent image if we drag and release we can see options like vae encode or empty latent image it took me a while to understand this but everything that happens in the case sampler node revolves around the latent space latent space represents hidden features of data in a simplified

14:37 abstract form making it easier for models to process everything that enters this space must be latent if it's pixel data we need to encode it first to convert it into this simplified form so if I have a photo made from pixels I cannot input it directly into the case sampler we need to use vae and code first we'll explore this process in another episode to create an imageo image workflow however for text to image we need an empty latent image even when using text to generate an image the system still requires a placeholder image to work with and add noise on top to perform its task effectively as you can see we have width and height options here since we are using an sdxl model we

15:22 can create a larger image such as a 1024 pixel image so basically most of the workflow is complete we have the model the prompts and um everything entering the case sampler uh including the empty image that allows us to choose the size um theoretically the image exists in the latent space um we just need to extract it to view it remember I mentioned that everything going into and out from the latent space must be either latent or converted to get pixels since we want to visualize the pixels we use the load vae decode node to extract the image from the latent space A vae variational Auto

16:08 encoder decode node is a component in machine learning models especially in image processing that transforms latent space representations back into their original visible form think of it like compressing and decompressing a file the vae um en code node um compresses the image into a compact form latent space and the vae decode node um decompresses it back to the original image now I know from the model description that Juggernaut has vae baked in so I can simply connect uh the vae from the decoder to the vae from the load checkpoint node but if you're using another model that requires a separate um vae file you'll need to search for a

16:57 node called load vae first download the vae and place it into your model folder then into the vae folder after refreshing select the model from the list and connect it to the vae decode in my case I don't need this step so I'll just connect it back to the model now the final pixel image is here we just need to save it we could use a preview node if we want to preview the image first um and then save it with a rightclick however what I prefer to do is use a save image note now that way everything I generate is saved and I can delete what I don't need later from the output folder and that's it um let's test it to see if it works by clicking on Q prompt um you'll notice each node gets a

17:44 green outline when the flow is active in that area which is a good sign um at the end we'll have our generated image all from a workflow created from scratch now you might ask why does it need so many components to make a simple image I might ask you back why do you need so many Lego pieces to build a castle consider a a real life example a desktop PC you have the unit itself um then you connect the power cable to the socket connect the internet cable um to the router which is connected to other cables um and you also connect the the mouse Monitor and maybe a printer all these components are are necessary for everything to function properly it's the same concept here if you want control over the workflow you need more components to build exactly what you

18:32 want I was curious about what's inside this latent image node so I tried adding a preview image node however as you can see we cannot connect them directly because the latent image is not pixel-based remember we need to decode it first so I will use the vae decode node and uh now I can connect the image to the preview image node as you can see I intentionally left the vae input disconnected so you could observe what happens when I run this workflow when I cue The Prompt you'll notice the other nodes turn green but this one remains red with a little circle around the vae input indicating this Branch uh was uh

19:19 interrupted here and to fix it we simply uh connect the vae to vae and try again this is how the latent image looks you know if I right click on it I can um open the image in a new tab and it appears as a gray with subtle purple Hues um matching the size we defined in width and height you can do the same for the generated image with a right click you can open save or copy the image I'll I'll delete this part since you know we've seen what's there and um it's not particularly exciting let's change the width and height to generate a landscape ratio image I'll adjust the values accordingly and also create a portrait ratio image remember to keep it around 1024 pixels

20:06 larger images can capture more details but if they're too big you might encounter issues like duplicate heads or slower processing speed when you're constructing a complex workflow you might find it useful to visualize how all the nodes are connected in such cases a node called reroot can be very handy think of a reroot node like a cable organizer for your computer desk instead of having all your cables Tangled and messy the cable organizer reroot Noe helps you manage and direct each cable neatly to its destination after completing the workflow you can arrange it to fit better on your screen and make it more comfortable for you for example if you're used to interfaces like automatic 1111 or Forge you can

20:53 organize it similarly um if that's more convenient for you in Forge um we have the stable diffusion checkpoint which is equivalent to the load checkpoint node in comfy UI similarly we have the positive and negative prompt nodes which we can also arrange under the checkpoint if we prefer and resize them accordingly then we have um the sampling method steps CFG settings as well as the width and height parameters all of which are uh also present in comfy UI within the case sampler node uh additionally there's the empty latent image node for setting the width and height let's remove these reroute nodes and concentrate on the vae code we can collapse the nodes we don't adjust

21:39 settings for I'll place it on top to mimic the layout in Forge and position the save image node on the right similar to how the preview is arranged in Forge if you don't like how the cables look in the background you can go to settings and choose a different link render mode such as straight uh then close the settings next I'll go to the manager and click restart after the restart the links are now straight I'll try moving a node to see if the link stays straight you can also group nodes together right click on the canvas and select add group I suggest resizing the group before moving it close to the nodes any node that touches or is within the group area will stick to that group like a super strong magnet that pulls in any node it gets

22:28 close to creating uh an organized bundle then I can arrange the items within that group as I like uh I can also rename the group now I can move all items at once just by selecting the group instead of individual nodes after playing around with it for a while I managed to make it look like this now it almost resembles a regular interface and doesn't look so intimidating anymore right to change the links back to the default style go to settings choose spline then close from the manager restart start the interface and voila we have spaghetti links again now there are custom nodes that can combine multiple nodes into one to make the interface even clearer but that's for another episode I hope you

23:15 enjoyed this video please leave a like and a comment to support my channel thank you and see you soon with a new episode [Music]

Share

YouTube Video Summaries