message: replace index_word with tokenizer.index_word
diff: "train_seqs = tokenizer.texts_to_sequences(train_captions)"
  ]
  },
  - {
  - "cell_type": "code",
  - "execution_count": null,
  - "metadata": {
  - "colab": {
  - "autoexec": {
  - "startup": false,
  - "wait_interval": 0
  - }
  - },
  - "colab_type": "code",
  - "id": "olQArbgbRPF1"
  - },
  - "outputs": [],
  - "source": [
  - "# creating a reverse mapping (index -> word)\n",
  - "index_word = {value:key for key, value in tokenizer.word_index.items()}"
  - ]
  - },
  {
  "cell_type": "code",
  "execution_count": null,
  " attention_plot[i] = tf.reshape(attention_weights, (-1, )).numpy()\n",
  "\n",
  " predicted_id = tf.argmax(predictions[0]).numpy()\n",
  - " result.append(index_word[predicted_id])\n",
  + " result.append(tokenizer.index_word[predicted_id])\n",
  "\n",
  - " if index_word[predicted_id] == '<end>':\n",
  + " if tokenizer.index_word[predicted_id] == '<end>':\n",
  " return result, attention_plot\n",
  "\n",
  " dec_input = tf.expand_dims([predicted_id], 0)\n",
  "# captions on the validation set\n",
  "rid = np.random.randint(0, len(img_name_val))\n",
  "image = img_name_val[rid]\n",
  - "real_caption = ' '.join([index_word[i] for i in cap_val[rid] if i not in [0]])\n",
  + "real_caption = ' '.join([tokenizer.index_word[i] for i in cap_val[rid] if i not in [0]])\n",
  "result, attention_plot = evaluate(image)\n",
  "\n",
  "print ('Real Caption:', real_caption)\n",
  