---
title: flux-controlnet-canny-diffusers
canonical_url: "https://www.modelscope.cn/models/AI-ModelScope/flux-controlnet-canny-diffusers"
md_url: "https://www.modelscope.cn/models/AI-ModelScope/flux-controlnet-canny-diffusers.md"
repository: AI-ModelScope/flux-controlnet-canny-diffusers
last_updated: 2024-10-15
license: other
pipeline_tag: text-to-image-synthesis
tasks:
  - text-to-image-synthesis
base_model:
  - black-forest-labs/FLUX.1-dev
base_model_relation: finetune
parameters: 743.8M
tensor_type:
  - BF16
library_name:
  - pytorch
  - diffusers
  - safetensors
frameworks:
  - pytorch
language:
  - en
downloads: 1962
stars: 0
tags:
  - diffusers
  - controlnet
  - Flux
  - image-generation
---

# flux-controlnet-canny-diffusers

> flux-controlnet-canny-diffusers - AI-ModelScope 在 ModelScope 开源的模型。Description This repository provides a Diffusers version of FLUX.1-dev Canny ControlNet checkpoint by Xlabs AI, original repo.

AI-ModelScope/flux-controlnet-canny-diffusers 是 ModelScope 魔搭社区上的 743.8M 参数text-to-image-synthesis模型，采用 other 许可，基于 black-forest-labs/FLUX.1-dev 构建。

- **Repository**: AI-ModelScope/flux-controlnet-canny-diffusers
- **License**: other
- **Tasks**: text-to-image-synthesis
- **Parameters**: 743.8M
- **Base model**: black-forest-labs/FLUX.1-dev
- **Tags**: diffusers, controlnet, Flux, image-generation
- **Downloads**: 1962
- **Stars**: 0
- **Last updated**: 2024-10-15

Source: https://www.modelscope.cn/models/AI-ModelScope/flux-controlnet-canny-diffusers

---

# Description
This repository provides a Diffusers version of FLUX.1-dev Canny ControlNet checkpoint by Xlabs AI, [original repo](https://huggingface.co/XLabs-AI/flux-controlnet-canny-v3). 

![Example Picture 1](canny_result.png?raw=true)

# How to use
This model can be used directly with the diffusers library

```
import torch
from diffusers.utils import load_image
from diffusers import FluxControlNetModel
from diffusers.pipelines import FluxControlNetPipeline
from PIL import Image
import numpy as np

generator = torch.Generator(device="cuda").manual_seed(87544357)

controlnet = FluxControlNetModel.from_pretrained(
  "Xlabs-AI/flux-controlnet-canny-diffusers",
  torch_dtype=torch.bfloat16,
  use_safetensors=True,
)
pipe = FluxControlNetPipeline.from_pretrained(
  "black-forest-labs/FLUX.1-dev",
  controlnet=controlnet,
  torch_dtype=torch.bfloat16
)
pipe.to("cuda")

control_image = load_image("https://huggingface.co/Xlabs-AI/flux-controlnet-canny-diffusers/resolve/main/canny_example.png")
prompt = "handsome girl with rainbow hair, anime"

image = pipe(
    prompt,
    control_image=control_image,
    controlnet_conditioning_scale=0.7,
    num_inference_steps=25,
    guidance_scale=3.5,
    height=1024,
    width=768,
    generator=generator,
    num_images_per_prompt=1,
).images[0]

image.save("output_test_controlnet.png")
```

## License

Our weights fall under the [FLUX.1 [dev]](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md) Non-Commercial License<br/>
