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
a41e4c50
Unverified
Commit
a41e4c50
authored
Jul 18, 2024
by
Sayak Paul
Committed by
GitHub
Jul 18, 2024
Browse files
[Chore] add disable forward chunking to SD3 transformer. (#8838)
add disable forward chunking to SD3 transformer.
parent
12625c1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
src/diffusers/models/transformers/transformer_sd3.py
src/diffusers/models/transformers/transformer_sd3.py
+12
-0
No files found.
src/diffusers/models/transformers/transformer_sd3.py
View file @
a41e4c50
...
@@ -139,6 +139,18 @@ class SD3Transformer2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin, FromOrigi
...
@@ -139,6 +139,18 @@ class SD3Transformer2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin, FromOrigi
for
module
in
self
.
children
():
for
module
in
self
.
children
():
fn_recursive_feed_forward
(
module
,
chunk_size
,
dim
)
fn_recursive_feed_forward
(
module
,
chunk_size
,
dim
)
# Copied from diffusers.models.unets.unet_3d_condition.UNet3DConditionModel.disable_forward_chunking
def
disable_forward_chunking
(
self
):
def
fn_recursive_feed_forward
(
module
:
torch
.
nn
.
Module
,
chunk_size
:
int
,
dim
:
int
):
if
hasattr
(
module
,
"set_chunk_feed_forward"
):
module
.
set_chunk_feed_forward
(
chunk_size
=
chunk_size
,
dim
=
dim
)
for
child
in
module
.
children
():
fn_recursive_feed_forward
(
child
,
chunk_size
,
dim
)
for
module
in
self
.
children
():
fn_recursive_feed_forward
(
module
,
None
,
0
)
@
property
@
property
# Copied from diffusers.models.unets.unet_2d_condition.UNet2DConditionModel.attn_processors
# Copied from diffusers.models.unets.unet_2d_condition.UNet2DConditionModel.attn_processors
def
attn_processors
(
self
)
->
Dict
[
str
,
AttentionProcessor
]:
def
attn_processors
(
self
)
->
Dict
[
str
,
AttentionProcessor
]:
...
...
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