clementchadebec
commited on
Commit
•
ba672b0
1
Parent(s):
b7dcb67
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model:
|
3 |
+
- black-forest-labs/FLUX.1-dev
|
4 |
+
library_name: diffusers
|
5 |
+
license_name: flux-1-dev-non-commercial-license
|
6 |
+
license_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
|
7 |
+
pipeline_tag: image-to-image
|
8 |
+
tags:
|
9 |
+
- ControlNet
|
10 |
+
---
|
11 |
+
# ⚡ Flux.1-dev: Depth ControlNet ⚡
|
12 |
+
|
13 |
+
This is [Flux.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) ControlNet for Surface Normals map developped by Jasper research team.
|
14 |
+
|
15 |
+
<p align="center">
|
16 |
+
<img style="width:700px;" src="examples/showcase.jpg">
|
17 |
+
</p>
|
18 |
+
|
19 |
+
# How to use
|
20 |
+
This model can be used directly with the `diffusers` library
|
21 |
+
|
22 |
+
```python
|
23 |
+
import torch
|
24 |
+
from diffusers.utils import load_image
|
25 |
+
from diffusers import FluxControlNetModel
|
26 |
+
from diffusers.pipelines import FluxControlNetPipeline
|
27 |
+
|
28 |
+
# Load pipeline
|
29 |
+
controlnet = FluxControlNetModel.from_pretrained(
|
30 |
+
"jasperai/Flux.1-dev-Controlnet-Surface-Normals",
|
31 |
+
torch_dtype=torch.bfloat16
|
32 |
+
)
|
33 |
+
pipe = FluxControlNetPipeline.from_pretrained(
|
34 |
+
"black-forest-labs/FLUX.1-dev",
|
35 |
+
controlnet=controlnet,
|
36 |
+
torch_dtype=torch.bfloat16
|
37 |
+
)
|
38 |
+
|
39 |
+
|
40 |
+
# Load a control image
|
41 |
+
control_image = load_image(
|
42 |
+
"https://huggingface.co/jasperai/Flux.1-dev-Controlnet-Surface-Normals/resolve/main/examples/depth.jpg"
|
43 |
+
)
|
44 |
+
|
45 |
+
prompt = "a statue of a gnome in a field of purple tulips"
|
46 |
+
|
47 |
+
image = pipe(
|
48 |
+
prompt,
|
49 |
+
control_image=control_image,
|
50 |
+
controlnet_conditioning_scale=0.6,
|
51 |
+
num_inference_steps=28,
|
52 |
+
guidance_scale=3.5,
|
53 |
+
height=control_image.size[1],
|
54 |
+
width=control_image.size[0]
|
55 |
+
).images[0]
|
56 |
+
image
|
57 |
+
```
|
58 |
+
|
59 |
+
<p align="center">
|
60 |
+
<img style="width:500px;" src="examples/output.jpg">
|
61 |
+
</p>
|
62 |
+
|
63 |
+
💡 Note: You can compute the conditioning map using the `NormalBaeDetector` from the `controlnet_aux` library
|
64 |
+
|
65 |
+
# Training
|
66 |
+
This model was trained with depth maps computed with [Clipdrop's surface normals estimator model](https://clipdrop.co/apis/docs/portrait-surface-normals) as well as an open-souce surface normals estimation model such as Boundary Aware Encoder (BAE).
|
67 |
+
|
68 |
+
# Licence
|
69 |
+
The licence under the Flux.1-dev model applies to this model.
|