-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathMakefile
executable file
·58 lines (47 loc) · 1.92 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
# BERT sample for TensorFlow
ARCH_LIBDIR ?= /lib/$(shell $(CC) -dumpmachine)
SGX_SIGNER_KEY ?= ../../../Pal/src/host/Linux-SGX/signer/enclave-key.pem
ifeq ($(DEBUG),1)
GRAMINE_LOG_LEVEL = debug
else
GRAMINE_LOG_LEVEL = error
endif
.PHONY: all
all: python.manifest
ifeq ($(SGX),1)
all: python.manifest.sgx python.sig python.token
endif
BERT_DATASET = https://storage.googleapis.com/bert_models/2019_05_30/wwm_uncased_L-24_H-1024_A-16.zip
SQUAAD_DATASET = https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v1.1.json
CHECKPOINTS = https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_8/bert_large_checkpoints.zip
BERT_FP32_MODEL = https://storage.googleapis.com/intel-optimized-tensorflow/models/v2_4_0/fp32_bert_squad.pb
.PHONY: collateral
collateral:
test -d models || git clone https://github.com/IntelAI/models.git
mkdir -p data
test -f data/wwm_uncased_L-24_H-1024_A-16.zip || wget $(BERT_DATASET) -P data/
test -d data/wwm_uncased_L-24_H-1024_A-16 || unzip data/wwm_uncased_L-24_H-1024_A-16.zip -d data
test -f data/wwm_uncased_L-24_H-1024_A-16/dev-v1.1.json || wget $(SQUAAD_DATASET) -P data/wwm_uncased_L-24_H-1024_A-16
test -f data/bert_large_checkpoints.zip || wget $(CHECKPOINTS) -P data/
test -d data/bert_large_checkpoints || unzip data/bert_large_checkpoints.zip -d data
test -f data/fp32_bert_squad.pb || wget $(BERT_FP32_MODEL) -P data/
python.manifest: python.manifest.template collateral
gramine-manifest \
-Dlog_level=$(GRAMINE_LOG_LEVEL) \
-Darch_libdir=$(ARCH_LIBDIR) \
-Dentrypoint=$(realpath $(shell sh -c "command -v python3")) \
-Dpythondistpath=$(PYTHONDISTPATH) \
$< >$@
python.manifest.sgx: python.manifest
gramine-sgx-sign \
--manifest $< \
--output $@
python.sig: python.manifest.sgx
python.token: python.sig
gramine-sgx-get-token --output $@ --sig $<
.PHONY: clean
clean:
$(RM) *.manifest *.manifest.sgx *.token *.sig
.PHONY: distclean
distclean: clean
$(RM) -r models/ data/