Replace HDF5 with TF format
parent
ace7a972b9
commit
7a551f5fb1
|
@ -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)"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -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\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue