-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
93 lines (75 loc) · 2.27 KB
/
makefile
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
## makefile automates the build and deployment for python projects
## Build system
#
# build config
PROJ_TYPE = python
PROJ_MODULES = git python-resources python-cli python-doc python-doc-deploy markdown
# build
ADD_CLEAN += $(shell find example -type d -name __pycache__)
ADD_CLEAN += preds
CLEAN_ALL_DEPS += data-clean
PY_DEP_POST_DEPS += modeldeps
# project specific
DIST_BIN = ./dist
PRED_BIN = ./mimicsid
MODEL = glove300
SID_ARGS = -c config/$(MODEL).conf
## Includes
#
include ./zenbuild/main.mk
## Targets
#
# install dependencies need by the the models (both training and inference)
.PHONY: modeldeps
modeldeps:
$(PIP_BIN) install $(PIP_ARGS) \
-r $(PY_SRC)/requirements-model.txt --no-deps
# the DeepNLP package is neeed to run the tests
.PHONY: testdeps
testdeps: deps
$(PIP_BIN) install -r $(PY_SRC)/requirements-test.txt
# test for successful training per the code by limiting epochs and batch size
.PHONY: trainfast
trainfast:
if [ ! -d data/shared/adm ] ; then \
$(DIST_BIN) preempt $(SID_ARGS) -w 1 ; \
fi
$(DIST_BIN) traintest $(SID_ARGS) -p --override \
'model_settings.epochs=2,batch_stash.batch_limit=3'
# train production models
.PHONY: preprocess
preprocess:
@echo "expecting passwords set in config/system.conf..."
nohup ./src/bin/preprocess.sh > preprocess.log 2>&1 &
@echo "remember to remove passwords in config/system.conf after complete"
# train production models and then package them in a staging directory
.PHONY: packageprod
packageprod:
@echo "remember to remove passwords in config/system.conf"
nohup ./src/bin/package.sh > package.log 2>&1 &
# stop any training
.PHONY: stop
stop:
mkdir -p data/model/model
touch data/model/model/update.json
# stop training by killing processes
.PHONY: hardstop
hardstop:
ps -eaf | grep python | grep $(DIST_BIN) | \
grep -v grep | awk '{print $$2}' | xargs kill
# test parsing
.PHONY: testparse
testparse:
@$(PRED_BIN) predict \
--config config/glove300.conf \
--path - test-resources/note.txt | \
diff - test-resources/should-predict.txt || \
exit 1
# test prediction and the DB access
.PHONY: testall
testall: test testparse
.PHONY: data-clean
data-clean: clean
rm -f *.log
rm -fr data
make -C docker/app cleanall