{"id":262,"date":"2021-09-09T12:00:32","date_gmt":"2021-09-09T19:00:32","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/windowsai\/?p=262"},"modified":"2021-10-01T17:28:44","modified_gmt":"2021-10-02T00:28:44","slug":"train-your-machine-learning-models-on-any-gpu-with-tensorflow-directml","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/windowsai\/train-your-machine-learning-models-on-any-gpu-with-tensorflow-directml\/","title":{"rendered":"Train your machine learning models on any GPU with TensorFlow-DirectML"},"content":{"rendered":"<p><a href=\"https:\/\/pypi.org\/project\/tensorflow-directml\/\">TensorFlow-DirectML<\/a> improves the experience and performance of model training through GPU acceleration on the breadth of Windows devices by working across different hardware vendors.<\/p>\n<p>Over the past year we launched the TensorFlow-DirectML <a href=\"https:\/\/blogs.windows.com\/windowsdeveloper\/2020\/06\/17\/gpu-accelerated-ml-training-inside-the-windows-subsystem-for-linux\/\">preview for Windows and the Windows Subsystem for Linux (WSL)<\/a>, <a href=\"https:\/\/github.com\/tensorflow\/community\/pull\/243\">worked with the TensorFlow community<\/a>, <a href=\"https:\/\/cloudblogs.microsoft.com\/opensource\/2020\/09\/08\/open-sourcing-tensorflow-with-directml\/\">open sourced the project<\/a>, and <a href=\"https:\/\/devblogs.microsoft.com\/windowsai\/using-tensorflow-directml-for-online-courses\/\">added targeted support for online course work<\/a>.<\/p>\n<p>Today we\u2019re excited to exit preview and announce our first generally consumable package of <a href=\"https:\/\/pypi.org\/project\/tensorflow-directml\/\">TensorFlow-DirectML<\/a>! We encourage you to use TensorFlow-DirectML whether you\u2019re a student learning or a professional developing machine learning models for production. Read on for more details on how we invested and where we\u2019re headed next.<\/p>\n<h3>TensorFlow-DirectML is easy to use and supports many ML workloads<\/h3>\n<p>Setting up TensorFlow-DirectML to work with your GPU is as easy as running \u201cpip install tensorflow-directml\u201d in your Python environment of choice. Once TensorFlow-DirectML is installed, it works seamlessly with existing model training scripts.<\/p>\n<p>We assembled a wide range of model scripts from existing TensorFlow tutorials, online learning courses, the TensorFlow Benchmark set, and AI-Benchmark, as well as other commonly used neural networks. This model set provided a breadth of scenarios for ensuring TensorFlow-DirectML has the operator coverage and performance needed for students\u2019 and professionals\u2019 success.<\/p>\n<p>Our team acted on customer feedback throughout the preview, improving the TensorFlow-DirectML experience on Windows and within WSL. Including optimizing specific operators like convolution and batch normalization and fine-tuning GPU scheduling and memory management so TensorFlow gets the most out of DirectML. We co-engineered with <a href=\"https:\/\/community.amd.com\/t5\/radeon-pro-graphics-blog\/amd-gpus-support-gpu-accelerated-machine-learning-with-release\/ba-p\/488595\">AMD<\/a>, <a href=\"https:\/\/www.intel.com\/content\/www\/us\/en\/download\/19387\/intel-graphics-beta-windows-10-dch-drivers.html\">Intel<\/a>, and <a href=\"https:\/\/developer.nvidia.com\/cuda\/wsl\/download\">NVIDIA<\/a> enabling a hardware accelerated training experience across the breadth of DirectX 12 capable GPUs.<\/p>\n<p><figure id=\"attachment_265\" aria-labelledby=\"figcaption_attachment_265\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/windowsai\/wp-content\/uploads\/sites\/71\/2021\/09\/sntraining_wsl2_terminal3.gif\"><img decoding=\"async\" class=\"wp-image-265 size-full\" src=\"https:\/\/devblogs.microsoft.com\/windowsai\/wp-content\/uploads\/sites\/71\/2021\/09\/sntraining_wsl2_terminal3.gif\" alt=\"SqueezeNet sample model training in WSL using TensorFlow-DirectML\" width=\"1731\" height=\"950\" \/><\/a><figcaption id=\"figcaption_attachment_265\" class=\"wp-caption-text\">SqueezeNet model sample training in WSL using TensorFlow-DirectML<\/figcaption><\/figure><\/p>\n<p>We encourage you to use your existing models but if you need examples to get started, we have a few <a href=\"https:\/\/github.com\/microsoft\/DirectML\/tree\/master\/TensorFlow\">sample models<\/a> available for you. We will continue improving TensorFlow-DirectML through targeted operator support and optimizations based on the feedback from the community. We look towards bringing these same benefits to the TensorFlow 2 codebase, including our plan of making a <a href=\"https:\/\/blog.tensorflow.org\/2021\/06\/pluggabledevice-device-plugins-for-TensorFlow.html\">TensorFlow PluggableDevice plugin<\/a> for DirectML.<\/p>\n<h3>Try out TensorFlow-DirectML today<\/h3>\n<p>If you have a Python environment setup then it is as simple as running \u201cpip install tensorflow-directml\u201d to get going with your existing TensorFlow training scripts. More detailed setup instructions are found on Microsoft Docs for <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/direct3d12\/gpu-tensorflow-windows\">Windows<\/a> and <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/direct3d12\/gpu-tensorflow-wsl\">WSL<\/a>. If you have feedback or run into issues with the package, please open an issue on the <a href=\"https:\/\/github.com\/microsoft\/tensorflow-directml\">TensorFlow-DirectML GitHub repo<\/a>. We would love to hear from you to make TensorFlow-DirectML even better!<\/p>\n<p>For future updates on TensorFlow-DirectML, stay tuned to the Windows AI Platform blog!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn about the first generally consumable package of TensorFlow-DirectML. TensorFlow-DirectML improves the experience and performance of model training through GPU acceleration on the breadth of Windows devices by working across different hardware vendors and supporting the needs of students\u2019 and professionals\u2019 workflows.<\/p>\n","protected":false},"author":28191,"featured_media":265,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[4,5],"class_list":["post-262","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-ai","tag-directml","tag-tensorflow"],"acf":[],"blog_post_summary":"<p>Learn about the first generally consumable package of TensorFlow-DirectML. TensorFlow-DirectML improves the experience and performance of model training through GPU acceleration on the breadth of Windows devices by working across different hardware vendors and supporting the needs of students\u2019 and professionals\u2019 workflows.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/posts\/262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/users\/28191"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/comments?post=262"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/posts\/262\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/media\/265"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/media?parent=262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/categories?post=262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/windowsai\/wp-json\/wp\/v2\/tags?post=262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}