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
594ca6de
Commit
594ca6de
authored
Dec 28, 2019
by
Julien Chaumond
Browse files
[debug] Debug Heisenbug, the old school way.
parent
0df4e62d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
tests/test_modeling_tf_common.py
tests/test_modeling_tf_common.py
+7
-0
No files found.
tests/test_modeling_tf_common.py
View file @
594ca6de
...
...
@@ -115,6 +115,13 @@ class TFModelTesterMixin:
tf_hidden_states
[
np
.
isnan
(
tf_hidden_states
)]
=
0
pt_hidden_states
[
np
.
isnan
(
pt_hidden_states
)]
=
0
max_diff
=
np
.
amax
(
np
.
abs
(
tf_hidden_states
-
pt_hidden_states
))
# Debug info (remove when fixed)
if
max_diff
>=
2e-2
:
print
(
"==="
)
print
(
model_class
)
print
(
config
)
print
(
inputs_dict
)
print
(
pt_inputs_dict
)
self
.
assertLessEqual
(
max_diff
,
2e-2
)
# Check we can load pt model in tf and vice-versa with checkpoint => model functions
...
...
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