forked from DingLi23/s2search
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel_performance_testing.py
32 lines (26 loc) · 1012 Bytes
/
model_performance_testing.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
from dis import dis
from ranker_helper import get_scores
import json
import time
import sys
if __name__ == '__main__':
multiple = 1
if len(sys.argv) > 1:
multiple = int(sys.argv[1])
paper = []
with open('./test.data') as f:
for l in f.readlines():
for i in range(multiple):
paper.append(json.loads(l.strip()))
# st = time.time()
# scores_nw = get_scores('Machine Learning', paper, task_name="Noworker", force_global=True)
# print(f"compute {len(paper)} paper scores within {round(time.time() - st, 6)} sec")
print(len(paper))
st = time.time()
scores_w = get_scores('Machine Learning', paper, task_name="Worker", force_global=False)
print(f"compute {len(paper)} paper scores within {round(time.time() - st, 6)} sec")
# same = True
# for i in range(len(scores_nw)):
# if scores_nw[i] != scores_w[i]:
# same = False
# print(f'the result with or without worker is the same: {same}')