|
567 | 567 | },
|
568 | 568 | "outputs": [],
|
569 | 569 | "source": [
|
570 |
| - "keras.utils.plot_model(model, \"updated_ticket_classifier.png\", show_shapes=True)" |
| 570 | + "keras.utils.plot_model(new_model, \"updated_ticket_classifier.png\", show_shapes=True)" |
571 | 571 | ]
|
572 | 572 | },
|
573 | 573 | {
|
|
846 | 846 | "\n",
|
847 | 847 | " def __init__(self, name=\"rmse\", **kwargs):\n",
|
848 | 848 | " super().__init__(name=name, **kwargs)\n",
|
849 |
| - " self.mse_sum = self.add_weight(\n", |
850 |
| - " name=\"mse_sum\", initializer=\"zeros\")\n", |
| 849 | + " self.mse_sum = self.add_weight(name=\"mse_sum\", initializer=\"zeros\")\n", |
851 | 850 | " self.total_samples = self.add_weight(\n",
|
852 | 851 | " name=\"total_samples\", initializer=\"zeros\", dtype=\"int32\")\n",
|
853 | 852 | "\n",
|
|
925 | 924 | " patience=1,\n",
|
926 | 925 | " ),\n",
|
927 | 926 | " keras.callbacks.ModelCheckpoint(\n",
|
928 |
| - " filepath=\"my_checkpoint_path\",\n", |
| 927 | + " filepath=\"checkpoint_path.keras\",\n", |
929 | 928 | " monitor=\"val_loss\",\n",
|
930 | 929 | " save_best_only=True,\n",
|
931 | 930 | " )\n",
|
|
948 | 947 | },
|
949 | 948 | "outputs": [],
|
950 | 949 | "source": [
|
951 |
| - "model = keras.models.load_model(\"my_checkpoint_path\")" |
| 950 | + "model = keras.models.load_model(\"checkpoint_path.keras\")" |
952 | 951 | ]
|
953 | 952 | },
|
954 | 953 | {
|
|
1024 | 1023 | "### Monitoring and visualization with TensorBoard"
|
1025 | 1024 | ]
|
1026 | 1025 | },
|
| 1026 | + { |
| 1027 | + "cell_type": "code", |
| 1028 | + "execution_count": 0, |
| 1029 | + "metadata": { |
| 1030 | + "colab_type": "code" |
| 1031 | + }, |
| 1032 | + "outputs": [], |
| 1033 | + "source": [ |
| 1034 | + "model = get_mnist_model()\n", |
| 1035 | + "model.compile(optimizer=\"rmsprop\",\n", |
| 1036 | + " loss=\"sparse_categorical_crossentropy\",\n", |
| 1037 | + " metrics=[\"accuracy\"])\n", |
| 1038 | + "\n", |
| 1039 | + "tensorboard = keras.callbacks.TensorBoard(\n", |
| 1040 | + " log_dir=\"/full_path_to_your_log_dir\",\n", |
| 1041 | + ")\n", |
| 1042 | + "model.fit(train_images, train_labels,\n", |
| 1043 | + " epochs=10,\n", |
| 1044 | + " validation_data=(val_images, val_labels),\n", |
| 1045 | + " callbacks=[tensorboard])" |
| 1046 | + ] |
| 1047 | + }, |
| 1048 | + { |
| 1049 | + "cell_type": "code", |
| 1050 | + "execution_count": 0, |
| 1051 | + "metadata": { |
| 1052 | + "colab_type": "code" |
| 1053 | + }, |
| 1054 | + "outputs": [], |
| 1055 | + "source": [ |
| 1056 | + "%load_ext tensorboard\n", |
| 1057 | + "%tensorboard --logdir /full_path_to_your_log_dir" |
| 1058 | + ] |
| 1059 | + }, |
1027 | 1060 | {
|
1028 | 1061 | "cell_type": "markdown",
|
1029 | 1062 | "metadata": {
|
|
0 commit comments