File size: 416 Bytes
c0a2ac4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from pathlib import Path
import json


def save_benchmark(report: dict, model_name: str):
    """
    Save benchmark report as benchmark.json.
    """

    outdir = Path("outputs") / model_name.replace("/", "_")
    outdir.mkdir(parents=True, exist_ok=True)

    outfile = outdir / "benchmark.json"

    with open(outfile, "w", encoding="utf-8") as f:
        json.dump(report, f, indent=2)

    return str(outfile)