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
6c875d84
"backend/vscode:/vscode.git/clone" did not exist on "81a3c97069f6a9bfbc4ba2c4968cede773ad0403"
Commit
6c875d84
authored
Feb 17, 2024
by
comfyanonymous
Browse files
Fix clip attention mask issues on some hardware.
parent
805c36ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
comfy/clip_model.py
comfy/clip_model.py
+1
-1
No files found.
comfy/clip_model.py
View file @
6c875d84
...
...
@@ -97,7 +97,7 @@ class CLIPTextModel_(torch.nn.Module):
x
=
self
.
embeddings
(
input_tokens
)
mask
=
None
if
attention_mask
is
not
None
:
mask
=
1.0
-
attention_mask
.
to
(
x
.
dtype
).
unsqueeze
(
1
).
unsqueeze
(
1
).
expand
(
attention_mask
.
shape
[
0
],
1
,
attention_mask
.
shape
[
-
1
],
attention_mask
.
shape
[
-
1
])
mask
=
1.0
-
attention_mask
.
to
(
x
.
dtype
).
reshape
((
attention_mask
.
shape
[
0
],
-
1
,
attention_mask
.
shape
[
-
1
])
).
expand
(
attention_mask
.
shape
[
0
],
attention_mask
.
shape
[
-
1
],
attention_mask
.
shape
[
-
1
])
mask
=
mask
.
masked_fill
(
mask
.
to
(
torch
.
bool
),
float
(
"-inf"
))
causal_mask
=
torch
.
empty
(
x
.
shape
[
1
],
x
.
shape
[
1
],
dtype
=
x
.
dtype
,
device
=
x
.
device
).
fill_
(
float
(
"-inf"
)).
triu_
(
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