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
ea2600bd
Commit
ea2600bd
authored
Jan 27, 2020
by
Lysandre
Browse files
Absolute definitive HeisenDistilBug solve
cc @julien-c @thomwolf
parent
5c3d441e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
tests/test_modeling_tf_common.py
tests/test_modeling_tf_common.py
+15
-6
No files found.
tests/test_modeling_tf_common.py
View file @
ea2600bd
...
@@ -113,10 +113,13 @@ class TFModelTesterMixin:
...
@@ -113,10 +113,13 @@ class TFModelTesterMixin:
tf_hidden_states
=
tfo
[
0
].
numpy
()
tf_hidden_states
=
tfo
[
0
].
numpy
()
pt_hidden_states
=
pto
[
0
].
numpy
()
pt_hidden_states
=
pto
[
0
].
numpy
()
pt_hidden_states
[
np
.
isnan
(
tf_hidden_states
)]
=
0
tf_nans
=
np
.
copy
(
np
.
isnan
(
tf_hidden_states
))
tf_hidden_states
[
np
.
isnan
(
tf_hidden_states
)]
=
0
pt_nans
=
np
.
copy
(
np
.
isnan
(
pt_hidden_states
))
pt_hidden_states
[
np
.
isnan
(
pt_hidden_states
)]
=
0
tf_hidden_states
[
np
.
isnan
(
pt_hidden_states
)]
=
0
pt_hidden_states
[
tf_nans
]
=
0
tf_hidden_states
[
tf_nans
]
=
0
pt_hidden_states
[
pt_nans
]
=
0
tf_hidden_states
[
pt_nans
]
=
0
max_diff
=
np
.
amax
(
np
.
abs
(
tf_hidden_states
-
pt_hidden_states
))
max_diff
=
np
.
amax
(
np
.
abs
(
tf_hidden_states
-
pt_hidden_states
))
# Debug info (remove when fixed)
# Debug info (remove when fixed)
...
@@ -148,8 +151,14 @@ class TFModelTesterMixin:
...
@@ -148,8 +151,14 @@ class TFModelTesterMixin:
tfo
=
tf_model
(
inputs_dict
)
tfo
=
tf_model
(
inputs_dict
)
tfo
=
tfo
[
0
].
numpy
()
tfo
=
tfo
[
0
].
numpy
()
pto
=
pto
[
0
].
numpy
()
pto
=
pto
[
0
].
numpy
()
tfo
[
np
.
isnan
(
tfo
)]
=
0
tf_nans
=
np
.
copy
(
np
.
isnan
(
tfo
))
pto
[
np
.
isnan
(
pto
)]
=
0
pt_nans
=
np
.
copy
(
np
.
isnan
(
pto
))
pto
[
tf_nans
]
=
0
tfo
[
tf_nans
]
=
0
pto
[
pt_nans
]
=
0
tfo
[
pt_nans
]
=
0
max_diff
=
np
.
amax
(
np
.
abs
(
tfo
-
pto
))
max_diff
=
np
.
amax
(
np
.
abs
(
tfo
-
pto
))
self
.
assertLessEqual
(
max_diff
,
2e-2
)
self
.
assertLessEqual
(
max_diff
,
2e-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