-
Notifications
You must be signed in to change notification settings - Fork 40
129 lines (121 loc) · 3.93 KB
/
cml.yaml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: CML
on:
pull_request:
branches:
- main
jobs:
cml-local:
name: CML (Local)
runs-on: ubuntu-20.04
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
- name: Set up CML
uses: iterative/setup-cml@v1
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: hm-cnn
- name: Install requirements
working-directory: convolutional-neural-network
shell: bash -l {0}
run: |
conda install pytorch torchvision torchaudio --channel=pytorch
conda install pandas
conda install tabulate
pip install -r requirements.txt
- name: Train model
working-directory: convolutional-neural-network
shell: bash -l {0}
env:
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
run: |
python main.py --should_download_original_data=True
- name: Write CML report
working-directory: convolutional-neural-network
shell: bash -l {0}
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "# CML (Local) Report" >> report.md
echo "## Params" >> report.md
cat output/reports/params.txt >> report.md
cml-send-comment report.md
cml-cloud-set-up-cloud:
name: CML (Cloud) - Set up cloud
runs-on: ubuntu-20.04
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
- name: Set up CML
uses: iterative/setup-cml@v1
- name: Set up cloud
shell: bash
env:
REPO_TOKEN: ${{ secrets.CML_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
cml-runner \
--cloud=aws \
--cloud-region=us-west-2 \
--cloud-type=t2.small \
--labels=cml-runner
cml-cloud-train:
name: CML (Cloud) - Train
needs: cml-cloud-set-up-cloud
runs-on: [self-hosted, cml-runner]
# container: docker://iterativeai/cml:0-dvc2-base1-gpu
container: docker://iterativeai/cml:0-dvc2-base1
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: hm-cnn
- name: Install requirements
working-directory: convolutional-neural-network
shell: bash -l {0}
run: |
conda install pytorch torchvision torchaudio --channel=pytorch
conda install pandas
conda install tabulate
pip install -r requirements.txt
- name: Pull Data
working-directory: convolutional-neural-network
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
dvc pull
- name: Train model
working-directory: convolutional-neural-network
shell: bash -l {0}
env:
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
run: |
dvc repro
- name: Write CML report
working-directory: convolutional-neural-network
shell: bash -l {0}
env:
REPO_TOKEN: ${{ secrets.CML_ACCESS_TOKEN }}
run: |
echo "# CML (Cloud) Report" >> report.md
echo "## Params" >> report.md
cat output/reports/params.txt >> report.md
cml-send-comment report.md