{
  "id": 308778,
  "title": "🤗 PyTorch on TPU: Hugging Face Accelerate",
  "url": "/competitions/happy-whale-and-dolphin/discussion/308778",
  "author_name": "",
  "post_date": "2022-02-20T08:23:54.074467700Z",
  "votes": 29,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I've seen many notebooks utilizing TPUs for Tensorflow but I was trying to explore materials for TPU training with PyTorch.</p>\n<p>I found hugging face accelerate, which allows running your code on Multi-GPUs or TPUs with just 4 lines of additional code.</p>\n<p>From the <a href=\"https://huggingface.co/docs/accelerate/\" target=\"_blank\">docs</a>:</p>\n<blockquote>\n  <p>🤗 Accelerate provides an easy API to make your scripts run with mixed precision and on any kind of distributed setting (multi-GPUs, TPUs etc.) while still letting you write your own training loop. The same code can then runs seamlessly on your local machine for debugging or your training environment.</p>\n  <p>🤗 Accelerate also provides a CLI tool that allows you to quickly configure and test your training environment then launch the scripts.</p>\n</blockquote>\n<p>Some resources: </p>\n<ul>\n<li><a href=\"https://www.youtube.com/watch?v=A7lnu-ZsFZs\" target=\"_blank\">Video Walkthrough by Sylvain Gugger</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=s7dy8QRgjJ0\" target=\"_blank\">Shorter video</a></li>\n<li><a href=\"https://github.com/huggingface/accelerate\" target=\"_blank\">Github</a></li>\n</ul>\n<p>Let's bring PyTorch to TPUs 🚀 I'll be playing around with the public kernels and will keep everyone posted of my experimentations with TPUs.</p>",
  "messages": [
    {
      "id": "1698238",
      "postDate": "02/20/2022 08:23:54",
      "content": "<p>I've seen many notebooks utilizing TPUs for Tensorflow but I was trying to explore materials for TPU training with PyTorch.</p>\n<p>I found hugging face accelerate, which allows running your code on Multi-GPUs or TPUs with just 4 lines of additional code.</p>\n<p>From the <a href=\"https://huggingface.co/docs/accelerate/\" target=\"_blank\">docs</a>:</p>\n<blockquote>\n  <p>🤗 Accelerate provides an easy API to make your scripts run with mixed precision and on any kind of distributed setting (multi-GPUs, TPUs etc.) while still letting you write your own training loop. The same code can then runs seamlessly on your local machine for debugging or your training environment.</p>\n  <p>🤗 Accelerate also provides a CLI tool that allows you to quickly configure and test your training environment then launch the scripts.</p>\n</blockquote>\n<p>Some resources: </p>\n<ul>\n<li><a href=\"https://www.youtube.com/watch?v=A7lnu-ZsFZs\" target=\"_blank\">Video Walkthrough by Sylvain Gugger</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=s7dy8QRgjJ0\" target=\"_blank\">Shorter video</a></li>\n<li><a href=\"https://github.com/huggingface/accelerate\" target=\"_blank\">Github</a></li>\n</ul>\n<p>Let's bring PyTorch to TPUs 🚀 I'll be playing around with the public kernels and will keep everyone posted of my experimentations with TPUs.</p>",
      "rawMarkdown": "I've seen many notebooks utilizing TPUs for Tensorflow but I was trying to explore materials for TPU training with PyTorch.\n\nI found hugging face accelerate, which allows running your code on Multi-GPUs or TPUs with just 4 lines of additional code.\n\nFrom the [docs](https://huggingface.co/docs/accelerate/):\n\n> 🤗 Accelerate provides an easy API to make your scripts run with mixed precision and on any kind of distributed setting (multi-GPUs, TPUs etc.) while still letting you write your own training loop. The same code can then runs seamlessly on your local machine for debugging or your training environment.\n\n\n> 🤗 Accelerate also provides a CLI tool that allows you to quickly configure and test your training environment then launch the scripts.\n\nSome resources: \n- [Video Walkthrough by Sylvain Gugger](https://www.youtube.com/watch?v=A7lnu-ZsFZs)\n- [Shorter video](https://www.youtube.com/watch?v=s7dy8QRgjJ0)\n- [Github](https://github.com/huggingface/accelerate)\n\nLet's bring PyTorch to TPUs 🚀 I'll be playing around with the public kernels and will keep everyone posted of my experimentations with TPUs.",
      "votes": null
    },
    {
      "id": "1699195",
      "postDate": "02/21/2022 02:20:18",
      "content": "<p>great!! Thanks!!!!👍👍👍👍👍</p>",
      "rawMarkdown": "great!! Thanks!!!!👍👍👍👍👍",
      "votes": null
    },
    {
      "id": "1699278",
      "postDate": "02/21/2022 04:43:04",
      "content": "<p>This seems really good! I am a big fan of TensorFlow but it lacks libraries than pytorch.</p>",
      "rawMarkdown": "This seems really good! I am a big fan of TensorFlow but it lacks libraries than pytorch.",
      "votes": null
    },
    {
      "id": "1700206",
      "postDate": "02/21/2022 18:31:13",
      "content": "<p>+1, I think the growing ecosystem makes PyTorch a bit more fun with ease of experimentation. </p>",
      "rawMarkdown": "1, I think the growing ecosystem makes PyTorch a bit more fun with ease of experimentation.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1699195,
      "author_name": "kalelpark",
      "author_url": "",
      "post_date": "02/21/2022 02:20:18",
      "content": "<p>great!! Thanks!!!!👍👍👍👍👍</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1699278,
      "author_name": "deepkim",
      "author_url": "",
      "post_date": "02/21/2022 04:43:04",
      "content": "<p>This seems really good! I am a big fan of TensorFlow but it lacks libraries than pytorch.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1700206,
          "author_name": "init27",
          "author_url": "",
          "post_date": "02/21/2022 18:31:13",
          "content": "<p>+1, I think the growing ecosystem makes PyTorch a bit more fun with ease of experimentation. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1698238": "I've seen many notebooks utilizing TPUs for Tensorflow but I was trying to explore materials for TPU training with PyTorch.\n\nI found hugging face accelerate, which allows running your code on Multi-GPUs or TPUs with just 4 lines of additional code.\n\nFrom the [docs](https://huggingface.co/docs/accelerate/):\n\n> 🤗 Accelerate provides an easy API to make your scripts run with mixed precision and on any kind of distributed setting (multi-GPUs, TPUs etc.) while still letting you write your own training loop. The same code can then runs seamlessly on your local machine for debugging or your training environment.\n\n\n> 🤗 Accelerate also provides a CLI tool that allows you to quickly configure and test your training environment then launch the scripts.\n\nSome resources: \n- [Video Walkthrough by Sylvain Gugger](https://www.youtube.com/watch?v=A7lnu-ZsFZs)\n- [Shorter video](https://www.youtube.com/watch?v=s7dy8QRgjJ0)\n- [Github](https://github.com/huggingface/accelerate)\n\nLet's bring PyTorch to TPUs 🚀 I'll be playing around with the public kernels and will keep everyone posted of my experimentations with TPUs.",
    "1699195": "great!! Thanks!!!!👍👍👍👍👍",
    "1699278": "This seems really good! I am a big fan of TensorFlow but it lacks libraries than pytorch.",
    "1700206": "1, I think the growing ecosystem makes PyTorch a bit more fun with ease of experimentation."
  },
  "source": "meta"
}