jaivial commited on
Commit
a413ecf
·
verified ·
1 Parent(s): 6f7a03c

Upload scripts/make_peer_compare.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/make_peer_compare.py +13 -0
scripts/make_peer_compare.py CHANGED
@@ -34,6 +34,12 @@ def parse(path):
34
  def med(x):
35
  x = sorted(x); return x[len(x)//2] if x else 0
36
 
 
 
 
 
 
 
37
  def main():
38
  a = parse(D / 'baseline_peer_pipeline.log') # v20
39
  b = parse(D / 'v21_peer21.log') # v21
@@ -53,6 +59,13 @@ def main():
53
  experts_per_layer=495616, peer_layers=3, pools='1 shared',
54
  ctrl_params=598145536, h_times_k=8),
55
  speedup=B/A if A else 0)
 
 
 
 
 
 
 
56
  (D / 'compare_metrics.json').write_text(json.dumps(M, indent=2))
57
  print(json.dumps(M, indent=2))
58
 
 
34
  def med(x):
35
  x = sorted(x); return x[len(x)//2] if x else 0
36
 
37
+ def ce_at(d, lo, hi):
38
+ """Mean valid CE over a token window - the only fair quality comparison when the
39
+ two runs stopped at different token counts."""
40
+ v = [c for t, c in zip(d['vtokens'], d['vce']) if lo <= t <= hi]
41
+ return sum(v)/len(v) if v else None
42
+
43
  def main():
44
  a = parse(D / 'baseline_peer_pipeline.log') # v20
45
  b = parse(D / 'v21_peer21.log') # v21
 
59
  experts_per_layer=495616, peer_layers=3, pools='1 shared',
60
  ctrl_params=598145536, h_times_k=8),
61
  speedup=B/A if A else 0)
62
+ # same-token quality: compare both runs over the window they BOTH covered
63
+ hi = min(max(a['vtokens'] or [0]), max(b['vtokens'] or [0]))
64
+ lo = 0.5 * hi
65
+ if hi > 0:
66
+ M['same_token_window'] = {'lo_tokens': lo, 'hi_tokens': hi,
67
+ 'v20_mean_valid_ce': ce_at(a, lo, hi),
68
+ 'v21_mean_valid_ce': ce_at(b, lo, hi)}
69
  (D / 'compare_metrics.json').write_text(json.dumps(M, indent=2))
70
  print(json.dumps(M, indent=2))
71