Flux installation and usage guide, another popular AI painting project

Flux has become very popular recently, and the portraits have become more realistic and delicate. Can you tell that these pictures are generated by AI?

33667d3cj00si92il0083d000gd00dcm

You can even precisely control the text you generate, such as writing on your hands and paper: I am not real.

dd109c73j00si92in00lud000sg00sgm

Whether it is a single person or multiple people, it is difficult to find flaws in facial lighting, skin texture, and hair.

a88a78e2j00si92in00qed000u000jim

Such realistic pictures can be easily generated using Flux:

de4d2201j00si92ii0020d000u000fem

todayStep-by-step instruction, teach you how to use Flux.

First experience with Flux

Robin Rombach, a former core member of Stability AI, founded a new company: "Black Forest Labs" and received $32 million in financing.

Flux is their work. The Black Forest Labs Flux.1 model family includes the following three variants:

  • Flux.1 [pro]: This is the top version of Flux.1, providing state-of-the-art image generation performance, but the model is not open source;
  • Flux.1 [dev]: open source model, but not commercially available;
  • Flux.1 [schnell]: This is the fastest model in the Flux.1 model family, optimized for local development and personal use.

Currently, ComfyUI has integrated Flux, and the experience can be deployed on ComfyUI.

So today's tutorial is divided into two parts, ComfyUI installation and Flux installation.

1. Installation of ComfyUI

The installation of ComfyUI is very simple. Open the releases address:

https://github.com/comfyanonymous/ComfyUI/releases

You can see the latest startup package and download it.

677f76eaj00si92im005yd000u000l2m

You can see these files, double-click run_nvidia_gpu.bat to start ComfyUI.

d3b94f55j00si92ij000td000ih007vm

If you don't have an N card, you can use run_cpu.bat to start ComfyUI using only the CPU.

After running successfully, it will automatically open the usage page, like this:

8e8be2e2j00si92il003ld000u000fem

To use ComfyUI, you must install a plug-in, ComfyUI-Manager.

The installation method is very simple. We open a computer and enter the root directory of the ComfyUI project:

terminal

93fa82f9j00si92im003md000u000f8m

You can see that my ComfyUI is stored in the directory. Then we go to the custom_nodes directory and use the command:

F:\Code\ComfyUI_windows_portable

cd .\ComfyUI\custom_nodes\

Like this:

e0ad17caj00si92im004sd000u000f8m

Then clone the ComfyUI-Manager project locally and use the command:

git clone https://github.com/ltdrdata/ComfyUI-Manager.git

Then restart ComfyUI and you can see the Manager in the lower right corner:

7d4b2c06j00si92im003yd000u000ggm

This means that ComfyUI is ready.

2. Flux

ComfyUI has provided a deployment tutorial for Flux. This is a demo:

https://comfyanonymous.github.io/ComfyUI_examples/flux/

We need to download 4 things in total:

  • t5xxl_fp16.safetensors: placed in the ComfyUI/models/clip/ directory
  • clip_l.safetensors: placed in the ComfyUI/models/clip/ directory
  • ae.safetensors: placed in the ComfyUI/models/vae/ directory
  • flux1-dev.safetensors: placed in the ComfyUI/models/unet/ directory

Download t5xxl_fp16.safetensors and clip_l.safetensors:

https://huggingface.co/comfyanonymous/flux_text_encoders/tree/main

t5xxl is divided into fp16 and fp8. If your memory exceeds 32GB, use fp16. If not, use fp8.

b0ce4f4ej00si92il002id000pq00e8m

ae.safetensors and flux1-dev.safetensors download address:

https://huggingface.co/black-forest-labs/FLUX.1-dev/tree/main

0a5514d5j00si92im005wd000u000g6m

If the GPU performance is insufficient or the video memory is insufficient, you can use the quantized version of the fp8 model, which will be much faster. Download address:

https://huggingface.co/Kijai/flux-fp8/tree/main

e890d62bj00si92ik0033d000u00093m

Just put these 4 models into the corresponding directories.

Finally, let's download an official picture:

https://comfyanonymous.github.io/ComfyUI_examples/flux/flux_dev_example.png

Be sure to use this link, download the image.

We open ComfyUI and drag this picture into ComfyUI:

57f2acd1j00si92im004md000u000fem

You will find that you have opened the entire node workflow of Flux:

d8df84f4j00si92im005gd000u000gcm

This is because the image not only stores the information of the image itself, but also the information of each node in the workflow.

We click the Queue Prompt to run the entire workflow:

e5d1af0ej00si92im005ed000u000fem

Wait a moment and you will see the generated image:

a4c2570ej00si92ii002bd000u000fem

I have an RTX 4090. After loading the model, I only run the Clip Text Encode part. For a 1024*1024 image, it takes about 20 seconds to run one image.

This is the official workflow of ComfyUI. You can also use Flux workflows published by other authors, such as this one:

https://openart.ai/workflows/shark_better_98/realism-no-lora/3EhdlEU8Edh3xgjYsIQD

This is a realistic character workflow, we choose to download:

484eca72j00si92im00bhd000u000hem

A json file will be downloaded, which contains the workflow information.

Let's drag the json file into ComfyUI:

7a283d4bj00si92ii001wd000u000fem

The workflow is updated:

90e32ad2j00si92im005ed000u000fem

If some nodes areRed, in an error state, like this:

2cecf254j00si92ii000id0006z006bm

That means you need to install the corresponding plug-in. Click Manager -> Install Missing Custom Nodes to install the missing nodes:

63c212ebj00si92im005kd000u000fem

This can solve most of the red nodes. If there are still red errors, it means that the Manager tool does not include this. You can install it through the URL. For example, the ComfyUI-Saveaswebp node cannot be installed through the Manager.

Then you can go to Github and search for the address of ComfyUI-Saveaswebp:

https://github.com/Kaharos94/ComfyUI-Saveaswebp

You can select Manager->Install via Git URL to install this tool:

4849dc31j00si92im0060d000u000fem

If it prompts that it is unsafe, you can directly open custom_nodes\ComfyUI-Manager\config.ini

7313c9f8j00si92im00bdd000u000llm

Just change security_level = weak.

After all configurations are completed, click Queue Prompt to run the workflow.

25fe148dj00si92ii002ad000u000fem

The effect is still very amazing!

The final generated image can also be combined with the video generation method to further generate AI video.

If many people like the content of this issue, I will continue to release some tutorials on how to make Flux combined with AI videos.

statement:The content of the source of public various media platforms, if the inclusion of the content violates your rights and interests, please contact the mailbox, this site will be the first time to deal with.
TutorialEncyclopedia

AI painting tutorial, use Stable Diffusion to teach you how to turn pictures into illustrations in one minute

2024-8-15 10:35:43

Encyclopedia

How to register and use Midjourney? Midjourney registration and usage tutorial

2024-8-16 12:24:44

Zenium
Search