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