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
fengzch-das
nunchaku
Commits
3bef6f22
Unverified
Commit
3bef6f22
authored
May 11, 2025
by
SMG
Committed by
GitHub
May 11, 2025
Browse files
fix : fbcache with controlNet (#360)
parent
da7059b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
nunchaku/caching/utils.py
nunchaku/caching/utils.py
+11
-9
No files found.
nunchaku/caching/utils.py
View file @
3bef6f22
...
@@ -390,19 +390,21 @@ class FluxCachedTransformerBlocks(nn.Module):
...
@@ -390,19 +390,21 @@ class FluxCachedTransformerBlocks(nn.Module):
original_dtype
=
hidden_states
.
dtype
original_dtype
=
hidden_states
.
dtype
original_device
=
hidden_states
.
device
original_device
=
hidden_states
.
device
hidden_states
=
hidden_states
.
to
(
self
.
dtype
).
to
(
self
.
device
)
hidden_states
=
hidden_states
.
to
(
self
.
dtype
).
to
(
original_
device
)
encoder_hidden_states
=
encoder_hidden_states
.
to
(
self
.
dtype
).
to
(
self
.
device
)
encoder_hidden_states
=
encoder_hidden_states
.
to
(
self
.
dtype
).
to
(
original_
device
)
temb
=
temb
.
to
(
self
.
dtype
).
to
(
self
.
device
)
temb
=
temb
.
to
(
self
.
dtype
).
to
(
original_
device
)
image_rotary_emb
=
image_rotary_emb
.
to
(
self
.
device
)
image_rotary_emb
=
image_rotary_emb
.
to
(
original_
device
)
if
controlnet_block_samples
is
not
None
:
if
controlnet_block_samples
is
not
None
:
controlnet_block_samples
=
(
controlnet_block_samples
=
(
torch
.
stack
(
controlnet_block_samples
).
to
(
self
.
device
)
if
len
(
controlnet_block_samples
)
>
0
else
None
torch
.
stack
(
controlnet_block_samples
).
to
(
original_device
)
if
len
(
controlnet_block_samples
)
>
0
else
None
)
if
controlnet_single_block_samples
is
not
None
and
len
(
controlnet_single_block_samples
)
>
0
:
controlnet_single_block_samples
=
(
torch
.
stack
(
controlnet_single_block_samples
).
to
(
original_device
)
if
len
(
controlnet_single_block_samples
)
>
0
else
None
)
)
if
controlnet_single_block_samples
:
controlnet_single_block_samples
=
torch
.
stack
(
controlnet_single_block_samples
).
to
(
self
.
device
)
else
:
controlnet_single_block_samples
=
None
assert
image_rotary_emb
.
ndim
==
6
assert
image_rotary_emb
.
ndim
==
6
assert
image_rotary_emb
.
shape
[
0
]
==
1
assert
image_rotary_emb
.
shape
[
0
]
==
1
...
...
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