Azure Machine Learning | PyTorch Environment for Training Models

Azure Machine Learning PyTorch Environment

Question

During your machine learning experiments, you need to use the PyTorch framework for training models.

One of your colleagues tells you that you can save manual work by using Azure's pre-configured environment for PyTorch and he comes up with the following code:

# connect to workspace from azureml.core import Workspace, Environment ws = Workspace.from_config() ... # set environment my_env = Environment.get(workspace=ws,name="PyTorch-1.1-CPU") ...
Does this code do its job as intended?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B.

Answer: B.

Option A is incorrect because Azure actually provides you with a bunch of pre-built (“curated”) environments for typical ML scenarios.

You can use them easily, by simply using them in your “Environment” definition.

The name of the curated environments start with the reserved prefix “AzureML”

Therefore, ML won't recognize“PyTorch-1.1-CPU" as a valid curated environment.

Option B is CORRECT because Azure actually provides a lot of pre-defined environments for typical ML scenarios, their name must start with the “AzureML” prefix, which is missing from the script, hence the script won't work as expected.

“AzureML-PyTorch-1.1-CPU" is the correct name.

Reference:

Based on the given code snippet, the code seems to be correctly importing the necessary modules and connecting to an Azure Machine Learning workspace using the from_config() method of the Workspace class.

However, the code sets the environment to PyTorch-1.1-CPU, which is a pre-configured environment for PyTorch version 1.1 on CPU. This may not be suitable for all machine learning experiments, especially if the models require a different version of PyTorch or need to be trained on GPU instead of CPU.

Therefore, the answer is B. No, the code may not do its job as intended for all machine learning experiments, and it may require further customization to fit specific requirements.