MCPcopy Index your code
hub / github.com/modelscope/DiffSynth-Studio / example_3

Function example_3

examples/ControlNet/flux_controlnet.py:63–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61
62
63def example_3():
64 model_manager = ModelManager(torch_dtype=torch.bfloat16, model_id_list=["FLUX.1-dev", "InstantX/FLUX.1-dev-Controlnet-Union-alpha"])
65 pipe = FluxImagePipeline.from_model_manager(model_manager, controlnet_config_units=[
66 ControlNetConfigUnit(
67 processor_id="canny",
68 model_path="models/ControlNet/InstantX/FLUX.1-dev-Controlnet-Union-alpha/diffusion_pytorch_model.safetensors",
69 scale=0.3
70 ),
71 ControlNetConfigUnit(
72 processor_id="depth",
73 model_path="models/ControlNet/InstantX/FLUX.1-dev-Controlnet-Union-alpha/diffusion_pytorch_model.safetensors",
74 scale=0.3
75 ),
76 ])
77
78 image_1 = pipe(
79 prompt="a cat is running",
80 height=1024, width=1024,
81 seed=4
82 )
83 image_1.save("image_5.jpg")
84
85 image_2 = pipe(
86 prompt="sunshine, a cat is running",
87 controlnet_image=image_1,
88 height=1024, width=1024,
89 seed=5
90 )
91 image_2.save("image_6.jpg")
92
93
94def example_4():

Callers 1

flux_controlnet.pyFile · 0.70

Calls 4

ModelManagerClass · 0.90
saveMethod · 0.80
from_model_managerMethod · 0.45

Tested by

no test coverage detected