-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_phase11.py
More file actions
56 lines (45 loc) · 2.12 KB
/
plot_phase11.py
File metadata and controls
56 lines (45 loc) · 2.12 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
50
51
52
53
54
55
56
import matplotlib.pyplot as plt
import re
import os
out_dir = 'assets'
os.makedirs(out_dir, exist_ok=True)
plt.figure(figsize=(14, 10))
for i in range(257, 259):
log_file = f'logs/neon{i}_parity_log.txt'
if not os.path.exists(log_file):
continue
steps = []
val_losses = []
with open(log_file, 'r') as f:
for line in f:
if 'Val Loss' in line and 'FINAL' not in line:
match = re.search(r'Step (\d+):.*Val Loss ([\d\.]+)', line)
if match:
steps.append(int(match.group(1)))
val_losses.append(float(match.group(2)))
name = 'neon257 (Wide Conv Kernel=9 Static)' if i == 257 else 'neon258 (Wide Conv Progressive Dropout)'
plt.plot(steps, val_losses, label=name, linewidth=2)
# Also plot the best Phase 7 model (neon241) for comparison baseline
baseline_log = 'logs/neon241_parity_log.txt'
if os.path.exists(baseline_log):
b_steps, b_losses = [], []
with open(baseline_log, 'r') as f:
for line in f:
if 'Val Loss' in line and 'FINAL' not in line:
match = re.search(r'Step (\d+):.*Val Loss ([\d\.]+)', line)
if match:
b_steps.append(int(match.group(1)))
b_losses.append(float(match.group(2)))
plt.plot(b_steps, b_losses, label='neon241 (Phase 7 - Standard Conv Kernel=3)', color='black', linestyle='--', linewidth=2)
plt.xlabel('Training Steps')
plt.ylabel('Validation Loss')
plt.title('Validation Loss vs Steps (Phase 11: Wide Conv & Progressive Dropout, 5M Params, Wiki103)')
plt.legend(bbox_to_anchor=(1.01, 1), loc='upper left', fontsize='small')
plt.grid(True, linestyle='--', alpha=0.6)
# Stage lines for neon258
plt.axvline(x=3000, color='r', linestyle=':', label='Stage 2 Start (Progressive Fade-in)')
plt.axvline(x=7000, color='g', linestyle=':', label='Stage 3 Start (Full Conv)')
plt.tight_layout()
out_file = os.path.join(out_dir, 'phase11_wide_progressive_val_loss.png')
plt.savefig(out_file, dpi=150)
print(f"Chart saved to {out_file}")