{
  "id": 171780,
  "title": "Pytorch progress bar in Colab = Tqdm",
  "url": "/competitions/global-wheat-detection/discussion/171780",
  "author_name": "",
  "post_date": "2020-08-02T13:00:30.720138100Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>If you train your model in Colab, and maybe using one of the public kernels, and doesn't see the progress during training/validation (steps, loss etc) but you did in Kaggle? \nSolution: Change to tqdm.</p>\n\n<p>I use one of the public kernels so you can see where and what to do:</p>\n\n<h2>Add to the import section</h2>\n\n<p>from tqdm import tqdm</p>\n\n<h2>Add to respective training and validation section</h2>\n\n<pre><code>    progress_bar = tqdm_notebook(train_loader)\n    for step, (images, targets, image_ids) in enumerate(progress_bar):\n     #   if self.config.verbose:\n       #     if step % self.config.verbose_step == 0:\n       #         print(\n      #              f'Train Step {step}/{len(train_loader)}, ' + \\\n       #             f'summary_loss: {summary_loss.avg:.5f}, ' + \\\n       #             f'time: {(time.time() - t):.5f}', end='\\r'\n       #         )\n        progress_bar.set_description(f'summary_loss: {summary_loss.avg:.5f}')\n\n    progress_bar = tqdm_notebook(val_loader)\n    for step, (images, targets, image_ids) in enumerate(progress_bar):\n      #  if self.config.verbose:\n     #       if step % self.config.verbose_step == 0:\n       #         print(\n       #             f'Val Step {step}/{len(val_loader)}, ' + \\\n      #              f'summary_loss: {summary_loss.avg:.5f}, ' + \\\n      #              f'time: {(time.time() - t):.5f}', end='\\r'\n       #         )\n        progress_bar.set_description(f'summary_loss: {summary_loss.avg:.5f}')\n</code></pre>\n\n<p>Then this  progress bar will appear:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3924325%2F69ad6ef62cea60ca0c4c454e1a66e587%2Ftqdm.JPG?generation=1596372515137751&amp;alt=media\" alt=\"\"></p>",
  "messages": [
    {
      "id": "955213",
      "postDate": "08/02/2020 13:00:30",
      "content": "<p>If you train your model in Colab, and maybe using one of the public kernels, and doesn't see the progress during training/validation (steps, loss etc) but you did in Kaggle? \nSolution: Change to tqdm.</p>\n\n<p>I use one of the public kernels so you can see where and what to do:</p>\n\n<h2>Add to the import section</h2>\n\n<p>from tqdm import tqdm</p>\n\n<h2>Add to respective training and validation section</h2>\n\n<pre><code>    progress_bar = tqdm_notebook(train_loader)\n    for step, (images, targets, image_ids) in enumerate(progress_bar):\n     #   if self.config.verbose:\n       #     if step % self.config.verbose_step == 0:\n       #         print(\n      #              f'Train Step {step}/{len(train_loader)}, ' + \\\n       #             f'summary_loss: {summary_loss.avg:.5f}, ' + \\\n       #             f'time: {(time.time() - t):.5f}', end='\\r'\n       #         )\n        progress_bar.set_description(f'summary_loss: {summary_loss.avg:.5f}')\n\n    progress_bar = tqdm_notebook(val_loader)\n    for step, (images, targets, image_ids) in enumerate(progress_bar):\n      #  if self.config.verbose:\n     #       if step % self.config.verbose_step == 0:\n       #         print(\n       #             f'Val Step {step}/{len(val_loader)}, ' + \\\n      #              f'summary_loss: {summary_loss.avg:.5f}, ' + \\\n      #              f'time: {(time.time() - t):.5f}', end='\\r'\n       #         )\n        progress_bar.set_description(f'summary_loss: {summary_loss.avg:.5f}')\n</code></pre>\n\n<p>Then this  progress bar will appear:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3924325%2F69ad6ef62cea60ca0c4c454e1a66e587%2Ftqdm.JPG?generation=1596372515137751&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "If you train your model in Colab, and maybe using one of the public kernels, and doesn't see the progress during training/validation (steps, loss etc) but you did in Kaggle? \nSolution: Change to tqdm.\n\nI use one of the public kernels so you can see where and what to do:\n\n##Add to the import section\nfrom tqdm import tqdm\n\n## Add to respective training and validation section\n\n        progress_bar = tqdm_notebook(train_loader)\n        for step, (images, targets, image_ids) in enumerate(progress_bar):\n         #   if self.config.verbose:\n           #     if step % self.config.verbose_step == 0:\n           #         print(\n          #              f'Train Step {step}/{len(train_loader)}, ' + \\\n           #             f'summary_loss: {summary_loss.avg:.5f}, ' + \\\n           #             f'time: {(time.time() - t):.5f}', end='\\r'\n           #         )\n            progress_bar.set_description(f'summary_loss: {summary_loss.avg:.5f}')\n\n        progress_bar = tqdm_notebook(val_loader)\n        for step, (images, targets, image_ids) in enumerate(progress_bar):\n          #  if self.config.verbose:\n         #       if step % self.config.verbose_step == 0:\n           #         print(\n           #             f'Val Step {step}/{len(val_loader)}, ' + \\\n          #              f'summary_loss: {summary_loss.avg:.5f}, ' + \\\n          #              f'time: {(time.time() - t):.5f}', end='\\r'\n           #         )\n            progress_bar.set_description(f'summary_loss: {summary_loss.avg:.5f}')\n\nThen this  progress bar will appear:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3924325%2F69ad6ef62cea60ca0c4c454e1a66e587%2Ftqdm.JPG?generation=1596372515137751&amp;alt=media)",
      "votes": null
    },
    {
      "id": "955354",
      "postDate": "08/02/2020 15:15:33",
      "content": "<p>There's also a nice library which provides keras-style progress bar for pytorch, and I'm using it for this competition. See <a href=\"https://github.com/yueyericardo/pkbar\">here</a>.</p>",
      "rawMarkdown": "There's also a nice library which provides keras-style progress bar for pytorch, and I'm using it for this competition. See [here](https://github.com/yueyericardo/pkbar).",
      "votes": null
    },
    {
      "id": "955383",
      "postDate": "08/02/2020 15:37:41",
      "content": "<p>Thanks, didn't know that.</p>",
      "rawMarkdown": "Thanks, didn't know that.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 955354,
      "author_name": "wasupandceacar",
      "author_url": "",
      "post_date": "08/02/2020 15:15:33",
      "content": "<p>There's also a nice library which provides keras-style progress bar for pytorch, and I'm using it for this competition. See <a href=\"https://github.com/yueyericardo/pkbar\">here</a>.</p>",
      "votes": null,
      "replies": [
        {
          "id": 955383,
          "author_name": "kirderf",
          "author_url": "",
          "post_date": "08/02/2020 15:37:41",
          "content": "<p>Thanks, didn't know that.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "955213": "If you train your model in Colab, and maybe using one of the public kernels, and doesn't see the progress during training/validation (steps, loss etc) but you did in Kaggle? \nSolution: Change to tqdm.\n\nI use one of the public kernels so you can see where and what to do:\n\n##Add to the import section\nfrom tqdm import tqdm\n\n## Add to respective training and validation section\n\n        progress_bar = tqdm_notebook(train_loader)\n        for step, (images, targets, image_ids) in enumerate(progress_bar):\n         #   if self.config.verbose:\n           #     if step % self.config.verbose_step == 0:\n           #         print(\n          #              f'Train Step {step}/{len(train_loader)}, ' + \\\n           #             f'summary_loss: {summary_loss.avg:.5f}, ' + \\\n           #             f'time: {(time.time() - t):.5f}', end='\\r'\n           #         )\n            progress_bar.set_description(f'summary_loss: {summary_loss.avg:.5f}')\n\n        progress_bar = tqdm_notebook(val_loader)\n        for step, (images, targets, image_ids) in enumerate(progress_bar):\n          #  if self.config.verbose:\n         #       if step % self.config.verbose_step == 0:\n           #         print(\n           #             f'Val Step {step}/{len(val_loader)}, ' + \\\n          #              f'summary_loss: {summary_loss.avg:.5f}, ' + \\\n          #              f'time: {(time.time() - t):.5f}', end='\\r'\n           #         )\n            progress_bar.set_description(f'summary_loss: {summary_loss.avg:.5f}')\n\nThen this  progress bar will appear:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3924325%2F69ad6ef62cea60ca0c4c454e1a66e587%2Ftqdm.JPG?generation=1596372515137751&amp;alt=media)",
    "955354": "There's also a nice library which provides keras-style progress bar for pytorch, and I'm using it for this competition. See [here](https://github.com/yueyericardo/pkbar).",
    "955383": "Thanks, didn't know that."
  },
  "source": "meta"
}