Upload variant_a/scripts/print_results.py with huggingface_hub
Browse files
variant_a/scripts/print_results.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Print results summary from eval JSON."""
|
| 3 |
+
import json, sys
|
| 4 |
+
|
| 5 |
+
path = sys.argv[1] if len(sys.argv) > 1 else '/dev/shm/eval/results_a/full_results.json'
|
| 6 |
+
with open(path) as f:
|
| 7 |
+
data = json.load(f)
|
| 8 |
+
|
| 9 |
+
if 'results' not in data:
|
| 10 |
+
print("No results found!")
|
| 11 |
+
sys.exit(1)
|
| 12 |
+
|
| 13 |
+
scores = []
|
| 14 |
+
for task, metrics in sorted(data['results'].items()):
|
| 15 |
+
found = False
|
| 16 |
+
for key in ['acc_norm', 'acc', 'f1', 'exact_match']:
|
| 17 |
+
# Try both plain key and key,none suffix
|
| 18 |
+
for k in [key, f'{key},none']:
|
| 19 |
+
if k in metrics:
|
| 20 |
+
val = metrics[k]
|
| 21 |
+
if isinstance(val, (int, float)):
|
| 22 |
+
print(f" {task}: {key} = {val:.4f} ({val*100:.2f}%)")
|
| 23 |
+
scores.append(val)
|
| 24 |
+
found = True
|
| 25 |
+
break
|
| 26 |
+
if found:
|
| 27 |
+
break
|
| 28 |
+
if not found:
|
| 29 |
+
# Print whatever numeric metrics exist
|
| 30 |
+
for k, v in metrics.items():
|
| 31 |
+
if isinstance(v, (int, float)) and not k.startswith('alias'):
|
| 32 |
+
print(f" {task}: {k} = {v:.4f}")
|
| 33 |
+
|
| 34 |
+
if scores:
|
| 35 |
+
avg = sum(scores) / len(scores)
|
| 36 |
+
print(f"\n Average: {avg:.4f} ({avg*100:.2f}%)")
|
| 37 |
+
print(f" Baseline (IQ2_XXS): 61.34%")
|
| 38 |
+
print(f" FP16 Instruct: 65.71%")
|
| 39 |
+
if avg * 100 > 61.34:
|
| 40 |
+
print(f" >>> BEATS BASELINE by {avg*100 - 61.34:.2f}pp <<<")
|
| 41 |
+
else:
|
| 42 |
+
print(f" >>> Below baseline by {61.34 - avg*100:.2f}pp <<<")
|