{
  "id": 330121,
  "title": "TensorFlow TPU Starter Notebook",
  "url": "/competitions/AI4Code/discussion/330121",
  "author_name": "",
  "post_date": "2022-06-10T12:35:46.925574800Z",
  "votes": 18,
  "comment_count": 8,
  "views": 0,
  "content": "<h3>Hello!</h3>\n<p>As a TensorFlow user, I was upset that I didn't find a single TensorFlow public notebook for this competition. So I decided to translate this <strong><a href=\"https://www.kaggle.com/code/aerdem4/ai4code-pytorch-distilbert-baseline\" target=\"_blank\">AI4Code Pytorch DistilBert Baseline</a></strong> from PyTorch to TensorFlow:</p>\n<h3><a href=\"https://www.kaggle.com/code/nickuzmenkov/ai4code-tensorflow-distilbert-baseline\" target=\"_blank\">AI4Code TensorFlow DistilBert Baseline</a></h3>\n<p>It's configured to run on TPU taking only 6 minutes per epoch for more than 2M training samples, leaving you with a plenty of room for experiments.</p>\n<p>Many thanks to <a href=\"https://www.kaggle.com/aerdem4\" target=\"_blank\">@aerdem4</a> for the original work!</p>",
  "messages": [
    {
      "id": "1816668",
      "postDate": "06/10/2022 12:35:46",
      "content": "<h3>Hello!</h3>\n<p>As a TensorFlow user, I was upset that I didn't find a single TensorFlow public notebook for this competition. So I decided to translate this <strong><a href=\"https://www.kaggle.com/code/aerdem4/ai4code-pytorch-distilbert-baseline\" target=\"_blank\">AI4Code Pytorch DistilBert Baseline</a></strong> from PyTorch to TensorFlow:</p>\n<h3><a href=\"https://www.kaggle.com/code/nickuzmenkov/ai4code-tensorflow-distilbert-baseline\" target=\"_blank\">AI4Code TensorFlow DistilBert Baseline</a></h3>\n<p>It's configured to run on TPU taking only 6 minutes per epoch for more than 2M training samples, leaving you with a plenty of room for experiments.</p>\n<p>Many thanks to <a href=\"https://www.kaggle.com/aerdem4\" target=\"_blank\">@aerdem4</a> for the original work!</p>",
      "rawMarkdown": "### Hello!\n\nAs a TensorFlow user, I was upset that I didn't find a single TensorFlow public notebook for this competition. So I decided to translate this **[AI4Code Pytorch DistilBert Baseline][0]** from PyTorch to TensorFlow:\n\n### [AI4Code TensorFlow DistilBert Baseline][1]\n\nIt's configured to run on TPU taking only 6 minutes per epoch for more than 2M training samples, leaving you with a plenty of room for experiments.\n\nMany thanks to @aerdem4 for the original work!\n\n[0]: https://www.kaggle.com/code/aerdem4/ai4code-pytorch-distilbert-baseline\n[1]: https://www.kaggle.com/code/nickuzmenkov/ai4code-tensorflow-distilbert-baseline",
      "votes": null
    },
    {
      "id": "1817968",
      "postDate": "06/12/2022 04:46:24",
      "content": "<p>Thanks very much for this!  Anyone on a budget (even a Colab Pro+ budget ;) ) should look at this, seriously.</p>\n<p>I'm looking at this on colab, and increasing the batch size (8192 looks good to me) appears to bring a notable speed improvement - considering that data has to be hauled over to the TPU in chunks, that makes sense.</p>",
      "rawMarkdown": "Thanks very much for this!  Anyone on a budget (even a Colab Pro+ budget ;) ) should look at this, seriously.\n\nI'm looking at this on colab, and increasing the batch size (8192 looks good to me) appears to bring a notable speed improvement - considering that data has to be hauled over to the TPU in chunks, that makes sense.",
      "votes": null
    },
    {
      "id": "1818107",
      "postDate": "06/12/2022 09:25:45",
      "content": "<blockquote>\n  <p>I didn't find a single TensorFlow public notebook for this competition</p>\n</blockquote>\n<p>Same here. Nobody seems to use TF these days. There seems to be a fundamental problem with using TF in competitions. :/</p>",
      "rawMarkdown": "> I didn't find a single TensorFlow public notebook for this competition\n\nSame here. Nobody seems to use TF these days. There seems to be a fundamental problem with using TF in competitions. :/",
      "votes": null
    },
    {
      "id": "1819880",
      "postDate": "06/14/2022 08:00:33",
      "content": "<p>You're right. </p>\n<p>I haven't used Torch a lot, but at first glance it seems to be more user friendly and flexible despite it requires way more code for the same task and thus seems harder to quickstart compared to Keras. However, if that's critical, Torch Lightning totally eliminates this.</p>\n<p>Torch also has more straightforward and intuitive API. I've seen somebody complaining here that there's exactly 5 ways to initialise convolutional layer in TF and Keras. Sounds like a joke, but it's true.</p>\n<p>TF gives a huge privilege of TPU support out of the box, but unfortunately, TPU comes with the same 16 Gb of memory as all other kernels, which makes it impossible to unleash all its power.</p>\n<p>But I guess the vital issue about TF + TPU in NLP competitions is that some transformers models aren't compatible with TPU (e.g. LongFormer), so it's worthless to go for TF.</p>",
      "rawMarkdown": "You're right. \n\nI haven't used Torch a lot, but at first glance it seems to be more user friendly and flexible despite it requires way more code for the same task and thus seems harder to quickstart compared to Keras. However, if that's critical, Torch Lightning totally eliminates this.\n\nTorch also has more straightforward and intuitive API. I've seen somebody complaining here that there's exactly 5 ways to initialise convolutional layer in TF and Keras. Sounds like a joke, but it's true.\n\nTF gives a huge privilege of TPU support out of the box, but unfortunately, TPU comes with the same 16 Gb of memory as all other kernels, which makes it impossible to unleash all its power.\n\nBut I guess the vital issue about TF + TPU in NLP competitions is that some transformers models aren't compatible with TPU (e.g. LongFormer), so it's worthless to go for TF.",
      "votes": null
    },
    {
      "id": "1819893",
      "postDate": "06/14/2022 08:06:59",
      "content": "<p>I always feel enthusiastic about making use of all the free resources provided by Kaggle :)</p>\n<blockquote>\n  <p>increasing the batch size (8192 looks good to me) appears to bring a notable speed improvement </p>\n</blockquote>\n<p>That's a good point, thanks! I'll give it a try too</p>",
      "rawMarkdown": "I always feel enthusiastic about making use of all the free resources provided by Kaggle :)\n\n> increasing the batch size (8192 looks good to me) appears to bring a notable speed improvement \n\nThat's a good point, thanks! I'll give it a try too",
      "votes": null
    },
    {
      "id": "1820069",
      "postDate": "06/14/2022 10:43:48",
      "content": "<p>This is truly wonderful.<br>\nThank you for making it a public notebook.</p>",
      "rawMarkdown": "This is truly wonderful.\nThank you for making it a public notebook.",
      "votes": null
    },
    {
      "id": "1821505",
      "postDate": "06/15/2022 15:45:02",
      "content": "<p>I think Jax is better choice than TF now.</p>",
      "rawMarkdown": "I think Jax is better choice than TF now.",
      "votes": null
    },
    {
      "id": "1822011",
      "postDate": "06/16/2022 02:27:53",
      "content": "<p>Are you using jax?</p>",
      "rawMarkdown": "Are you using jax?",
      "votes": null
    },
    {
      "id": "1822047",
      "postDate": "06/16/2022 03:24:31",
      "content": "<p>Thanks for the clue, I'll check it out!</p>",
      "rawMarkdown": "Thanks for the clue, I'll check it out!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1817968,
      "author_name": "happycube",
      "author_url": "",
      "post_date": "06/12/2022 04:46:24",
      "content": "<p>Thanks very much for this!  Anyone on a budget (even a Colab Pro+ budget ;) ) should look at this, seriously.</p>\n<p>I'm looking at this on colab, and increasing the batch size (8192 looks good to me) appears to bring a notable speed improvement - considering that data has to be hauled over to the TPU in chunks, that makes sense.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1819893,
          "author_name": "nickuzmenkov",
          "author_url": "",
          "post_date": "06/14/2022 08:06:59",
          "content": "<p>I always feel enthusiastic about making use of all the free resources provided by Kaggle :)</p>\n<blockquote>\n  <p>increasing the batch size (8192 looks good to me) appears to bring a notable speed improvement </p>\n</blockquote>\n<p>That's a good point, thanks! I'll give it a try too</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1818107,
      "author_name": "tornikeonoprishvili",
      "author_url": "",
      "post_date": "06/12/2022 09:25:45",
      "content": "<blockquote>\n  <p>I didn't find a single TensorFlow public notebook for this competition</p>\n</blockquote>\n<p>Same here. Nobody seems to use TF these days. There seems to be a fundamental problem with using TF in competitions. :/</p>",
      "votes": null,
      "replies": [
        {
          "id": 1819880,
          "author_name": "nickuzmenkov",
          "author_url": "",
          "post_date": "06/14/2022 08:00:33",
          "content": "<p>You're right. </p>\n<p>I haven't used Torch a lot, but at first glance it seems to be more user friendly and flexible despite it requires way more code for the same task and thus seems harder to quickstart compared to Keras. However, if that's critical, Torch Lightning totally eliminates this.</p>\n<p>Torch also has more straightforward and intuitive API. I've seen somebody complaining here that there's exactly 5 ways to initialise convolutional layer in TF and Keras. Sounds like a joke, but it's true.</p>\n<p>TF gives a huge privilege of TPU support out of the box, but unfortunately, TPU comes with the same 16 Gb of memory as all other kernels, which makes it impossible to unleash all its power.</p>\n<p>But I guess the vital issue about TF + TPU in NLP competitions is that some transformers models aren't compatible with TPU (e.g. LongFormer), so it's worthless to go for TF.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1821505,
          "author_name": "snaker",
          "author_url": "",
          "post_date": "06/15/2022 15:45:02",
          "content": "<p>I think Jax is better choice than TF now.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1822011,
          "author_name": "yuanzhezhou",
          "author_url": "",
          "post_date": "06/16/2022 02:27:53",
          "content": "<p>Are you using jax?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1822047,
          "author_name": "nickuzmenkov",
          "author_url": "",
          "post_date": "06/16/2022 03:24:31",
          "content": "<p>Thanks for the clue, I'll check it out!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1820069,
      "author_name": "thedevastator",
      "author_url": "",
      "post_date": "06/14/2022 10:43:48",
      "content": "<p>This is truly wonderful.<br>\nThank you for making it a public notebook.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1816668": "### Hello!\n\nAs a TensorFlow user, I was upset that I didn't find a single TensorFlow public notebook for this competition. So I decided to translate this **[AI4Code Pytorch DistilBert Baseline][0]** from PyTorch to TensorFlow:\n\n### [AI4Code TensorFlow DistilBert Baseline][1]\n\nIt's configured to run on TPU taking only 6 minutes per epoch for more than 2M training samples, leaving you with a plenty of room for experiments.\n\nMany thanks to @aerdem4 for the original work!\n\n[0]: https://www.kaggle.com/code/aerdem4/ai4code-pytorch-distilbert-baseline\n[1]: https://www.kaggle.com/code/nickuzmenkov/ai4code-tensorflow-distilbert-baseline",
    "1817968": "Thanks very much for this!  Anyone on a budget (even a Colab Pro+ budget ;) ) should look at this, seriously.\n\nI'm looking at this on colab, and increasing the batch size (8192 looks good to me) appears to bring a notable speed improvement - considering that data has to be hauled over to the TPU in chunks, that makes sense.",
    "1818107": "> I didn't find a single TensorFlow public notebook for this competition\n\nSame here. Nobody seems to use TF these days. There seems to be a fundamental problem with using TF in competitions. :/",
    "1819880": "You're right. \n\nI haven't used Torch a lot, but at first glance it seems to be more user friendly and flexible despite it requires way more code for the same task and thus seems harder to quickstart compared to Keras. However, if that's critical, Torch Lightning totally eliminates this.\n\nTorch also has more straightforward and intuitive API. I've seen somebody complaining here that there's exactly 5 ways to initialise convolutional layer in TF and Keras. Sounds like a joke, but it's true.\n\nTF gives a huge privilege of TPU support out of the box, but unfortunately, TPU comes with the same 16 Gb of memory as all other kernels, which makes it impossible to unleash all its power.\n\nBut I guess the vital issue about TF + TPU in NLP competitions is that some transformers models aren't compatible with TPU (e.g. LongFormer), so it's worthless to go for TF.",
    "1819893": "I always feel enthusiastic about making use of all the free resources provided by Kaggle :)\n\n> increasing the batch size (8192 looks good to me) appears to bring a notable speed improvement \n\nThat's a good point, thanks! I'll give it a try too",
    "1820069": "This is truly wonderful.\nThank you for making it a public notebook.",
    "1821505": "I think Jax is better choice than TF now.",
    "1822011": "Are you using jax?",
    "1822047": "Thanks for the clue, I'll check it out!"
  },
  "source": "meta"
}