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
6e016634
Unverified
Commit
6e016634
authored
Sep 01, 2022
by
Joao Gante
Committed by
GitHub
Sep 01, 2022
Browse files
Generate: smaller TF serving test (#18840)
parent
563a8d58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
tests/test_modeling_tf_common.py
tests/test_modeling_tf_common.py
+5
-5
No files found.
tests/test_modeling_tf_common.py
View file @
6e016634
...
...
@@ -75,7 +75,7 @@ if is_tf_available():
TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING
,
BertConfig
,
TFAutoModel
,
TFAutoModelFor
Seq2Seq
LM
,
TFAutoModelFor
Causal
LM
,
TFAutoModelForSequenceClassification
,
TFBertModel
,
TFSharedEmbeddings
,
...
...
@@ -2180,8 +2180,8 @@ class UtilsFunctionsTest(unittest.TestCase):
self
.
assertTrue
(
np
.
allclose
(
p1
.
numpy
(),
p2
.
numpy
()))
def
test_generate_tf_function_export
(
self
):
test_model
=
TFAutoModelFor
Seq2Seq
LM
.
from_pretrained
(
"hf-internal-testing/tiny-random-
t5
"
)
max_length
=
8
test_model
=
TFAutoModelFor
Causal
LM
.
from_pretrained
(
"hf-internal-testing/tiny-random-
gpt2
"
)
max_length
=
2
class
DummyModel
(
tf
.
Module
):
def
__init__
(
self
,
model
):
...
...
@@ -2204,8 +2204,8 @@ class UtilsFunctionsTest(unittest.TestCase):
)
return
{
"sequences"
:
outputs
[
"sequences"
]}
dummy_input_ids
=
[[
2
,
3
,
4
,
1
,
0
,
0
,
0
,
0
],
[
102
,
103
,
104
,
105
,
1
,
0
,
0
,
0
]]
dummy_attention_masks
=
[[
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
],
[
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
]]
dummy_input_ids
=
[[
2
,
0
],
[
102
,
103
]]
dummy_attention_masks
=
[[
1
,
0
],
[
1
,
1
]]
dummy_model
=
DummyModel
(
model
=
test_model
)
with
tempfile
.
TemporaryDirectory
()
as
tmp_dir
:
tf
.
saved_model
.
save
(
dummy_model
,
tmp_dir
,
signatures
=
{
"serving_default"
:
dummy_model
.
serving
})
...
...
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