Run this model with HF Jobs
Run ChuuniZ/comfyui-image-models on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ChuuniZ/comfyui-image-models. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ChuuniZ/comfyui-image-models on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ChuuniZ/comfyui-image-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ChuuniZ/comfyui-image-models with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ChuuniZ/comfyui-image-models", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload controlnet/FLUX.1/FLUX.1-dev-ControlNet-Union-Pro-2.0/README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154---license: otherlicense_name: flux-1-dev-non-commercial-licenselicense_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
language: - enlibrary_name: diffuserspipeline_tag: text-to-image
tags:- Text-to-Image- ControlNet- Diffusers- Flux.1-dev- image-generation- Stable Diffusionbase_model: black-forest-labs/FLUX.1-dev---
# FLUX.1-dev-ControlNet-Union-Pro-2.0
This repository contains an unified ControlNet for FLUX.1-dev model released by [Shakker Labs](https://huggingface.co/Shakker-Labs). We provide an [online demo](https://huggingface.co/spaces/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0). A FP8 quantized version provided by community can be found in [ABDALLALSWAITI/FLUX.1-dev-ControlNet-Union-Pro-2.0-fp8](https://huggingface.co/ABDALLALSWAITI/FLUX.1-dev-ControlNet-Union-Pro-2.0-fp8).
# KeynotesIn comparison with [Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro),- Remove mode embedding, has smaller model size.- Improve on canny and pose, better control and aesthetics.- Add support for soft edge. Remove support for tile.
# Model Cards- This ControlNet consists of 6 double blocks and 0 single block. Mode embedding is removed.- We train the model from scratch for 300k steps using a dataset of 20M high-quality general and human images. We train at 512x512 resolution in BFloat16, batch size = 128, learning rate = 2e-5, the guidance is uniformly sampled from [1, 7]. We set the text drop ratio to 0.20.- This model supports multiple control modes, including canny, soft edge, depth, pose, gray. You can use it just as a normal ControlNet.- This model can be jointly used with other ControlNets.
# Showcases
<table> <tr> <td><img src="./images/canny.png" alt="canny" style="height:100%"></td> </tr> <tr> <td><img src="./images/softedge.png" alt="softedge" style="height:100%"></td> </tr> <tr> <td><img src="./images/pose.png" alt="pose" style="height:100%"></td> </tr> <tr> <td><img src="./images/depth.png" alt="depth" style="height:100%"></td> </tr> <tr> <td><img src="./images/gray.png" alt="gray" style="height:100%"></td> </tr></table> # Inference```pythonimport torchfrom diffusers.utils import load_imagefrom diffusers import FluxControlNetPipeline, FluxControlNetModel
base_model = 'black-forest-labs/FLUX.1-dev'controlnet_model_union = 'Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0'
controlnet = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_dtype=torch.bfloat16)pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)pipe.to("cuda")
# replace with other condscontrol_image = load_image("./conds/canny.png")width, height = control_image.size
prompt = "A young girl stands gracefully at the edge of a serene beach, her long, flowing hair gently tousled by the sea breeze. She wears a soft, pastel-colored dress that complements the tranquil blues and greens of the coastal scenery. The golden hues of the setting sun cast a warm glow on her face, highlighting her serene expression. The background features a vast, azure ocean with gentle waves lapping at the shore, surrounded by distant cliffs and a clear, cloudless sky. The composition emphasizes the girl's serene presence amidst the natural beauty, with a balanced blend of warm and cool tones."
image = pipe( prompt, control_image=control_image, width=width, height=height, controlnet_conditioning_scale=0.7, control_guidance_end=0.8, num_inference_steps=30, guidance_scale=3.5, generator=torch.Generator(device="cuda").manual_seed(42),).images[0]```
# Multi-Inference```pythonimport torchfrom diffusers.utils import load_image
# https://github.com/huggingface/diffusers/pull/11350# You can directly import from diffusers by install the laster version from source# from diffusers import FluxControlNetPipeline, FluxControlNetModel
# use local files for this momentfrom pipeline_flux_controlnet import FluxControlNetPipelinefrom controlnet_flux import FluxControlNetModel
base_model = 'black-forest-labs/FLUX.1-dev'controlnet_model_union = 'Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0'
controlnet = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_dtype=torch.bfloat16)pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=[controlnet], torch_dtype=torch.bfloat16) # use [] to enable multi-CNspipe.to("cuda")
# replace with other condscontrol_image = load_image("./conds/canny.png")width, height = control_image.size
prompt = "A young girl stands gracefully at the edge of a serene beach, her long, flowing hair gently tousled by the sea breeze. She wears a soft, pastel-colored dress that complements the tranquil blues and greens of the coastal scenery. The golden hues of the setting sun cast a warm glow on her face, highlighting her serene expression. The background features a vast, azure ocean with gentle waves lapping at the shore, surrounded by distant cliffs and a clear, cloudless sky. The composition emphasizes the girl's serene presence amidst the natural beauty, with a balanced blend of warm and cool tones."
image = pipe( prompt, control_image=[control_image, control_image], # try with different conds such as canny&depth, pose&depth width=width, height=height, controlnet_conditioning_scale=[0.35, 0.35], control_guidance_end=[0.8, 0.8], num_inference_steps=30, guidance_scale=3.5, generator=torch.Generator(device="cuda").manual_seed(42),).images[0]```
# Recommended ParametersYou can adjust controlnet_conditioning_scale and control_guidance_end for stronger control and better detail preservation. For better stability, we highly suggest to use detailed prompt, for some cases, multi-conditions help.- Canny: use cv2.Canny, controlnet_conditioning_scale=0.7, control_guidance_end=0.8.- Soft Edge: use [AnylineDetector](https://github.com/huggingface/controlnet_aux), controlnet_conditioning_scale=0.7, control_guidance_end=0.8.- Depth: use [depth-anything](https://github.com/DepthAnything/Depth-Anything-V2), controlnet_conditioning_scale=0.8, control_guidance_end=0.8.- Pose: use [DWPose](https://github.com/IDEA-Research/DWPose/tree/onnx), controlnet_conditioning_scale=0.9, control_guidance_end=0.65.- Gray: use cv2.cvtColor, controlnet_conditioning_scale=0.9, control_guidance_end=0.8.
# Resources- [InstantX/FLUX.1-dev-IP-Adapter](https://huggingface.co/InstantX/FLUX.1-dev-IP-Adapter)- [InstantX/FLUX.1-dev-Controlnet-Canny](https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Canny)- [Shakker-Labs/FLUX.1-dev-ControlNet-Depth](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Depth)- [Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro)
# AcknowledgementsThis model is developed by [Shakker Labs](https://huggingface.co/Shakker-Labs). The original idea is inspired by [xinsir/controlnet-union-sdxl-1.0](https://huggingface.co/xinsir/controlnet-union-sdxl-1.0). All copyright reserved.
# CitationIf you find this project useful in your research, please cite us via```@misc{flux-cn-union-pro-2, author = {Shakker-Labs}, title = {ControlNet-Union}, year = {2025}, howpublished={\url{https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0}},}```controlnet/FLUX.1/FLUX.1-dev-ControlNet-Union-Pro-2.0/README.mdAdded+154