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
8e5d84fc
Commit
8e5d84fc
authored
Nov 26, 2019
by
v_sboliu
Committed by
Julien Chaumond
Nov 26, 2019
Browse files
Fixed typo
parent
5d3b8daa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
transformers/modeling_bert.py
transformers/modeling_bert.py
+1
-1
No files found.
transformers/modeling_bert.py
View file @
8e5d84fc
...
...
@@ -278,7 +278,7 @@ class BertAttention(nn.Module):
if
len
(
heads
)
==
0
:
return
mask
=
torch
.
ones
(
self
.
self
.
num_attention_heads
,
self
.
self
.
attention_head_size
)
heads
=
set
(
heads
)
-
self
.
pruned_heads
# Convert to set and emove already pruned heads
heads
=
set
(
heads
)
-
self
.
pruned_heads
# Convert to set and
r
emove already pruned heads
for
head
in
heads
:
# Compute how many pruned heads are before the head and move the index accordingly
head
=
head
-
sum
(
1
if
h
<
head
else
0
for
h
in
self
.
pruned_heads
)
...
...
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