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
875c4ae4
Commit
875c4ae4
authored
Jan 27, 2020
by
Lysandre
Browse files
Definitive HeisenDistilBug fix
cc @julien-c @@thomwolf
parent
f09f42d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
tests/test_modeling_tf_common.py
tests/test_modeling_tf_common.py
+4
-0
tests/test_modeling_tf_distilbert.py
tests/test_modeling_tf_distilbert.py
+1
-1
No files found.
tests/test_modeling_tf_common.py
View file @
875c4ae4
...
@@ -112,8 +112,12 @@ class TFModelTesterMixin:
...
@@ -112,8 +112,12 @@ class TFModelTesterMixin:
tfo
=
tf_model
(
inputs_dict
,
training
=
False
)
tfo
=
tf_model
(
inputs_dict
,
training
=
False
)
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_hidden_states
[
np
.
isnan
(
tf_hidden_states
)]
=
0
tf_hidden_states
[
np
.
isnan
(
tf_hidden_states
)]
=
0
pt_hidden_states
[
np
.
isnan
(
pt_hidden_states
)]
=
0
pt_hidden_states
[
np
.
isnan
(
pt_hidden_states
)]
=
0
tf_hidden_states
[
np
.
isnan
(
pt_hidden_states
)]
=
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)
if
max_diff
>=
2e-2
:
if
max_diff
>=
2e-2
:
...
...
tests/test_modeling_tf_distilbert.py
View file @
875c4ae4
...
@@ -219,5 +219,5 @@ class TFDistilBertModelTest(TFModelTesterMixin, unittest.TestCase):
...
@@ -219,5 +219,5 @@ class TFDistilBertModelTest(TFModelTesterMixin, unittest.TestCase):
# @slow
# @slow
# def test_model_from_pretrained(self):
# def test_model_from_pretrained(self):
# for model_name in list(DISTILBERT_PRETRAINED_MODEL_ARCHIVE_MAP.keys())[:1]:
# for model_name in list(DISTILBERT_PRETRAINED_MODEL_ARCHIVE_MAP.keys())[:1]:
# model = DistilBertMode
l
.from_pretrained(model_name, cache_dir=CACHE_DIR)
# model = DistilBertMode
sss
.from_pretrained(model_name, cache_dir=CACHE_DIR)
# self.assertIsNotNone(model)
# self.assertIsNotNone(model)
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