|
1048 | 1048 | "source": [
|
1049 | 1049 | "random_tool = v1.keras.utils.DeterministicRandomTestTool(mode='num_random_ops')\n",
|
1050 | 1050 | "with random_tool.scope():\n",
|
1051 |
| - " tf.keras.utils.set_random_seed(42)\n", |
| 1051 | + " tf.keras.utils.set_random_seed(42)\n", |
1052 | 1052 | " layer = CompatModel(10)\n",
|
1053 | 1053 | "\n",
|
1054 | 1054 | " inputs = tf.random.normal(shape=(10, 5, 5, 5))\n",
|
|
1070 | 1070 | "source": [
|
1071 | 1071 | "random_tool = v1.keras.utils.DeterministicRandomTestTool(mode='num_random_ops')\n",
|
1072 | 1072 | "with random_tool.scope():\n",
|
1073 |
| - " tf.keras.utils.set_random_seed(42)\n", |
| 1073 | + " tf.keras.utils.set_random_seed(42)\n", |
1074 | 1074 | " layer = PartiallyMigratedModel(10)\n",
|
1075 | 1075 | "\n",
|
1076 | 1076 | " inputs = tf.random.normal(shape=(10, 5, 5, 5))\n",
|
|
1144 | 1144 | "source": [
|
1145 | 1145 | "random_tool = v1.keras.utils.DeterministicRandomTestTool(mode='num_random_ops')\n",
|
1146 | 1146 | "with random_tool.scope():\n",
|
1147 |
| - " tf.keras.utils.set_random_seed(42)\n", |
| 1147 | + " tf.keras.utils.set_random_seed(42)\n", |
1148 | 1148 | " layer = NearlyFullyNativeModel(10)\n",
|
1149 | 1149 | "\n",
|
1150 | 1150 | " inputs = tf.random.normal(shape=(10, 5, 5, 5))\n",
|
|
1218 | 1218 | "source": [
|
1219 | 1219 | "random_tool = v1.keras.utils.DeterministicRandomTestTool(mode='num_random_ops')\n",
|
1220 | 1220 | "with random_tool.scope():\n",
|
1221 |
| - " tf.keras.utils.set_random_seed(42)\n", |
| 1221 | + " tf.keras.utils.set_random_seed(42)\n", |
1222 | 1222 | " layer = FullyNativeModel(10)\n",
|
1223 | 1223 | "\n",
|
1224 | 1224 | " inputs = tf.random.normal(shape=(10, 5, 5, 5))\n",
|
|
1253 | 1253 | "\n",
|
1254 | 1254 | "The above migration process to native TF2 APIs changed both the variable names (as Keras APIs produce very different weight names), and the object-oriented paths that point to different weights in the model. The impact of these changes is that they will have broken both any existing TF1-style name-based checkpoints or TF2-style object-oriented checkpoints.\n",
|
1255 | 1255 | "\n",
|
1256 |
| - "However, in some cases, you might be able to take your original name-based checkpoint and find a mapping of the variables to their new names with approaches like the one detailed in the [Reusing TF1.x checkpoints guide](./reusing_checkpoints.ipynb).\n", |
| 1256 | + "However, in some cases, you might be able to take your original name-based checkpoint and find a mapping of the variables to their new names with approaches like the one detailed in the [Reusing TF1.x checkpoints guide](./migrating_checkpoints.ipynb).\n", |
1257 | 1257 | "\n",
|
1258 | 1258 | "Some tips to making this feasible are as follows:\n",
|
1259 | 1259 | "- Variables still all have a `name` argument you can set.\n",
|
|
0 commit comments