Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions site/en/tutorials/keras/save_and_load.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"\n",
"Caution: TensorFlow models are code and it is important to be careful with untrusted code. See [Using TensorFlow Securely](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for details.\n",
"\n",
"### Options\n",
"## Options\n",
"\n",
"There are different ways to save TensorFlow models depending on the API you're using. This guide uses [tf.keras](https://www.tensorflow.org/guide/keras)—a high-level API to build and train models in TensorFlow. The new, high-level `.keras` format used in this tutorial is recommended for saving Keras objects, as it provides robust, efficient name-based saving that is often easier to debug than low-level or legacy formats. For more advanced saving or serialization workflows, especially those involving custom objects, please refer to the [Save and load Keras models guide](https://www.tensorflow.org/guide/keras/save_and_serialize). For other approaches, refer to the [Using the SavedModel format guide](../../guide/saved_model.ipynb)."
]
Expand Down Expand Up @@ -169,7 +169,7 @@
"source": [
"### Get an example dataset\n",
"\n",
"To demonstrate how to save and load weights, you'll use the [MNIST dataset](http://yann.lecun.com/exdb/mnist/). To speed up these runs, use the first 1000 examples:"
"To demonstrate how to save and load weights, you'll use the [MNIST dataset](https://www.tensorflow.org/datasets/catalog/mnist). To speed up these runs, use the first 1000 examples:"
]
},
{
Expand Down Expand Up @@ -218,9 +218,9 @@
"# Define a simple sequential model\n",
"def create_model():\n",
" model = tf.keras.Sequential([\n",
" keras.layers.Dense(512, activation='relu', input_shape=(784,)),\n",
" keras.layers.Dropout(0.2),\n",
" keras.layers.Dense(10)\n",
" tf.keras.layers.Dense(512, activation='relu', input_shape=(784,)),\n",
" tf.keras.layers.Dropout(0.2),\n",
" tf.keras.layers.Dense(10)\n",
" ])\n",
"\n",
" model.compile(optimizer='adam',\n",
Expand Down Expand Up @@ -559,9 +559,9 @@
"- Passing `save_format='h5'` to `save()`\n",
"- Passing a filename that ends in `.h5`\n",
"\n",
"Saving a fully-functional model is very useful—you can load them in TensorFlow.js ([Saved Model](https://www.tensorflow.org/js/tutorials/conversion/import_saved_model), [HDF5](https://www.tensorflow.org/js/tutorials/conversion/import_keras)) and then train and run them in web browsers, or convert them to run on mobile devices using TensorFlow Lite ([Saved Model](https://www.tensorflow.org/lite/models/convert/#convert_a_savedmodel_recommended_), [HDF5](https://www.tensorflow.org/lite/models/convert/#convert_a_keras_model_))\n",
"Saving a fully-functional model is very useful—you can load them in TensorFlow.js ([Saved Model](https://www.tensorflow.org/js/guide/conversion), [HDF5](https://www.tensorflow.org/js/guide/conversion)) and then train and run them in web browsers, or convert them to run on mobile devices using TensorFlow Lite ([Saved Model](https://www.tensorflow.org/lite/models/convert/), [HDF5](https://www.tensorflow.org/lite/models/convert/))\n",
"\n",
"\\*Custom objects (for example, subclassed models or layers) require special attention when saving and loading. Refer to the **Saving custom objects** section below."
"**Note:** Custom objects (for example, subclassed models or layers) require special attention when saving and loading. Refer to the **Saving custom objects** section below."
]
},
{
Expand Down Expand Up @@ -813,8 +813,8 @@
"* The model's architecture\n",
"* The model's training configuration (what you pass to the `.compile()` method)\n",
"* The optimizer and its state, if any (this enables you to restart training where you left off)\n",
"\n",
"Keras is not able to save the `v1.x` optimizers (from `tf.compat.v1.train`) since they aren't compatible with checkpoints. For v1.x optimizers, you need to re-compile the model after loading—losing the state of the optimizer.\n"
"\n"

]
},
{
Expand Down