forked from karpathy/llama2.c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse_log.py
68 lines (53 loc) · 2.49 KB
/
parse_log.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import re
import glob
def parse(file):
print(file)
with open(file, 'r') as file:
log_content = file.read()
# 使用正则表达式匹配 max_seq_len 和 test loss
max_seq_len_pattern = re.compile(r'max_seq_len (\d+)')
test_loss_pattern = re.compile(r'test loss ([\d.]+)')
# 找到所有匹配的 max_seq_len 和 test loss
max_seq_lens = max_seq_len_pattern.findall(log_content)
test_losses = test_loss_pattern.findall(log_content)
# 打印结果
for max_seq_len, test_loss in zip(max_seq_lens, test_losses):
print(f"{max_seq_len:5}: {test_loss}")
# print(f"max_seq_len: {max_seq_len}, test loss: {test_loss}")
for name in [
# "retry2_repeat_custom4096_len256",
# "retry_repeat_custom4096_len256_nope",
# "retry2_repeat_custom4096_len256_memory32_ffn_norm_reusekv_trainmem",
# "retry_reverse_custom4096_len256_theta",
# "retry_reverse_custom4096_len256_theta100000",
# "retry_reverse_custom4096_len256_theta1000000",
# "retry_reverse_custom4096_len256_xpos",
# "retry_reverse_custom4096_len256_xpos128",
# "retry_reverse_custom4096_len256_xpos1024",
# "retry_reverse_custom4096_len1024",
# "retry5_reverse_custom4096_len1024",
# "retry5_reverse_custom4096_len1024_xpos1024",
# "retry5_reverse_custom4096_len1024_xpos128",
# "retry5_reverse_custom4096_len1024_xpos32",
# "retry_reverse_custom4096_len256",
# "retry_reverse_custom4096_len256_nope",
# "retry_reverse_custom4096_len256_memory32_ffn_norm_reusekv_trainmem",
# "retry_reverse_custom4096_len256_freqsAbs",
# "retry_reverse_custom4096_len256_sumCis",
# "retry_reverse_custom4096_len256_sumCis_freqsAbs",
"infinity_repeat_custom4096_len256_memory32_ffn_norm_reusekv",
"infinity_repeat_custom4096_len256_memory32_ffn_norm_reusekv_updatemem",
"retry_reverse_custom4096_len256_memory32_ffn_norm_reusekv_updatemem",
# "infinity_repeat_custom4096_len1024_memory64_ffn_norm_reusekv_updatemem*",
# "infinity_reverse_custom4096_len1024_memory64_ffn_norm_reusekv_updatemem*",
]:
# pattern = re.compile(r".*(ReRoPE).*\.txt")
# pattern = re.compile(r".*(log_selfExtend).*\.txt")
# pattern = re.compile(r".*(SWA).*\.txt")
# pattern = re.compile(r".*(selfExtend|ReRoPE).*\.txt")
pattern = re.compile(r".*\.txt")
files = glob.glob(f"./out/{name}/*.txt")
matching_files = [file for file in files if pattern.search(file)]
print("="*30, name)
for file in matching_files:
parse(file)