{
  "id": 315363,
  "title": "How to install a newer version of tf or how I solved the problem that Embeddings contains Nan",
  "url": "/competitions/happy-whale-and-dolphin/discussion/315363",
  "author_name": "",
  "post_date": "2022-03-27T18:36:00.027228400Z",
  "votes": 24,
  "comment_count": 7,
  "views": 0,
  "content": "<p>Hi there!<br>\nI encountered a problem that Embeddings on the test dataset contains Nan. I couldn't figure out what it was until I accidentally discovered that everything works fine on colab. From this discussion: <a href=\"https://www.kaggle.com/competitions/happy-whale-and-dolphin/discussion/314372\" target=\"_blank\">https://www.kaggle.com/competitions/happy-whale-and-dolphin/discussion/314372</a> I understand that this problem is not unique to me, so I will send as I install new versions of tf in kaggle notebooks, or you can always use colab:</p>\n<p>!pip3 install -U tensorflow==2.7 </p>\n<p>print(\"update TPU server tensorflow version…\")</p>\n<p>!pip install cloud-tpu-client<br>\nimport tensorflow as tf <br>\nfrom cloud_tpu_client import Client<br>\nprint(tf.<strong>version</strong>)<br>\nClient().configure_tpu_version(tf.<strong>version</strong>, restart_type='ifNeeded')</p>\n<p>!pip install -U tensorflow-gcs-config==2.7</p>\n<p>The above code is taken from Kaggle notebooks, all thanks to all authors.<br>\nAs you can see, the versions of tensorflow and tensorflow-gcs-config must be the same. Also keep in mind that some libraries may not work after updating tf.</p>\n<p>Good luck to all! </p>",
  "messages": [
    {
      "id": "1736794",
      "postDate": "03/27/2022 18:36:00",
      "content": "<p>Hi there!<br>\nI encountered a problem that Embeddings on the test dataset contains Nan. I couldn't figure out what it was until I accidentally discovered that everything works fine on colab. From this discussion: <a href=\"https://www.kaggle.com/competitions/happy-whale-and-dolphin/discussion/314372\" target=\"_blank\">https://www.kaggle.com/competitions/happy-whale-and-dolphin/discussion/314372</a> I understand that this problem is not unique to me, so I will send as I install new versions of tf in kaggle notebooks, or you can always use colab:</p>\n<p>!pip3 install -U tensorflow==2.7 </p>\n<p>print(\"update TPU server tensorflow version…\")</p>\n<p>!pip install cloud-tpu-client<br>\nimport tensorflow as tf <br>\nfrom cloud_tpu_client import Client<br>\nprint(tf.<strong>version</strong>)<br>\nClient().configure_tpu_version(tf.<strong>version</strong>, restart_type='ifNeeded')</p>\n<p>!pip install -U tensorflow-gcs-config==2.7</p>\n<p>The above code is taken from Kaggle notebooks, all thanks to all authors.<br>\nAs you can see, the versions of tensorflow and tensorflow-gcs-config must be the same. Also keep in mind that some libraries may not work after updating tf.</p>\n<p>Good luck to all! </p>",
      "rawMarkdown": "Hi there!\nI encountered a problem that Embeddings on the test dataset contains Nan. I couldn't figure out what it was until I accidentally discovered that everything works fine on colab. From this discussion: https://www.kaggle.com/competitions/happy-whale-and-dolphin/discussion/314372 I understand that this problem is not unique to me, so I will send as I install new versions of tf in kaggle notebooks, or you can always use colab:\n\n!pip3 install -U tensorflow==2.7 \n\nprint(\"update TPU server tensorflow version...\")\n\n!pip install cloud-tpu-client\nimport tensorflow as tf \nfrom cloud_tpu_client import Client\nprint(tf.__version__)\nClient().configure_tpu_version(tf.__version__, restart_type='ifNeeded')\n\n!pip install -U tensorflow-gcs-config==2.7\n\nThe above code is taken from Kaggle notebooks, all thanks to all authors.\nAs you can see, the versions of tensorflow and tensorflow-gcs-config must be the same. Also keep in mind that some libraries may not work after updating tf.\n\nGood luck to all!",
      "votes": null
    },
    {
      "id": "1736831",
      "postDate": "03/27/2022 19:16:03",
      "content": "<p>Thank you! Was having the same problem. </p>",
      "rawMarkdown": "Thank you! Was having the same problem.",
      "votes": null
    },
    {
      "id": "1736840",
      "postDate": "03/27/2022 19:29:01",
      "content": "<p>Thank you!!</p>",
      "rawMarkdown": "Thank you!!",
      "votes": null
    },
    {
      "id": "1736941",
      "postDate": "03/28/2022 01:11:45",
      "content": "<p>thx for sharing! </p>",
      "rawMarkdown": "thx for sharing!",
      "votes": null
    },
    {
      "id": "1737654",
      "postDate": "03/28/2022 15:47:45",
      "content": "<p>Useful information, thanks</p>",
      "rawMarkdown": "Useful information, thanks",
      "votes": null
    },
    {
      "id": "1738440",
      "postDate": "03/29/2022 09:29:43",
      "content": "<p>Thank you!</p>",
      "rawMarkdown": "Thank you!",
      "votes": null
    },
    {
      "id": "1741594",
      "postDate": "04/01/2022 01:36:46",
      "content": "<p>Thank you for this solution! I have been converting nan values to zeros using <code>np.nan_to_num(train_embeddings)</code> and it seems to work for me. Hope this makes sense!</p>",
      "rawMarkdown": "Thank you for this solution! I have been converting nan values to zeros using `np.nan_to_num(train_embeddings)` and it seems to work for me. Hope this makes sense!",
      "votes": null
    },
    {
      "id": "1741765",
      "postDate": "04/01/2022 06:08:46",
      "content": "<p>I know about this solution, but it doesn't always work, especially when you're using a giant network and you don't have enough memory for this feature …</p>",
      "rawMarkdown": "I know about this solution, but it doesn't always work, especially when you're using a giant network and you don't have enough memory for this feature ...",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1736831,
      "author_name": "flrotm",
      "author_url": "",
      "post_date": "03/27/2022 19:16:03",
      "content": "<p>Thank you! Was having the same problem. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1736840,
      "author_name": "meesz9",
      "author_url": "",
      "post_date": "03/27/2022 19:29:01",
      "content": "<p>Thank you!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1736941,
      "author_name": "dragonzhang",
      "author_url": "",
      "post_date": "03/28/2022 01:11:45",
      "content": "<p>thx for sharing! </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1737654,
      "author_name": "djacon",
      "author_url": "",
      "post_date": "03/28/2022 15:47:45",
      "content": "<p>Useful information, thanks</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1738440,
      "author_name": "lextoumbourou",
      "author_url": "",
      "post_date": "03/29/2022 09:29:43",
      "content": "<p>Thank you!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1741594,
      "author_name": "frlemarchand",
      "author_url": "",
      "post_date": "04/01/2022 01:36:46",
      "content": "<p>Thank you for this solution! I have been converting nan values to zeros using <code>np.nan_to_num(train_embeddings)</code> and it seems to work for me. Hope this makes sense!</p>",
      "votes": null,
      "replies": [
        {
          "id": 1741765,
          "author_name": "aikhmelnytskyy",
          "author_url": "",
          "post_date": "04/01/2022 06:08:46",
          "content": "<p>I know about this solution, but it doesn't always work, especially when you're using a giant network and you don't have enough memory for this feature …</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1736794": "Hi there!\nI encountered a problem that Embeddings on the test dataset contains Nan. I couldn't figure out what it was until I accidentally discovered that everything works fine on colab. From this discussion: https://www.kaggle.com/competitions/happy-whale-and-dolphin/discussion/314372 I understand that this problem is not unique to me, so I will send as I install new versions of tf in kaggle notebooks, or you can always use colab:\n\n!pip3 install -U tensorflow==2.7 \n\nprint(\"update TPU server tensorflow version...\")\n\n!pip install cloud-tpu-client\nimport tensorflow as tf \nfrom cloud_tpu_client import Client\nprint(tf.__version__)\nClient().configure_tpu_version(tf.__version__, restart_type='ifNeeded')\n\n!pip install -U tensorflow-gcs-config==2.7\n\nThe above code is taken from Kaggle notebooks, all thanks to all authors.\nAs you can see, the versions of tensorflow and tensorflow-gcs-config must be the same. Also keep in mind that some libraries may not work after updating tf.\n\nGood luck to all!",
    "1736831": "Thank you! Was having the same problem.",
    "1736840": "Thank you!!",
    "1736941": "thx for sharing!",
    "1737654": "Useful information, thanks",
    "1738440": "Thank you!",
    "1741594": "Thank you for this solution! I have been converting nan values to zeros using `np.nan_to_num(train_embeddings)` and it seems to work for me. Hope this makes sense!",
    "1741765": "I know about this solution, but it doesn't always work, especially when you're using a giant network and you don't have enough memory for this feature ..."
  },
  "source": "meta"
}