apetersson commited on
Commit
4fcf06b
·
verified ·
1 Parent(s): dc11375

v41 quant: progress reporter

Browse files
Files changed (1) hide show
  1. progress.py +19 -0
progress.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datetime, glob, json, os
2
+
3
+ out = '/workspace/v41-quant/q2-iq2-20260910'
4
+ plan = json.load(open(out + '/plan.json'))
5
+ shards = plan['shards']
6
+ total_q = sum(sum(t['out_bytes'] for t in s['tensors'] if t['role'] == 'quantised') for s in shards)
7
+ files = sorted(glob.glob(out + '/*.complete'), key=os.path.getmtime)
8
+ done = [os.path.basename(f).replace('.complete', '') for f in files]
9
+ q = sum(sum(t['out_bytes'] for t in s['tensors'] if t['role'] == 'quantised') for s in shards if s['output_shard'] in done)
10
+ m = [os.path.getmtime(f) for f in files]
11
+ recent = [m[j + 1] - m[j] for j in range(max(0, len(m) - 6), len(m) - 1)]
12
+ cad = sum(recent) / len(recent) if recent else 0.0
13
+ now = datetime.datetime.now(datetime.timezone.utc)
14
+ eta_s = cad * (len(shards) - len(done))
15
+ abs_t = (now + datetime.timedelta(seconds=eta_s)).strftime('%H:%M')
16
+ size = sum(os.path.getsize(out + '/' + s['output_shard']) for s in shards if os.path.exists(out + '/' + s['output_shard']))
17
+ total_bytes = sum(s['data_bytes'] for s in shards)
18
+ print(f"{now.strftime('%H:%M:%S')}Z shards {len(done)}/{len(shards)} {q / total_q * 100:.1f}% of quantised bytes "
19
+ f"{size / 1e9:.1f}/{total_bytes / 1e9:.1f} GB cadence {cad:.0f}s/shard ETA {eta_s / 60:.0f} min -> ~{abs_t}Z")