You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -922,14 +940,9 @@ More details on how to create input functions can be find in `Building Input Fun
922
940
Creating a ``serving_input_fn``
923
941
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
924
942
925
-
``serving_input_fn``is used to define the shapes and types of the inputs
926
-
the model accepts when the model is exported for Tensorflow Serving. ``serving_input_fn``is called
927
-
at the end of model training andisnot called during inference. (If you'd like to preprocess inference data,
928
-
please see ``input_fn``). This function has the following purposes:
943
+
``serving_input_fn``is used to define the shapes and types of the inputs the model accepts when the model is exported for Tensorflow Serving. It is optional, but required for deploying the trained model to a SageMaker endpoint.
929
944
930
-
- To add placeholders to the graph that the serving system will feed with inference requests.
931
-
- To add any additional ops needed to convert data from the inputformat into the feature Tensors
932
-
expected by the model.
945
+
``serving_input_fn``is called at the end of model training andis**not** called during inference. (If you'd like to preprocess inference data, please see **Overriding input preprocessing with an input_fn**).
933
946
934
947
The basic skeleton for the ``serving_input_fn`` looks like this:
935
948
@@ -939,8 +952,10 @@ The basic skeleton for the ``serving_input_fn`` looks like this:
939
952
# Logic to the following:
940
953
# 1. Defines placeholders that TensorFlow serving will feed with inference requests
941
954
# 2. Preprocess input data
942
-
# 3. Returns a tf.estimator.export.ServingInputReceiver object, which packages the placeholders
943
-
and the resulting feature Tensors together.
955
+
# 3. Returns a tf.estimator.export.ServingInputReceiver or tf.estimator.export.TensorServingInputReceiver,
956
+
# which packages the placeholders and the resulting feature Tensors together.
957
+
958
+
**Note:** For TensorFlow 1.4and1.5, ``serving_input_fn`` may also return a no-argument function which returns a ``tf.estimator.export.ServingInputReceiver``or``tf.estimator.export.TensorServingInputReceiver``. This is no longer supported for TensorFlow 1.6and up.
944
959
945
960
Example of a complete ``serving_input_fn``
946
961
''''''''''''''''''''''''''''''''''''''''''
@@ -1137,15 +1152,23 @@ These hyperparameters are used by TensorFlow to fine tune the training.
1137
1152
You need to add them inside the hyperparameters dictionary in the
1138
1153
``TensorFlow`` estimator constructor.
1139
1154
1155
+
**All versions**
1156
+
1140
1157
- ``save_summary_steps (int)`` Save summaries every this many steps.
1141
1158
- ``save_checkpoints_secs (int)`` Save checkpoints every this many seconds. Can not be specified with ``save_checkpoints_steps``.
1142
1159
- ``save_checkpoints_steps (int)`` Save checkpoints every this many steps. Can not be specified with ``save_checkpoints_secs``.
1143
1160
- ``keep_checkpoint_max (int)`` The maximum number of recent checkpoint files to keep. As new files are created, older files are deleted. If None or 0, all checkpoint files are kept. Defaults to 5 (that is, the 5 most recent checkpoint files are kept.)
1144
1161
- ``keep_checkpoint_every_n_hours (int)`` Number of hours between each checkpoint to be saved. The default value of 10,000 hours effectively disables the feature.
1145
1162
- ``log_step_count_steps (int)`` The frequency, in number of global steps, that the global step/sec will be logged during training.
1163
+
1164
+
**TensorFlow 1.6 and up**
1165
+
1166
+
- ``start_delay_secs (int)`` See docs for this parameter in `tf.estimator.EvalSpec <https://www.tensorflow.org/api_docs/python/tf/estimator/EvalSpec>`_.
1167
+
- ``throttle_secs (int)`` See docs for this parameter in `tf.estimator.EvalSpec <https://www.tensorflow.org/api_docs/python/tf/estimator/EvalSpec>`_.
1168
+
1169
+
**TensorFlow 1.4 and 1.5**
1170
+
1146
1171
- ``eval_metrics (dict)`` ``dict`` of string, metric function. If `None`, default set is used. This should be ``None`` if the ``estimator`` is `tf.estimator.Estimator <https://www.tensorflow.org/api_docs/python/tf/estimator/Estimator>`_. If metrics are provided they will be *appended* to the default set.
1147
-
- ``train_monitors (list)`` A list of monitors to pass during training.
1148
-
- ``eval_hooks (list)`` A list of `SessionRunHook` hooks to pass during evaluation.
1149
1172
- ``eval_delay_secs (int)`` Start evaluating after waiting for this many seconds.
1150
1173
- ``continuous_eval_throttle_secs (int)`` Do not re-evaluate unless the last evaluation was started at least this many seconds ago.
1151
1174
- ``min_eval_frequency (int)`` The minimum number of steps between evaluations. Of course, evaluation does not occur if no new snapshot is available, hence, this is the minimum. If 0, the evaluation will only happen after training. If None, defaults to 1000.
@@ -1398,7 +1421,7 @@ This process looks like this:
1398
1421
1399
1422
The common functionality can be extended by the addiction of the following two functions to your training script:
1400
1423
1401
-
Overriding input precessing with an ``input_fn``
1424
+
Overriding input preprocessing with an ``input_fn``
1402
1425
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1403
1426
1404
1427
An example of ``input_fn`` for the content-type "application/python-pickle" can be seen below:
@@ -1417,7 +1440,7 @@ An example of ``input_fn`` for the content-type "application/python-pickle" can
1417
1440
# if the content type is not supported.
1418
1441
pass
1419
1442
1420
-
Overriding output precessing with an ``output_fn``
1443
+
Overriding output postprocessing with an ``output_fn``
0 commit comments