Wiki source code of Flux.1 Bild KI

Version 3.1 by René Schmidt on 2025/03/26 21:11

Show last authors
1 [[Tutorial>>url:https://sandner.art/articles/tutorial/]]
2
3
4 Git Repo zum nachschauen.................[[https:~~/~~/github.com/comfyanonymous/ComfyUI>>https://github.com/comfyanonymous/ComfyUI]]
5
6 = Fast Hyperrealism with FLUX.1: Local Generation Guide =
7
8 [[Daniel Sandner >>url:https://sandner.art/authors/daniel-sandner/]]August 16, 2024
9
10 FLUX.1 is suite of text-to-image models using novel functional approach to image synthesis. FLUX is creation of AI researchers from The Black Forest Team (VQGAN, Latent Diffusion, Stable Diffusion XL, SVD). FLUX.1  offers better text render, better details and compositions, and improvements in rendering anatomy. In this article we will install FLUX.1 (schnell) for local image generation (you may use the tutorial also to install the //dev //version).
11
12 * [[Introduction and System Requirements>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#introduction-andandnbspsystem-requirements]]
13 * [[Portable Setup of ComfyUI>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#portable-setup-of-comfyui]]
14 ** [[Download and Installation>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#download-and-installation]]
15 ** [[Adjusting System Paths>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#adjusting-system-paths]]
16 ** [[Running ComfyUI and Updating>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#running-comfyui-and-updating]]
17 ** [[Installing ComfyUI-Manager>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#installing-comfyui-manager]]
18 ** [[GGUF: Installing Support for GGUF Format Models and Encoders for Portable ComfyUI>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#gguf-installing-support-for-gguf-format-models-and-encoders-for-portable-comfyui]]
19 * [[FLUX.1>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#flux1]]
20 ** [[Needed Files/Models>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#needed-filesmodels]]
21 ** [[Workflows>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#workflows]]
22 ** [[FLUX.1 LoRAs>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#flux1-loras]]
23 ** [[FLUX.1 ControlNet>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#flux1-controlnet]]
24 ** [[Using X-LABS (flux-dev,) Controlnets in ComfyUI>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#using-x-labs-flux-dev-controlnets-in-comfyui]]
25 * [[Forge UI Supports FLUX.1 >>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#forge-ui-supports-flux1andnbsp]]
26 * [[Conclusion>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#conclusion]]
27 * [[References>>url:https://sandner.art/fast-hyperrealism-with-flux1-local-generation-guide/#references]]
28
29 == Introduction and System Requirements ==
30
31 You'll need an SDXL-capable machine. All workflows in this article were tested on an NVIDIA RTX A4000 with 16GB VRAM (system has 64GB RAM). I recommend at least 16GB VRAM for optimal performance of FLUX.1 (schnell), the more memory the better. FLUX.1 (Pro) version is more resource hungry and is available as an API at the time being.
32
33 If you are already using ComfyUI or SWARM, you may jump directly to FLUX.1 files download.[[image:https://sandner.art/media/posts/74/flux-sd-sandner-article.jpg||alt="FLUX generative AI model photorealism and stylized hyperrealistic portraits" height="683" width="2048"]]
34
35 FLUX excels at hyperrealistic details and produces notably improved hand poses out of the box.
36
37 == Portable Setup of ComfyUI ==
38
39 === Download and Installation ===
40
41 * Download Portable ComfyUI from here: [[https:~~/~~/github.com/comfyanonymous/ComfyUI/releases>>url:https://github.com/comfyanonymous/ComfyUI/releases]]
42 * Unzip in your target folder. Download 7zip from here: [[www.7-zip.org/>>url:https://www.7-zip.org/]]
43
44 === Adjusting System Paths ===
45
46 If you are just starting your AI generation journey, just put your downloaded models into proper ComfyUI folders. If you have models already downloaded for A1111 or SWARM installations, you do not need to download or duplicate those files.
47
48 * Find the file //**extra_model_paths.yaml.example**// in your ComfyUI, rename it to **extra_model_paths.yaml. Then open the .yaml file and add:**
49 * In "a111: base_path:" section add the path to your models, f.i. C:/stable-diffusion-webui
50 * At the end of the section (after controlnet: models/ControlNetentry), add two lines (needed for FLUX workflows):
51 * unet: models/unet
52 clip: models/clip
53
54 === Running ComfyUI and Updating ===
55
56 You will run Portable ComfyUI with run_nvidia_gpu.bat. You may update to the latest version in the future with //**update/update_comfyui.bat**//.
57
58 === Installing ComfyUI-Manager ===
59
60 For an effective work with various nodes, install ComfyUI-Manager (it will appear as the **Manager** button in ComfyUI main menu)
61
62 * Install git (you probably have it already)
63 * Go to **ComfyUI/custom_nodes directory.**
64 * **From there, run cmd command to open the terminal**
65 * **Enter **git clone https:~/~/github.com/ltdrdata/ComfyUI-Manager.git
66 * If you restart ComfyUI after the installation finishes (usually couple of seconds), ComfyUI-Manager should be ready.[[image:https://sandner.art/media/posts/74/FLUX-realism.jpg||alt="FLUX.1 schnell: Fast realism in details" height="700" width="2100"]]
67
68 FLUX.1: Realism in details
69
70 === GGUF: Installing Support for GGUF Format Models and Encoders for Portable ComfyUI ===
71
72 Currently ComfyUI does not support GGUF format yet. You can install custom nodes from here [[https:~~/~~/github.com/city96/ComfyUI-GGUF>>url:https://github.com/city96/ComfyUI-GGUF]]  (this way you can use GGUF dev and schnell quantized models for speed and lower filesize. Simplest installation for ComfyUI Portable:
73
74 * go to your Comfy folder where run_nvidia_gpu.bat resides
75 * run terminal cmd from this folder with the command:
76
77 {{{git clone https://github.com/city96/ComfyUI-GGUF ComfyUI/custom_nodes/ComfyUI-GGUF
78 .\python_embeded\python.exe -s -m pip install -r .\ComfyUI\custom_nodes\ComfyUI-GGUF\requirements.txt}}}
79
80 Now you can use custom GGUF nodes Unet Loader(GGUF) for models and DualCLIPLoader(GGUF) for encoders. Check examples in my test workflows [[https:~~/~~/github.com/sandner-art/ai-research/tree/main/FLUX>>url:https://github.com/sandner-art/ai-research/tree/main/FLUX]]
81
82 == FLUX.1 ==
83
84 === Needed Files/Models ===
85
86 1. Download text encoders [[https:~~/~~/huggingface.co/comfyanonymous/flux_text_encoders/tree/main>>url:https://huggingface.co/comfyanonymous/flux_text_encoders/tree/main]] . Files **clip_l.safetensors** and **t5xxl_fp8_e4m3fn.safetensors** will work with the provided workflows.The files will go to folder **models/clip**.
87 Alternative text encoders for better text rendering in the image are here: [[https:~~/~~/huggingface.co/zer0int/CLIP-GmP-ViT-L-14/tree/main >>url:https://huggingface.co/zer0int/CLIP-GmP-ViT-L-14/tree/main]] (try ViT-L-14-TEXT-detail-improved-hiT-GmP-TE-only-HF or ViT-L-14-TEXT-detail-improved-hiT-GmP-HF.
88 1. Download VAE [[https:~~/~~/huggingface.co/black-forest-labs/FLUX.1-schnell/tree/main/vae>>url:https://huggingface.co/black-forest-labs/FLUX.1-schnell/tree/main/vae]] The file **diffusion_pytorch_model.safetensors** (rename it as you want) will go to folder **models/VAE**.
89 1. Download the FLUX.1 model [[https:~~/~~/huggingface.co/Kijai/flux-fp8/tree/main>>url:https://huggingface.co/Kijai/flux-fp8/tree/main]] The file **flux1-schnell-fp8.safetensors** will go to folder **models/unet**. You may, of course, experiment with the development (dev) version as well.
90
91 Note that the **main model goes to models/unet folder** (not the usual Stable Diffusion folder). If there is no unet folder in your SD models path, make unet folder manually).
92
93 === Workflows ===
94
95 Run ComfyUI. Download the images or workflow from the test folder  [[https:~~/~~/github.com/sandner-art/ai-research/tree/main/FLUX>>url:https://github.com/sandner-art/ai-research/tree/main/FLUX]] and drag+drop into ComfyUI workplace in the browser. This will load the node workflow into ComfyUI.
96
97 If you see some red nodes indicating an error, install missing nodes with ComfyUI-Manager. Open the **MANAGER** button from the menu and use "Install Missing Custom Nodes".
98
99 === FLUX.1 LoRAs ===
100
101 FLUX.1 test LoRAs [[https:~~/~~/huggingface.co/XLabs-AI/flux-lora-collection/tree/main>>url:https://huggingface.co/XLabs-AI/flux-lora-collection/tree/main]] Workflows in references.
102
103 === FLUX.1 ControlNet ===
104
105 ControlNet  Collections [[https:~~/~~/huggingface.co/XLabs-AI/flux-controlnet-collections/tree/main>>url:https://huggingface.co/XLabs-AI/flux-controlnet-collections/tree/main]] . Workflows in references.
106
107 === Using X-LABS (flux-dev,) Controlnets in ComfyUI ===
108
109 For the XLABS test workflows to work, you need to put Controlnets models into the folder \ComfyUI\models\xlabs\controlnets, otherwise the workflow will not find the models!
110
111 == Forge UI Supports FLUX.1 ==
112
113 You may run FLUX models also in A1111 Forge now, check [[this article for more details>>url:https://sandner.art/flux1-in-forge-ui-setup-guide-with-sdsdxl-tips/]].[[image:https://sandner.art/media/posts/74/FLUX-sandner-art.jpg||alt="FLUX.1 (schnell) image generation for free on local machine" height="683" width="2048"]]
114
115 FLUX.1 (schnell)
116
117
118
119 = ComfyUI Manager =
120
121
122 **ComfyUI-Manager** is an extension designed to enhance the usability of [[ComfyUI>>url:https://github.com/comfyanonymous/ComfyUI]]. It offers management functions to **install, remove, disable, and enable** various custom nodes of ComfyUI. Furthermore, this extension provides a hub feature and convenience functions to access a wide range of information within ComfyUI.
123
124 [[~[~[image:https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/refs/heads/Main/ComfyUI-Manager/images/dialog.jpg~|~|alt="menu"~]~]>>url:https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/refs/heads/Main/ComfyUI-Manager/images/dialog.jpg]]
125
126 == NOTICE ==
127
128
129 * V3.16: Support for uv has been added. Set use_uv in config.ini.
130 * V3.10: double-click feature is removed
131 ** This feature has been moved to [[https:~~/~~/github.com/ltdrdata/comfyui-connection-helper>>url:https://github.com/ltdrdata/comfyui-connection-helper]]
132 * V3.3.2: Overhauled. Officially supports [[https:~~/~~/comfyregistry.org/>>url:https://comfyregistry.org/]].
133 * You can see whole nodes info on [[ComfyUI Nodes Info>>url:https://ltdrdata.github.io/]] page.
134
135 == Installation ==
136
137
138 === Installation[method1] (General installation method: ComfyUI-Manager only) ===
139
140
141 To install ComfyUI-Manager in addition to an existing installation of ComfyUI, you can follow the following steps:
142
143 1. goto ComfyUI/custom_nodes dir in terminal(cmd)
144 1. git clone https:~/~/github.com/ltdrdata/ComfyUI-Manager comfyui-manager
145 1. Restart ComfyUI
146
147 == Conclusion ==
148
149 FLUX.1's potential is truly impressive. Even as a base model, it generates astonishingly detailed images that often surpass expectations. While prompt engineering requires a bit more finesse due to the model's tendency towards hyperrealism, the quality is undeniable. The combination of specific details and careful style guidance is key.
150
151 Also the chronic pain of SD models—generating hands and limbs—is considerably better (even at quite crazy angles and poses).  However, character interaction with objects is not so great yet.
152
153 As we will surely see a fast evolution with custom LoRAs and finetuned versions of the base model, it seems most text-to-image models have found its contender.
154
155 You can test FLUX.1 (Schnell, Dev, Pro) on Civitai, and also train LoRAs for FLUX.1 there.
156
157 == References ==
158
159 * Link to ComfyUI GitHub repository [[https:~~/~~/github.com/comfyanonymous/ComfyUI>>url:https://github.com/comfyanonymous/ComfyUI]]
160 * Link to FLUX models [[https:~~/~~/huggingface.co/black-forest-labs>>url:https://huggingface.co/black-forest-labs]]
161 * Blackforest.ai, creator of FLUX [[https:~~/~~/blackforestlabs.ai/>>url:https://blackforestlabs.ai/]]
162 * Announcement  [[https:~~/~~/blackforestlabs.ai/announcing-black-forest-labs/>>url:https://blackforestlabs.ai/announcing-black-forest-labs/]]
163 * My test FLUX workflows [[https:~~/~~/github.com/sandner-art/ai-research/tree/main/FLUX>>url:https://github.com/sandner-art/ai-research/tree/main/FLUX]]
164 * FLUX workflows (various) [[https:~~/~~/openart.ai/workflows/all?keyword=flux>>url:https://openart.ai/workflows/all?keyword=flux]]
165 * FLUX Weights [[https:~~/~~/huggingface.co/silveroxides/flux1-nf4-weights/tree/main>>url:https://huggingface.co/silveroxides/flux1-nf4-weights/tree/main]]
166 * GGUF T5 encoders [[https:~~/~~/huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/tree/main>>url:https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/tree/main]]
167 * GGUF DEV + SCHNELL version [[https:~~/~~/huggingface.co/city96>>url:https://huggingface.co/city96]]
168 * ComfyUI GGUF [[https:~~/~~/github.com/city96/ComfyUI-GGUF>>url:https://github.com/city96/ComfyUI-GGUF]]