Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# FLUX.1-dev Controlnet
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
<img src="./images/image_demo.jpg" width = "800" />
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
Diffusers version: until the next Diffusers pypi release,
|
| 12 |
+
please install Diffusers from source and use [this PR](https://github.com/huggingface/diffusers/pull/9126) to be able to use FLUX controlnet.
|
| 13 |
+
TODO: change when new version.
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
# Demo
|
| 19 |
+
```python
|
| 20 |
+
import torch
|
| 21 |
+
from diffusers.utils import load_image
|
| 22 |
+
from diffusers.pipelines.flux.pipeline_flux_controlnet import FluxControlNetPipeline
|
| 23 |
+
from diffusers.models.controlnet_flux import FluxControlNetModel
|
| 24 |
+
|
| 25 |
+
controlnet_model = 'InstantX/FLUX.1-dev-Controlnet-Canny-alpha'
|
| 26 |
+
controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=torch.bfloat16)
|
| 27 |
+
pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
|
| 28 |
+
pipe.to("cuda")
|
| 29 |
+
|
| 30 |
+
control_image = load_image("https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Canny-alpha/resolve/main/canny.jpg")
|
| 31 |
+
prompt = "A girl in city, 25 years old, cool, futuristic"
|
| 32 |
+
image = pipe(
|
| 33 |
+
prompt,
|
| 34 |
+
control_image=control_image,
|
| 35 |
+
controlnet_conditioning_scale=0.6,
|
| 36 |
+
num_inference_steps=28,
|
| 37 |
+
guidance_scale=3.5,
|
| 38 |
+
).images[0]
|
| 39 |
+
image.save("image.jpg")
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
## Limitation
|
| 44 |
+
The current weights are trained on 512x512, but inference can still be performed on non-512 sizes.
|
| 45 |
+
The latest 1024 + multi-scale model is under training, and it will be synchronized and open-sourced on HF afterwards.
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|