-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (39 loc) · 2.17 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
# This Makefile is used inside the Docker container to build MarianNMT,
# and other tools (e.g. moses, subword-nmt, sentencepiece, etc). It also
# includes steps to make it quicker to rerun the docker build and docker run
# commands themselves.
#expose environment variables for docker build and run in this Makefile
include edinmt/configs/env_build.sh
export $(shell sed 's/=.*//' edinmt/configs/env_build.sh)
all: tools python-requirements systems marian
# docker
docker-build:
docker build -t scriptsmt/systems:$(DOCKER_VERSION) .
docker-run:
docker run --gpus all --rm --env-file=edinmt/configs/env_run.sh --name edinmt scriptsmt/systems:$(DOCKER_VERSION) serve
docker-test:
docker run --gpus all --rm --env-file=edinmt/configs/env_run.sh --name edinmt scriptsmt/systems:${DOCKER_VERSION} test
docker-save:
docker save scriptsmt/systems:$(DOCKER_VERSION) > scriptsmt-systems:$(DOCKER_VERSION).tar
#NMT software (note flag to build on cpu arch to work on cpu of downstream users)
marian: marian-dev marian-nbest-words
marian-dev:
git clone $(MARIAN_REPO_URL) -b $(MARIAN_BRANCH_NAME) $@ && cd $@ && git checkout $(MARIAN_COMMIT_ID)
mkdir -p $@/build && cd $@/build && cmake .. -DBUILD_ARCH=westmere -DUSE_STATIC_LIBS=on -DCMAKE_BUILD_TYPE=Release -DCOMPILE_SERVER=on -DCOMPILE_CPU=on && make -j && rm -rf src/ local/
marian-nbest-words:
git clone $(NBEST_WORDS_REPO_URL) -b $(NBEST_WORDS_BRANCH_NAME) $@ && cd $@ && git checkout $(NBEST_WORDS_COMMIT_ID)
mkdir -p $@/build && cd $@/build && cmake .. -DBUILD_ARCH=westmere -DUSE_STATIC_LIBS=on -DCMAKE_BUILD_TYPE=Release -DCOMPILE_SERVER=on -DCOMPILE_CPU=on && make -j && rm -rf src/ local/
#other tools
tools: tools/moses-scripts tools/subword-nmt tools/sentencepiece
tools/moses-scripts:
git clone $(MOSES_REPO_URL) -b $(MOSES_BRANCH_NAME) $@
tools/subword-nmt:
git clone $(SUBWORDNMT_REPO_URL) -b $(SUBWORDNMT_BRANCH_NAME) $@
tools/sentencepiece:
git clone $(SENTENCEPIECE_REPO_URL) -b $(SENTENCEPIECE_BRANCH_NAME) $@
mkdir -p $@/build && cd $@/build && cmake .. && make -j
python-requirements:
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
.PHONY: all python-requirements systems.$(MODEL_VERSION) tools