forked from ServiceNow/picard
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
73 lines (58 loc) · 2.93 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
GIT_HEAD_REF := $(shell git rev-parse HEAD)
BASE_IMAGE := pytorch/pytorch:1.9.0-cuda11.1-cudnn8-devel
IMAGE_NAME := 1301122/datasaur
BUILDKIT_BUILDER ?= buildx-local
BASE_DIR := $(shell pwd)
.PHONY: build-thrift-code
build-thrift-code:
thrift1 --gen mstch_cpp2 picard.thrift
thrift1 --gen mstch_py3 picard.thrift
cd gen-py3 && python setup.py build_ext --inplace
.PHONY: build-picard-deps
build-picard-deps:
cabal update
thrift-compiler --hs --use-hash-map --use-hash-set --gen-prefix gen-hs -o . picard.thrift
patch -p 1 -N -d third_party/hsthrift < ./fb-util-cabal.patch || true
cd third_party/hsthrift \
&& make THRIFT_COMPILE=thrift-compiler thrift-cpp thrift-hs
cabal build --only-dependencies lib:picard
.PHONY: build-picard
build-picard:
cabal install --overwrite-policy=always --install-method=copy exe:picard
.PHONY: build-eval-image
build-eval-image:
docker build . --tag $(IMAGE_NAME):$(GIT_HEAD_REF) --build-arg BASE_IMAGE=pytorch/pytorch:1.9.0-cuda11.1-cudnn8-devel
.PHONY: train
train:
mkdir -p -m 777 train
mkdir -p -m 777 transformers_cache
mkdir -p -m 777 wandb
docker run -ti --runtime=nvidia -e NVIDIA_DRIVER_CAPABILITIES=compute,utility -e NVIDIA_VISIBLE_DEVICES=all \
-it --rm --user root -p 8000:8000 \
--mount type=bind,source=/home/datasaur22/picard/train,target=/train \
--mount type=bind,source=/home/datasaur22/picard/wandb,target=/app/wandb \
--mount type=bind,source=/home/datasaur22/picard/transformers_cache,target=/transformers_cache \
--mount type=bind,source=/home/datasaur22/picard/configs,target=/app/configs \
1301122/datasaur:$(GIT_HEAD_REF) /bin/bash -c "python seq2seq/run_seq2seq.py configs/train.json"
.PHONY: eval
eval:
mkdir -p -m 777 eval
mkdir -p -m 777 transformers_cache
mkdir -p -m 777 wandb
docker run -ti --runtime=nvidia -e NVIDIA_DRIVER_CAPABILITIES=compute,utility -e NVIDIA_VISIBLE_DEVICES=all \
-it --rm --user root -p 8000:8000 \
--mount type=bind,source=/home/datasaur22/picard/eval,target=/eval \
--mount type=bind,source=/home/datasaur22/picard/wandb,target=/app/wandb \
--mount type=bind,source=/home/datasaur22/picard/transformers_cache,target=/transformers_cache \
--mount type=bind,source=/home/datasaur22/picard/configs,target=/app/configs \
1301122/datasaur:$(GIT_HEAD_REF) /bin/bash -c "python seq2seq/run_seq2seq.py configs/eval.json"
.PHONY: serve
serve:
mkdir -p -m 777 transformers_cache
mkdir -p -m 777 wandb
docker run -ti --runtime=nvidia -e NVIDIA_DRIVER_CAPABILITIES=compute,utility -e NVIDIA_VISIBLE_DEVICES=all \
-it --rm --user root -p 8000:8000 \
--mount type=bind,source=/home/datasaur22/picard/database,target=/database \
--mount type=bind,source=/home/datasaur22/picard/transformers_cache,target=/transformers_cache \
--mount type=bind,source=/home/datasaur22/picard/configs,target=/app/configs \
1301122/datasaur:$(GIT_HEAD_REF) /bin/bash -c "python seq2seq/serve_seq2seq.py configs/serve.json"