FLUX 1 将像 Stable Diffusion 一样完整支持ControlNet组件

之前 InstantX 团队做的多合一的 Flux ControlNet 现在开始和 ShakkerAI 合作并推出了:Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro

该模型支持 7 种控制模式,包括 canny (0), tile (1), depth (2), blur (3), pose (4), gray (5) 和 low quality (6),并且还能和其他 ControlNet 一起使用。

模型卡片

  • 该 checkpoint 是 FLUX.1-dev-Controlnet-Union 的专业版,经过更多步骤和数据集的训练。
  • 该模型支持 7 种控制模式,包括 canny (0)、tile (1)、depth (2)、blur (3)、pose (4)、gray (5)、low quality (6)。
  • 建议 controlnet_conditioning_scale 为 0.3-0.8。
  • 该模型可与其他 ControlNets 共同使用。

效果



Multi-Controls 推理

python 复制代码
import torch
from diffusers.utils import load_image

from diffusers import FluxControlNetPipeline, FluxControlNetModel, FluxMultiControlNetModel

base_model = 'black-forest-labs/FLUX.1-dev'
controlnet_model_union = 'Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro'

controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_dtype=torch.bfloat16)
controlnet = FluxMultiControlNetModel([controlnet_union]) # we always recommend loading via FluxMultiControlNetModel

pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
pipe.to("cuda")

prompt = 'A bohemian-style female travel blogger with sun-kissed skin and messy beach waves.'
control_image_depth = load_image("https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro/resolve/main/assets/depth.jpg")
control_mode_depth = 2

control_image_canny = load_image("https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro/resolve/main/assets/canny.jpg")
control_mode_canny = 0

width, height = control_image.size

image = pipe(
    prompt, 
    control_image=[control_image_depth, control_image_canny],
    control_mode=[control_mode_depth, control_mode_canny],
    width=width,
    height=height,
    controlnet_conditioning_scale=[0.2, 0.4],
    num_inference_steps=24, 
    guidance_scale=3.5,
    generator=torch.manual_seed(42),
).images[0]

我们还支持像以前一样加载多个控制网。

python 复制代码
from diffusers import FluxControlNetModel, FluxMultiControlNetModel

controlnet_model_union = 'Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro'
controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_dtype=torch.bfloat16)

controlnet_model_depth = 'Shakker-Labs/FLUX.1-dev-Controlnet-Depth'
controlnet_depth = FluxControlNetModel.from_pretrained(controlnet_model_depth, torch_dtype=torch.bfloat16)

controlnet = FluxMultiControlNetModel([controlnet_union, controlnet_depth])

# set mode to None for other ControlNets
control_mode=[2, None]

资料

  • InstantX/FLUX.1-dev-Controlnet-Canny
  • Shakker-Labs/FLUX.1-dev-ControlNet-Depth
  • Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro
相关推荐
小K讲AI营销1 分钟前
存储定价权重构:用“产能分配“框架重估 DRAM+46%、NAND+65%
人工智能
小雨青年2 分钟前
【HarmonyOS 7开发者前瞻】10 HarmonyOS 7 真实项目适配路线图:API 26、AI / Agent 与多端改造优先级
人工智能·华为·harmonyos
半兽先生7 分钟前
大模型技术开发与应用——5.大模型Agent开发(CrewAI)
大数据·人工智能·python·机器学习·ai
aqi009 分钟前
鸿蒙版本的小小机器人APP开放源码啦
人工智能·华为·harmonyos·鸿蒙·harmony
眼泪划过的星空9 分钟前
快速了解LangGraph:构建智能Agent工作流的核心框架
人工智能·python·langchain
眞bilibili18 分钟前
如何快速无缝的从 vscode 转向AI编辑器 cursor、kiro、trae 等
人工智能·vscode·编辑器
码农小白AI20 分钟前
适配外贸出口质检标准!IACheck AI报告审核打通制造业来料成品质控壁垒
人工智能
泛泛7辈24 分钟前
通过matlab训练和验证深度学习的目标检测
深度学习·目标检测·matlab
二川bro40 分钟前
2026主流大模型横向对比:Kimi/Claude/GPT选型+网关管理实战
人工智能