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
transformers
Commits
cb26b035
Commit
cb26b035
authored
Oct 17, 2019
by
Rémi Louf
Browse files
remove potential UndefinedError
parent
b915ba9d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
transformers/modeling_xlm.py
transformers/modeling_xlm.py
+1
-1
No files found.
transformers/modeling_xlm.py
View file @
cb26b035
...
...
@@ -81,8 +81,8 @@ def get_masks(slen, lengths, causal, padding_mask=None):
mask
=
alen
<
lengths
[:,
None
]
# attention mask is the same as mask, or triangular inferior attention (causal)
if
causal
:
bs
=
lengths
.
size
(
0
)
if
causal
:
attn_mask
=
alen
[
None
,
None
,
:].
repeat
(
bs
,
slen
,
1
)
<=
alen
[
None
,
:,
None
]
else
:
attn_mask
=
mask
...
...
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