This repository has been archived by the owner on Dec 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (62 loc) · 2.26 KB
/
on_pr.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
name: DVC & CML Workflow
on:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container: docker://ghcr.io/iterative/cml:latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup
run: |
pip install -r requirements.txt
- name: Pull Data
continue-on-error: true
env:
GDRIVE_CREDENTIALS_DATA: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}
run: |
dvc pull --force
- name: Run DVC pipeline
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
GDRIVE_CREDENTIALS_DATA: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}
run: |
dvc repro
- name: Share changes
env:
GDRIVE_CREDENTIALS_DATA: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}
run: |
dvc push
- name: Create a P.R. with CML
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cml pr --rebase "dvc.lock" "params.yaml" "outs/*.json" "outs/eval" "outs/train_metrics"
- name: CML Report
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "## Metrics & Params" >> report.md
dvc exp diff main --show-md >> report.md
echo "## Plots" >> report.md
echo "### Eval Loss" >> report.md
dvc plots diff \
--target outs/train_metrics/scalars/eval_loss.tsv --show-vega main > vega.json
vl2png vega.json -s 1.5 > plot.png
cml-publish ./plot.png --md >> report.md
echo "### Eval Accuracy" >> report.md
dvc plots diff \
--target outs/train_metrics/scalars/eval_accuracy.tsv --show-vega main > vega.json
vl2png vega.json -s 1.5 > plot.png
cml-publish ./plot.png --md >> report.md
echo "### Confusion Matrix" >> report.md
dvc plots diff \
--target outs/eval/plots/confusion_matrix.json --show-vega main > vega.json
vl2png vega.json -s 1.5 > plot.png
cml-publish ./plot.png --md >> report.md
cml send-comment --pr report.md