Replace HDF5 with TF format

main
Aurélien Geron 2022-09-12 11:46:42 +12:00
parent 81601cedf3
commit ace7a972b9
1 changed files with 4 additions and 4 deletions

View File

@ -2055,7 +2055,7 @@
} }
], ],
"source": [ "source": [
"model.save(\"my_keras_model\")" "model.save(\"my_keras_model\", save_format=\"tf\")"
] ]
}, },
{ {
@ -3678,7 +3678,7 @@
], ],
"source": [ "source": [
"early_stopping_cb = tf.keras.callbacks.EarlyStopping(patience=20)\n", "early_stopping_cb = tf.keras.callbacks.EarlyStopping(patience=20)\n",
"checkpoint_cb = tf.keras.callbacks.ModelCheckpoint(\"my_mnist_model.h5\", save_best_only=True)\n", "checkpoint_cb = tf.keras.callbacks.ModelCheckpoint(\"my_mnist_model\", save_best_only=True)\n",
"tensorboard_cb = tf.keras.callbacks.TensorBoard(run_logdir)\n", "tensorboard_cb = tf.keras.callbacks.TensorBoard(run_logdir)\n",
"\n", "\n",
"history = model.fit(X_train, y_train, epochs=100,\n", "history = model.fit(X_train, y_train, epochs=100,\n",
@ -3710,7 +3710,7 @@
} }
], ],
"source": [ "source": [
"model = tf.keras.models.load_model(\"my_mnist_model.h5\") # rollback to best model\n", "model = tf.keras.models.load_model(\"my_mnist_model\") # rollback to best model\n",
"model.evaluate(X_test, y_test)" "model.evaluate(X_test, y_test)"
] ]
}, },
@ -3781,7 +3781,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.12" "version": "3.9.10"
}, },
"nav_menu": { "nav_menu": {
"height": "264px", "height": "264px",