Update README.md
Browse files
README.md
CHANGED
@@ -18,14 +18,15 @@ tags:
|
|
18 |
base_model: black-forest-labs/FLUX.1-dev
|
19 |
---
|
20 |
|
21 |
-
# FLUX.1-dev-ControlNet-
|
22 |
|
23 |
-
This repository contains an unified ControlNet for FLUX.1-dev model jointly
|
24 |
|
25 |
# Model Cards
|
26 |
- This checkpoint is a Pro version of [FLUX.1-dev-Controlnet-Union](https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Union).
|
27 |
- This model support 7 control modes, including canny (0), tile (1), depth (2), blur (3), pose (4), gray (5), low quality (6).
|
28 |
- The recommended controlnet_conditioning_scale is 0.3-0.7.
|
|
|
29 |
|
30 |
|
31 |
# Showcases
|
@@ -36,9 +37,56 @@ This repository contains an unified ControlNet for FLUX.1-dev model jointly trai
|
|
36 |
|
37 |
|
38 |
# Inference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
```python
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
```
|
42 |
|
43 |
# Acknowledgements
|
44 |
-
This project is sponsored by [Shakker AI](https://www.shakker.ai/). All copyright reserved.
|
|
|
18 |
base_model: black-forest-labs/FLUX.1-dev
|
19 |
---
|
20 |
|
21 |
+
# FLUX.1-dev-ControlNet-Union-Pro
|
22 |
|
23 |
+
This repository contains an unified ControlNet for FLUX.1-dev model jointly released by researchers from [InstantX Team](https://huggingface.co/InstantX) and [Shakker Labs](https://huggingface.co/Shakker-Labs).
|
24 |
|
25 |
# Model Cards
|
26 |
- This checkpoint is a Pro version of [FLUX.1-dev-Controlnet-Union](https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Union).
|
27 |
- This model support 7 control modes, including canny (0), tile (1), depth (2), blur (3), pose (4), gray (5), low quality (6).
|
28 |
- The recommended controlnet_conditioning_scale is 0.3-0.7.
|
29 |
+
- This model can be jointly used with other ControlNets.
|
30 |
|
31 |
|
32 |
# Showcases
|
|
|
37 |
|
38 |
|
39 |
# Inference
|
40 |
+
Please install `diffusers` from the source, as the PR has not been included in currently released version yet.
|
41 |
+
|
42 |
+
# Multi-Controls Inference
|
43 |
+
```python
|
44 |
+
import torch
|
45 |
+
from diffusers.utils import load_image
|
46 |
+
|
47 |
+
from diffusers import FluxControlNetPipeline, FluxControlNetModel, FluxMultiControlNetModel
|
48 |
+
|
49 |
+
base_model = 'black-forest-labs/FLUX.1-dev'
|
50 |
+
controlnet_model_union = './Shakker-Labs/FLUX.1-dev-Controlnet-Union'
|
51 |
+
|
52 |
+
controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_dtype=torch.bfloat16)
|
53 |
+
controlnet = FluxMultiControlNetModel([controlnet_union]) # we always recommend loading via FluxMultiControlNetModel
|
54 |
+
|
55 |
+
pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
|
56 |
+
pipe.to("cuda")
|
57 |
+
|
58 |
+
prompt = 'a young girl'
|
59 |
+
control_image_depth = load_image("https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Union/resolve/main/images/depth.jpg")
|
60 |
+
control_mode_depth = 2
|
61 |
+
|
62 |
+
control_image_canny = load_image("https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Union/resolve/main/images/canny.jpg")
|
63 |
+
control_mode_canny = 0
|
64 |
+
|
65 |
+
width, height = control_image.size
|
66 |
+
|
67 |
+
image = pipe(
|
68 |
+
prompt,
|
69 |
+
control_image=[control_image_depth, control_image_canny],
|
70 |
+
control_mode=[control_mode_depth, control_mode_canny],
|
71 |
+
width=width,
|
72 |
+
height=height,
|
73 |
+
controlnet_conditioning_scale=[0.5, 0.5],
|
74 |
+
num_inference_steps=24,
|
75 |
+
guidance_scale=3.5,
|
76 |
+
generator=torch.manual_seed(42),
|
77 |
+
).images[0]
|
78 |
+
```
|
79 |
+
|
80 |
+
We also support loading multiple ControlNets as before, you can load as
|
81 |
```python
|
82 |
+
controlnet_model_union = './Shakker-Labs/FLUX.1-dev-Controlnet-Union'
|
83 |
+
controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_dtype=torch.bfloat16)
|
84 |
+
|
85 |
+
controlnet_model_depth = './Shakker-Labs/FLUX.1-dev-Controlnet-Depth'
|
86 |
+
controlnet_depth = FluxControlNetModel.from_pretrained(controlnet_model_depth, torch_dtype=torch.bfloat16)
|
87 |
+
|
88 |
+
controlnet = FluxMultiControlNetModel([controlnet_union, controlnet_depth])
|
89 |
```
|
90 |
|
91 |
# Acknowledgements
|
92 |
+
This project is trained by [InstantX Team](https://huggingface.co/InstantX) and sponsored by [Shakker AI](https://www.shakker.ai/). All copyright reserved.
|