-
Remove any previous AML CLI extension installations
az extension remove -n ml az extension remove -n azure-cli-ml -
Install the latest AML 2.0 CLI, which is in public preview, and then verify installation
az extension add -n ml az ml -h -
Let's set some defaults for all subsequent "az ml" CLI commands
az account set --subscription <subcription id> az configure --defaults workspace=<azureml workspace name> group=<resource group> -
For this simple training job with AML 2.0 CLI, we have following project directory structure:
simple-train-cli |-- src | |-- train.py | |-- utils.py |-- job.ymlAs you can see from above, the project simply contains a job YAML file and some Python training scripts. In general, this a very typical project setup for Azure Arc-enabled ML training. Let's take a look a job YAML file:
experiment_name: Tutorial-sklearn-mnist code: local_path: ./src command: python train.py --data-folder {inputs.mnist} --regularization 0.5 environment: name: tutorial-env version: 1 path: . conda_file: file:./environment.yml docker: image: mcr.microsoft.com/azureml/intelmpi2018.3-ubuntu16.04:20210301.v1 compute: target: azureml:<your compute target name> instance_type: <your instance type> inputs: mnist: data: azureml:mnist_opendataset:1 mode: mount
Note: Instance type is optional parameter. If it's not given, the compute default instance type will be used. For this example to run, you would have created following assets in AML Workspace: compute target named <your compute name>, and file dataset named mnist_opendataset.
-
Git clone preview Github repo and switch to simple-train-cli directory
git clone https://github.com/Azure/AML-Kubernetes.git cd AML-Kubernetes/examples/simple-train-cli
-
Modify job YAML file to replace amlarc-ml with your own compute target name, and register open dataset MNIST as file dataset and named mnist_opendataset in AML Workspace from public URL: https://azureopendatastorage.blob.core.windows.net/mnist/*.gz
-
Run the image classification training job
az ml job create -f job.yml --webCreating this job uploads any specified local assets, like the source code directory, validates the YAML file, and submits the run. If needed, the environment is built, then the compute is scaled up and configured for running the job.
-
Once the job is compute, you can download the outputs:
az ml job download -n $run_id --outputs
That is it! You have successfully trained an image classification model and download outputs to local directory.