Welcome to the Azure Machine Learning (AML) examples repository!
- An Azure subscription. If you don't have an Azure subscription, create a free account before you begin.
- Familiarity with Python and Azure Machine Learning concepts.
- A terminal and Python >=3.6,<3.9.
Clone this repository and install required packages:
git clone https://github.com/Azure/azureml-examples
cd azureml-examples
pip install --upgrade -r requirements.txt
To create or setup a workspace with the assets used in these examples, run the setup script.
If you do not have an AML Workspace, run
python setup-workspace.py --subscription-id $ID
, where$ID
is your Azure subscription id. A resource group, AML Workspace, and other necessary resources will be created in the subscription.If you have an AML Workspace, install the AML CLI and run
az ml folder attach -w $WS -g $RG
, where$WS
and$RG
are the workspace and resource group names.Run
python setup-workspace.py -h
to see other arguments.
This example repo is structured for real ML projects, with modifications specific to showing examples. You can use the official GitHub template to schedule your own ML workflow(s).
directory | description |
---|---|
.cloud |
cloud templates |
.github |
GitHub specific files like Actions workflow yaml definitions and issue templates |
code |
ML code organized by scenario (train, deploy, etc.) then tool (pytorch, tensorflow, etc.) |
data |
not recommended - used for convenient data for examples - data should not be stored directly in a repository |
environments |
environment definition files such as conda yaml, pip txt, or dockerfile |
mlprojects |
mlflow project specifications |
models |
not recommended - used for convenient models for examples - models should not be stored directly in a repository |
notebooks |
interactive jupyter notebooks for iterative ML development |
tutorials |
not recommended - end to end tutorials |
website |
not recommended - used for hosting website |
workflows |
AML control plane specification (currently Python scripts) of job(s) to be run |
To get started, try the introductory tutorial.
We welcome contributions and suggestions! Please see the contributing guidelines for details.
This project has adopted the Microsoft Open Source Code of Conduct. Please see the code of conduct for details.
Tutorials
Notebooks
path | description |
---|---|
notebooks/train-lightgbm-local.ipynb | use AML and mlflow to track interactive experimentation in the cloud |
Train
path | compute | environment | description |
---|---|---|---|
workflows/train/deepspeed-cifar.py | AML - GPU | docker | train CIFAR-10 using DeepSpeed and PyTorch |
workflows/train/fastai-mnist-mlproject.py | AML - CPU | mlproject | train fastai resnet18 model on mnist data via mlflow mlproject |
workflows/train/fastai-mnist.py | AML - CPU | conda | train fastai resnet18 model on mnist data |
workflows/train/fastai-pets.py | AML - GPU | docker | train fastai resnet34 model on pets data |
workflows/train/lightgbm-iris.py | AML - CPU | pip | train a lightgbm model on iris data |
workflows/train/pytorch-mnist-mlproject.py | AML - GPU | mlproject | train a pytorch CNN model on mnist data via mlflow mlproject |
workflows/train/pytorch-mnist.py | AML - GPU | conda | train a pytorch CNN model on mnist data |
workflows/train/sklearn-diabetes-mlproject.py | AML - CPU | mlproject | train sklearn ridge model on diabetes data via mlflow mlproject |
workflows/train/sklearn-diabetes.py | AML - CPU | conda | train sklearn ridge model on diabetes data |
workflows/train/tensorflow-iris.py | AML - CPU | conda | train tensorflow NN model on iris data |
workflows/train/tensorflow-mnist-distributed-horovod.py | AML - GPU | conda | train tensorflow CNN model on mnist data distributed via horovod |
workflows/train/tensorflow-mnist-distributed.py | AML - GPU | conda | train tensorflow CNN model on mnist data distributed via tensorflow |
workflows/train/tensorflow-mnist.py | AML - GPU | conda | train tensorflow NN model on mnist data |
workflows/train/xgboost-iris.py | AML - CPU | pip | train xgboost model on iris data |
Deploy
path | compute | description |
---|---|---|
workflows/deploy/pytorch-mnist-aks-cpu.py | AKS - CPU | deploy pytorch CNN model trained on mnist data to AKS |
workflows/deploy/sklearn-diabetes-aks-cpu.py | AKS - CPU | deploy sklearn ridge model trained on diabetes data to AKS |