forked from msr-fiddle/dejavu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_output.py
More file actions
40 lines (30 loc) · 1 KB
/
process_output.py
File metadata and controls
40 lines (30 loc) · 1 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
import sys
import numpy as np
def get_data(inp):
idx = 0
prompts = []
tokens = []
totals = []
with open(inp, 'r') as f:
lines = f.readlines()
for line in lines:
if 'START GPT FORWARD BENCHMARK' in line:
idx += 1
if idx > 2:
data = line.split(" ")
if 'PROMPT processing' in line:
prompts.append(float(data[-2]))
elif 'ALL-TOKEN generation' in line:
tokens.append(float(data[-2]))
elif 'TOTAL generation' in line:
totals.append(float(data[-2]))
return prompts, tokens, totals
if __name__ == "__main__":
prompts, tokens, totals = get_data(sys.argv[1])
print(f"PROMPTS: {prompts}")
print(f"TOKENS: {tokens}")
print(f"TOTALS: {totals}")
pavg = round(np.average(prompts), 2)
tokavg = round(np.average(tokens), 2)
totavg = round(np.average(totals), 2)
print(f"{pavg},{tokavg},{totavg}")