InstantX/FLUX.1-dev-Controlnet-Canny
1972.6k
1---2license: other3license_name: flux-1-dev-non-commercial-license4license_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md5tags:6- Text-to-Image7- ControlNet8- Diffusers9- Stable Diffusion10base_model: black-forest-labs/FLUX.1-dev11---12 13# FLUX.1-dev Controlnet14 15We have completed the training of the first version. 16The training was conducted with a total pixel count of `1024*1024` at multi-scale. 17We trained for 30k steps using a batch size of 8*8.18 19 20 21<img src="./images/image_demo.jpg" width = "800" />22<img src="./images/image_demo_weight.png" width = "800" />23 24 25# Diffusers version26 27Please ensure that you have installed the latest version of [Diffusers](https://github.com/huggingface/diffusers).28 29 30 31 32 33# Demo34```python35import torch36from diffusers.utils import load_image37from diffusers.pipelines.flux.pipeline_flux_controlnet import FluxControlNetPipeline38from diffusers.models.controlnet_flux import FluxControlNetModel39 40base_model = 'black-forest-labs/FLUX.1-dev'41controlnet_model = 'InstantX/FLUX.1-dev-Controlnet-Canny'42controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=torch.bfloat16)43pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)44pipe.to("cuda")45 46control_image = load_image("https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Canny/resolve/main/canny.jpg")47prompt = "A girl in city, 25 years old, cool, futuristic"48image = pipe(49 prompt, 50 control_image=control_image,51 controlnet_conditioning_scale=0.6,52 num_inference_steps=28, 53 guidance_scale=3.5,54).images[0]55image.save("image.jpg")56```57 58 59 60 61 62 63 64 