-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path03_extract_edges.py
46 lines (39 loc) · 1.52 KB
/
03_extract_edges.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
37
38
39
40
41
42
43
44
45
46
"""Extract Edges run script
Loads the configuration and computes edge candidates.
Expects data specified as [validate_data] and [test_data]
Automatically selects data; if db name not set, set automatically
based on data
"""
import argparse
import logging
import sys
import time
from linajea.config import load_config
from linajea.process_blockwise import extract_edges_blockwise
from linajea.utils import (print_time,
getNextInferenceData)
logger = logging.getLogger(__name__)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--config', type=str,
help='path to config file')
parser.add_argument('--checkpoint', type=int, default=-1,
help='checkpoint to process')
parser.add_argument('--validation', action="store_true",
help='use validation data?')
parser.add_argument('--validate_on_train', action="store_true",
help='validate on train data?')
args = parser.parse_args()
config = load_config(args.config)
logging.basicConfig(
level=config['general']['logging'],
handlers=[
logging.FileHandler('run.log', mode='a'),
logging.StreamHandler(sys.stdout),
],
format='%(asctime)s %(name)s %(levelname)-8s %(message)s')
start_time = time.time()
for inf_config in getNextInferenceData(args):
extract_edges_blockwise(inf_config)
end_time = time.time()
print_time(end_time - start_time)