diff --git a/15_processing_sequences_using_rnns_and_cnns.ipynb b/15_processing_sequences_using_rnns_and_cnns.ipynb index f6e2e5b..0d1face 100644 --- a/15_processing_sequences_using_rnns_and_cnns.ipynb +++ b/15_processing_sequences_using_rnns_and_cnns.ipynb @@ -3988,7 +3988,7 @@ } ], "source": [ - "model.save(\"my_sketchrnn\")" + "model.save(\"my_sketchrnn\", save_format=\"tf\")" ] }, { @@ -4638,7 +4638,7 @@ } ], "source": [ - "model.save(\"my_bach_model.h5\")\n", + "model.save(\"my_bach_model\", save_format=\"tf\")\n", "model.evaluate(test_set)" ] }, diff --git a/19_training_and_deploying_at_scale.ipynb b/19_training_and_deploying_at_scale.ipynb index ead10a4..352b3db 100644 --- a/19_training_and_deploying_at_scale.ipynb +++ b/19_training_and_deploying_at_scale.ipynb @@ -229,7 +229,7 @@ "model_name = \"my_mnist_model\"\n", "model_version = \"0001\"\n", "model_path = Path(model_name) / model_version\n", - "model.save(model_path)" + "model.save(model_path, save_format=\"tf\")" ] }, { @@ -706,7 +706,7 @@ "source": [ "model_version = \"0002\"\n", "model_path = Path(model_name) / model_version\n", - "model.save(model_path)" + "model.save(model_path, save_format=\"tf\")" ] }, { @@ -1830,7 +1830,7 @@ "source": [ "# extra code – shows that saving a model does not preserve its distribution\n", "# strategy\n", - "model.save(\"my_mirrored_model\")\n", + "model.save(\"my_mirrored_model\", save_format=\"tf\")\n", "model = tf.keras.models.load_model(\"my_mirrored_model\")\n", "type(model.weights[0])" ] @@ -2151,10 +2151,10 @@ "model.fit(X_train, y_train, validation_data=(X_valid, y_valid), epochs=10)\n", "\n", "if resolver.task_id == 0: # the chief saves the model to the right location\n", - " model.save(\"my_mnist_multiworker_model\")\n", + " model.save(\"my_mnist_multiworker_model\", save_format=\"tf\")\n", "else:\n", " tmpdir = tempfile.mkdtemp() # other workers save to a temporary directory\n", - " model.save(tmpdir)\n", + " model.save(tmpdir, save_format=\"tf\")\n", " tf.io.gfile.rmtree(tmpdir) # and we can delete this directory at the end!" ] }, @@ -2319,7 +2319,7 @@ "\n", "model.fit(X_train, y_train, validation_data=(X_valid, y_valid), epochs=10,\n", " callbacks=callbacks)\n", - "model.save(model_dir)" + "model.save(model_dir, save_format=\"tf\")" ] }, { @@ -2471,7 +2471,7 @@ "model = build_model(args)\n", "history = model.fit(X_train, y_train, validation_data=(X_valid, y_valid),\n", " epochs=10, callbacks=callbacks)\n", - "model.save(model_dir) # extra code\n", + "model.save(model_dir, save_format=\"tf\") # extra code\n", "\n", "import hypertune\n", "\n", @@ -2771,7 +2771,7 @@ "if tuner_id == \"chief\":\n", " best_hp = hyperband_tuner.get_best_hyperparameters()[0]\n", " best_model = hyperband_tuner.hypermodel.build(best_hp)\n", - " best_model.save(os.getenv(\"AIP_MODEL_DIR\"))" + " best_model.save(os.getenv(\"AIP_MODEL_DIR\"), save_format=\"tf\")" ] }, {