Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
a4f9c3cb
"src/vscode:/vscode.git/clone" did not exist on "bcdfbfd57c8f3cd6cd65998464bb71a562d49948"
Unverified
Commit
a4f9c3cb
authored
Apr 24, 2025
by
Ishan Modi
Committed by
GitHub
Apr 23, 2025
Browse files
[Feature] Added Xlab Controlnet support (#11249)
update
parent
4b60f4b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
22 deletions
+29
-22
src/diffusers/pipelines/flux/pipeline_flux_controlnet_image_to_image.py
...pipelines/flux/pipeline_flux_controlnet_image_to_image.py
+29
-22
No files found.
src/diffusers/pipelines/flux/pipeline_flux_controlnet_image_to_image.py
View file @
a4f9c3cb
...
...
@@ -800,6 +800,9 @@ class FluxControlNetImg2ImgPipeline(DiffusionPipeline, FluxLoraLoaderMixin, From
)
height
,
width
=
control_image
.
shape
[
-
2
:]
# xlab controlnet has a input_hint_block and instantx controlnet does not
controlnet_blocks_repeat
=
False
if
self
.
controlnet
.
input_hint_block
is
None
else
True
if
self
.
controlnet
.
input_hint_block
is
None
:
control_image
=
retrieve_latents
(
self
.
vae
.
encode
(
control_image
),
generator
=
generator
)
control_image
=
(
control_image
-
self
.
vae
.
config
.
shift_factor
)
*
self
.
vae
.
config
.
scaling_factor
...
...
@@ -819,7 +822,9 @@ class FluxControlNetImg2ImgPipeline(DiffusionPipeline, FluxLoraLoaderMixin, From
elif
isinstance
(
self
.
controlnet
,
FluxMultiControlNetModel
):
control_images
=
[]
for
control_image_
in
control_image
:
# xlab controlnet has a input_hint_block and instantx controlnet does not
controlnet_blocks_repeat
=
False
if
self
.
controlnet
.
nets
[
0
].
input_hint_block
is
None
else
True
for
i
,
control_image_
in
enumerate
(
control_image
):
control_image_
=
self
.
prepare_image
(
image
=
control_image_
,
width
=
width
,
...
...
@@ -831,6 +836,7 @@ class FluxControlNetImg2ImgPipeline(DiffusionPipeline, FluxLoraLoaderMixin, From
)
height
,
width
=
control_image_
.
shape
[
-
2
:]
if
self
.
controlnet
.
nets
[
0
].
input_hint_block
is
None
:
control_image_
=
retrieve_latents
(
self
.
vae
.
encode
(
control_image_
),
generator
=
generator
)
control_image_
=
(
control_image_
-
self
.
vae
.
config
.
shift_factor
)
*
self
.
vae
.
config
.
scaling_factor
...
...
@@ -955,6 +961,7 @@ class FluxControlNetImg2ImgPipeline(DiffusionPipeline, FluxLoraLoaderMixin, From
img_ids
=
latent_image_ids
,
joint_attention_kwargs
=
self
.
joint_attention_kwargs
,
return_dict
=
False
,
controlnet_blocks_repeat
=
controlnet_blocks_repeat
,
)[
0
]
latents_dtype
=
latents
.
dtype
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment