#VS2019 – ML.NET Model Builder GPU Support, awesome !

Buy Me A Coffee

Hi !

Machine Learning.Net (ML.Net) includes a visual / step-by-step option for Auto ML: Model Builder. Even if ML.Net is based on .Net Core, and we can use it on Windows, Linux or Mac; Model Builder is only available for Visual Studio 2019.

And, in the latest preview version, Model Builder supports 3 specific training environments

  • Local (CPU)
  • Local (GPU)
  • Azure

And as you can imagine, if you have a decent GPU, the 2nd option is a must. So, let’s have a review for this.

First step is to install the [ML.NET Model Builder GPU Support (Preview)] extension (see references).

This will take a couple of minutes, and it will add the GPU option to our Model Builder projects. Once we have the extension installed, when we create a new ML.Net Model Builder Scenario, we can choose for CPU, GPU, or Azure environment.

In each one, we can see the different options available.

For this test, I use a sample Image Recognition scenario with 24 images for 3 different labels: fish, flower and human. This is a very simple scenario and the RestNet will easily work on this.

CPU Train

So, the total time to train a Image Recognition model with my CPU is:

Total experiment time : 230.8386996 Secs

Here are some more details:

------------------------------------------------------------------------------------------------------------------
|                                                     Summary                                                    |
------------------------------------------------------------------------------------------------------------------
|ML Task: image-classification                                                                                   |
|Dataset: C:\Users\bruno\AppData\Local\Temp\81efe1ab-c776-4071-b0ea-b7c93c65b239.tsv                             |
|Label : Label                                                                                                   |
|Total experiment time : 230.8386996 Secs                                                                        |
|Total number of models explored: 1                                                                              |
------------------------------------------------------------------------------------------------------------------

GPU Train

So, the total time to train a Image Recognition model with my GPO is:

Total experiment time : 228.1201648 Secs

More Details

------------------------------------------------------------------------------------------------------------------
|                                                     Summary                                                    |
------------------------------------------------------------------------------------------------------------------
|ML Task: image-classification                                                                                   |
|Dataset: C:\Users\bruno\AppData\Local\Temp\727e5bf8-bbe0-4d13-9513-043453a06bec.tsv                             |
|Label : Label                                                                                                   |
|Total experiment time : 228.1201648 Secs                                                                        |
|Total number of models explored: 1                                                                              |
------------------------------------------------------------------------------------------------------------------

CUDA and GPU must be configured

As you can see, the time is very similar in both scenarios, and there is a good reason for this. I just installed a brand new Windows 10 environment, and I haven’t configured my GPU / CUDA.

Lucky for us, there is an option in the Environment process, which allow us to check if our GPU will work.

Last time, it took me almost a day to configure my NVIDIA CUDA environment. So, as soon as I get this up and running, I’ll update this post!

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.

More info in https://beacons.ai/elbruno


References

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.