This repository was archived by the owner on Nov 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdice.py
More file actions
49 lines (43 loc) · 1.25 KB
/
Copy pathdice.py
File metadata and controls
49 lines (43 loc) · 1.25 KB
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
"""Commensense Knowledge Reasoning Framework
Usage: python dice.py [FLAGS] <MODULE> [ARGUMENTS]
Flags:
--help display this message
--version display current program version
"""
def warn(*args, **kwargs):
pass
import warnings
warnings.warn = warn
import sys
from dice.modules import modules
def fail():
print(__doc__.split("\n")[1]
+ "\nTry 'python dice.py --help' for more information.")
exit()
if __name__ == "__main__":
import os
os.environ["OMP_NUM_THREADS"] = "12"
os.environ["OPENBLAS_NUM_THREADS"] = "12"
os.environ["MKL_NUM_THREADS"] = "12"
os.environ["VECLIB_MAXIMUM_THREADS"] = "12"
os.environ["NUMEXPR_NUM_THREADS"] = "12"
if "--help" in sys.argv:
print(__doc__)
print("Modules:\n " + "\n ".join(modules.keys()) + "\n")
for module in modules.values():
print(module.doc)
exit()
elif "--version" in sys.argv:
print("Commensense Knowledge Reasoning Framework 1.0")
exit()
if len(sys.argv) < 2:
fail()
module = sys.argv[1]
if module == "test":
from tests import tests
tests.main()
elif module not in modules:
fail()
else:
pipeline = modules[module]
pipeline.main()