-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.py
36 lines (31 loc) · 1.1 KB
/
main.py
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
from os import path
import sys
sys.path.insert(0, "./python")
from mrt.V3.utils import merge_cfg, override_cfg_args
from mrt.V3.execute import run
from mrt.V3.utils import DOC as utils_doc
from mrt.V3.prepare import DOC as prepare_doc
from mrt.V3.calibrate import DOC as calibrate_doc
from mrt.V3.quantize import DOC as quantize_doc
from mrt.V3.evaluate import DOC as evaluate_doc
from mrt.V3.mrt_compile import DOC as compile_doc
DOC = """
Usage: python {0} --help
python {0} [YAML_FILE_PATH] [OPTIONS]
""".format(sys.argv[0])
def complete_docs():
return docs
if __name__ == "__main__":
if len(sys.argv) == 2 and sys.argv[1] in ["--help", "-h"]:
docs = "\n".join([
DOC, utils_doc, prepare_doc, calibrate_doc,
quantize_doc, evaluate_doc, compile_doc])
print(docs)
else:
assert len(sys.argv) >= 2 and len(sys.argv)%2 == 0, \
"invalid length: {} of sys.argv: {}".format(
len(sys.argv), sys.argv)
yaml_file = sys.argv[1]
cfg = merge_cfg(yaml_file)
cfg = override_cfg_args(cfg, sys.argv[2:])
run(cfg)