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
ModelZoo
ResNet50_tensorflow
Commits
ea384789
Commit
ea384789
authored
Aug 09, 2021
by
A. Unique TensorFlower
Browse files
Internal change
PiperOrigin-RevId: 389748939
parent
3f0ae320
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
official/nlp/serving/serving_modules.py
official/nlp/serving/serving_modules.py
+6
-2
No files found.
official/nlp/serving/serving_modules.py
View file @
ea384789
...
...
@@ -84,7 +84,8 @@ class SentencePrediction(export_base.ExportModule):
def
serve
(
self
,
input_word_ids
,
input_mask
=
None
,
input_type_ids
=
None
)
->
Dict
[
str
,
tf
.
Tensor
]:
input_type_ids
=
None
,
use_prob
=
False
)
->
Dict
[
str
,
tf
.
Tensor
]:
if
input_type_ids
is
None
:
# Requires CLS token is the first token of inputs.
input_type_ids
=
tf
.
zeros_like
(
input_word_ids
)
...
...
@@ -97,7 +98,10 @@ class SentencePrediction(export_base.ExportModule):
input_word_ids
=
input_word_ids
,
input_mask
=
input_mask
,
input_type_ids
=
input_type_ids
)
return
dict
(
outputs
=
self
.
inference_step
(
inputs
))
if
not
use_prob
:
return
dict
(
outputs
=
self
.
inference_step
(
inputs
))
else
:
return
dict
(
outputs
=
tf
.
nn
.
softmax
(
self
.
inference_step
(
inputs
)))
@
tf
.
function
def
serve_examples
(
self
,
inputs
)
->
Dict
[
str
,
tf
.
Tensor
]:
...
...
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