The workspace object is the fundamental handle on your Azure ML assets and is used
throughout (often simply referred to by
For more details: Workspaces
For more details: Compute Target
You can use a pip
requirements.txt file or a Conda
env.yml file to define a Python environment on your compute.
You can also use docker images to prepare your environments.
For more details: Environment
To run code in Azure ML you need to:
- Configure: Configuration includes specifying the code to run, the compute target to run on and the Python environment to run in.
- Submit: Create or reuse an Azure ML Experiment and submit the run.
A typical directory may have the following structure:
$ (env) python <path/to/code>/script.py [arguments] on a remote compute
target: ComputeTarget with an environment
env: Environment we can use
For more details on arguments: Command line arguments
compute_target: If not provided the script will run on your local machine.
environment: If not provided, uses a default Python environment managed by Azure ML. See Environment for more details.
It is possible to provide the explicit command to run.
For more details: Commands
To submit this code, create an
Experiment: a light-weight container that helps to
organize our submissions and keep track of code (See Run History).
This link will take you to the Azure ML Studio where you can monitor your run.
For more details: ScriptRunConfig
Here is a fairly typical example using a Conda environment to run a training
train.py on our local machine from the command line.
Suppose you want to run this on a GPU in Azure.
ScriptRunConfig to enable distributed GPU training.
mcr.microsoft.com/azureml/openmpi3.1.2-cuda10.1-cudnn7-ubuntu18.04is a docker image with OpenMPI. This is required for distributed training on Azure ML.
MpiConfigurationis where you specify the number of nodes and GPUs (per node) you want to train on.
For more details: Distributed GPU Training
To work with data in your training scripts using your workspace
ws and its default datastore:
For more details see: Data
Pass this to your training script as a command line argument.