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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {
|
| 6 |
+
"id": "pUWCd_Ch5J49"
|
| 7 |
+
},
|
| 8 |
+
"source": [
|
| 9 |
+
"# Character-level recurrent sequence-to-sequence model\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"**Author:** [fchollet](https://twitter.com/fchollet)<br>\n",
|
| 12 |
+
"**Date created:** 2017/09/29<br>\n",
|
| 13 |
+
"**Last modified:** 2020/04/26<br>\n",
|
| 14 |
+
"**Description:** Character-level recurrent sequence-to-sequence model."
|
| 15 |
+
]
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"cell_type": "markdown",
|
| 19 |
+
"metadata": {
|
| 20 |
+
"id": "y2uZhuQ-5J5B"
|
| 21 |
+
},
|
| 22 |
+
"source": [
|
| 23 |
+
"## Introduction\n",
|
| 24 |
+
"\n",
|
| 25 |
+
"This example demonstrates how to implement a basic character-level\n",
|
| 26 |
+
"recurrent sequence-to-sequence model. We apply it to translating\n",
|
| 27 |
+
"short English sentences into short French sentences,\n",
|
| 28 |
+
"character-by-character. Note that it is fairly unusual to\n",
|
| 29 |
+
"do character-level machine translation, as word-level\n",
|
| 30 |
+
"models are more common in this domain.\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"**Summary of the algorithm**\n",
|
| 33 |
+
"\n",
|
| 34 |
+
"- We start with input sequences from a domain (e.g. English sentences)\n",
|
| 35 |
+
" and corresponding target sequences from another domain\n",
|
| 36 |
+
" (e.g. French sentences).\n",
|
| 37 |
+
"- An encoder LSTM turns input sequences to 2 state vectors\n",
|
| 38 |
+
" (we keep the last LSTM state and discard the outputs).\n",
|
| 39 |
+
"- A decoder LSTM is trained to turn the target sequences into\n",
|
| 40 |
+
" the same sequence but offset by one timestep in the future,\n",
|
| 41 |
+
" a training process called \"teacher forcing\" in this context.\n",
|
| 42 |
+
" It uses as initial state the state vectors from the encoder.\n",
|
| 43 |
+
" Effectively, the decoder learns to generate `targets[t+1...]`\n",
|
| 44 |
+
" given `targets[...t]`, conditioned on the input sequence.\n",
|
| 45 |
+
"- In inference mode, when we want to decode unknown input sequences, we:\n",
|
| 46 |
+
" - Encode the input sequence into state vectors\n",
|
| 47 |
+
" - Start with a target sequence of size 1\n",
|
| 48 |
+
" (just the start-of-sequence character)\n",
|
| 49 |
+
" - Feed the state vectors and 1-char target sequence\n",
|
| 50 |
+
" to the decoder to produce predictions for the next character\n",
|
| 51 |
+
" - Sample the next character using these predictions\n",
|
| 52 |
+
" (we simply use argmax).\n",
|
| 53 |
+
" - Append the sampled character to the target sequence\n",
|
| 54 |
+
" - Repeat until we generate the end-of-sequence character or we\n",
|
| 55 |
+
" hit the character limit.\n"
|
| 56 |
+
]
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"cell_type": "markdown",
|
| 60 |
+
"metadata": {
|
| 61 |
+
"id": "ymvVW7f55J5C"
|
| 62 |
+
},
|
| 63 |
+
"source": [
|
| 64 |
+
"## Setup\n"
|
| 65 |
+
]
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"cell_type": "code",
|
| 69 |
+
"execution_count": 1,
|
| 70 |
+
"metadata": {
|
| 71 |
+
"id": "IKzDuATV5J5C"
|
| 72 |
+
},
|
| 73 |
+
"outputs": [],
|
| 74 |
+
"source": [
|
| 75 |
+
"import numpy as np\n",
|
| 76 |
+
"import tensorflow as tf\n",
|
| 77 |
+
"from tensorflow import keras\n"
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"cell_type": "markdown",
|
| 82 |
+
"metadata": {
|
| 83 |
+
"id": "KsdDP8835J5D"
|
| 84 |
+
},
|
| 85 |
+
"source": [
|
| 86 |
+
"## Download the data\n"
|
| 87 |
+
]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"cell_type": "code",
|
| 91 |
+
"execution_count": 2,
|
| 92 |
+
"metadata": {
|
| 93 |
+
"id": "QjrXitpv5J5E",
|
| 94 |
+
"colab": {
|
| 95 |
+
"base_uri": "https://localhost:8080/"
|
| 96 |
+
},
|
| 97 |
+
"outputId": "a5c71e87-b3c7-419e-d987-5f2551c0e236"
|
| 98 |
+
},
|
| 99 |
+
"outputs": [
|
| 100 |
+
{
|
| 101 |
+
"output_type": "execute_result",
|
| 102 |
+
"data": {
|
| 103 |
+
"text/plain": [
|
| 104 |
+
"['Archive: fra-eng.zip',\n",
|
| 105 |
+
" ' inflating: _about.txt ',\n",
|
| 106 |
+
" ' inflating: fra.txt ']"
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
"metadata": {},
|
| 110 |
+
"execution_count": 2
|
| 111 |
+
}
|
| 112 |
+
],
|
| 113 |
+
"source": [
|
| 114 |
+
"!!curl -O http://www.manythings.org/anki/fra-eng.zip\n",
|
| 115 |
+
"!!unzip fra-eng.zip\n"
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"cell_type": "markdown",
|
| 120 |
+
"metadata": {
|
| 121 |
+
"id": "4Qi0m1NC5J5E"
|
| 122 |
+
},
|
| 123 |
+
"source": [
|
| 124 |
+
"## Configuration\n"
|
| 125 |
+
]
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"cell_type": "code",
|
| 129 |
+
"execution_count": 3,
|
| 130 |
+
"metadata": {
|
| 131 |
+
"id": "UB6qEq0b5J5F"
|
| 132 |
+
},
|
| 133 |
+
"outputs": [],
|
| 134 |
+
"source": [
|
| 135 |
+
"batch_size = 64 # Batch size for training.\n",
|
| 136 |
+
"epochs = 100 # Number of epochs to train for.\n",
|
| 137 |
+
"latent_dim = 256 # Latent dimensionality of the encoding space.\n",
|
| 138 |
+
"num_samples = 10000 # Number of samples to train on.\n",
|
| 139 |
+
"# Path to the data txt file on disk.\n",
|
| 140 |
+
"data_path = \"fra.txt\"\n"
|
| 141 |
+
]
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
"cell_type": "markdown",
|
| 145 |
+
"metadata": {
|
| 146 |
+
"id": "50hqcmjH5J5F"
|
| 147 |
+
},
|
| 148 |
+
"source": [
|
| 149 |
+
"## Prepare the data\n"
|
| 150 |
+
]
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"cell_type": "code",
|
| 154 |
+
"execution_count": 4,
|
| 155 |
+
"metadata": {
|
| 156 |
+
"id": "XIoa7eHS5J5G",
|
| 157 |
+
"colab": {
|
| 158 |
+
"base_uri": "https://localhost:8080/"
|
| 159 |
+
},
|
| 160 |
+
"outputId": "583ed656-723a-4c36-eede-259afa77ffba"
|
| 161 |
+
},
|
| 162 |
+
"outputs": [
|
| 163 |
+
{
|
| 164 |
+
"output_type": "stream",
|
| 165 |
+
"name": "stdout",
|
| 166 |
+
"text": [
|
| 167 |
+
"Number of samples: 10000\n",
|
| 168 |
+
"Number of unique input tokens: 71\n",
|
| 169 |
+
"Number of unique output tokens: 92\n",
|
| 170 |
+
"Max sequence length for inputs: 15\n",
|
| 171 |
+
"Max sequence length for outputs: 59\n"
|
| 172 |
+
]
|
| 173 |
+
}
|
| 174 |
+
],
|
| 175 |
+
"source": [
|
| 176 |
+
"# Vectorize the data.\n",
|
| 177 |
+
"input_texts = []\n",
|
| 178 |
+
"target_texts = []\n",
|
| 179 |
+
"input_characters = set()\n",
|
| 180 |
+
"target_characters = set()\n",
|
| 181 |
+
"with open(data_path, \"r\", encoding=\"utf-8\") as f:\n",
|
| 182 |
+
" lines = f.read().split(\"\\n\")\n",
|
| 183 |
+
"for line in lines[: min(num_samples, len(lines) - 1)]:\n",
|
| 184 |
+
" input_text, target_text, _ = line.split(\"\\t\")\n",
|
| 185 |
+
" # We use \"tab\" as the \"start sequence\" character\n",
|
| 186 |
+
" # for the targets, and \"\\n\" as \"end sequence\" character.\n",
|
| 187 |
+
" target_text = \"\\t\" + target_text + \"\\n\"\n",
|
| 188 |
+
" input_texts.append(input_text)\n",
|
| 189 |
+
" target_texts.append(target_text)\n",
|
| 190 |
+
" for char in input_text:\n",
|
| 191 |
+
" if char not in input_characters:\n",
|
| 192 |
+
" input_characters.add(char)\n",
|
| 193 |
+
" for char in target_text:\n",
|
| 194 |
+
" if char not in target_characters:\n",
|
| 195 |
+
" target_characters.add(char)\n",
|
| 196 |
+
"\n",
|
| 197 |
+
"input_characters = sorted(list(input_characters))\n",
|
| 198 |
+
"target_characters = sorted(list(target_characters))\n",
|
| 199 |
+
"num_encoder_tokens = len(input_characters)\n",
|
| 200 |
+
"num_decoder_tokens = len(target_characters)\n",
|
| 201 |
+
"max_encoder_seq_length = max([len(txt) for txt in input_texts])\n",
|
| 202 |
+
"max_decoder_seq_length = max([len(txt) for txt in target_texts])\n",
|
| 203 |
+
"\n",
|
| 204 |
+
"print(\"Number of samples:\", len(input_texts))\n",
|
| 205 |
+
"print(\"Number of unique input tokens:\", num_encoder_tokens)\n",
|
| 206 |
+
"print(\"Number of unique output tokens:\", num_decoder_tokens)\n",
|
| 207 |
+
"print(\"Max sequence length for inputs:\", max_encoder_seq_length)\n",
|
| 208 |
+
"print(\"Max sequence length for outputs:\", max_decoder_seq_length)\n",
|
| 209 |
+
"\n",
|
| 210 |
+
"input_token_index = dict([(char, i) for i, char in enumerate(input_characters)])\n",
|
| 211 |
+
"target_token_index = dict([(char, i) for i, char in enumerate(target_characters)])\n",
|
| 212 |
+
"\n",
|
| 213 |
+
"encoder_input_data = np.zeros(\n",
|
| 214 |
+
" (len(input_texts), max_encoder_seq_length, num_encoder_tokens), dtype=\"float32\"\n",
|
| 215 |
+
")\n",
|
| 216 |
+
"decoder_input_data = np.zeros(\n",
|
| 217 |
+
" (len(input_texts), max_decoder_seq_length, num_decoder_tokens), dtype=\"float32\"\n",
|
| 218 |
+
")\n",
|
| 219 |
+
"decoder_target_data = np.zeros(\n",
|
| 220 |
+
" (len(input_texts), max_decoder_seq_length, num_decoder_tokens), dtype=\"float32\"\n",
|
| 221 |
+
")\n",
|
| 222 |
+
"\n",
|
| 223 |
+
"for i, (input_text, target_text) in enumerate(zip(input_texts, target_texts)):\n",
|
| 224 |
+
" for t, char in enumerate(input_text):\n",
|
| 225 |
+
" encoder_input_data[i, t, input_token_index[char]] = 1.0\n",
|
| 226 |
+
" encoder_input_data[i, t + 1 :, input_token_index[\" \"]] = 1.0\n",
|
| 227 |
+
" for t, char in enumerate(target_text):\n",
|
| 228 |
+
" # decoder_target_data is ahead of decoder_input_data by one timestep\n",
|
| 229 |
+
" decoder_input_data[i, t, target_token_index[char]] = 1.0\n",
|
| 230 |
+
" if t > 0:\n",
|
| 231 |
+
" # decoder_target_data will be ahead by one timestep\n",
|
| 232 |
+
" # and will not include the start character.\n",
|
| 233 |
+
" decoder_target_data[i, t - 1, target_token_index[char]] = 1.0\n",
|
| 234 |
+
" decoder_input_data[i, t + 1 :, target_token_index[\" \"]] = 1.0\n",
|
| 235 |
+
" decoder_target_data[i, t:, target_token_index[\" \"]] = 1.0\n"
|
| 236 |
+
]
|
| 237 |
+
},
|
| 238 |
+
{
|
| 239 |
+
"cell_type": "markdown",
|
| 240 |
+
"metadata": {
|
| 241 |
+
"id": "Nmmia38F5J5H"
|
| 242 |
+
},
|
| 243 |
+
"source": [
|
| 244 |
+
"## Build the model\n"
|
| 245 |
+
]
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"cell_type": "code",
|
| 249 |
+
"execution_count": 5,
|
| 250 |
+
"metadata": {
|
| 251 |
+
"id": "xUBfSVSH5J5H"
|
| 252 |
+
},
|
| 253 |
+
"outputs": [],
|
| 254 |
+
"source": [
|
| 255 |
+
"# Define an input sequence and process it.\n",
|
| 256 |
+
"encoder_inputs = keras.Input(shape=(None, num_encoder_tokens))\n",
|
| 257 |
+
"encoder = keras.layers.LSTM(latent_dim, return_state=True)\n",
|
| 258 |
+
"encoder_outputs, state_h, state_c = encoder(encoder_inputs)\n",
|
| 259 |
+
"\n",
|
| 260 |
+
"# We discard `encoder_outputs` and only keep the states.\n",
|
| 261 |
+
"encoder_states = [state_h, state_c]\n",
|
| 262 |
+
"\n",
|
| 263 |
+
"# Set up the decoder, using `encoder_states` as initial state.\n",
|
| 264 |
+
"decoder_inputs = keras.Input(shape=(None, num_decoder_tokens))\n",
|
| 265 |
+
"\n",
|
| 266 |
+
"# We set up our decoder to return full output sequences,\n",
|
| 267 |
+
"# and to return internal states as well. We don't use the\n",
|
| 268 |
+
"# return states in the training model, but we will use them in inference.\n",
|
| 269 |
+
"decoder_lstm = keras.layers.LSTM(latent_dim, return_sequences=True, return_state=True)\n",
|
| 270 |
+
"decoder_outputs, _, _ = decoder_lstm(decoder_inputs, initial_state=encoder_states)\n",
|
| 271 |
+
"decoder_dense = keras.layers.Dense(num_decoder_tokens, activation=\"softmax\")\n",
|
| 272 |
+
"decoder_outputs = decoder_dense(decoder_outputs)\n",
|
| 273 |
+
"\n",
|
| 274 |
+
"# Define the model that will turn\n",
|
| 275 |
+
"# `encoder_input_data` & `decoder_input_data` into `decoder_target_data`\n",
|
| 276 |
+
"model = keras.Model([encoder_inputs, decoder_inputs], decoder_outputs)\n"
|
| 277 |
+
]
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"cell_type": "markdown",
|
| 281 |
+
"metadata": {
|
| 282 |
+
"id": "MYvCCy4i5J5I"
|
| 283 |
+
},
|
| 284 |
+
"source": [
|
| 285 |
+
"## Train the model\n"
|
| 286 |
+
]
|
| 287 |
+
},
|
| 288 |
+
{
|
| 289 |
+
"cell_type": "code",
|
| 290 |
+
"execution_count": 6,
|
| 291 |
+
"metadata": {
|
| 292 |
+
"id": "3kgt3bnl5J5I",
|
| 293 |
+
"colab": {
|
| 294 |
+
"base_uri": "https://localhost:8080/"
|
| 295 |
+
},
|
| 296 |
+
"outputId": "f347151f-3666-4f10-8a05-6949a2361301"
|
| 297 |
+
},
|
| 298 |
+
"outputs": [
|
| 299 |
+
{
|
| 300 |
+
"output_type": "stream",
|
| 301 |
+
"name": "stdout",
|
| 302 |
+
"text": [
|
| 303 |
+
"Epoch 1/100\n",
|
| 304 |
+
"125/125 [==============================] - 8s 19ms/step - loss: 1.1334 - accuracy: 0.7368 - val_loss: 1.0400 - val_accuracy: 0.7264\n",
|
| 305 |
+
"Epoch 2/100\n",
|
| 306 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.8081 - accuracy: 0.7805 - val_loss: 0.8330 - val_accuracy: 0.7693\n",
|
| 307 |
+
"Epoch 3/100\n",
|
| 308 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.6407 - accuracy: 0.8185 - val_loss: 0.6837 - val_accuracy: 0.8008\n",
|
| 309 |
+
"Epoch 4/100\n",
|
| 310 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.5614 - accuracy: 0.8366 - val_loss: 0.6254 - val_accuracy: 0.8138\n",
|
| 311 |
+
"Epoch 5/100\n",
|
| 312 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.5160 - accuracy: 0.8490 - val_loss: 0.5773 - val_accuracy: 0.8346\n",
|
| 313 |
+
"Epoch 6/100\n",
|
| 314 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.4815 - accuracy: 0.8589 - val_loss: 0.5527 - val_accuracy: 0.8383\n",
|
| 315 |
+
"Epoch 7/100\n",
|
| 316 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.4538 - accuracy: 0.8659 - val_loss: 0.5317 - val_accuracy: 0.8430\n",
|
| 317 |
+
"Epoch 8/100\n",
|
| 318 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.4314 - accuracy: 0.8716 - val_loss: 0.5120 - val_accuracy: 0.8484\n",
|
| 319 |
+
"Epoch 9/100\n",
|
| 320 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.4118 - accuracy: 0.8768 - val_loss: 0.5096 - val_accuracy: 0.8493\n",
|
| 321 |
+
"Epoch 10/100\n",
|
| 322 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.3945 - accuracy: 0.8818 - val_loss: 0.4892 - val_accuracy: 0.8545\n",
|
| 323 |
+
"Epoch 11/100\n",
|
| 324 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.3785 - accuracy: 0.8864 - val_loss: 0.4884 - val_accuracy: 0.8550\n",
|
| 325 |
+
"Epoch 12/100\n",
|
| 326 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.3637 - accuracy: 0.8905 - val_loss: 0.4725 - val_accuracy: 0.8597\n",
|
| 327 |
+
"Epoch 13/100\n",
|
| 328 |
+
"125/125 [==============================] - 2s 14ms/step - loss: 0.3498 - accuracy: 0.8946 - val_loss: 0.4674 - val_accuracy: 0.8624\n",
|
| 329 |
+
"Epoch 14/100\n",
|
| 330 |
+
"125/125 [==============================] - 2s 15ms/step - loss: 0.3370 - accuracy: 0.8981 - val_loss: 0.4597 - val_accuracy: 0.8644\n",
|
| 331 |
+
"Epoch 15/100\n",
|
| 332 |
+
"125/125 [==============================] - 2s 14ms/step - loss: 0.3244 - accuracy: 0.9020 - val_loss: 0.4533 - val_accuracy: 0.8661\n",
|
| 333 |
+
"Epoch 16/100\n",
|
| 334 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.3124 - accuracy: 0.9056 - val_loss: 0.4569 - val_accuracy: 0.8655\n",
|
| 335 |
+
"Epoch 17/100\n",
|
| 336 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.3012 - accuracy: 0.9088 - val_loss: 0.4515 - val_accuracy: 0.8688\n",
|
| 337 |
+
"Epoch 18/100\n",
|
| 338 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2904 - accuracy: 0.9118 - val_loss: 0.4440 - val_accuracy: 0.8704\n",
|
| 339 |
+
"Epoch 19/100\n",
|
| 340 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2803 - accuracy: 0.9154 - val_loss: 0.4473 - val_accuracy: 0.8697\n",
|
| 341 |
+
"Epoch 20/100\n",
|
| 342 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2703 - accuracy: 0.9179 - val_loss: 0.4470 - val_accuracy: 0.8709\n",
|
| 343 |
+
"Epoch 21/100\n",
|
| 344 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2611 - accuracy: 0.9212 - val_loss: 0.4447 - val_accuracy: 0.8725\n",
|
| 345 |
+
"Epoch 22/100\n",
|
| 346 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2519 - accuracy: 0.9235 - val_loss: 0.4457 - val_accuracy: 0.8721\n",
|
| 347 |
+
"Epoch 23/100\n",
|
| 348 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2436 - accuracy: 0.9262 - val_loss: 0.4503 - val_accuracy: 0.8723\n",
|
| 349 |
+
"Epoch 24/100\n",
|
| 350 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2356 - accuracy: 0.9283 - val_loss: 0.4506 - val_accuracy: 0.8732\n",
|
| 351 |
+
"Epoch 25/100\n",
|
| 352 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2275 - accuracy: 0.9309 - val_loss: 0.4531 - val_accuracy: 0.8733\n",
|
| 353 |
+
"Epoch 26/100\n",
|
| 354 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2201 - accuracy: 0.9328 - val_loss: 0.4524 - val_accuracy: 0.8749\n",
|
| 355 |
+
"Epoch 27/100\n",
|
| 356 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2132 - accuracy: 0.9353 - val_loss: 0.4615 - val_accuracy: 0.8736\n",
|
| 357 |
+
"Epoch 28/100\n",
|
| 358 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.2064 - accuracy: 0.9370 - val_loss: 0.4609 - val_accuracy: 0.8740\n",
|
| 359 |
+
"Epoch 29/100\n",
|
| 360 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1999 - accuracy: 0.9390 - val_loss: 0.4612 - val_accuracy: 0.8750\n",
|
| 361 |
+
"Epoch 30/100\n",
|
| 362 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1933 - accuracy: 0.9411 - val_loss: 0.4701 - val_accuracy: 0.8734\n",
|
| 363 |
+
"Epoch 31/100\n",
|
| 364 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1877 - accuracy: 0.9427 - val_loss: 0.4718 - val_accuracy: 0.8747\n",
|
| 365 |
+
"Epoch 32/100\n",
|
| 366 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1816 - accuracy: 0.9443 - val_loss: 0.4749 - val_accuracy: 0.8747\n",
|
| 367 |
+
"Epoch 33/100\n",
|
| 368 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1763 - accuracy: 0.9462 - val_loss: 0.4805 - val_accuracy: 0.8746\n",
|
| 369 |
+
"Epoch 34/100\n",
|
| 370 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1711 - accuracy: 0.9477 - val_loss: 0.4855 - val_accuracy: 0.8742\n",
|
| 371 |
+
"Epoch 35/100\n",
|
| 372 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1661 - accuracy: 0.9494 - val_loss: 0.4849 - val_accuracy: 0.8745\n",
|
| 373 |
+
"Epoch 36/100\n",
|
| 374 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1612 - accuracy: 0.9505 - val_loss: 0.4939 - val_accuracy: 0.8739\n",
|
| 375 |
+
"Epoch 37/100\n",
|
| 376 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1566 - accuracy: 0.9518 - val_loss: 0.5005 - val_accuracy: 0.8734\n",
|
| 377 |
+
"Epoch 38/100\n",
|
| 378 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1517 - accuracy: 0.9536 - val_loss: 0.5021 - val_accuracy: 0.8748\n",
|
| 379 |
+
"Epoch 39/100\n",
|
| 380 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1476 - accuracy: 0.9548 - val_loss: 0.5051 - val_accuracy: 0.8744\n",
|
| 381 |
+
"Epoch 40/100\n",
|
| 382 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1434 - accuracy: 0.9561 - val_loss: 0.5081 - val_accuracy: 0.8740\n",
|
| 383 |
+
"Epoch 41/100\n",
|
| 384 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1396 - accuracy: 0.9573 - val_loss: 0.5173 - val_accuracy: 0.8745\n",
|
| 385 |
+
"Epoch 42/100\n",
|
| 386 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1356 - accuracy: 0.9584 - val_loss: 0.5199 - val_accuracy: 0.8745\n",
|
| 387 |
+
"Epoch 43/100\n",
|
| 388 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1318 - accuracy: 0.9591 - val_loss: 0.5236 - val_accuracy: 0.8738\n",
|
| 389 |
+
"Epoch 44/100\n",
|
| 390 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1290 - accuracy: 0.9602 - val_loss: 0.5382 - val_accuracy: 0.8731\n",
|
| 391 |
+
"Epoch 45/100\n",
|
| 392 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1250 - accuracy: 0.9616 - val_loss: 0.5393 - val_accuracy: 0.8736\n",
|
| 393 |
+
"Epoch 46/100\n",
|
| 394 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1218 - accuracy: 0.9624 - val_loss: 0.5392 - val_accuracy: 0.8734\n",
|
| 395 |
+
"Epoch 47/100\n",
|
| 396 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1189 - accuracy: 0.9633 - val_loss: 0.5483 - val_accuracy: 0.8742\n",
|
| 397 |
+
"Epoch 48/100\n",
|
| 398 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1159 - accuracy: 0.9642 - val_loss: 0.5486 - val_accuracy: 0.8740\n",
|
| 399 |
+
"Epoch 49/100\n",
|
| 400 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1127 - accuracy: 0.9652 - val_loss: 0.5606 - val_accuracy: 0.8734\n",
|
| 401 |
+
"Epoch 50/100\n",
|
| 402 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1104 - accuracy: 0.9654 - val_loss: 0.5610 - val_accuracy: 0.8738\n",
|
| 403 |
+
"Epoch 51/100\n",
|
| 404 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1075 - accuracy: 0.9664 - val_loss: 0.5674 - val_accuracy: 0.8735\n",
|
| 405 |
+
"Epoch 52/100\n",
|
| 406 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1050 - accuracy: 0.9673 - val_loss: 0.5702 - val_accuracy: 0.8731\n",
|
| 407 |
+
"Epoch 53/100\n",
|
| 408 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1027 - accuracy: 0.9679 - val_loss: 0.5756 - val_accuracy: 0.8732\n",
|
| 409 |
+
"Epoch 54/100\n",
|
| 410 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.1004 - accuracy: 0.9684 - val_loss: 0.5783 - val_accuracy: 0.8736\n",
|
| 411 |
+
"Epoch 55/100\n",
|
| 412 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0978 - accuracy: 0.9691 - val_loss: 0.5838 - val_accuracy: 0.8729\n",
|
| 413 |
+
"Epoch 56/100\n",
|
| 414 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0955 - accuracy: 0.9700 - val_loss: 0.5851 - val_accuracy: 0.8736\n",
|
| 415 |
+
"Epoch 57/100\n",
|
| 416 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0934 - accuracy: 0.9703 - val_loss: 0.5969 - val_accuracy: 0.8722\n",
|
| 417 |
+
"Epoch 58/100\n",
|
| 418 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0913 - accuracy: 0.9709 - val_loss: 0.6024 - val_accuracy: 0.8723\n",
|
| 419 |
+
"Epoch 59/100\n",
|
| 420 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0890 - accuracy: 0.9717 - val_loss: 0.6073 - val_accuracy: 0.8723\n",
|
| 421 |
+
"Epoch 60/100\n",
|
| 422 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0873 - accuracy: 0.9720 - val_loss: 0.6113 - val_accuracy: 0.8731\n",
|
| 423 |
+
"Epoch 61/100\n",
|
| 424 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0858 - accuracy: 0.9725 - val_loss: 0.6190 - val_accuracy: 0.8726\n",
|
| 425 |
+
"Epoch 62/100\n",
|
| 426 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0836 - accuracy: 0.9732 - val_loss: 0.6139 - val_accuracy: 0.8731\n",
|
| 427 |
+
"Epoch 63/100\n",
|
| 428 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0819 - accuracy: 0.9737 - val_loss: 0.6242 - val_accuracy: 0.8725\n",
|
| 429 |
+
"Epoch 64/100\n",
|
| 430 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0803 - accuracy: 0.9740 - val_loss: 0.6318 - val_accuracy: 0.8709\n",
|
| 431 |
+
"Epoch 65/100\n",
|
| 432 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0784 - accuracy: 0.9748 - val_loss: 0.6384 - val_accuracy: 0.8728\n",
|
| 433 |
+
"Epoch 66/100\n",
|
| 434 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0768 - accuracy: 0.9749 - val_loss: 0.6392 - val_accuracy: 0.8721\n",
|
| 435 |
+
"Epoch 67/100\n",
|
| 436 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0755 - accuracy: 0.9754 - val_loss: 0.6453 - val_accuracy: 0.8718\n",
|
| 437 |
+
"Epoch 68/100\n",
|
| 438 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0741 - accuracy: 0.9758 - val_loss: 0.6492 - val_accuracy: 0.8716\n",
|
| 439 |
+
"Epoch 69/100\n",
|
| 440 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0720 - accuracy: 0.9765 - val_loss: 0.6505 - val_accuracy: 0.8720\n",
|
| 441 |
+
"Epoch 70/100\n",
|
| 442 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0711 - accuracy: 0.9768 - val_loss: 0.6605 - val_accuracy: 0.8720\n",
|
| 443 |
+
"Epoch 71/100\n",
|
| 444 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0698 - accuracy: 0.9771 - val_loss: 0.6621 - val_accuracy: 0.8714\n",
|
| 445 |
+
"Epoch 72/100\n",
|
| 446 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0685 - accuracy: 0.9774 - val_loss: 0.6656 - val_accuracy: 0.8721\n",
|
| 447 |
+
"Epoch 73/100\n",
|
| 448 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0668 - accuracy: 0.9778 - val_loss: 0.6736 - val_accuracy: 0.8715\n",
|
| 449 |
+
"Epoch 74/100\n",
|
| 450 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0654 - accuracy: 0.9782 - val_loss: 0.6759 - val_accuracy: 0.8713\n",
|
| 451 |
+
"Epoch 75/100\n",
|
| 452 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0642 - accuracy: 0.9786 - val_loss: 0.6830 - val_accuracy: 0.8717\n",
|
| 453 |
+
"Epoch 76/100\n",
|
| 454 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0633 - accuracy: 0.9789 - val_loss: 0.6856 - val_accuracy: 0.8705\n",
|
| 455 |
+
"Epoch 77/100\n",
|
| 456 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0623 - accuracy: 0.9792 - val_loss: 0.6924 - val_accuracy: 0.8714\n",
|
| 457 |
+
"Epoch 78/100\n",
|
| 458 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0608 - accuracy: 0.9795 - val_loss: 0.6958 - val_accuracy: 0.8709\n",
|
| 459 |
+
"Epoch 79/100\n",
|
| 460 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0601 - accuracy: 0.9798 - val_loss: 0.7000 - val_accuracy: 0.8712\n",
|
| 461 |
+
"Epoch 80/100\n",
|
| 462 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0589 - accuracy: 0.9799 - val_loss: 0.6989 - val_accuracy: 0.8719\n",
|
| 463 |
+
"Epoch 81/100\n",
|
| 464 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0577 - accuracy: 0.9804 - val_loss: 0.7021 - val_accuracy: 0.8704\n",
|
| 465 |
+
"Epoch 82/100\n",
|
| 466 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0571 - accuracy: 0.9806 - val_loss: 0.7111 - val_accuracy: 0.8705\n",
|
| 467 |
+
"Epoch 83/100\n",
|
| 468 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0562 - accuracy: 0.9808 - val_loss: 0.7124 - val_accuracy: 0.8715\n",
|
| 469 |
+
"Epoch 84/100\n",
|
| 470 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0549 - accuracy: 0.9812 - val_loss: 0.7160 - val_accuracy: 0.8711\n",
|
| 471 |
+
"Epoch 85/100\n",
|
| 472 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0541 - accuracy: 0.9815 - val_loss: 0.7220 - val_accuracy: 0.8707\n",
|
| 473 |
+
"Epoch 86/100\n",
|
| 474 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0537 - accuracy: 0.9817 - val_loss: 0.7173 - val_accuracy: 0.8711\n",
|
| 475 |
+
"Epoch 87/100\n",
|
| 476 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0521 - accuracy: 0.9820 - val_loss: 0.7312 - val_accuracy: 0.8702\n",
|
| 477 |
+
"Epoch 88/100\n",
|
| 478 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0514 - accuracy: 0.9822 - val_loss: 0.7252 - val_accuracy: 0.8718\n",
|
| 479 |
+
"Epoch 89/100\n",
|
| 480 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0507 - accuracy: 0.9825 - val_loss: 0.7324 - val_accuracy: 0.8703\n",
|
| 481 |
+
"Epoch 90/100\n",
|
| 482 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0503 - accuracy: 0.9824 - val_loss: 0.7375 - val_accuracy: 0.8696\n",
|
| 483 |
+
"Epoch 91/100\n",
|
| 484 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0493 - accuracy: 0.9829 - val_loss: 0.7417 - val_accuracy: 0.8699\n",
|
| 485 |
+
"Epoch 92/100\n",
|
| 486 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0485 - accuracy: 0.9831 - val_loss: 0.7448 - val_accuracy: 0.8712\n",
|
| 487 |
+
"Epoch 93/100\n",
|
| 488 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0484 - accuracy: 0.9831 - val_loss: 0.7448 - val_accuracy: 0.8699\n",
|
| 489 |
+
"Epoch 94/100\n",
|
| 490 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0470 - accuracy: 0.9834 - val_loss: 0.7461 - val_accuracy: 0.8709\n",
|
| 491 |
+
"Epoch 95/100\n",
|
| 492 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0468 - accuracy: 0.9834 - val_loss: 0.7468 - val_accuracy: 0.8712\n",
|
| 493 |
+
"Epoch 96/100\n",
|
| 494 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0463 - accuracy: 0.9838 - val_loss: 0.7601 - val_accuracy: 0.8701\n",
|
| 495 |
+
"Epoch 97/100\n",
|
| 496 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0456 - accuracy: 0.9839 - val_loss: 0.7589 - val_accuracy: 0.8702\n",
|
| 497 |
+
"Epoch 98/100\n",
|
| 498 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0448 - accuracy: 0.9840 - val_loss: 0.7604 - val_accuracy: 0.8709\n",
|
| 499 |
+
"Epoch 99/100\n",
|
| 500 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0445 - accuracy: 0.9840 - val_loss: 0.7593 - val_accuracy: 0.8701\n",
|
| 501 |
+
"Epoch 100/100\n",
|
| 502 |
+
"125/125 [==============================] - 2s 13ms/step - loss: 0.0442 - accuracy: 0.9842 - val_loss: 0.7654 - val_accuracy: 0.8698\n"
|
| 503 |
+
]
|
| 504 |
+
},
|
| 505 |
+
{
|
| 506 |
+
"output_type": "stream",
|
| 507 |
+
"name": "stderr",
|
| 508 |
+
"text": [
|
| 509 |
+
"WARNING:absl:Found untraced functions such as lstm_cell_layer_call_fn, lstm_cell_layer_call_and_return_conditional_losses, lstm_cell_1_layer_call_fn, lstm_cell_1_layer_call_and_return_conditional_losses, lstm_cell_layer_call_fn while saving (showing 5 of 10). These functions will not be directly callable after loading.\n"
|
| 510 |
+
]
|
| 511 |
+
},
|
| 512 |
+
{
|
| 513 |
+
"output_type": "stream",
|
| 514 |
+
"name": "stdout",
|
| 515 |
+
"text": [
|
| 516 |
+
"INFO:tensorflow:Assets written to: s2s/assets\n"
|
| 517 |
+
]
|
| 518 |
+
},
|
| 519 |
+
{
|
| 520 |
+
"output_type": "stream",
|
| 521 |
+
"name": "stderr",
|
| 522 |
+
"text": [
|
| 523 |
+
"INFO:tensorflow:Assets written to: s2s/assets\n",
|
| 524 |
+
"WARNING:absl:<keras.layers.recurrent.LSTMCell object at 0x7f4ff1317d10> has the same name 'LSTMCell' as a built-in Keras object. Consider renaming <class 'keras.layers.recurrent.LSTMCell'> to avoid naming conflicts when loading with `tf.keras.models.load_model`. If renaming is not possible, pass the object in the `custom_objects` parameter of the load function.\n",
|
| 525 |
+
"WARNING:absl:<keras.layers.recurrent.LSTMCell object at 0x7f4fe0236410> has the same name 'LSTMCell' as a built-in Keras object. Consider renaming <class 'keras.layers.recurrent.LSTMCell'> to avoid naming conflicts when loading with `tf.keras.models.load_model`. If renaming is not possible, pass the object in the `custom_objects` parameter of the load function.\n"
|
| 526 |
+
]
|
| 527 |
+
}
|
| 528 |
+
],
|
| 529 |
+
"source": [
|
| 530 |
+
"# early_stopping_patience = 10\n",
|
| 531 |
+
"\n",
|
| 532 |
+
"# # Add early stopping\n",
|
| 533 |
+
"# early_stopping = keras.callbacks.EarlyStopping(\n",
|
| 534 |
+
"# monitor=\"val_accuracy\", patience=early_stopping_patience, restore_best_weights=True\n",
|
| 535 |
+
"# )\n",
|
| 536 |
+
"\n",
|
| 537 |
+
"model.compile(\n",
|
| 538 |
+
" optimizer=\"rmsprop\", loss=\"categorical_crossentropy\", metrics=[\"accuracy\"]\n",
|
| 539 |
+
")\n",
|
| 540 |
+
"model.fit(\n",
|
| 541 |
+
" [encoder_input_data, decoder_input_data],\n",
|
| 542 |
+
" decoder_target_data,\n",
|
| 543 |
+
" batch_size=batch_size,\n",
|
| 544 |
+
" epochs=epochs,\n",
|
| 545 |
+
" validation_split=0.2,\n",
|
| 546 |
+
" # callbacks=[early_stopping]\n",
|
| 547 |
+
")\n",
|
| 548 |
+
"# Save model\n",
|
| 549 |
+
"model.save(\"s2s\")\n"
|
| 550 |
+
]
|
| 551 |
+
},
|
| 552 |
+
{
|
| 553 |
+
"cell_type": "markdown",
|
| 554 |
+
"metadata": {
|
| 555 |
+
"id": "HxkS8_Pf5J5I"
|
| 556 |
+
},
|
| 557 |
+
"source": [
|
| 558 |
+
"## Run inference (sampling)\n",
|
| 559 |
+
"\n",
|
| 560 |
+
"1. encode input and retrieve initial decoder state\n",
|
| 561 |
+
"2. run one step of decoder with this initial state\n",
|
| 562 |
+
"and a \"start of sequence\" token as target.\n",
|
| 563 |
+
"Output will be the next target token.\n",
|
| 564 |
+
"3. Repeat with the current target token and current states\n"
|
| 565 |
+
]
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"cell_type": "code",
|
| 569 |
+
"execution_count": 7,
|
| 570 |
+
"metadata": {
|
| 571 |
+
"id": "-KKcZuAa5J5I"
|
| 572 |
+
},
|
| 573 |
+
"outputs": [],
|
| 574 |
+
"source": [
|
| 575 |
+
"# Define sampling models\n",
|
| 576 |
+
"# Restore the model and construct the encoder and decoder.\n",
|
| 577 |
+
"model = keras.models.load_model(\"s2s\")\n",
|
| 578 |
+
"\n",
|
| 579 |
+
"encoder_inputs = model.input[0] # input_1\n",
|
| 580 |
+
"encoder_outputs, state_h_enc, state_c_enc = model.layers[2].output # lstm_1\n",
|
| 581 |
+
"encoder_states = [state_h_enc, state_c_enc]\n",
|
| 582 |
+
"encoder_model = keras.Model(encoder_inputs, encoder_states)\n",
|
| 583 |
+
"\n",
|
| 584 |
+
"decoder_inputs = model.input[1] # input_2\n",
|
| 585 |
+
"decoder_state_input_h = keras.Input(shape=(latent_dim,))\n",
|
| 586 |
+
"decoder_state_input_c = keras.Input(shape=(latent_dim,))\n",
|
| 587 |
+
"decoder_states_inputs = [decoder_state_input_h, decoder_state_input_c]\n",
|
| 588 |
+
"decoder_lstm = model.layers[3]\n",
|
| 589 |
+
"decoder_outputs, state_h_dec, state_c_dec = decoder_lstm(\n",
|
| 590 |
+
" decoder_inputs, initial_state=decoder_states_inputs\n",
|
| 591 |
+
")\n",
|
| 592 |
+
"decoder_states = [state_h_dec, state_c_dec]\n",
|
| 593 |
+
"decoder_dense = model.layers[4]\n",
|
| 594 |
+
"decoder_outputs = decoder_dense(decoder_outputs)\n",
|
| 595 |
+
"decoder_model = keras.Model(\n",
|
| 596 |
+
" [decoder_inputs] + decoder_states_inputs, [decoder_outputs] + decoder_states\n",
|
| 597 |
+
")\n",
|
| 598 |
+
"\n",
|
| 599 |
+
"# Reverse-lookup token index to decode sequences back to\n",
|
| 600 |
+
"# something readable.\n",
|
| 601 |
+
"reverse_input_char_index = dict((i, char) for char, i in input_token_index.items())\n",
|
| 602 |
+
"reverse_target_char_index = dict((i, char) for char, i in target_token_index.items())\n",
|
| 603 |
+
"\n",
|
| 604 |
+
"\n",
|
| 605 |
+
"def decode_sequence(input_seq):\n",
|
| 606 |
+
" # Encode the input as state vectors.\n",
|
| 607 |
+
" states_value = encoder_model.predict(input_seq)\n",
|
| 608 |
+
"\n",
|
| 609 |
+
" # Generate empty target sequence of length 1.\n",
|
| 610 |
+
" target_seq = np.zeros((1, 1, num_decoder_tokens))\n",
|
| 611 |
+
" # Populate the first character of target sequence with the start character.\n",
|
| 612 |
+
" target_seq[0, 0, target_token_index[\"\\t\"]] = 1.0\n",
|
| 613 |
+
"\n",
|
| 614 |
+
" # Sampling loop for a batch of sequences\n",
|
| 615 |
+
" # (to simplify, here we assume a batch of size 1).\n",
|
| 616 |
+
" stop_condition = False\n",
|
| 617 |
+
" decoded_sentence = \"\"\n",
|
| 618 |
+
" while not stop_condition:\n",
|
| 619 |
+
" output_tokens, h, c = decoder_model.predict([target_seq] + states_value)\n",
|
| 620 |
+
"\n",
|
| 621 |
+
" # Sample a token\n",
|
| 622 |
+
" sampled_token_index = np.argmax(output_tokens[0, -1, :])\n",
|
| 623 |
+
" sampled_char = reverse_target_char_index[sampled_token_index]\n",
|
| 624 |
+
" decoded_sentence += sampled_char\n",
|
| 625 |
+
"\n",
|
| 626 |
+
" # Exit condition: either hit max length\n",
|
| 627 |
+
" # or find stop character.\n",
|
| 628 |
+
" if sampled_char == \"\\n\" or len(decoded_sentence) > max_decoder_seq_length:\n",
|
| 629 |
+
" stop_condition = True\n",
|
| 630 |
+
"\n",
|
| 631 |
+
" # Update the target sequence (of length 1).\n",
|
| 632 |
+
" target_seq = np.zeros((1, 1, num_decoder_tokens))\n",
|
| 633 |
+
" target_seq[0, 0, sampled_token_index] = 1.0\n",
|
| 634 |
+
"\n",
|
| 635 |
+
" # Update states\n",
|
| 636 |
+
" states_value = [h, c]\n",
|
| 637 |
+
" return decoded_sentence\n",
|
| 638 |
+
"\n"
|
| 639 |
+
]
|
| 640 |
+
},
|
| 641 |
+
{
|
| 642 |
+
"cell_type": "markdown",
|
| 643 |
+
"metadata": {
|
| 644 |
+
"id": "pLvBXjXg5J5J"
|
| 645 |
+
},
|
| 646 |
+
"source": [
|
| 647 |
+
"You can now generate decoded sentences as such:\n"
|
| 648 |
+
]
|
| 649 |
+
},
|
| 650 |
+
{
|
| 651 |
+
"cell_type": "code",
|
| 652 |
+
"execution_count": 8,
|
| 653 |
+
"metadata": {
|
| 654 |
+
"id": "7fG4EDSX5J5J",
|
| 655 |
+
"colab": {
|
| 656 |
+
"base_uri": "https://localhost:8080/"
|
| 657 |
+
},
|
| 658 |
+
"outputId": "84f4486e-fc08-4269-fed2-48628b568240"
|
| 659 |
+
},
|
| 660 |
+
"outputs": [
|
| 661 |
+
{
|
| 662 |
+
"output_type": "stream",
|
| 663 |
+
"name": "stdout",
|
| 664 |
+
"text": [
|
| 665 |
+
"-\n",
|
| 666 |
+
"Input sentence: Go.\n",
|
| 667 |
+
"Decoded sentence: Bouge !\n",
|
| 668 |
+
"\n",
|
| 669 |
+
"-\n",
|
| 670 |
+
"Input sentence: Go.\n",
|
| 671 |
+
"Decoded sentence: Bouge !\n",
|
| 672 |
+
"\n",
|
| 673 |
+
"-\n",
|
| 674 |
+
"Input sentence: Go.\n",
|
| 675 |
+
"Decoded sentence: Bouge !\n",
|
| 676 |
+
"\n",
|
| 677 |
+
"-\n",
|
| 678 |
+
"Input sentence: Hi.\n",
|
| 679 |
+
"Decoded sentence: Salut.\n",
|
| 680 |
+
"\n",
|
| 681 |
+
"-\n",
|
| 682 |
+
"Input sentence: Hi.\n",
|
| 683 |
+
"Decoded sentence: Salut.\n",
|
| 684 |
+
"\n",
|
| 685 |
+
"-\n",
|
| 686 |
+
"Input sentence: Run!\n",
|
| 687 |
+
"Decoded sentence: Courez !\n",
|
| 688 |
+
"\n",
|
| 689 |
+
"-\n",
|
| 690 |
+
"Input sentence: Run!\n",
|
| 691 |
+
"Decoded sentence: Courez !\n",
|
| 692 |
+
"\n",
|
| 693 |
+
"-\n",
|
| 694 |
+
"Input sentence: Run!\n",
|
| 695 |
+
"Decoded sentence: Courez !\n",
|
| 696 |
+
"\n",
|
| 697 |
+
"-\n",
|
| 698 |
+
"Input sentence: Run!\n",
|
| 699 |
+
"Decoded sentence: Courez !\n",
|
| 700 |
+
"\n",
|
| 701 |
+
"-\n",
|
| 702 |
+
"Input sentence: Run!\n",
|
| 703 |
+
"Decoded sentence: Courez !\n",
|
| 704 |
+
"\n",
|
| 705 |
+
"-\n",
|
| 706 |
+
"Input sentence: Run!\n",
|
| 707 |
+
"Decoded sentence: Courez !\n",
|
| 708 |
+
"\n",
|
| 709 |
+
"-\n",
|
| 710 |
+
"Input sentence: Run!\n",
|
| 711 |
+
"Decoded sentence: Courez !\n",
|
| 712 |
+
"\n",
|
| 713 |
+
"-\n",
|
| 714 |
+
"Input sentence: Run!\n",
|
| 715 |
+
"Decoded sentence: Courez !\n",
|
| 716 |
+
"\n",
|
| 717 |
+
"-\n",
|
| 718 |
+
"Input sentence: Run.\n",
|
| 719 |
+
"Decoded sentence: Courez !\n",
|
| 720 |
+
"\n",
|
| 721 |
+
"-\n",
|
| 722 |
+
"Input sentence: Run.\n",
|
| 723 |
+
"Decoded sentence: Courez !\n",
|
| 724 |
+
"\n",
|
| 725 |
+
"-\n",
|
| 726 |
+
"Input sentence: Run.\n",
|
| 727 |
+
"Decoded sentence: Courez !\n",
|
| 728 |
+
"\n",
|
| 729 |
+
"-\n",
|
| 730 |
+
"Input sentence: Run.\n",
|
| 731 |
+
"Decoded sentence: Courez !\n",
|
| 732 |
+
"\n",
|
| 733 |
+
"-\n",
|
| 734 |
+
"Input sentence: Run.\n",
|
| 735 |
+
"Decoded sentence: Courez !\n",
|
| 736 |
+
"\n",
|
| 737 |
+
"-\n",
|
| 738 |
+
"Input sentence: Run.\n",
|
| 739 |
+
"Decoded sentence: Courez !\n",
|
| 740 |
+
"\n",
|
| 741 |
+
"-\n",
|
| 742 |
+
"Input sentence: Run.\n",
|
| 743 |
+
"Decoded sentence: Courez !\n",
|
| 744 |
+
"\n"
|
| 745 |
+
]
|
| 746 |
+
}
|
| 747 |
+
],
|
| 748 |
+
"source": [
|
| 749 |
+
"for seq_index in range(20):\n",
|
| 750 |
+
" # Take one sequence (part of the training set)\n",
|
| 751 |
+
" # for trying out decoding.\n",
|
| 752 |
+
" input_seq = encoder_input_data[seq_index : seq_index + 1]\n",
|
| 753 |
+
" decoded_sentence = decode_sequence(input_seq)\n",
|
| 754 |
+
" print(\"-\")\n",
|
| 755 |
+
" print(\"Input sentence:\", input_texts[seq_index])\n",
|
| 756 |
+
" print(\"Decoded sentence:\", decoded_sentence)\n"
|
| 757 |
+
]
|
| 758 |
+
},
|
| 759 |
+
{
|
| 760 |
+
"cell_type": "code",
|
| 761 |
+
"source": [
|
| 762 |
+
"import json"
|
| 763 |
+
],
|
| 764 |
+
"metadata": {
|
| 765 |
+
"id": "bqV-cbvJA5hd"
|
| 766 |
+
},
|
| 767 |
+
"execution_count": 10,
|
| 768 |
+
"outputs": []
|
| 769 |
+
},
|
| 770 |
+
{
|
| 771 |
+
"cell_type": "code",
|
| 772 |
+
"source": [
|
| 773 |
+
"with open(\"input_vocab.json\", \"w\", encoding='utf-8') as outfile:\n",
|
| 774 |
+
" json.dump(input_token_index, outfile, ensure_ascii=False)\n",
|
| 775 |
+
"with open(\"target_vocab.json\", \"w\", encoding='utf-8') as outfile:\n",
|
| 776 |
+
" json.dump(target_token_index, outfile, ensure_ascii=False)"
|
| 777 |
+
],
|
| 778 |
+
"metadata": {
|
| 779 |
+
"id": "jXPS4ycZ9A9o"
|
| 780 |
+
},
|
| 781 |
+
"execution_count": 13,
|
| 782 |
+
"outputs": []
|
| 783 |
+
},
|
| 784 |
+
{
|
| 785 |
+
"cell_type": "code",
|
| 786 |
+
"source": [
|
| 787 |
+
"!pip install huggingface-hub\n",
|
| 788 |
+
"!sudo apt-get install git-lfs\n",
|
| 789 |
+
"!git-lfs install"
|
| 790 |
+
],
|
| 791 |
+
"metadata": {
|
| 792 |
+
"colab": {
|
| 793 |
+
"base_uri": "https://localhost:8080/"
|
| 794 |
+
},
|
| 795 |
+
"id": "MCQ_ND66BXn9",
|
| 796 |
+
"outputId": "f58a6d0d-2c4b-4fb6-f44e-43b8167a5ded"
|
| 797 |
+
},
|
| 798 |
+
"execution_count": 14,
|
| 799 |
+
"outputs": [
|
| 800 |
+
{
|
| 801 |
+
"output_type": "stream",
|
| 802 |
+
"name": "stdout",
|
| 803 |
+
"text": [
|
| 804 |
+
"Collecting huggingface-hub\n",
|
| 805 |
+
" Downloading huggingface_hub-0.4.0-py3-none-any.whl (67 kB)\n",
|
| 806 |
+
"\u001b[?25l\r\u001b[K |█████ | 10 kB 35.3 MB/s eta 0:00:01\r\u001b[K |█████████▉ | 20 kB 24.7 MB/s eta 0:00:01\r\u001b[K |██████████████▊ | 30 kB 18.8 MB/s eta 0:00:01\r\u001b[K |███████████████████▋ | 40 kB 16.2 MB/s eta 0:00:01\r\u001b[K |████████████████████████▌ | 51 kB 8.3 MB/s eta 0:00:01\r\u001b[K |█████████████████████████████▍ | 61 kB 9.6 MB/s eta 0:00:01\r\u001b[K |████████████████████████████████| 67 kB 4.1 MB/s \n",
|
| 807 |
+
"\u001b[?25hRequirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from huggingface-hub) (2.23.0)\n",
|
| 808 |
+
"Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (from huggingface-hub) (3.13)\n",
|
| 809 |
+
"Requirement already satisfied: filelock in /usr/local/lib/python3.7/dist-packages (from huggingface-hub) (3.4.2)\n",
|
| 810 |
+
"Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.7/dist-packages (from huggingface-hub) (21.3)\n",
|
| 811 |
+
"Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.7/dist-packages (from huggingface-hub) (4.10.1)\n",
|
| 812 |
+
"Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.7/dist-packages (from huggingface-hub) (3.10.0.2)\n",
|
| 813 |
+
"Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from huggingface-hub) (4.62.3)\n",
|
| 814 |
+
"Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging>=20.9->huggingface-hub) (3.0.7)\n",
|
| 815 |
+
"Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata->huggingface-hub) (3.7.0)\n",
|
| 816 |
+
"Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->huggingface-hub) (2.10)\n",
|
| 817 |
+
"Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->huggingface-hub) (3.0.4)\n",
|
| 818 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->huggingface-hub) (2021.10.8)\n",
|
| 819 |
+
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->huggingface-hub) (1.24.3)\n",
|
| 820 |
+
"Installing collected packages: huggingface-hub\n",
|
| 821 |
+
"Successfully installed huggingface-hub-0.4.0\n",
|
| 822 |
+
"Reading package lists... Done\n",
|
| 823 |
+
"Building dependency tree \n",
|
| 824 |
+
"Reading state information... Done\n",
|
| 825 |
+
"The following packages were automatically installed and are no longer required:\n",
|
| 826 |
+
" cuda-command-line-tools-10-0 cuda-command-line-tools-10-1\n",
|
| 827 |
+
" cuda-command-line-tools-11-0 cuda-compiler-10-0 cuda-compiler-10-1\n",
|
| 828 |
+
" cuda-compiler-11-0 cuda-cuobjdump-10-0 cuda-cuobjdump-10-1\n",
|
| 829 |
+
" cuda-cuobjdump-11-0 cuda-cupti-10-0 cuda-cupti-10-1 cuda-cupti-11-0\n",
|
| 830 |
+
" cuda-cupti-dev-11-0 cuda-documentation-10-0 cuda-documentation-10-1\n",
|
| 831 |
+
" cuda-documentation-11-0 cuda-documentation-11-1 cuda-gdb-10-0 cuda-gdb-10-1\n",
|
| 832 |
+
" cuda-gdb-11-0 cuda-gpu-library-advisor-10-0 cuda-gpu-library-advisor-10-1\n",
|
| 833 |
+
" cuda-libraries-10-0 cuda-libraries-10-1 cuda-libraries-11-0\n",
|
| 834 |
+
" cuda-memcheck-10-0 cuda-memcheck-10-1 cuda-memcheck-11-0 cuda-nsight-10-0\n",
|
| 835 |
+
" cuda-nsight-10-1 cuda-nsight-11-0 cuda-nsight-11-1 cuda-nsight-compute-10-0\n",
|
| 836 |
+
" cuda-nsight-compute-10-1 cuda-nsight-compute-11-0 cuda-nsight-compute-11-1\n",
|
| 837 |
+
" cuda-nsight-systems-10-1 cuda-nsight-systems-11-0 cuda-nsight-systems-11-1\n",
|
| 838 |
+
" cuda-nvcc-10-0 cuda-nvcc-10-1 cuda-nvcc-11-0 cuda-nvdisasm-10-0\n",
|
| 839 |
+
" cuda-nvdisasm-10-1 cuda-nvdisasm-11-0 cuda-nvml-dev-10-0 cuda-nvml-dev-10-1\n",
|
| 840 |
+
" cuda-nvml-dev-11-0 cuda-nvprof-10-0 cuda-nvprof-10-1 cuda-nvprof-11-0\n",
|
| 841 |
+
" cuda-nvprune-10-0 cuda-nvprune-10-1 cuda-nvprune-11-0 cuda-nvtx-10-0\n",
|
| 842 |
+
" cuda-nvtx-10-1 cuda-nvtx-11-0 cuda-nvvp-10-0 cuda-nvvp-10-1 cuda-nvvp-11-0\n",
|
| 843 |
+
" cuda-nvvp-11-1 cuda-samples-10-0 cuda-samples-10-1 cuda-samples-11-0\n",
|
| 844 |
+
" cuda-samples-11-1 cuda-sanitizer-11-0 cuda-sanitizer-api-10-1\n",
|
| 845 |
+
" cuda-toolkit-10-0 cuda-toolkit-10-1 cuda-toolkit-11-0 cuda-toolkit-11-1\n",
|
| 846 |
+
" cuda-tools-10-0 cuda-tools-10-1 cuda-tools-11-0 cuda-tools-11-1\n",
|
| 847 |
+
" cuda-visual-tools-10-0 cuda-visual-tools-10-1 cuda-visual-tools-11-0\n",
|
| 848 |
+
" cuda-visual-tools-11-1 default-jre dkms freeglut3 freeglut3-dev\n",
|
| 849 |
+
" keyboard-configuration libargon2-0 libcap2 libcryptsetup12\n",
|
| 850 |
+
" libdevmapper1.02.1 libfontenc1 libidn11 libip4tc0 libjansson4\n",
|
| 851 |
+
" libnvidia-cfg1-510 libnvidia-common-460 libnvidia-common-510\n",
|
| 852 |
+
" libnvidia-extra-510 libnvidia-fbc1-510 libnvidia-gl-510 libpam-systemd\n",
|
| 853 |
+
" libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libxfont2\n",
|
| 854 |
+
" libxi-dev libxkbfile1 libxmu-dev libxmu-headers libxnvctrl0 libxtst6\n",
|
| 855 |
+
" nsight-compute-2020.2.1 nsight-compute-2022.1.0 nsight-systems-2020.3.2\n",
|
| 856 |
+
" nsight-systems-2020.3.4 nsight-systems-2021.5.2 nvidia-dkms-510\n",
|
| 857 |
+
" nvidia-kernel-common-510 nvidia-kernel-source-510 nvidia-modprobe\n",
|
| 858 |
+
" nvidia-settings openjdk-11-jre policykit-1 policykit-1-gnome python3-xkit\n",
|
| 859 |
+
" screen-resolution-extra systemd systemd-sysv udev x11-xkb-utils\n",
|
| 860 |
+
" xserver-common xserver-xorg-core-hwe-18.04 xserver-xorg-video-nvidia-510\n",
|
| 861 |
+
"Use 'sudo apt autoremove' to remove them.\n",
|
| 862 |
+
"The following NEW packages will be installed:\n",
|
| 863 |
+
" git-lfs\n",
|
| 864 |
+
"0 upgraded, 1 newly installed, 0 to remove and 39 not upgraded.\n",
|
| 865 |
+
"Need to get 2,129 kB of archives.\n",
|
| 866 |
+
"After this operation, 7,662 kB of additional disk space will be used.\n",
|
| 867 |
+
"Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 git-lfs amd64 2.3.4-1 [2,129 kB]\n",
|
| 868 |
+
"Fetched 2,129 kB in 1s (1,551 kB/s)\n",
|
| 869 |
+
"debconf: unable to initialize frontend: Dialog\n",
|
| 870 |
+
"debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)\n",
|
| 871 |
+
"debconf: falling back to frontend: Readline\n",
|
| 872 |
+
"debconf: unable to initialize frontend: Readline\n",
|
| 873 |
+
"debconf: (This frontend requires a controlling tty.)\n",
|
| 874 |
+
"debconf: falling back to frontend: Teletype\n",
|
| 875 |
+
"dpkg-preconfigure: unable to re-open stdin: \n",
|
| 876 |
+
"Selecting previously unselected package git-lfs.\n",
|
| 877 |
+
"(Reading database ... 155113 files and directories currently installed.)\n",
|
| 878 |
+
"Preparing to unpack .../git-lfs_2.3.4-1_amd64.deb ...\n",
|
| 879 |
+
"Unpacking git-lfs (2.3.4-1) ...\n",
|
| 880 |
+
"Setting up git-lfs (2.3.4-1) ...\n",
|
| 881 |
+
"Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n",
|
| 882 |
+
"Error: Failed to call git rev-parse --git-dir --show-toplevel: \"fatal: not a git repository (or any of the parent directories): .git\\n\"\n",
|
| 883 |
+
"Git LFS initialized.\n"
|
| 884 |
+
]
|
| 885 |
+
}
|
| 886 |
+
]
|
| 887 |
+
},
|
| 888 |
+
{
|
| 889 |
+
"cell_type": "code",
|
| 890 |
+
"source": [
|
| 891 |
+
"!huggingface-cli login"
|
| 892 |
+
],
|
| 893 |
+
"metadata": {
|
| 894 |
+
"colab": {
|
| 895 |
+
"base_uri": "https://localhost:8080/"
|
| 896 |
+
},
|
| 897 |
+
"id": "vr7EzjdvBzHT",
|
| 898 |
+
"outputId": "69fa8334-c203-4000-d970-1a8b8f9f1ba6"
|
| 899 |
+
},
|
| 900 |
+
"execution_count": 15,
|
| 901 |
+
"outputs": [
|
| 902 |
+
{
|
| 903 |
+
"output_type": "stream",
|
| 904 |
+
"name": "stdout",
|
| 905 |
+
"text": [
|
| 906 |
+
"\n",
|
| 907 |
+
" _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|\n",
|
| 908 |
+
" _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n",
|
| 909 |
+
" _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|\n",
|
| 910 |
+
" _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n",
|
| 911 |
+
" _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|\n",
|
| 912 |
+
"\n",
|
| 913 |
+
" To login, `huggingface_hub` now requires a token generated from https://huggingface.co/settings/token.\n",
|
| 914 |
+
" (Deprecated, will be removed in v0.3.0) To login with username and password instead, interrupt with Ctrl+C.\n",
|
| 915 |
+
" \n",
|
| 916 |
+
"Token: \n",
|
| 917 |
+
"Login successful\n",
|
| 918 |
+
"Your token has been saved to /root/.huggingface/token\n",
|
| 919 |
+
"\u001b[1m\u001b[31mAuthenticated through git-credential store but this isn't the helper defined on your machine.\n",
|
| 920 |
+
"You might have to re-authenticate when pushing to the Hugging Face Hub. Run the following command in your terminal in case you want to set this credential helper as the default\n",
|
| 921 |
+
"\n",
|
| 922 |
+
"git config --global credential.helper store\u001b[0m\n"
|
| 923 |
+
]
|
| 924 |
+
}
|
| 925 |
+
]
|
| 926 |
+
},
|
| 927 |
+
{
|
| 928 |
+
"cell_type": "code",
|
| 929 |
+
"source": [
|
| 930 |
+
"from huggingface_hub.keras_mixin import push_to_hub_keras\n",
|
| 931 |
+
"push_to_hub_keras(model = model, repo_url = \"https://huggingface.co/keras-io/char-lstm-seq2seq\", organization = \"keras-io\")"
|
| 932 |
+
],
|
| 933 |
+
"metadata": {
|
| 934 |
+
"colab": {
|
| 935 |
+
"base_uri": "https://localhost:8080/",
|
| 936 |
+
"height": 345,
|
| 937 |
+
"referenced_widgets": [
|
| 938 |
+
"0873642bfadd4c37b54e92dac1de35bf",
|
| 939 |
+
"042ecadcff7b47fbb32069cdf1064d09",
|
| 940 |
+
"942b7ed2e1f0404fb5f44b266a16d0cd",
|
| 941 |
+
"8dcb06d036d64bad92a2117db8874bd9",
|
| 942 |
+
"1ef6e4d8d6ff4f3cad20a518f8f4f2cb",
|
| 943 |
+
"3679ebef4abc417ebb06c2f7d45bbf4b",
|
| 944 |
+
"60a1fc7920304a5e82499d9268e6e1a8",
|
| 945 |
+
"93e1a0fe3609475da590bd08fae66fa7",
|
| 946 |
+
"3e3abf2a02724044af294b759243bbff",
|
| 947 |
+
"173ac791952944b9a758a5ba47245e66",
|
| 948 |
+
"34e8e3a5d2a0423cab28196710bdc684",
|
| 949 |
+
"48c696f7e40c4ee5a41ff4e823e88e8d",
|
| 950 |
+
"0fec85cbc02f43568b13b6b128513849",
|
| 951 |
+
"0910616a312041489a80714c88219bd9",
|
| 952 |
+
"734f0340dd2b4cd594290e0457a5df0b",
|
| 953 |
+
"9462930017094b64bddaf19b5f66aa58",
|
| 954 |
+
"63b105a140524e7abed1c7a2eee86d70",
|
| 955 |
+
"ead2f71ec2034c70a970a72f18973607",
|
| 956 |
+
"8b814bfa9fac40f1a24d1442f95d7ae8",
|
| 957 |
+
"82502d93f92d4369ac159a5498c62015",
|
| 958 |
+
"277a1e05f0dc4afb839468c0b5c08bd7",
|
| 959 |
+
"0b0c60f854f54830adfdf0464701460c"
|
| 960 |
+
]
|
| 961 |
+
},
|
| 962 |
+
"id": "ZhPSjrEAB26W",
|
| 963 |
+
"outputId": "1e454a43-108a-450a-9e4e-3fa327b23e26"
|
| 964 |
+
},
|
| 965 |
+
"execution_count": 16,
|
| 966 |
+
"outputs": [
|
| 967 |
+
{
|
| 968 |
+
"output_type": "stream",
|
| 969 |
+
"name": "stderr",
|
| 970 |
+
"text": [
|
| 971 |
+
"Cloning https://huggingface.co/keras-io/char-lstm-seq2seq into local empty directory.\n",
|
| 972 |
+
"WARNING:huggingface_hub.repository:Cloning https://huggingface.co/keras-io/char-lstm-seq2seq into local empty directory.\n",
|
| 973 |
+
"WARNING:absl:Found untraced functions such as lstm_cell_2_layer_call_fn, lstm_cell_2_layer_call_and_return_conditional_losses, lstm_cell_3_layer_call_fn, lstm_cell_3_layer_call_and_return_conditional_losses, lstm_cell_2_layer_call_fn while saving (showing 5 of 10). These functions will not be directly callable after loading.\n"
|
| 974 |
+
]
|
| 975 |
+
},
|
| 976 |
+
{
|
| 977 |
+
"output_type": "stream",
|
| 978 |
+
"name": "stdout",
|
| 979 |
+
"text": [
|
| 980 |
+
"INFO:tensorflow:Assets written to: char-lstm-seq2seq/assets\n"
|
| 981 |
+
]
|
| 982 |
+
},
|
| 983 |
+
{
|
| 984 |
+
"output_type": "stream",
|
| 985 |
+
"name": "stderr",
|
| 986 |
+
"text": [
|
| 987 |
+
"INFO:tensorflow:Assets written to: char-lstm-seq2seq/assets\n",
|
| 988 |
+
"WARNING:absl:<keras.layers.recurrent.LSTMCell object at 0x7f4f5d43eed0> has the same name 'LSTMCell' as a built-in Keras object. Consider renaming <class 'keras.layers.recurrent.LSTMCell'> to avoid naming conflicts when loading with `tf.keras.models.load_model`. If renaming is not possible, pass the object in the `custom_objects` parameter of the load function.\n",
|
| 989 |
+
"WARNING:absl:<keras.layers.recurrent.LSTMCell object at 0x7f4f5d676190> has the same name 'LSTMCell' as a built-in Keras object. Consider renaming <class 'keras.layers.recurrent.LSTMCell'> to avoid naming conflicts when loading with `tf.keras.models.load_model`. If renaming is not possible, pass the object in the `custom_objects` parameter of the load function.\n"
|
| 990 |
+
]
|
| 991 |
+
},
|
| 992 |
+
{
|
| 993 |
+
"output_type": "display_data",
|
| 994 |
+
"data": {
|
| 995 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 996 |
+
"model_id": "0873642bfadd4c37b54e92dac1de35bf",
|
| 997 |
+
"version_minor": 0,
|
| 998 |
+
"version_major": 2
|
| 999 |
+
},
|
| 1000 |
+
"text/plain": [
|
| 1001 |
+
"Upload file saved_model.pb: 0%| | 3.39k/1.38M [00:00<?, ?B/s]"
|
| 1002 |
+
]
|
| 1003 |
+
},
|
| 1004 |
+
"metadata": {}
|
| 1005 |
+
},
|
| 1006 |
+
{
|
| 1007 |
+
"output_type": "display_data",
|
| 1008 |
+
"data": {
|
| 1009 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 1010 |
+
"model_id": "48c696f7e40c4ee5a41ff4e823e88e8d",
|
| 1011 |
+
"version_minor": 0,
|
| 1012 |
+
"version_major": 2
|
| 1013 |
+
},
|
| 1014 |
+
"text/plain": [
|
| 1015 |
+
"Upload file keras_metadata.pb: 22%|##2 | 3.39k/15.3k [00:00<?, ?B/s]"
|
| 1016 |
+
]
|
| 1017 |
+
},
|
| 1018 |
+
"metadata": {}
|
| 1019 |
+
},
|
| 1020 |
+
{
|
| 1021 |
+
"output_type": "stream",
|
| 1022 |
+
"name": "stderr",
|
| 1023 |
+
"text": [
|
| 1024 |
+
"To https://huggingface.co/keras-io/char-lstm-seq2seq\n",
|
| 1025 |
+
" df51a58..69c5bbb main -> main\n",
|
| 1026 |
+
"\n",
|
| 1027 |
+
"WARNING:huggingface_hub.repository:To https://huggingface.co/keras-io/char-lstm-seq2seq\n",
|
| 1028 |
+
" df51a58..69c5bbb main -> main\n",
|
| 1029 |
+
"\n"
|
| 1030 |
+
]
|
| 1031 |
+
},
|
| 1032 |
+
{
|
| 1033 |
+
"output_type": "execute_result",
|
| 1034 |
+
"data": {
|
| 1035 |
+
"application/vnd.google.colaboratory.intrinsic+json": {
|
| 1036 |
+
"type": "string"
|
| 1037 |
+
},
|
| 1038 |
+
"text/plain": [
|
| 1039 |
+
"'https://huggingface.co/keras-io/char-lstm-seq2seq/commit/69c5bbba7cfcad71d97557b045f3592ad5b26c39'"
|
| 1040 |
+
]
|
| 1041 |
+
},
|
| 1042 |
+
"metadata": {},
|
| 1043 |
+
"execution_count": 16
|
| 1044 |
+
}
|
| 1045 |
+
]
|
| 1046 |
+
},
|
| 1047 |
+
{
|
| 1048 |
+
"cell_type": "code",
|
| 1049 |
+
"source": [
|
| 1050 |
+
""
|
| 1051 |
+
],
|
| 1052 |
+
"metadata": {
|
| 1053 |
+
"id": "2TbeYdeuCJ5_"
|
| 1054 |
+
},
|
| 1055 |
+
"execution_count": null,
|
| 1056 |
+
"outputs": []
|
| 1057 |
+
}
|
| 1058 |
+
],
|
| 1059 |
+
"metadata": {
|
| 1060 |
+
"colab": {
|
| 1061 |
+
"collapsed_sections": [],
|
| 1062 |
+
"name": "lstm_seq2seq",
|
| 1063 |
+
"provenance": [],
|
| 1064 |
+
"machine_shape": "hm"
|
| 1065 |
+
},
|
| 1066 |
+
"kernelspec": {
|
| 1067 |
+
"display_name": "Python 3",
|
| 1068 |
+
"language": "python",
|
| 1069 |
+
"name": "python3"
|
| 1070 |
+
},
|
| 1071 |
+
"language_info": {
|
| 1072 |
+
"codemirror_mode": {
|
| 1073 |
+
"name": "ipython",
|
| 1074 |
+
"version": 3
|
| 1075 |
+
},
|
| 1076 |
+
"file_extension": ".py",
|
| 1077 |
+
"mimetype": "text/x-python",
|
| 1078 |
+
"name": "python",
|
| 1079 |
+
"nbconvert_exporter": "python",
|
| 1080 |
+
"pygments_lexer": "ipython3",
|
| 1081 |
+
"version": "3.7.0"
|
| 1082 |
+
},
|
| 1083 |
+
"accelerator": "GPU",
|
| 1084 |
+
"widgets": {
|
| 1085 |
+
"application/vnd.jupyter.widget-state+json": {
|
| 1086 |
+
"0873642bfadd4c37b54e92dac1de35bf": {
|
| 1087 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1088 |
+
"model_name": "HBoxModel",
|
| 1089 |
+
"model_module_version": "1.5.0",
|
| 1090 |
+
"state": {
|
| 1091 |
+
"_view_name": "HBoxView",
|
| 1092 |
+
"_dom_classes": [],
|
| 1093 |
+
"_model_name": "HBoxModel",
|
| 1094 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 1095 |
+
"_model_module_version": "1.5.0",
|
| 1096 |
+
"_view_count": null,
|
| 1097 |
+
"_view_module_version": "1.5.0",
|
| 1098 |
+
"box_style": "",
|
| 1099 |
+
"layout": "IPY_MODEL_042ecadcff7b47fbb32069cdf1064d09",
|
| 1100 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 1101 |
+
"children": [
|
| 1102 |
+
"IPY_MODEL_942b7ed2e1f0404fb5f44b266a16d0cd",
|
| 1103 |
+
"IPY_MODEL_8dcb06d036d64bad92a2117db8874bd9",
|
| 1104 |
+
"IPY_MODEL_1ef6e4d8d6ff4f3cad20a518f8f4f2cb"
|
| 1105 |
+
]
|
| 1106 |
+
}
|
| 1107 |
+
},
|
| 1108 |
+
"042ecadcff7b47fbb32069cdf1064d09": {
|
| 1109 |
+
"model_module": "@jupyter-widgets/base",
|
| 1110 |
+
"model_name": "LayoutModel",
|
| 1111 |
+
"model_module_version": "1.2.0",
|
| 1112 |
+
"state": {
|
| 1113 |
+
"_view_name": "LayoutView",
|
| 1114 |
+
"grid_template_rows": null,
|
| 1115 |
+
"right": null,
|
| 1116 |
+
"justify_content": null,
|
| 1117 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1118 |
+
"overflow": null,
|
| 1119 |
+
"_model_module_version": "1.2.0",
|
| 1120 |
+
"_view_count": null,
|
| 1121 |
+
"flex_flow": null,
|
| 1122 |
+
"width": null,
|
| 1123 |
+
"min_width": null,
|
| 1124 |
+
"border": null,
|
| 1125 |
+
"align_items": null,
|
| 1126 |
+
"bottom": null,
|
| 1127 |
+
"_model_module": "@jupyter-widgets/base",
|
| 1128 |
+
"top": null,
|
| 1129 |
+
"grid_column": null,
|
| 1130 |
+
"overflow_y": null,
|
| 1131 |
+
"overflow_x": null,
|
| 1132 |
+
"grid_auto_flow": null,
|
| 1133 |
+
"grid_area": null,
|
| 1134 |
+
"grid_template_columns": null,
|
| 1135 |
+
"flex": null,
|
| 1136 |
+
"_model_name": "LayoutModel",
|
| 1137 |
+
"justify_items": null,
|
| 1138 |
+
"grid_row": null,
|
| 1139 |
+
"max_height": null,
|
| 1140 |
+
"align_content": null,
|
| 1141 |
+
"visibility": null,
|
| 1142 |
+
"align_self": null,
|
| 1143 |
+
"height": null,
|
| 1144 |
+
"min_height": null,
|
| 1145 |
+
"padding": null,
|
| 1146 |
+
"grid_auto_rows": null,
|
| 1147 |
+
"grid_gap": null,
|
| 1148 |
+
"max_width": null,
|
| 1149 |
+
"order": null,
|
| 1150 |
+
"_view_module_version": "1.2.0",
|
| 1151 |
+
"grid_template_areas": null,
|
| 1152 |
+
"object_position": null,
|
| 1153 |
+
"object_fit": null,
|
| 1154 |
+
"grid_auto_columns": null,
|
| 1155 |
+
"margin": null,
|
| 1156 |
+
"display": null,
|
| 1157 |
+
"left": null
|
| 1158 |
+
}
|
| 1159 |
+
},
|
| 1160 |
+
"942b7ed2e1f0404fb5f44b266a16d0cd": {
|
| 1161 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1162 |
+
"model_name": "HTMLModel",
|
| 1163 |
+
"model_module_version": "1.5.0",
|
| 1164 |
+
"state": {
|
| 1165 |
+
"_view_name": "HTMLView",
|
| 1166 |
+
"style": "IPY_MODEL_3679ebef4abc417ebb06c2f7d45bbf4b",
|
| 1167 |
+
"_dom_classes": [],
|
| 1168 |
+
"description": "",
|
| 1169 |
+
"_model_name": "HTMLModel",
|
| 1170 |
+
"placeholder": "",
|
| 1171 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 1172 |
+
"_model_module_version": "1.5.0",
|
| 1173 |
+
"value": "Upload file saved_model.pb: 100%",
|
| 1174 |
+
"_view_count": null,
|
| 1175 |
+
"_view_module_version": "1.5.0",
|
| 1176 |
+
"description_tooltip": null,
|
| 1177 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 1178 |
+
"layout": "IPY_MODEL_60a1fc7920304a5e82499d9268e6e1a8"
|
| 1179 |
+
}
|
| 1180 |
+
},
|
| 1181 |
+
"8dcb06d036d64bad92a2117db8874bd9": {
|
| 1182 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1183 |
+
"model_name": "FloatProgressModel",
|
| 1184 |
+
"model_module_version": "1.5.0",
|
| 1185 |
+
"state": {
|
| 1186 |
+
"_view_name": "ProgressView",
|
| 1187 |
+
"style": "IPY_MODEL_93e1a0fe3609475da590bd08fae66fa7",
|
| 1188 |
+
"_dom_classes": [],
|
| 1189 |
+
"description": "",
|
| 1190 |
+
"_model_name": "FloatProgressModel",
|
| 1191 |
+
"bar_style": "success",
|
| 1192 |
+
"max": 1444428,
|
| 1193 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 1194 |
+
"_model_module_version": "1.5.0",
|
| 1195 |
+
"value": 1444428,
|
| 1196 |
+
"_view_count": null,
|
| 1197 |
+
"_view_module_version": "1.5.0",
|
| 1198 |
+
"orientation": "horizontal",
|
| 1199 |
+
"min": 0,
|
| 1200 |
+
"description_tooltip": null,
|
| 1201 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 1202 |
+
"layout": "IPY_MODEL_3e3abf2a02724044af294b759243bbff"
|
| 1203 |
+
}
|
| 1204 |
+
},
|
| 1205 |
+
"1ef6e4d8d6ff4f3cad20a518f8f4f2cb": {
|
| 1206 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1207 |
+
"model_name": "HTMLModel",
|
| 1208 |
+
"model_module_version": "1.5.0",
|
| 1209 |
+
"state": {
|
| 1210 |
+
"_view_name": "HTMLView",
|
| 1211 |
+
"style": "IPY_MODEL_173ac791952944b9a758a5ba47245e66",
|
| 1212 |
+
"_dom_classes": [],
|
| 1213 |
+
"description": "",
|
| 1214 |
+
"_model_name": "HTMLModel",
|
| 1215 |
+
"placeholder": "",
|
| 1216 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 1217 |
+
"_model_module_version": "1.5.0",
|
| 1218 |
+
"value": " 1.38M/1.38M [00:06<00:00, 188kB/s]",
|
| 1219 |
+
"_view_count": null,
|
| 1220 |
+
"_view_module_version": "1.5.0",
|
| 1221 |
+
"description_tooltip": null,
|
| 1222 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 1223 |
+
"layout": "IPY_MODEL_34e8e3a5d2a0423cab28196710bdc684"
|
| 1224 |
+
}
|
| 1225 |
+
},
|
| 1226 |
+
"3679ebef4abc417ebb06c2f7d45bbf4b": {
|
| 1227 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1228 |
+
"model_name": "DescriptionStyleModel",
|
| 1229 |
+
"model_module_version": "1.5.0",
|
| 1230 |
+
"state": {
|
| 1231 |
+
"_view_name": "StyleView",
|
| 1232 |
+
"_model_name": "DescriptionStyleModel",
|
| 1233 |
+
"description_width": "",
|
| 1234 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1235 |
+
"_model_module_version": "1.5.0",
|
| 1236 |
+
"_view_count": null,
|
| 1237 |
+
"_view_module_version": "1.2.0",
|
| 1238 |
+
"_model_module": "@jupyter-widgets/controls"
|
| 1239 |
+
}
|
| 1240 |
+
},
|
| 1241 |
+
"60a1fc7920304a5e82499d9268e6e1a8": {
|
| 1242 |
+
"model_module": "@jupyter-widgets/base",
|
| 1243 |
+
"model_name": "LayoutModel",
|
| 1244 |
+
"model_module_version": "1.2.0",
|
| 1245 |
+
"state": {
|
| 1246 |
+
"_view_name": "LayoutView",
|
| 1247 |
+
"grid_template_rows": null,
|
| 1248 |
+
"right": null,
|
| 1249 |
+
"justify_content": null,
|
| 1250 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1251 |
+
"overflow": null,
|
| 1252 |
+
"_model_module_version": "1.2.0",
|
| 1253 |
+
"_view_count": null,
|
| 1254 |
+
"flex_flow": null,
|
| 1255 |
+
"width": null,
|
| 1256 |
+
"min_width": null,
|
| 1257 |
+
"border": null,
|
| 1258 |
+
"align_items": null,
|
| 1259 |
+
"bottom": null,
|
| 1260 |
+
"_model_module": "@jupyter-widgets/base",
|
| 1261 |
+
"top": null,
|
| 1262 |
+
"grid_column": null,
|
| 1263 |
+
"overflow_y": null,
|
| 1264 |
+
"overflow_x": null,
|
| 1265 |
+
"grid_auto_flow": null,
|
| 1266 |
+
"grid_area": null,
|
| 1267 |
+
"grid_template_columns": null,
|
| 1268 |
+
"flex": null,
|
| 1269 |
+
"_model_name": "LayoutModel",
|
| 1270 |
+
"justify_items": null,
|
| 1271 |
+
"grid_row": null,
|
| 1272 |
+
"max_height": null,
|
| 1273 |
+
"align_content": null,
|
| 1274 |
+
"visibility": null,
|
| 1275 |
+
"align_self": null,
|
| 1276 |
+
"height": null,
|
| 1277 |
+
"min_height": null,
|
| 1278 |
+
"padding": null,
|
| 1279 |
+
"grid_auto_rows": null,
|
| 1280 |
+
"grid_gap": null,
|
| 1281 |
+
"max_width": null,
|
| 1282 |
+
"order": null,
|
| 1283 |
+
"_view_module_version": "1.2.0",
|
| 1284 |
+
"grid_template_areas": null,
|
| 1285 |
+
"object_position": null,
|
| 1286 |
+
"object_fit": null,
|
| 1287 |
+
"grid_auto_columns": null,
|
| 1288 |
+
"margin": null,
|
| 1289 |
+
"display": null,
|
| 1290 |
+
"left": null
|
| 1291 |
+
}
|
| 1292 |
+
},
|
| 1293 |
+
"93e1a0fe3609475da590bd08fae66fa7": {
|
| 1294 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1295 |
+
"model_name": "ProgressStyleModel",
|
| 1296 |
+
"model_module_version": "1.5.0",
|
| 1297 |
+
"state": {
|
| 1298 |
+
"_view_name": "StyleView",
|
| 1299 |
+
"_model_name": "ProgressStyleModel",
|
| 1300 |
+
"description_width": "",
|
| 1301 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1302 |
+
"_model_module_version": "1.5.0",
|
| 1303 |
+
"_view_count": null,
|
| 1304 |
+
"_view_module_version": "1.2.0",
|
| 1305 |
+
"bar_color": null,
|
| 1306 |
+
"_model_module": "@jupyter-widgets/controls"
|
| 1307 |
+
}
|
| 1308 |
+
},
|
| 1309 |
+
"3e3abf2a02724044af294b759243bbff": {
|
| 1310 |
+
"model_module": "@jupyter-widgets/base",
|
| 1311 |
+
"model_name": "LayoutModel",
|
| 1312 |
+
"model_module_version": "1.2.0",
|
| 1313 |
+
"state": {
|
| 1314 |
+
"_view_name": "LayoutView",
|
| 1315 |
+
"grid_template_rows": null,
|
| 1316 |
+
"right": null,
|
| 1317 |
+
"justify_content": null,
|
| 1318 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1319 |
+
"overflow": null,
|
| 1320 |
+
"_model_module_version": "1.2.0",
|
| 1321 |
+
"_view_count": null,
|
| 1322 |
+
"flex_flow": null,
|
| 1323 |
+
"width": null,
|
| 1324 |
+
"min_width": null,
|
| 1325 |
+
"border": null,
|
| 1326 |
+
"align_items": null,
|
| 1327 |
+
"bottom": null,
|
| 1328 |
+
"_model_module": "@jupyter-widgets/base",
|
| 1329 |
+
"top": null,
|
| 1330 |
+
"grid_column": null,
|
| 1331 |
+
"overflow_y": null,
|
| 1332 |
+
"overflow_x": null,
|
| 1333 |
+
"grid_auto_flow": null,
|
| 1334 |
+
"grid_area": null,
|
| 1335 |
+
"grid_template_columns": null,
|
| 1336 |
+
"flex": null,
|
| 1337 |
+
"_model_name": "LayoutModel",
|
| 1338 |
+
"justify_items": null,
|
| 1339 |
+
"grid_row": null,
|
| 1340 |
+
"max_height": null,
|
| 1341 |
+
"align_content": null,
|
| 1342 |
+
"visibility": null,
|
| 1343 |
+
"align_self": null,
|
| 1344 |
+
"height": null,
|
| 1345 |
+
"min_height": null,
|
| 1346 |
+
"padding": null,
|
| 1347 |
+
"grid_auto_rows": null,
|
| 1348 |
+
"grid_gap": null,
|
| 1349 |
+
"max_width": null,
|
| 1350 |
+
"order": null,
|
| 1351 |
+
"_view_module_version": "1.2.0",
|
| 1352 |
+
"grid_template_areas": null,
|
| 1353 |
+
"object_position": null,
|
| 1354 |
+
"object_fit": null,
|
| 1355 |
+
"grid_auto_columns": null,
|
| 1356 |
+
"margin": null,
|
| 1357 |
+
"display": null,
|
| 1358 |
+
"left": null
|
| 1359 |
+
}
|
| 1360 |
+
},
|
| 1361 |
+
"173ac791952944b9a758a5ba47245e66": {
|
| 1362 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1363 |
+
"model_name": "DescriptionStyleModel",
|
| 1364 |
+
"model_module_version": "1.5.0",
|
| 1365 |
+
"state": {
|
| 1366 |
+
"_view_name": "StyleView",
|
| 1367 |
+
"_model_name": "DescriptionStyleModel",
|
| 1368 |
+
"description_width": "",
|
| 1369 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1370 |
+
"_model_module_version": "1.5.0",
|
| 1371 |
+
"_view_count": null,
|
| 1372 |
+
"_view_module_version": "1.2.0",
|
| 1373 |
+
"_model_module": "@jupyter-widgets/controls"
|
| 1374 |
+
}
|
| 1375 |
+
},
|
| 1376 |
+
"34e8e3a5d2a0423cab28196710bdc684": {
|
| 1377 |
+
"model_module": "@jupyter-widgets/base",
|
| 1378 |
+
"model_name": "LayoutModel",
|
| 1379 |
+
"model_module_version": "1.2.0",
|
| 1380 |
+
"state": {
|
| 1381 |
+
"_view_name": "LayoutView",
|
| 1382 |
+
"grid_template_rows": null,
|
| 1383 |
+
"right": null,
|
| 1384 |
+
"justify_content": null,
|
| 1385 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1386 |
+
"overflow": null,
|
| 1387 |
+
"_model_module_version": "1.2.0",
|
| 1388 |
+
"_view_count": null,
|
| 1389 |
+
"flex_flow": null,
|
| 1390 |
+
"width": null,
|
| 1391 |
+
"min_width": null,
|
| 1392 |
+
"border": null,
|
| 1393 |
+
"align_items": null,
|
| 1394 |
+
"bottom": null,
|
| 1395 |
+
"_model_module": "@jupyter-widgets/base",
|
| 1396 |
+
"top": null,
|
| 1397 |
+
"grid_column": null,
|
| 1398 |
+
"overflow_y": null,
|
| 1399 |
+
"overflow_x": null,
|
| 1400 |
+
"grid_auto_flow": null,
|
| 1401 |
+
"grid_area": null,
|
| 1402 |
+
"grid_template_columns": null,
|
| 1403 |
+
"flex": null,
|
| 1404 |
+
"_model_name": "LayoutModel",
|
| 1405 |
+
"justify_items": null,
|
| 1406 |
+
"grid_row": null,
|
| 1407 |
+
"max_height": null,
|
| 1408 |
+
"align_content": null,
|
| 1409 |
+
"visibility": null,
|
| 1410 |
+
"align_self": null,
|
| 1411 |
+
"height": null,
|
| 1412 |
+
"min_height": null,
|
| 1413 |
+
"padding": null,
|
| 1414 |
+
"grid_auto_rows": null,
|
| 1415 |
+
"grid_gap": null,
|
| 1416 |
+
"max_width": null,
|
| 1417 |
+
"order": null,
|
| 1418 |
+
"_view_module_version": "1.2.0",
|
| 1419 |
+
"grid_template_areas": null,
|
| 1420 |
+
"object_position": null,
|
| 1421 |
+
"object_fit": null,
|
| 1422 |
+
"grid_auto_columns": null,
|
| 1423 |
+
"margin": null,
|
| 1424 |
+
"display": null,
|
| 1425 |
+
"left": null
|
| 1426 |
+
}
|
| 1427 |
+
},
|
| 1428 |
+
"48c696f7e40c4ee5a41ff4e823e88e8d": {
|
| 1429 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1430 |
+
"model_name": "HBoxModel",
|
| 1431 |
+
"model_module_version": "1.5.0",
|
| 1432 |
+
"state": {
|
| 1433 |
+
"_view_name": "HBoxView",
|
| 1434 |
+
"_dom_classes": [],
|
| 1435 |
+
"_model_name": "HBoxModel",
|
| 1436 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 1437 |
+
"_model_module_version": "1.5.0",
|
| 1438 |
+
"_view_count": null,
|
| 1439 |
+
"_view_module_version": "1.5.0",
|
| 1440 |
+
"box_style": "",
|
| 1441 |
+
"layout": "IPY_MODEL_0fec85cbc02f43568b13b6b128513849",
|
| 1442 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 1443 |
+
"children": [
|
| 1444 |
+
"IPY_MODEL_0910616a312041489a80714c88219bd9",
|
| 1445 |
+
"IPY_MODEL_734f0340dd2b4cd594290e0457a5df0b",
|
| 1446 |
+
"IPY_MODEL_9462930017094b64bddaf19b5f66aa58"
|
| 1447 |
+
]
|
| 1448 |
+
}
|
| 1449 |
+
},
|
| 1450 |
+
"0fec85cbc02f43568b13b6b128513849": {
|
| 1451 |
+
"model_module": "@jupyter-widgets/base",
|
| 1452 |
+
"model_name": "LayoutModel",
|
| 1453 |
+
"model_module_version": "1.2.0",
|
| 1454 |
+
"state": {
|
| 1455 |
+
"_view_name": "LayoutView",
|
| 1456 |
+
"grid_template_rows": null,
|
| 1457 |
+
"right": null,
|
| 1458 |
+
"justify_content": null,
|
| 1459 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1460 |
+
"overflow": null,
|
| 1461 |
+
"_model_module_version": "1.2.0",
|
| 1462 |
+
"_view_count": null,
|
| 1463 |
+
"flex_flow": null,
|
| 1464 |
+
"width": null,
|
| 1465 |
+
"min_width": null,
|
| 1466 |
+
"border": null,
|
| 1467 |
+
"align_items": null,
|
| 1468 |
+
"bottom": null,
|
| 1469 |
+
"_model_module": "@jupyter-widgets/base",
|
| 1470 |
+
"top": null,
|
| 1471 |
+
"grid_column": null,
|
| 1472 |
+
"overflow_y": null,
|
| 1473 |
+
"overflow_x": null,
|
| 1474 |
+
"grid_auto_flow": null,
|
| 1475 |
+
"grid_area": null,
|
| 1476 |
+
"grid_template_columns": null,
|
| 1477 |
+
"flex": null,
|
| 1478 |
+
"_model_name": "LayoutModel",
|
| 1479 |
+
"justify_items": null,
|
| 1480 |
+
"grid_row": null,
|
| 1481 |
+
"max_height": null,
|
| 1482 |
+
"align_content": null,
|
| 1483 |
+
"visibility": null,
|
| 1484 |
+
"align_self": null,
|
| 1485 |
+
"height": null,
|
| 1486 |
+
"min_height": null,
|
| 1487 |
+
"padding": null,
|
| 1488 |
+
"grid_auto_rows": null,
|
| 1489 |
+
"grid_gap": null,
|
| 1490 |
+
"max_width": null,
|
| 1491 |
+
"order": null,
|
| 1492 |
+
"_view_module_version": "1.2.0",
|
| 1493 |
+
"grid_template_areas": null,
|
| 1494 |
+
"object_position": null,
|
| 1495 |
+
"object_fit": null,
|
| 1496 |
+
"grid_auto_columns": null,
|
| 1497 |
+
"margin": null,
|
| 1498 |
+
"display": null,
|
| 1499 |
+
"left": null
|
| 1500 |
+
}
|
| 1501 |
+
},
|
| 1502 |
+
"0910616a312041489a80714c88219bd9": {
|
| 1503 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1504 |
+
"model_name": "HTMLModel",
|
| 1505 |
+
"model_module_version": "1.5.0",
|
| 1506 |
+
"state": {
|
| 1507 |
+
"_view_name": "HTMLView",
|
| 1508 |
+
"style": "IPY_MODEL_63b105a140524e7abed1c7a2eee86d70",
|
| 1509 |
+
"_dom_classes": [],
|
| 1510 |
+
"description": "",
|
| 1511 |
+
"_model_name": "HTMLModel",
|
| 1512 |
+
"placeholder": "",
|
| 1513 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 1514 |
+
"_model_module_version": "1.5.0",
|
| 1515 |
+
"value": "Upload file keras_metadata.pb: 100%",
|
| 1516 |
+
"_view_count": null,
|
| 1517 |
+
"_view_module_version": "1.5.0",
|
| 1518 |
+
"description_tooltip": null,
|
| 1519 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 1520 |
+
"layout": "IPY_MODEL_ead2f71ec2034c70a970a72f18973607"
|
| 1521 |
+
}
|
| 1522 |
+
},
|
| 1523 |
+
"734f0340dd2b4cd594290e0457a5df0b": {
|
| 1524 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1525 |
+
"model_name": "FloatProgressModel",
|
| 1526 |
+
"model_module_version": "1.5.0",
|
| 1527 |
+
"state": {
|
| 1528 |
+
"_view_name": "ProgressView",
|
| 1529 |
+
"style": "IPY_MODEL_8b814bfa9fac40f1a24d1442f95d7ae8",
|
| 1530 |
+
"_dom_classes": [],
|
| 1531 |
+
"description": "",
|
| 1532 |
+
"_model_name": "FloatProgressModel",
|
| 1533 |
+
"bar_style": "success",
|
| 1534 |
+
"max": 15672,
|
| 1535 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 1536 |
+
"_model_module_version": "1.5.0",
|
| 1537 |
+
"value": 15672,
|
| 1538 |
+
"_view_count": null,
|
| 1539 |
+
"_view_module_version": "1.5.0",
|
| 1540 |
+
"orientation": "horizontal",
|
| 1541 |
+
"min": 0,
|
| 1542 |
+
"description_tooltip": null,
|
| 1543 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 1544 |
+
"layout": "IPY_MODEL_82502d93f92d4369ac159a5498c62015"
|
| 1545 |
+
}
|
| 1546 |
+
},
|
| 1547 |
+
"9462930017094b64bddaf19b5f66aa58": {
|
| 1548 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1549 |
+
"model_name": "HTMLModel",
|
| 1550 |
+
"model_module_version": "1.5.0",
|
| 1551 |
+
"state": {
|
| 1552 |
+
"_view_name": "HTMLView",
|
| 1553 |
+
"style": "IPY_MODEL_277a1e05f0dc4afb839468c0b5c08bd7",
|
| 1554 |
+
"_dom_classes": [],
|
| 1555 |
+
"description": "",
|
| 1556 |
+
"_model_name": "HTMLModel",
|
| 1557 |
+
"placeholder": "",
|
| 1558 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 1559 |
+
"_model_module_version": "1.5.0",
|
| 1560 |
+
"value": " 15.3k/15.3k [00:06<00:00, 2.02kB/s]",
|
| 1561 |
+
"_view_count": null,
|
| 1562 |
+
"_view_module_version": "1.5.0",
|
| 1563 |
+
"description_tooltip": null,
|
| 1564 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 1565 |
+
"layout": "IPY_MODEL_0b0c60f854f54830adfdf0464701460c"
|
| 1566 |
+
}
|
| 1567 |
+
},
|
| 1568 |
+
"63b105a140524e7abed1c7a2eee86d70": {
|
| 1569 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1570 |
+
"model_name": "DescriptionStyleModel",
|
| 1571 |
+
"model_module_version": "1.5.0",
|
| 1572 |
+
"state": {
|
| 1573 |
+
"_view_name": "StyleView",
|
| 1574 |
+
"_model_name": "DescriptionStyleModel",
|
| 1575 |
+
"description_width": "",
|
| 1576 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1577 |
+
"_model_module_version": "1.5.0",
|
| 1578 |
+
"_view_count": null,
|
| 1579 |
+
"_view_module_version": "1.2.0",
|
| 1580 |
+
"_model_module": "@jupyter-widgets/controls"
|
| 1581 |
+
}
|
| 1582 |
+
},
|
| 1583 |
+
"ead2f71ec2034c70a970a72f18973607": {
|
| 1584 |
+
"model_module": "@jupyter-widgets/base",
|
| 1585 |
+
"model_name": "LayoutModel",
|
| 1586 |
+
"model_module_version": "1.2.0",
|
| 1587 |
+
"state": {
|
| 1588 |
+
"_view_name": "LayoutView",
|
| 1589 |
+
"grid_template_rows": null,
|
| 1590 |
+
"right": null,
|
| 1591 |
+
"justify_content": null,
|
| 1592 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1593 |
+
"overflow": null,
|
| 1594 |
+
"_model_module_version": "1.2.0",
|
| 1595 |
+
"_view_count": null,
|
| 1596 |
+
"flex_flow": null,
|
| 1597 |
+
"width": null,
|
| 1598 |
+
"min_width": null,
|
| 1599 |
+
"border": null,
|
| 1600 |
+
"align_items": null,
|
| 1601 |
+
"bottom": null,
|
| 1602 |
+
"_model_module": "@jupyter-widgets/base",
|
| 1603 |
+
"top": null,
|
| 1604 |
+
"grid_column": null,
|
| 1605 |
+
"overflow_y": null,
|
| 1606 |
+
"overflow_x": null,
|
| 1607 |
+
"grid_auto_flow": null,
|
| 1608 |
+
"grid_area": null,
|
| 1609 |
+
"grid_template_columns": null,
|
| 1610 |
+
"flex": null,
|
| 1611 |
+
"_model_name": "LayoutModel",
|
| 1612 |
+
"justify_items": null,
|
| 1613 |
+
"grid_row": null,
|
| 1614 |
+
"max_height": null,
|
| 1615 |
+
"align_content": null,
|
| 1616 |
+
"visibility": null,
|
| 1617 |
+
"align_self": null,
|
| 1618 |
+
"height": null,
|
| 1619 |
+
"min_height": null,
|
| 1620 |
+
"padding": null,
|
| 1621 |
+
"grid_auto_rows": null,
|
| 1622 |
+
"grid_gap": null,
|
| 1623 |
+
"max_width": null,
|
| 1624 |
+
"order": null,
|
| 1625 |
+
"_view_module_version": "1.2.0",
|
| 1626 |
+
"grid_template_areas": null,
|
| 1627 |
+
"object_position": null,
|
| 1628 |
+
"object_fit": null,
|
| 1629 |
+
"grid_auto_columns": null,
|
| 1630 |
+
"margin": null,
|
| 1631 |
+
"display": null,
|
| 1632 |
+
"left": null
|
| 1633 |
+
}
|
| 1634 |
+
},
|
| 1635 |
+
"8b814bfa9fac40f1a24d1442f95d7ae8": {
|
| 1636 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1637 |
+
"model_name": "ProgressStyleModel",
|
| 1638 |
+
"model_module_version": "1.5.0",
|
| 1639 |
+
"state": {
|
| 1640 |
+
"_view_name": "StyleView",
|
| 1641 |
+
"_model_name": "ProgressStyleModel",
|
| 1642 |
+
"description_width": "",
|
| 1643 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1644 |
+
"_model_module_version": "1.5.0",
|
| 1645 |
+
"_view_count": null,
|
| 1646 |
+
"_view_module_version": "1.2.0",
|
| 1647 |
+
"bar_color": null,
|
| 1648 |
+
"_model_module": "@jupyter-widgets/controls"
|
| 1649 |
+
}
|
| 1650 |
+
},
|
| 1651 |
+
"82502d93f92d4369ac159a5498c62015": {
|
| 1652 |
+
"model_module": "@jupyter-widgets/base",
|
| 1653 |
+
"model_name": "LayoutModel",
|
| 1654 |
+
"model_module_version": "1.2.0",
|
| 1655 |
+
"state": {
|
| 1656 |
+
"_view_name": "LayoutView",
|
| 1657 |
+
"grid_template_rows": null,
|
| 1658 |
+
"right": null,
|
| 1659 |
+
"justify_content": null,
|
| 1660 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1661 |
+
"overflow": null,
|
| 1662 |
+
"_model_module_version": "1.2.0",
|
| 1663 |
+
"_view_count": null,
|
| 1664 |
+
"flex_flow": null,
|
| 1665 |
+
"width": null,
|
| 1666 |
+
"min_width": null,
|
| 1667 |
+
"border": null,
|
| 1668 |
+
"align_items": null,
|
| 1669 |
+
"bottom": null,
|
| 1670 |
+
"_model_module": "@jupyter-widgets/base",
|
| 1671 |
+
"top": null,
|
| 1672 |
+
"grid_column": null,
|
| 1673 |
+
"overflow_y": null,
|
| 1674 |
+
"overflow_x": null,
|
| 1675 |
+
"grid_auto_flow": null,
|
| 1676 |
+
"grid_area": null,
|
| 1677 |
+
"grid_template_columns": null,
|
| 1678 |
+
"flex": null,
|
| 1679 |
+
"_model_name": "LayoutModel",
|
| 1680 |
+
"justify_items": null,
|
| 1681 |
+
"grid_row": null,
|
| 1682 |
+
"max_height": null,
|
| 1683 |
+
"align_content": null,
|
| 1684 |
+
"visibility": null,
|
| 1685 |
+
"align_self": null,
|
| 1686 |
+
"height": null,
|
| 1687 |
+
"min_height": null,
|
| 1688 |
+
"padding": null,
|
| 1689 |
+
"grid_auto_rows": null,
|
| 1690 |
+
"grid_gap": null,
|
| 1691 |
+
"max_width": null,
|
| 1692 |
+
"order": null,
|
| 1693 |
+
"_view_module_version": "1.2.0",
|
| 1694 |
+
"grid_template_areas": null,
|
| 1695 |
+
"object_position": null,
|
| 1696 |
+
"object_fit": null,
|
| 1697 |
+
"grid_auto_columns": null,
|
| 1698 |
+
"margin": null,
|
| 1699 |
+
"display": null,
|
| 1700 |
+
"left": null
|
| 1701 |
+
}
|
| 1702 |
+
},
|
| 1703 |
+
"277a1e05f0dc4afb839468c0b5c08bd7": {
|
| 1704 |
+
"model_module": "@jupyter-widgets/controls",
|
| 1705 |
+
"model_name": "DescriptionStyleModel",
|
| 1706 |
+
"model_module_version": "1.5.0",
|
| 1707 |
+
"state": {
|
| 1708 |
+
"_view_name": "StyleView",
|
| 1709 |
+
"_model_name": "DescriptionStyleModel",
|
| 1710 |
+
"description_width": "",
|
| 1711 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1712 |
+
"_model_module_version": "1.5.0",
|
| 1713 |
+
"_view_count": null,
|
| 1714 |
+
"_view_module_version": "1.2.0",
|
| 1715 |
+
"_model_module": "@jupyter-widgets/controls"
|
| 1716 |
+
}
|
| 1717 |
+
},
|
| 1718 |
+
"0b0c60f854f54830adfdf0464701460c": {
|
| 1719 |
+
"model_module": "@jupyter-widgets/base",
|
| 1720 |
+
"model_name": "LayoutModel",
|
| 1721 |
+
"model_module_version": "1.2.0",
|
| 1722 |
+
"state": {
|
| 1723 |
+
"_view_name": "LayoutView",
|
| 1724 |
+
"grid_template_rows": null,
|
| 1725 |
+
"right": null,
|
| 1726 |
+
"justify_content": null,
|
| 1727 |
+
"_view_module": "@jupyter-widgets/base",
|
| 1728 |
+
"overflow": null,
|
| 1729 |
+
"_model_module_version": "1.2.0",
|
| 1730 |
+
"_view_count": null,
|
| 1731 |
+
"flex_flow": null,
|
| 1732 |
+
"width": null,
|
| 1733 |
+
"min_width": null,
|
| 1734 |
+
"border": null,
|
| 1735 |
+
"align_items": null,
|
| 1736 |
+
"bottom": null,
|
| 1737 |
+
"_model_module": "@jupyter-widgets/base",
|
| 1738 |
+
"top": null,
|
| 1739 |
+
"grid_column": null,
|
| 1740 |
+
"overflow_y": null,
|
| 1741 |
+
"overflow_x": null,
|
| 1742 |
+
"grid_auto_flow": null,
|
| 1743 |
+
"grid_area": null,
|
| 1744 |
+
"grid_template_columns": null,
|
| 1745 |
+
"flex": null,
|
| 1746 |
+
"_model_name": "LayoutModel",
|
| 1747 |
+
"justify_items": null,
|
| 1748 |
+
"grid_row": null,
|
| 1749 |
+
"max_height": null,
|
| 1750 |
+
"align_content": null,
|
| 1751 |
+
"visibility": null,
|
| 1752 |
+
"align_self": null,
|
| 1753 |
+
"height": null,
|
| 1754 |
+
"min_height": null,
|
| 1755 |
+
"padding": null,
|
| 1756 |
+
"grid_auto_rows": null,
|
| 1757 |
+
"grid_gap": null,
|
| 1758 |
+
"max_width": null,
|
| 1759 |
+
"order": null,
|
| 1760 |
+
"_view_module_version": "1.2.0",
|
| 1761 |
+
"grid_template_areas": null,
|
| 1762 |
+
"object_position": null,
|
| 1763 |
+
"object_fit": null,
|
| 1764 |
+
"grid_auto_columns": null,
|
| 1765 |
+
"margin": null,
|
| 1766 |
+
"display": null,
|
| 1767 |
+
"left": null
|
| 1768 |
+
}
|
| 1769 |
+
}
|
| 1770 |
+
}
|
| 1771 |
+
}
|
| 1772 |
+
},
|
| 1773 |
+
"nbformat": 4,
|
| 1774 |
+
"nbformat_minor": 0
|
| 1775 |
+
}
|