forked from Azure/azureml-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
job.py
32 lines (23 loc) · 734 Bytes
/
job.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# description: train fastai resnet18 model on mnist data via mlflow mlproject
# imports
import mlflow
from pathlib import Path
from azureml.core import Workspace
# get workspace
ws = Workspace.from_config()
# get root of git repo
prefix = Path(__file__).parent
# project settings
project_uri = prefix.joinpath("src")
# azure ml settings
experiment_name = "fastai-mnist-mlproject-example"
compute_name = "cpu-cluster"
# setup mlflow tracking
mlflow.set_tracking_uri(ws.get_mlflow_tracking_uri())
mlflow.set_experiment(experiment_name)
# setup backend config
backend_config = {"COMPUTE": compute_name}
# run mlflow project
run = mlflow.projects.run(
uri=str(project_uri), backend="azureml", backend_config=backend_config
)