Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
5ae087cf
Unverified
Commit
5ae087cf
authored
Jul 05, 2022
by
Matt
Committed by
GitHub
Jul 05, 2022
Browse files
Fix T5/mT5 tests (#18029)
parent
ec07eccc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
tests/models/mt5/test_modeling_tf_mt5.py
tests/models/mt5/test_modeling_tf_mt5.py
+2
-2
tests/models/t5/test_modeling_tf_t5.py
tests/models/t5/test_modeling_tf_t5.py
+6
-6
No files found.
tests/models/mt5/test_modeling_tf_mt5.py
View file @
5ae087cf
...
...
@@ -67,7 +67,7 @@ class TFMT5ModelIntegrationTest(unittest.TestCase):
labels
=
tokenizer
(
"Hi I am"
,
return_tensors
=
"tf"
).
input_ids
loss
=
model
(
input_ids
,
labels
=
labels
).
loss
mtf_score
=
-
tf
.
math
.
reduce_
sum
(
loss
).
numpy
()
mtf_score
=
-
tf
.
math
.
reduce_
mean
(
loss
).
numpy
()
EXPECTED_SCORE
=
-
84.9127
EXPECTED_SCORE
=
-
21.210594
self
.
assertTrue
(
abs
(
mtf_score
-
EXPECTED_SCORE
)
<
2e-4
)
tests/models/t5/test_modeling_tf_t5.py
View file @
5ae087cf
...
...
@@ -659,9 +659,9 @@ class TFT5ModelIntegrationTests(unittest.TestCase):
labels
=
tokenizer
(
"Hi I am"
,
return_tensors
=
"tf"
).
input_ids
loss
=
model
(
input_ids
,
labels
=
labels
).
loss
mtf_score
=
-
tf
.
math
.
reduce_
sum
(
loss
).
numpy
()
mtf_score
=
-
tf
.
math
.
reduce_
mean
(
loss
).
numpy
()
EXPECTED_SCORE
=
-
19.0845
EXPECTED_SCORE
=
-
4.7710114
self
.
assertTrue
(
abs
(
mtf_score
-
EXPECTED_SCORE
)
<
1e-4
)
@
slow
...
...
@@ -685,9 +685,9 @@ class TFT5ModelIntegrationTests(unittest.TestCase):
labels
=
tokenizer
(
"Hi I am"
,
return_tensors
=
"tf"
).
input_ids
loss
=
model
(
input_ids
,
labels
=
labels
).
loss
mtf_score
=
-
tf
.
math
.
reduce_
sum
(
loss
).
numpy
()
mtf_score
=
-
tf
.
math
.
reduce_
mean
(
loss
).
numpy
()
EXPECTED_SCORE
=
-
59.0293
EXPECTED_SCORE
=
-
14.759922
self
.
assertTrue
(
abs
(
mtf_score
-
EXPECTED_SCORE
)
<
1e-4
)
@
slow
...
...
@@ -709,9 +709,9 @@ class TFT5ModelIntegrationTests(unittest.TestCase):
labels
=
tokenizer
(
"Hi I am"
,
return_tensors
=
"tf"
).
input_ids
loss
=
model
(
input_ids
,
labels
=
labels
).
loss
mtf_score
=
-
tf
.
math
.
reduce_
sum
(
loss
).
numpy
()
mtf_score
=
-
tf
.
math
.
reduce_
mean
(
loss
).
numpy
()
EXPECTED_SCORE
=
-
60.7397
EXPECTED_SCORE
=
-
7.594554
self
.
assertTrue
(
abs
(
mtf_score
-
EXPECTED_SCORE
)
<
1e-4
)
@
slow
...
...
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