bielik-q2-sharp-docs / variant_a /scripts /print_results.py
Jakubrd4's picture
Upload variant_a/scripts/print_results.py with huggingface_hub
1a09fb2 verified
#!/usr/bin/env python3
"""Print results summary from eval JSON."""
import json, sys
path = sys.argv[1] if len(sys.argv) > 1 else '/dev/shm/eval/results_a/full_results.json'
with open(path) as f:
data = json.load(f)
if 'results' not in data:
print("No results found!")
sys.exit(1)
scores = []
for task, metrics in sorted(data['results'].items()):
found = False
for key in ['acc_norm', 'acc', 'f1', 'exact_match']:
# Try both plain key and key,none suffix
for k in [key, f'{key},none']:
if k in metrics:
val = metrics[k]
if isinstance(val, (int, float)):
print(f" {task}: {key} = {val:.4f} ({val*100:.2f}%)")
scores.append(val)
found = True
break
if found:
break
if not found:
# Print whatever numeric metrics exist
for k, v in metrics.items():
if isinstance(v, (int, float)) and not k.startswith('alias'):
print(f" {task}: {k} = {v:.4f}")
if scores:
avg = sum(scores) / len(scores)
print(f"\n Average: {avg:.4f} ({avg*100:.2f}%)")
print(f" Baseline (IQ2_XXS): 61.34%")
print(f" FP16 Instruct: 65.71%")
if avg * 100 > 61.34:
print(f" >>> BEATS BASELINE by {avg*100 - 61.34:.2f}pp <<<")
else:
print(f" >>> Below baseline by {61.34 - avg*100:.2f}pp <<<")