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
chenpangpang
ComfyUI
Commits
afe732be
Commit
afe732be
authored
Jul 26, 2024
by
comfyanonymous
Browse files
Hunyuan dit can now accept longer prompts.
parent
a9ac56fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
comfy/ldm/hydit/models.py
comfy/ldm/hydit/models.py
+7
-5
No files found.
comfy/ldm/hydit/models.py
View file @
afe732be
...
@@ -319,13 +319,15 @@ class HunYuanDiT(nn.Module):
...
@@ -319,13 +319,15 @@ class HunYuanDiT(nn.Module):
text_states_mask
=
text_embedding_mask
.
bool
()
# 2,77
text_states_mask
=
text_embedding_mask
.
bool
()
# 2,77
text_states_t5_mask
=
text_embedding_mask_t5
.
bool
()
# 2,256
text_states_t5_mask
=
text_embedding_mask_t5
.
bool
()
# 2,256
b_t5
,
l_t5
,
c_t5
=
text_states_t5
.
shape
b_t5
,
l_t5
,
c_t5
=
text_states_t5
.
shape
text_states_t5
=
self
.
mlp_t5
(
text_states_t5
.
view
(
-
1
,
c_t5
))
text_states_t5
=
self
.
mlp_t5
(
text_states_t5
.
view
(
-
1
,
c_t5
)).
view
(
b_t5
,
l_t5
,
-
1
)
text_states
=
torch
.
cat
([
text_states
,
text_states_t5
.
view
(
b_t5
,
l_t5
,
-
1
)],
dim
=
1
)
# 2,205,1024
clip_t5_mask
=
torch
.
cat
([
text_states_mask
,
text_states_t5_mask
],
dim
=-
1
)
padding
=
self
.
text_embedding_padding
.
to
(
text_states
)
clip_t5_mask
=
clip_t5_mask
text_states
[:,
-
self
.
text_len
:]
=
torch
.
where
(
text_states_mask
[:,
-
self
.
text_len
:].
unsqueeze
(
2
),
text_states
[:,
-
self
.
text_len
:],
padding
[:
self
.
text_len
])
text_states
=
torch
.
where
(
clip_t5_mask
.
unsqueeze
(
2
),
text_states
,
self
.
text_embedding_padding
.
to
(
text_states
))
text_states_t5
[:,
-
self
.
text_len_t5
:]
=
torch
.
where
(
text_states_t5_mask
[:,
-
self
.
text_len_t5
:].
unsqueeze
(
2
),
text_states_t5
[:,
-
self
.
text_len_t5
:],
padding
[
self
.
text_len
:])
text_states
=
torch
.
cat
([
text_states
,
text_states_t5
],
dim
=
1
)
# 2,205,1024
# clip_t5_mask = torch.cat([text_states_mask, text_states_t5_mask], dim=-1)
_
,
_
,
oh
,
ow
=
x
.
shape
_
,
_
,
oh
,
ow
=
x
.
shape
th
,
tw
=
(
oh
+
(
self
.
patch_size
//
2
))
//
self
.
patch_size
,
(
ow
+
(
self
.
patch_size
//
2
))
//
self
.
patch_size
th
,
tw
=
(
oh
+
(
self
.
patch_size
//
2
))
//
self
.
patch_size
,
(
ow
+
(
self
.
patch_size
//
2
))
//
self
.
patch_size
...
...
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