-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (84 loc) · 3.29 KB
/
trainer.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
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
name: Dataset trainer
on:
workflow_call:
inputs:
edit-set-name:
required: true
type: string
train-set-ids:
required: true
type: string
trial-set-ids:
required: true
type: string
bayes-set-ids:
required: true
type: string
jobs:
trainer:
runs-on: ubuntu-20.04
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with: { python-version: '3.9' }
- name: Install cbng-trainer
run: pip install git+https://github.com/cluebotng/trainer.git@main
- name: Download reviewed edits
run: |
filter=""
if [ ! -z "${{ join(fromJSON(inputs.train-set-ids)) }}" ];
then
export filter="${filter} --edit-set ${{ join(fromJSON(inputs.train-set-ids), ' --edit-set ') }}"
fi
cbng-trainer download-edits --output=train-edits.xml $filter
# If we have specific edits for the bayes set, then download them. Otherwise, use the same list as train.
# Note: We duplicate it here, so we can treat the artifact the same in all other steps
if [ ! -z "${{ join(fromJSON(inputs.bayes-set-ids)) }}" ];
then
cbng-trainer download-edits --output=bayes-edits.xml --edit-set ${{ join(fromJSON(inputs.bayes-set-ids), ' --edit-set ') }}
else
cp -v train-edits.xml bayes-edits.xml
fi
- name: Build databases
run: |
mkdir -p "results/"
cbng-trainer build-database --ann-input=train-edits.xml --bayes-input=bayes-edits.xml --output "results/"
- name: Prepare files
run: |
sudo chown -R runner:docker "results/"
sudo find results -type f -exec chmod 644 {} \;
cp train-edits.xml "results/"
cp bayes-edits.xml "results/"
- name: Run trial
run: |
# If we have specific edits for the trail set, then download them.
# Otherwise, download a random set of edits to use for comparison.
if [ ! -z "${{ join(fromJSON(inputs.trial-set-ids)) }}" ];
then
cbng-trainer download-edits --output=trial-edits.xml --edit-set ${{ join(fromJSON(inputs.trial-set-ids), ' --edit-set ') }}
else
cbng-trainer download-edits --output=trial-edits.xml --random-edits
fi
cp trial-edits.xml "results/"
# Run the actual trial logic
cbng-trainer trial-database --input trial-edits.xml --output "results/"
- name: Cleanup artifacts before release
id: clean
run: |
rm -f results/Dockerfile
# Re-structure the trial output (can't use a directory structure in releases)
for file in results/trialreport/*;
do
file_name=$(basename $(echo $file | cut -d/ -f3))
cp "$file" "results/trialreport-${file_name}"
done
rm -rf results/trialreport/
echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Crease a release
uses: ncipollo/release-action@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
artifacts: "results/*"
tag: "${{ inputs.edit-set-name }}/${{ steps.clean.outputs.date }}"