0:00
hello I'm starting a new series of
0:01
tutorials on stable diffusion AI using
0:03
the comfy UI interface every day I'm
0:06
learning more about it and uh I'll share
0:08
the things I've learned with you you
0:10
know I'll explain it from a graphic
0:12
designer's perspective in a way that's
0:14
easy to understand so anyone can use it
0:17
I'll structure it into episodes allowing
0:19
you to watch in a certain order and
0:21
progress from beginner to Advanced in
0:25
this first episode I'll discuss what
0:27
comfy UI is and its advantages and
0:30
disadvantages then we'll quickly go
0:32
through the installation process
0:35
download different models so by the end
0:37
of this video you'll be able to generate
0:39
your first image for free using your own
0:41
computer when it comes to stable
0:43
diffusion there are multiple interfaces
0:45
to choose from each with its own
0:47
characteristics some are easier to use
0:49
While others are more complex or faster
0:52
popular interfaces include automatic
0:54
1111 Forge UI invoke and today's Focus
0:58
comfy UI
1:00
comfy UI is a user interface framework
1:03
that lets you create and manage
1:05
workflows by visually connecting
1:07
different tasks um much like building
1:09
with Lego blocks each block or node
1:12
represents a specific function and by
1:15
connecting them you can easily construct
1:17
complex processes advantages of using
1:20
comfy UI comfy UI lets you create
1:23
workflows quickly and flexibly without
1:25
being limited by preset options each
1:28
node shows a specific function making it
1:30
easy to see the entire process you can
1:33
easily share your workflows um and use
1:35
ones made by others promoting
1:37
collaboration comfy UI requires no
1:39
coding just drag and drop nodes to
1:42
create and customize workflows for your
1:44
needs downsides of using comfy UI the
1:47
organization of nodes and comfy UI can
1:49
vary between workflows um which can be
1:52
confusing when using other people's
1:54
setups the detailed view of processes
1:56
might overwhelm uh average users who
1:59
prefer simpl
2:00
despite no coding requirements there is
2:02
a learning curve to effectively use
2:05
nodes and build workflows complex
2:07
workflows can affect performance um
2:10
slowing down your computer if it doesn't
2:11
meet system requirements despite these
2:14
downsides comfy UI remains a strong and
2:16
versatile tool uh for creating and
2:19
managing workflows especially for users
2:21
who need detailed control once you have
2:23
your workflow set up it is fast and
2:25
efficient initially I avoided comfy UI
2:28
because it seemed too complex with all
2:30
the
2:31
nodes but after spending a few days with
2:35
some
2:36
tutorials I started to appreciate its
2:39
capabilities so let's start with the
Installing ComfyUI on Windows
2:41
installation um you can visit the GitHub
2:43
page for comy UI in the feature section
2:47
you'll find everything it can do such as
2:49
stable diffusion video stable audio and
2:52
other supported features there's also a
2:55
list of shortcuts um available finally
2:58
you'll find the installation
2:59
instructions I have Windows operating
3:01
system and an Nvidia RTX 4090 card so
3:05
I'll demonstrate the installation for
3:07
Windows and Nvidia if you have a
3:09
different operating system or graphics
3:11
card you can find installation
3:14
instructions below for those systems for
3:16
system requirements you'll need a recent
3:18
operating system and the more vram your
3:21
video card has the faster it will
3:23
generate especially if it's from the RTX
3:26
series therefore Nvidia cards are
3:29
preferred for for their speed I tested
3:31
it on a 6 GB vram video card and it
3:35
worked okay but not very quickly so I
3:38
would recommend opting for an Nvidia
3:39
card with at least 8 gigabyte of vram or
3:41
more and ensure you have 16 gigabyte of
3:44
ram in your system for a smoother
3:46
workflow for Windows it's quite
3:49
straightforward you just need to click
3:50
on the direct download link for the
3:53
portable version and choose a folder
3:55
where you want to store it I'll choose
3:56
to put it on my D drive and create a
3:59
folder named comfy UI the archive is in
4:02
7z format and you can extract it using
4:04
szip you can find a download link here
4:07
or in my case I have WinRAR and we'll
4:10
use that to extract it now let's
4:13
navigate into that newly extracted
4:15
folder you'll notice it indicates that
4:17
it's portable inside you'll find several
4:20
dobat files and a readme file that you
4:24
should read the readme file explains
4:26
which dobat file you need to run
4:28
depending on what you want to do for
4:30
Optimal Performance use Nvidia GPU
4:33
because it's much faster than the CPU
4:35
and the redmi file also includes
4:37
additional information such as where to
4:39
place the models and other relevant
4:41
details double click on the Run Nvidia
4:44
GPU dobat file and a command window will
4:47
open and this will launch the comfy UI
4:49
you can view here details about your
4:51
graphics card including how much vam and
4:53
RAM you have once it finishes a new
4:56
browser window will automatically open
4:59
display playing The Comfy UI interface
5:03
you can use the mouse wheel to zoom in
5:05
or out or you can use shortcuts like alt
5:07
plus and ALT minus you can move the
5:09
canvas around by clicking on it and
5:11
dragging or you can press the space bar
5:14
uh and move the cursor you can also
5:16
click on nodes and drag them around
5:18
arrange the interface so that it fits
5:20
your screen comfortably those little
5:22
rectangular windows are called nodes in
5:24
comfy UI you connect these nodes to load
5:27
models input text create images
5:30
and save your work in a step-by-step
5:32
process the lines between nodes show how
5:34
information moves between them
5:36
connecting each part of your work
5:38
together the Q prompt button in comfy UI
5:41
adds your current image generation task
5:43
to a list allowing multiple tasks to run
5:46
one after another automatically um if I
5:49
click on it it should generate an image
5:52
uh but instead I get an error first of
5:54
all when you encounter an error it's
5:56
helpful to look at which nodes the error
5:58
occurred in um you can see that the load
6:00
checkpoint node has a red outline and
6:03
the message says value is not in the
6:05
list which means it couldn't find that
6:07
specific checkpoint with that name on
6:09
our computer if I click on that list and
6:11
try to select a model um you'll notice I
6:14
can't find one because I haven't
6:16
downloaded any checkpoints for this to
6:18
work therefore we need a stable
6:20
diffusion model there in order for it to
Downloading and Placing Models
6:22
work properly the easiest way to get
6:24
models is to visit the civit AI website
6:27
there you'll find a tab labeled model
6:30
click on it to see various types of
6:31
models what I like to do is sort them by
6:34
highest rating or most downloads you can
6:37
also use filters to select a specific
6:39
time period like a week or a month for
6:42
file format I prefer safe tensor because
6:45
it's safer than the ckpt format uh the
6:48
most popular models are typically v1.5
6:51
sdxl and recently sd3 I will select an
6:56
sdxl model which is the one I usually
6:59
use let's go to the search and look for
7:01
Juggernaut models here we have a few
7:04
options this one is the sdxl version and
7:08
this one is the v1.5 version I'll choose
7:11
the XL version and you can see there are
7:14
different versions available such as um
7:17
the hyper version however I prefer
7:19
version X because in my opinion it
7:21
offers better quality let's download
7:23
this model by clicking on the download
7:25
button with the down arrow icon after
7:27
that you need to place it in a specific
7:29
folder navigate to The Comfy UI folder
7:31
then locate the models directory inside
7:34
there's a folder named checkpoints where
7:36
you store all your stable diffusion
7:38
models um regardless of the version
7:41
click save and wait for the download to
7:44
complete since it's quite large around 6
7:47
GB it will take some time to finish
7:49
downloading let's download an SD v1.5
7:52
model as well suitable for those with
7:54
less powerful video cards to generate
7:56
images faster at lower sizes you can go
7:59
to the filters and select only v1.5
8:01
models or you can search for Juggernaut
8:04
again and choose the v1.5 version the
8:07
latest version is called reborn so you
8:09
can download that one before downloading
8:12
make sure to check for um the base model
8:15
label to ensure it's the correct base
8:17
model for example if it says
8:19
v1.5 it's crucial to use the same base
8:22
model across all your models this is
8:25
important because features like control
8:27
net will only work with you know the
8:30
same base model type for v1.5 models
8:33
you'll need v1.5 control net and related
8:36
extensions while sdxl models will
8:39
require corresponding sdxl components
8:41
and extensions for now it's important to
8:44
understand that the base model exists
8:47
and what type it is I'll talk more about
8:48
it in future episodes so don't stress to
8:51
much click download and place it in the
8:53
same U checkpoints folder as the
8:57
previous model if you check other models
9:00
you'll notice that each one specifies
9:02
its base model often with different
9:04
versions from various dates generally
9:07
newer versions have undergone more
9:08
training and provide better quality so
9:11
you'll likely prefer the latest version
9:14
if I quickly navigate to comfy UI then
9:16
go to models and checkpoints you'll see
9:19
that the download isn't finished yet
9:21
it's still in progress if I skip ahead a
9:24
few minutes both models the reborn and X
9:27
versions are now here and ready the
9:29
installation of comfy UI isn't
9:31
complicated at all you simply download
9:33
comfy and the model and you're done I
9:36
could have made a two-minute video
9:37
showing just that however I prefer to
9:40
explain each step in detail so you have
9:42
a better understanding of what's
9:43
happening this way you'll be able to do
9:46
more than just clicking generate and
9:49
getting an image you'll understand how
9:51
to use it effectively if you try to load
Generating Your First Image
9:53
the newly downloaded model and nothing
9:55
happens it's likely because the comfy UI
9:57
was already open and when we downloaded
10:00
the model in this case you need to click
10:02
on refresh and now you should see the
10:05
models appear in the list both the
10:07
reborn and X versions should be visible
10:10
now I'll select the sdxl version I will
10:12
resize the node to see the model name
10:14
better you can only adjust it from uh
10:16
the bottom right corner after resizing
10:18
you can then move the node into place
10:20
now if I try to generate again using the
10:23
Q prompt you'll notice that we have a
10:26
green outline around this checkpoint
10:28
note um but that's not all you can
10:30
follow the flow to the next node and see
10:33
that it's also green if each node turns
10:36
green all the way to the end it means
10:38
the image was successfully generated
10:41
however if any nodes turn red there's a
10:43
problem that needs to be addressed and
10:45
for this prompt here is the result now
10:48
I'll choose the other model the reborn
10:50
version to see if it works I'll click on
10:52
Q prompt as you can see the flow moves
10:56
quickly from one node to the next you'll
10:57
notice in the command window that it
10:59
generated in just a few seconds the
11:01
first time may take longer um because
11:04
it's also loading the new model um if I
11:06
generate again you'll see it only took
11:08
one second for a 5 on 12 pixel image in
11:11
the next episode I'll provide more
11:14
detailed explanations of what each node
11:16
does but for now here's the short
11:19
version this workflow uh loads the model
11:22
using the uh load checkpoint node it
11:25
encodes the positive prompt where we
11:27
describe what we want like a glass
11:29
bottle and the negative prompt with
11:31
words you want to avoid like Watermark
11:33
using two clip text and code prompt
11:36
nodes these encoded prompts are then fed
11:39
into the case sampler node which adjusts
11:42
parameters such as seed steps and CFG to
11:46
generate a latent image based on these
11:48
inputs the latent image is decoded using
11:51
the vae decode node and the final step
11:54
involves saving the generated image with
11:57
the save image node each model performs
12:00
best with specific settings and many
12:02
models come with recommended
12:05
configurations if we return to the model
12:07
page and scroll down um clicking on show
12:11
more reveals all the details here you'll
12:13
find information such as recommended
12:15
image size number of steps and other
12:19
relevant settings these details help
12:21
optimize the
12:22
performance of each model according to
12:25
its
12:26
specifications as you can see here it
12:28
indicates
12:30
512x 768 pixels for the image width and
12:34
height the v1.5 base models were trained
12:37
on images sized 512 by 512 pixels you
12:42
can go slightly larger up to 768 pixels
12:45
but exceeding this might cause the model
12:47
to interpret the image as 2 512 pixel
12:49
images resulting in double heads and
12:52
various distortions so we can create
12:55
Square landscape and portrait images as
12:58
long as they are closed
13:00
to those values let's try the portrait
13:03
orientation look for the empty latent
13:06
image node and here you can enter the
13:09
width and height I will use 768 for the
13:12
height and press okay let's see what
13:15
else we have here it mentions um sampler
13:18
DPM plus plus 2m caras so we'll look for
13:22
sampler in the list we can find it here
13:25
although it doesn't have two plus signs
13:28
but it has two PS so it's essentially
13:32
the same but with a different name
13:34
however we don't have Caris in the name
13:36
instead Caris is placed under um Schuler
13:40
in uh in the next field so where it says
13:43
schedular normal um we replace normal
13:46
with Caris um it also mentions steps 35
13:49
and cfg7 so we'll add those values as
13:53
well since we're testing things out
13:55
let's also try their example if I look
13:57
where the images are
13:59
um and click on the I button I can see
14:03
the prompts and settings used to
14:05
generate that image I can copy the
14:08
positive prompt and paste it into my
14:10
positive prompt field and do the same
14:12
for the negative prompt you'll notice
14:15
the settings are the same only the seat
14:17
is fixed but I'll leave mine random when
14:20
I cue The Prompt I get this beautiful
14:22
portrait image not bad for a v1.5
14:27
model uh let me try a few more Times Yes
14:29
it seems to be working just fine now
Saving and Loading Workflows
14:32
that we've configured all the settings
14:33
and everything is working well we don't
14:36
want to set up these configurations
14:37
every time instead we can save the
14:39
entire workflow so we can return to it
14:41
later or you know share it with others
14:44
click on Save and save it in a location
14:48
where you can easily find it again I
14:51
recommend creating a workflows folder
14:54
somewhere on your drive for organization
14:57
uh give it a descriptive name so you
14:59
know what it's all about and and there
15:02
you have it you've created um your
15:04
working
15:05
v1.5 um workflow for this specific model
15:09
let's go to the sdxl model page for the
15:13
Juggernaut version XR 10 and uh click on
15:16
show more here we have recommended
15:20
settings for both the normal version and
15:22
the hyper version since we downloaded
15:24
the normal version we'll use the
15:26
settings for that one now let's load
15:29
that sdxl model into our comfy UI
15:35
interface I prefer the sdxl model over
15:38
v1.5 because now I can create 1024px
15:41
images if you enter values for width and
15:43
height around that number it should work
15:45
fine the sampler steps and CFG settings
15:50
um are similar to the other Juggernaut
15:52
model so I'll leave those the
15:54
same I'll copy the positive and negative
15:57
prompts from one of the examples to see
15:59
what we can get since the image width
16:02
and height are larger it will take
16:05
longer to
16:07
generate however the image quality is
16:09
better in my
16:10
opinion so now we have a working
16:14
workflow for sdxl as well we can save
16:17
this workflow to preserve all the
16:18
settings for later I'll give it a name
16:20
that I'll remember now that the workflow
16:23
is saved we can clear the current
16:25
workflow using the clear button using
16:28
the load button we can load other
16:30
workflows for example I can load the um
16:33
reborn version if I want or I can click
16:36
load again to get the sdxl version
16:38
workflow everything works fine now as
16:42
you can see I can test it quickly and it
16:44
works great let me show you where the
16:47
generated images are saved you can
16:49
navigate to The Comfy UI folder then
16:52
into uh the output folder here you'll
16:55
find all the images that have been
16:57
generated um another cool feature is
17:00
that these images embed the workflow
17:02
information so if you drag an image into
17:05
the comfy UI interface it will load the
17:07
workflow used to generate that
17:09
image for example um this image was uh
17:14
generated with reborn and it contains
17:18
the uh positive and negative prompts as
17:21
well as the settings if I drag another
17:23
image you'll see that the settings are
17:25
different for that
17:26
image if we want to close comfy UI we
17:30
can simply close the command window uh
17:32
you'll notice in the interface it says
17:34
reconnecting but if you refresh nothing
17:36
will be
17:37
there let me show you another thing uh
17:39
first I'll delete the zip archive we use
17:42
to um extract comfy UI to save some
17:45
space then to make it easier for us to
17:48
start comfy UI without navigating to the
17:51
folder uh we can create a shortcut for
17:53
it right click on the Run Nvidia GPU bat
17:57
file then go to send to and choose
18:00
desktop this will create a shortcut on
18:02
the desktop for it now if we go to the
18:05
desktop we can give it a better name
18:07
like comfy UI right click on it and
18:09
select properties then click on change
18:13
icon click okay and you can select an
18:16
icon from there such as a star perhaps
18:18
click okay and then
18:20
apply um let's see if it
18:22
works double click on it and yes it's
18:25
loading the command window and now we
18:27
have the last interface we used so now
18:29
we can clear the workflow and create one
18:32
from scratch I'll show you how to do
18:33
that in the next episode you can load
18:35
the default
18:37
workflow um but for now let's load the
18:39
sdxl workflow and test it with a cute
18:44
cartoon house the house looks
18:46
cute if you want to do more such as
Installing ComfyUI Manager
18:48
loading other people's workflows or
18:50
installing custom nodes you'll need a
18:53
manager for that called comfy UI manager
18:56
and you can find it on the GitHub page
18:58
page and I highly recommend getting it
19:02
just follow these instructions to
19:03
install it navigate to The Comfy UI
19:06
folder then go to custom nodes in the
19:09
address bar type acmd and press enter
19:12
this will open a command window next
19:15
copy the text from step two and paste it
19:17
into the command window then uh press
19:19
enter this action um will uh clone or
19:24
copy the custom node uh which we refer
19:27
to as the manager into your folder wait
19:30
for the process to finish then you can
19:32
close the command window to restart
19:34
comfy UI close the command window and
19:37
reopen um The Comfy UI interface the
19:40
first time you do this it will perform
19:42
some initial setup tasks such as
19:44
installing the necessary components for
19:46
the manager to function which are called
19:48
dependencies because it relies on them
19:51
and now you will notice in the bottom
19:53
right corner you have a button called
19:56
manager if you click on it you can see
19:59
it has more options and buttons from
20:02
here you can update everything or just
20:05
the comfy UI for example if I click on
20:08
it you can see in the command window
20:11
that it is checking for updates uh when
20:15
it's done you'll see a successful update
20:17
message in the
20:19
interface also next time you need to
20:22
restart just go to manager and hit
20:25
restart instead of closing the command
20:28
window and trying to reopen it it will
20:31
handle everything for you and open a new
20:34
tab with a fresh interface one useful
20:37
feature is that if you install a
20:39
workflow from someone else that includes
20:42
custom nodes not on your computer you
20:44
can click on install missing nodes here
20:47
you'll see all the missing node names
20:49
listed uh with the option to install
20:51
them on the right in the next episode
20:54
I'll demonstrate how to build a workflow
20:56
from scratch and understand its
20:57
components I'll explain what each node
21:00
means how to add them move them connect
21:02
them and more if you find this helpful
21:05
please leave a like thank you for
21:06
watching
21:12
[Music] traduza para o portuugues e reescreva tirando os numeros de tempo quero criar um audio