Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
57ffd8ab
Unverified
Commit
57ffd8ab
authored
May 04, 2023
by
Younes Belkada
Committed by
GitHub
May 04, 2023
Browse files
[`GPT-J`] Fix causal mask dtype (#23147)
* fix #23136 * better fix * same fix for `masked_bias`
parent
83b38fbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
src/transformers/models/gptj/modeling_gptj.py
src/transformers/models/gptj/modeling_gptj.py
+3
-2
No files found.
src/transformers/models/gptj/modeling_gptj.py
View file @
57ffd8ab
...
...
@@ -89,8 +89,9 @@ class GPTJAttention(nn.Module):
torch
.
tril
(
torch
.
ones
((
max_positions
,
max_positions
),
dtype
=
torch
.
bool
)).
view
(
1
,
1
,
max_positions
,
max_positions
),
persistent
=
False
,
)
self
.
register_buffer
(
"masked_bias"
,
torch
.
tensor
(
-
1e9
))
self
.
register_buffer
(
"masked_bias"
,
torch
.
tensor
(
-
1e9
)
,
persistent
=
False
)
self
.
attn_dropout
=
nn
.
Dropout
(
config
.
attn_pdrop
)
self
.
resid_dropout
=
nn
.
Dropout
(
config
.
resid_pdrop
)
...
...
@@ -732,7 +733,7 @@ class GPTJModel(GPTJPreTrainedModel):
GPTJ_START_DOCSTRING
,
)
class
GPTJForCausalLM
(
GPTJPreTrainedModel
):
_keys_to_ignore_on_load_
missing
=
[
r
"h\.\d+\.attn\.masked_bias"
,
r
"h\.\d+\.attn\.bias"
]
_keys_to_ignore_on_load_
unexpected
=
[
r
"h\.\d+\.attn\.masked_bias"
,
r
"h\.\d+\.attn\.bias"
]
def
__init__
(
self
,
config
):
super
().
__init__
(
config
)
...
...
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