forked from rsethur/saferollout
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.61 KB
/
train.yml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: train
on:
workflow_dispatch
env:
TRAINING_JOB_PREFIX: risk-model-job
MODEL_NAME: risk-model #registered registration model name
#MODEL_FILE_NAME: risk_model.joblib #output file from training script
jobs:
train:
runs-on: ubuntu-latest
steps:
- name: azure login
uses: azure/login@v1
with:
creds: ${{secrets.AZURE_CREDENTIALS}}
- run: |
az config set defaults.workspace=${{secrets.AML_WORKSPACE}}
az config set defaults.group=${{secrets.RESOURCE_GROUP}}
az account set -s ${{secrets.SUBSCRIPTION_ID}}
- name: Install azureml cli extension
run: az extension add -n ml -y
- name: Checkout
uses: actions/[email protected]
- name: Run training job
run: |
export TRAINING_JOB=${{ env.TRAINING_JOB_PREFIX }}-`echo $RANDOM`
# run the training job
az ml job create -f train/job.yml -n $TRAINING_JOB -s
echo "TRAINING_JOB=$TRAINING_JOB" >> $GITHUB_ENV
- name: Register model
run: |
# download the job output
az ml job download -n $TRAINING_JOB -p run-outputs
# register model
MODEL_VERSION=$(az ml model create -n ${{ env.MODEL_NAME }} -l run-outputs/$TRAINING_JOB/outputs/ | jq -r .version)
#write model name and version to file
export MODEL_NAME_WITH_VERSION=azureml:${{ env.MODEL_NAME }}:$MODEL_VERSION
echo $MODEL_NAME_WITH_VERSION > latest-model.txt
- name: Update model verion as artifact
uses: actions/upload-artifact@v2
with:
name: latest-model
path: latest-model.txt