apetersson/v41-quant-worker
0198
1import datetime, glob, json, os2 3out = '/workspace/v41-quant/q2-iq2-20260910'4plan = json.load(open(out + '/plan.json'))5shards = plan['shards']6total_q = sum(sum(t['out_bytes'] for t in s['tensors'] if t['role'] == 'quantised') for s in shards)7files = sorted(glob.glob(out + '/*.complete'), key=os.path.getmtime)8done = [os.path.basename(f).replace('.complete', '') for f in files]9q = sum(sum(t['out_bytes'] for t in s['tensors'] if t['role'] == 'quantised') for s in shards if s['output_shard'] in done)10m = [os.path.getmtime(f) for f in files]11recent = [m[j + 1] - m[j] for j in range(max(0, len(m) - 6), len(m) - 1)]12cad = sum(recent) / len(recent) if recent else 0.013now = datetime.datetime.now(datetime.timezone.utc)14eta_s = cad * (len(shards) - len(done))15abs_t = (now + datetime.timedelta(seconds=eta_s)).strftime('%H:%M')16size = sum(os.path.getsize(out + '/' + s['output_shard']) for s in shards if os.path.exists(out + '/' + s['output_shard']))17total_bytes = sum(s['data_bytes'] for s in shards)18print(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")20 