-
Notifications
You must be signed in to change notification settings - Fork 46
/
.gitlab-ci.yml
52 lines (48 loc) · 2.22 KB
/
.gitlab-ci.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
stages:
- train
variables:
SMBUS: "<sambus_path>"
USER: "<sambus_username>"
PASSWORD: "<sambus_password>"
CONFIG: "<config_file>"
DATAROOT: "<data_root>"
EPOCH: "<epochs>"
EXTRA: "<extra_parameters>"
PROJECT: ""
train_job:
stage: train
image: sscma
tags:
- runner-gpu
script:
- PROJECT=$(echo ${CONFIG} | rev | cut -d '/' -f 1 | rev | sed 's/.py//g')
- echo "Config=$CONFIG"
- echo "Data root=$DATAROOT"
- echo "Epochs=$EPOCH"
- echo "Extra=$EXTRA"
- echo "Project=$PROJECT"
- nvidia-smi
- free -m
- df -h
- cd /builds/awesome-se/SSCMA
- pip install .
- mkdir -p /builds/awesome-se/work
- mount -t cifs -o username=$USER,password=$PASSWORD,vers=3.0,uid=`id -u`,gid=`id -g`,rw,file_mode=0664 $SMBUS /builds/awesome-se/work
- ln -s /builds/awesome-se/work/datasets datasets
- ls -l datasets/
- python tools/train.py ${CONFIG} --cfg-options data_root=$DATAROOT epochs=$EPOCH $EXTRA
- python tools/export.py ${CONFIG} "$(cat work_dirs/$PROJECT/last_checkpoint)" --cfg-options data_root=$DATAROOT $EXTRA
# get every weights file path
- WEIGHTBASE=$(cat work_dirs/$PROJECT/last_checkpoint | rev | cut -d '/' -f 1 |rev| sed 's/.pth//g')
- FILENAMEPTH=$(cat work_dirs/$PROJECT/last_checkpoint)
- FILENAMEONNX=$(echo work_dirs/${PROJECT}/${WEIGHTBASE}_float32.onnx)
- FILENAMETFLITE=$(echo work_dirs/${PROJECT}/${WEIGHTBASE}_float32.tflite)
- FILENAMEINT8=$(echo work_dirs/${PROJECT}/${WEIGHTBASE}_int8.tflite)
# inference every weights
- python tools/inference.py ${CONFIG} ${FILENAMEPTH} --dump ${FILENAMEPTH}.pkl --cfg-options data_root=$DATAROOT $EXTRA
- python tools/inference.py ${CONFIG} ${FILENAMEONNX} --dump ${FILENAMEONNX}.json --cfg-options data_root=$DATAROOT $EXTRA
- python tools/inference.py ${CONFIG} ${FILENAMETFLITE} --dump ${FILENAMETFLITE}.json --cfg-options data_root=$DATAROOT $EXTRA
- python tools/inference.py ${CONFIG} ${FILENAMEINT8} --dump ${FILENAMEINT8}.json --cfg-options data_root=$DATAROOT $EXTRA
- tar -czvf $PROJECT.tar.gz work_dirs
- mkdir -p /builds/awesome-se/work/result/$(date "+%Y-%m-%d_%H-%M-%S")
- cp $PROJECT.tar.gz /builds/awesome-se/work/result/$(date "+%Y-%m-%d_%H-%M-%S")/