Outils pour utilisateurs

Outils du site


issue202:tutoriel

Ceci est une ancienne révision du document !


This article focuses on ComfyUI, an interface to Stable Diffusion that provides greater flexibility for producing images. For some time, I was thinking there was no reason to consider the ComfyUI option - both Easy Diffusion and Automatic1111 were more than sufficient. However, as one becomes familiar with the possibilities, I began to see the advantages of ComfyUI even though it looked a bit more demanding for the user. It had also been suggested that it was developing faster than other interfaces – which may be helpful, depending on your image production needs. The most obvious visual difference is the use of nodes and connectors. Perhaps you are familiar with Blender (blender.org), and may recall it uses nodes in a similar way for the compositor function. A screenshot shows the nodes with connections with the dark default color scheme.

We will cover a few nodes in some detail, but consider how this differs from the other interfaces. They consist of what appears to be similar options – without the node and connector concept. With nodes and connectors, you make the interface reflect your needs and not hamper your creativity. ComfyUI allows you to add duplicate nodes wherever needed or add additional nodes and reroute the workflow. You can right-click on the node area and select a node to add. As an example I selected add Node, sampling, custom sampling, and samplers. The number of choices gives you a taste for the possibilities and we will use this feature in the future. Other interfaces may have additional options but the simplicity of drawing out your workflow like a map makes it both: • obvious what you are doing now, and • easier to follow when you go back to it in the future.

That said, the complexity can dramatically increase, and learning and understanding all the possible options can require much more experience.

But before we get too carried away with adding complexity to what some would think is already too complex, let’s see what it takes to make an image. Keep in mind that this is an introduction, and expanded information and initial install will be the goal next time. Let’s start with a picture I needed showing a mother helping her daughter make a pot roast.

When you first start ComfyUI, you get a generic interface which contains essentially the same interface as other “simpler” interfaces. First you determine the checkpoint to be used, which in this case is an SDXL safetensors version or sd_xl_base_1.0.safetensors. Clicking on that area of the Load Checkpoint node gives you the option of choosing from what is available. Next, as with other interfaces, you need to add appropriate descriptive text or prompt. Instead of two different areas set in the interface, ComfyUI uses a CLIP Text Encode (Prompt) node which is only differentiated by where it is connected. The yellow CLIP connection goes to two different CLIP nodes (you could rename them as Positive and Negative). Nodes can also be moved around to reflect your needs with connectors following appropriately.

It all starts to come together in the KSampler node. Conditioning outputs from the CLIP nodes in orange go to the Positive and Negative input in the KSampler. The Model output originating from the Load Checkpoint node (light purple) does the same. An Empty Latent Image node (pink), which also connects to the KSampler, allows you to determine image size and batch size for the image(s) to be created. A latent image is not a true image but essentially information that can be converted into an image.

A variety of options are available within the KSampler (also see the larger version). Sampling steps with higher numbers increase quality and time required, and a minimum of 20 is a good start. The CFG or Classifier Free Guidance scale controls how much the prompt should be followed. De-noise strength determines how much the image should change in the IMG2IMG process, zero is none and one is completely changed. Other options are available via drop-down lists. To create an image, click on the Queue Prompt button.

As it starts, you can watch it progress as each node border becomes highlighted in green. Most processing occurs in the Ksampler, now highlighted, and a thicker green line indicates progress as it moves from the left to right.

The initial result produced is a single image or batch with the 40 images shown in this case. You can select one and look at each in detail. Hopefully this introduction will entice you to try the ComfyUI interface (rather than discourage you). Next time we will address initial installation, updates, and a few additions you will want to add.

issue202/tutoriel.1708986118.txt.gz · Dernière modification : 2024/02/26 23:21 de d52fr