Skip to content

Commit

Permalink
Add missing custom_objects in load_model()
Browse files Browse the repository at this point in the history
  • Loading branch information
ageron committed Oct 5, 2024
1 parent 2c0de8d commit 9143aa2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 12_custom_models_and_training_with_tensorflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3365,7 +3365,10 @@
"source": [
"# extra code – the model can be loaded and you can continue training or use it\n",
"# to make predictions\n",
"model = tf.keras.models.load_model(\"my_custom_model.keras\")\n",
"model = tf.keras.models.load_model(\n",
" \"my_custom_model.keras\",\n",
" custom_objects={\"ResidualRegressor\": ResidualRegressor}\n",
")\n",
"history = model.fit(X_train_scaled, y_train, epochs=2)\n",
"model.predict(X_test_scaled[:3])"
]
Expand Down

0 comments on commit 9143aa2

Please sign in to comment.