Contact Us
Apps Page Background Image
Learn/Course/ComfyUI Chapter1 Basic Theory and Tutorial for Beginners

FeaturedComfyUI Chapter1 Basic Theory and Tutorial for Beginners

0
0
0
mimicpc
08/05/2024
ComfyUI
Beginners
ComfyUI features a node-based interface, which significantly enhances user flexibility when working with Stable Diffusion.


If you're familiar with Stable Diffusion and have used applications like Auto1111 or Midjourney, you might have heard of ComfyUI, the most popular and powerful Stable Diffusion GUI. Unlike Auto1111, ComfyUI features a node-based interface, which significantly enhances user flexibility when working with Stable Diffusion.

In other stable diffusion applications, you are typically limited to the configurations and methods set up by the developer, with only a few adjustable parameters. However, with ComfyUI, you can create various generation processes by freely combining different functional nodes.

Installation of ComfyUI

Requirements:

  1. Python: Make sure you have Python installed on your system. You can download it from the official Python website.
  2. Git: Ensure Git is installed. You can get it from https://github.com/comfyanonymous/ComfyUI/releases

Steps to Install ComfyUI:

  1. Clone the ComfyUI Repository:
    • Open a terminal or command prompt.
    • Run the following command to clone the ComfyUI repository:

git clone https://github.com/comfyanonymous/ComfyUI.git

  • Navigate to the cloned directory

cd ComfyUI

  1. Set Up a Virtual Environment (optional but recommended):
    • Create a virtual environment:

python -m venv venv

  • Activate the virtual environment:
    • On Windows:

\venv\Scripts\activate

  • On macOS and Linux:

source venv/bin/activate

  1. Install Dependencies:
    • Install the required Python packages:

pip install -r requirements.txt

  1. Run ComfyUI:
    • Start the ComfyUI application:

python app.py

  1. Access the Interface:
    • Open your web browser and go to http://localhost:5000 to access the ComfyUI interface.

Additional Notes:

  • If you encounter any issues during installation, make sure you have the necessary permissions and that your Python and Git installations are correctly set up.
  • Regularly update your ComfyUI installation by navigating to the ComfyUI directory and running:

git pull

pip install -r requirements.txt

By following these steps, you should be able to install and run ComfyUI on your system.

If you use Mimicpc, it's all done for you!

https://www.mimicpc.com/?co-from=HN%3Futm_source%3Dstartuptile.com


How to Operate and Build Workflow

First, let's take a look at the complete workflow interface of ComfyUI. Start by typing your prompt into the CLIP Text Encode field, then click "Queue Prompt." After that, you will be able to see the generated image.

If you click clear, all the workflows will be removed. Now Let's create the workflow node by node.

First, right-click in ComfyUI and select "Add Node." This will display various organized nodes. Then, click on "Loaders" and single-click "Load Checkpoint."

After that, you will see the Load Checkpoint node, which you can drag to any position you like. By clicking on it, you can read a checkpoint model from the model library.

After the checkpoint, add a node by right-clicking on the board and selecting "Add Node." Choose "Conditioning" and then "CLIP Text Encode (prompt)." You'll need two prompt nodes—one for positive prompts and one for negative prompts. To do this, copy and paste the same prompt node using Command + C and Command + V. Now, you'll have two prompt nodes.

However, nodes need to be connected together to function properly. When you click on "CLIP" in "Load Checkpoint," a line will appear that you can drag. This line needs to be connected to "CLIP" in the two prompt boards. Remember, only lines with the same color can be connected.

Now we should build the most important node, K sampler. Right click, Add Node, sampling and then Ksampler.

In WebUI, we set -1 as value to random the seed. However, in ComfyUI, random or not is control by this section. fixed means the seed remain unchanged while randomise means random new seed.

In WebUI, the most common sampler we used is DPM++ 2M Karras, which is DPM++ 2M sampler add Karras scheduler. Now we choose dpmpp_2m in sampler and karras in scheduler. Remeber to connect the nodes together.

Then right click, add node, latent and choose empty latent image. This enables users to adjust the width and height of final image. remember to connect the line!

We also need a image node to generate the image otherwise there will be a lot of latent but not images. Right click, add node, image, and choose save image. However, we could see the colour of Save Image node is blue, which means it cannot connected with other nodes.

Therefore, we need an adapter to transfer latent into image. You must heard of the name, VAE. Right click, add node, latent, and choose VAE decode. Then we could connect everything together.


Now enter prompt and click queue prompt, we could use this completed workflow to generate images.


ComfyUI Workflow


The best aspect of workflow in ComfyUI is its high level of portability. Workflows can be exported as complete files and shared with others, allowing them to replicate all the nodes, prompts, and parameters on their own computers.

There are three ways to duplicate a workflow:

  1. Save and Load:
    • Click "Save" to save the workflow as a file.
    • Send this file to others.
    • The recipients can then click "Load" to display the workflow on their computers.


The second method is to drag pictures into ComfyUI. Sometimes, you might only have an image of the workflow shared by others, without an accompanying file. In this case, save the picture to your computer and then drag it into ComfyUI. The workflow will be displayed automatically.


The last method is to copy text-based workflow parameters. Some developers might share their workflows as large blocks of text. Simply copy this text into ComfyUI, and the workflow will be generated.


Recommanded Workflow Website

  1. Comfy Workflows: https://comfyworkflows.com/

  1. Openart.AI:https://openart.ai/workflows/all

  1. Civitai:https://civitai.com/models


Now that you have learned how to create a basic workflow, follow us to explore more features of ComfyUI together.



Catalogue