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
14f0e8e5
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "33eb8a165d1f6b95df2d79fe24edd773d98b24f5"
Commit
14f0e8e5
authored
Jun 19, 2019
by
thomwolf
Browse files
fix cuda
parent
34d706a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
examples/bertology.py
examples/bertology.py
+2
-2
No files found.
examples/bertology.py
View file @
14f0e8e5
...
@@ -209,8 +209,8 @@ def run_model():
...
@@ -209,8 +209,8 @@ def run_model():
attn_entropy
,
head_importance
,
_
,
_
=
compute_heads_importance
(
args
,
model
,
eval_dataloader
)
attn_entropy
,
head_importance
,
_
,
_
=
compute_heads_importance
(
args
,
model
,
eval_dataloader
)
# Print/save matrices
# Print/save matrices
np
.
save
(
os
.
path
.
join
(
args
.
output_dir
,
'attn_entropy.npy'
),
attn_entropy
)
np
.
save
(
os
.
path
.
join
(
args
.
output_dir
,
'attn_entropy.npy'
),
attn_entropy
.
detach
().
cpu
().
numpy
()
)
np
.
save
(
os
.
path
.
join
(
args
.
output_dir
,
'head_importance.npy'
),
head_importance
)
np
.
save
(
os
.
path
.
join
(
args
.
output_dir
,
'head_importance.npy'
),
head_importance
.
detach
().
cpu
().
numpy
()
)
logger
.
info
(
"Attention entropies"
)
logger
.
info
(
"Attention entropies"
)
print_2d_tensor
(
attn_entropy
)
print_2d_tensor
(
attn_entropy
)
...
...
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