Update README.md
Browse files
README.md
CHANGED
|
@@ -24,17 +24,29 @@ This repository contains an unified ControlNet for FLUX.1-dev model released by
|
|
| 24 |
|
| 25 |
# Keynotes
|
| 26 |
In comparison with [Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro),
|
| 27 |
-
- Remove mode embedding
|
| 28 |
- Improve on canny and pose, better control and aesthetics.
|
| 29 |
- Add support for soft edge. Remove support for tile.
|
| 30 |
|
| 31 |
-
|
| 32 |
# Model Cards
|
| 33 |
- This ControlNet consists of 6 double blocks and 0 single block as the same as [Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro). Mode embedding is removed.
|
| 34 |
- 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.
|
| 35 |
-
- This model supports multiple control modes, including canny, soft edge, depth, pose, gray.
|
| 36 |
- This model can be jointly used with other ControlNets.
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
# Inference
|
| 39 |
```python
|
| 40 |
import torch
|
|
@@ -48,7 +60,11 @@ controlnet = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_d
|
|
| 48 |
pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
|
| 49 |
pipe.to("cuda")
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
image = pipe(
|
| 54 |
prompt,
|
|
@@ -57,9 +73,9 @@ image = pipe(
|
|
| 57 |
height=height,
|
| 58 |
controlnet_conditioning_scale=0.7,
|
| 59 |
control_guidance_end=0.8,
|
| 60 |
-
num_inference_steps=
|
| 61 |
guidance_scale=3.5,
|
| 62 |
-
generator=torch.manual_seed(42),
|
| 63 |
).images[0]
|
| 64 |
```
|
| 65 |
|
|
|
|
| 24 |
|
| 25 |
# Keynotes
|
| 26 |
In comparison with [Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro),
|
| 27 |
+
- Remove mode embedding, has smaller model size.
|
| 28 |
- Improve on canny and pose, better control and aesthetics.
|
| 29 |
- Add support for soft edge. Remove support for tile.
|
| 30 |
|
|
|
|
| 31 |
# Model Cards
|
| 32 |
- This ControlNet consists of 6 double blocks and 0 single block as the same as [Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro](https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro). Mode embedding is removed.
|
| 33 |
- 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.
|
| 34 |
+
- This model supports multiple control modes, including canny, soft edge, depth, pose, gray. You can use it just as a normal ControlNet.
|
| 35 |
- This model can be jointly used with other ControlNets.
|
| 36 |
|
| 37 |
+
# Showcases
|
| 38 |
+
|
| 39 |
+
<table>
|
| 40 |
+
<tr>
|
| 41 |
+
<td><img src="./images/canny.png" alt="canny" style="width:100%"></td>
|
| 42 |
+
<td><img src="./images/softedge.png" alt="softedge" style="width:100%"></td>
|
| 43 |
+
<td><img src="./images/pose.png" alt="pose" style="width:100%"></td>
|
| 44 |
+
<td><img src="./images/depth.png" alt="depth" style="width:100%"></td>
|
| 45 |
+
<td><img src="./images/gray.png" alt="gray" style="width:100%"></td>
|
| 46 |
+
</tr>
|
| 47 |
+
</table>
|
| 48 |
+
|
| 49 |
+
|
| 50 |
# Inference
|
| 51 |
```python
|
| 52 |
import torch
|
|
|
|
| 60 |
pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
|
| 61 |
pipe.to("cuda")
|
| 62 |
|
| 63 |
+
# replace with other conds
|
| 64 |
+
control_image = load_image("./conds/canny.png")
|
| 65 |
+
width, height = control_image.size
|
| 66 |
+
|
| 67 |
+
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."
|
| 68 |
|
| 69 |
image = pipe(
|
| 70 |
prompt,
|
|
|
|
| 73 |
height=height,
|
| 74 |
controlnet_conditioning_scale=0.7,
|
| 75 |
control_guidance_end=0.8,
|
| 76 |
+
num_inference_steps=30,
|
| 77 |
guidance_scale=3.5,
|
| 78 |
+
generator=torch.Generator(device="cuda").manual_seed(42),
|
| 79 |
).images[0]
|
| 80 |
```
|
| 81 |
|