|
67 | 67 | "source": [
|
68 | 68 | "Evaluation is a critical part of measuring and benchmarking models.\n",
|
69 | 69 | "\n",
|
70 |
| - "This guide demonstrates how to migrate evaluator tasks from TensorFlow 1 to TensorFlow 2. In Tensorflow 1 this functionality is implemented by `tf.estimator.train_and_evaluate`, when the API is running distributedly. In Tensorflow 2, you can use the built-in `tf.keras.experimental.SidecarEvaluator`, or a custom evaluation loop on the evaluator task.\n", |
| 70 | + "This guide demonstrates how to migrate evaluator tasks from TensorFlow 1 to TensorFlow 2. In Tensorflow 1 this functionality is implemented by `tf.estimator.train_and_evaluate`, when the API is running distributedly. In Tensorflow 2, you can use the built-in `tf.keras.utils.SidecarEvaluator`, or a custom evaluation loop on the evaluator task.\n", |
71 | 71 | "\n",
|
72 | 72 | "There are simple serial evaluation options in both TensorFlow 1 (`tf.estimator.Estimator.evaluate`) and TensorFlow 2 (`Model.fit(..., validation_data=(...))` or `Model.evaluate`). The evaluator task is preferable when you would like your workers not switching between training and evaluation, and built-in evaluation in `Model.fit` is preferable when you would like your evaluation to be distributed.\n"
|
73 | 73 | ]
|
|
193 | 193 | "source": [
|
194 | 194 | "## TensorFlow 2: Evaluating a Keras model\n",
|
195 | 195 | "\n",
|
196 |
| - "In TensorFlow 2, if you use the Keras `Model.fit` API for training, you can evaluate the model with `tf.keras.experimental.SidecarEvaluator`. You can also visualize the evaluation metrics in Tensorboard which is not shown in this guide.\n", |
| 196 | + "In TensorFlow 2, if you use the Keras `Model.fit` API for training, you can evaluate the model with `tf.keras.utils.SidecarEvaluator`. You can also visualize the evaluation metrics in Tensorboard which is not shown in this guide.\n", |
197 | 197 | "\n",
|
198 | 198 | "To help demonstrate this, let's first start by defining and training the model:\n"
|
199 | 199 | ]
|
|
240 | 240 | "id": "AhU3VTYZoDh-"
|
241 | 241 | },
|
242 | 242 | "source": [
|
243 |
| - "Then, evaluate the model using `tf.keras.experimental.SidecarEvaluator`. In real training, it's recommended to use a separate job to conduct the evaluation to free up worker resources for training." |
| 243 | + "Then, evaluate the model using `tf.keras.utils.SidecarEvaluator`. In real training, it's recommended to use a separate job to conduct the evaluation to free up worker resources for training." |
244 | 244 | ]
|
245 | 245 | },
|
246 | 246 | {
|
|
254 | 254 | "data = tf.data.Dataset.from_tensor_slices((x_test, y_test))\n",
|
255 | 255 | "data = data.batch(64)\n",
|
256 | 256 | "\n",
|
257 |
| - "tf.keras.experimental.SidecarEvaluator(\n", |
| 257 | + "tf.keras.utils.SidecarEvaluator(\n", |
258 | 258 | " model=model,\n",
|
259 | 259 | " data=data,\n",
|
260 | 260 | " checkpoint_dir=log_dir,\n",
|
|
270 | 270 | "source": [
|
271 | 271 | "## Next steps\n",
|
272 | 272 | "\n",
|
273 |
| - "- To learn more about sidecar evaluation consider reading the `tf.keras.experimental.SidecarEvaluator` API docs.\n", |
| 273 | + "- To learn more about sidecar evaluation consider reading the `tf.keras.utils.SidecarEvaluator` API docs.\n", |
274 | 274 | "- To consider alternating training and evaluation in Keras consider reading about [other built-in methods](https://www.tensorflow.org/guide/keras/train_and_evaluate)."
|
275 | 275 | ]
|
276 | 276 | }
|
|
0 commit comments