generated from HephaestusProject/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
34 lines (26 loc) · 913 Bytes
/
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
"""BinaryConnect: Training Deep Neural Networks with binary weights during propagations
Usage:
main.py <command> [<args>...]
main.py (-h | --help)
Available commands:
train
predict
evaluate
test
Options:
-h --help Show this.
See 'python main.py <command> --help' for more information on a specific command.
"""
from pathlib import Path
from type_docopt import docopt
if __name__ == "__main__":
args = docopt(__doc__, options_first=True)
argv = [args["<command>"]] + args["<args>"]
if args["<command>"] == "train":
from train import __doc__, train
train(docopt(__doc__, argv=argv, types={"path": Path}))
elif args["<command>"] == "predict":
from infer import __doc__, infer
infer(docopt(__doc__, argv=argv, types={"path": Path}))
else:
raise NotImplementedError(f"Command does not exist: {args['<command>']}")