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
OpenDAS
ColossalAI
Commits
1559c0df
Unverified
Commit
1559c0df
authored
Mar 21, 2022
by
ver217
Committed by
GitHub
Mar 21, 2022
Browse files
fix attn mask shape of gpt (#472)
parent
3cb3fc27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
model_zoo/gpt/gpt.py
model_zoo/gpt/gpt.py
+1
-1
No files found.
model_zoo/gpt/gpt.py
View file @
1559c0df
...
@@ -292,7 +292,7 @@ class GPT(nn.Module):
...
@@ -292,7 +292,7 @@ class GPT(nn.Module):
# So we can broadcast to [batch_size, num_heads, from_seq_length, to_seq_length]
# So we can broadcast to [batch_size, num_heads, from_seq_length, to_seq_length]
# Adapted from huggingface
# Adapted from huggingface
if
attention_mask
is
not
None
:
if
attention_mask
is
not
None
:
batch_size
=
x
.
shape
[
0
]
batch_size
=
input_ids
.
shape
[
0
]
attention_mask
=
attention_mask
.
view
(
batch_size
,
-
1
)
attention_mask
=
attention_mask
.
view
(
batch_size
,
-
1
)
attention_mask
=
col_nn
.
partition_batch
(
attention_mask
)
attention_mask
=
col_nn
.
partition_batch
(
attention_mask
)
attention_mask
=
attention_mask
.
unsqueeze
(
1
).
unsqueeze
(
2
)
attention_mask
=
attention_mask
.
unsqueeze
(
1
).
unsqueeze
(
2
)
...
...
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