mirror of
https://github.com/p-e-w/heretic.git
synced 2026-10-15 15:10:08 -07:00
+14
-13
@@ -1327,6 +1327,15 @@ def run():
|
|||||||
else:
|
else:
|
||||||
table.add_column("Value", justify="right")
|
table.add_column("Value", justify="right")
|
||||||
|
|
||||||
|
def format_value(value: Any) -> str:
|
||||||
|
if isinstance(
|
||||||
|
value,
|
||||||
|
(float, np.floating),
|
||||||
|
):
|
||||||
|
return f"{value:.4f}"
|
||||||
|
else:
|
||||||
|
return f"{value}"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
first_benchmark = True
|
first_benchmark = True
|
||||||
|
|
||||||
@@ -1350,22 +1359,16 @@ def run():
|
|||||||
first_row = True
|
first_row = True
|
||||||
|
|
||||||
for metric, value in results.items():
|
for metric, value in results.items():
|
||||||
if metric != "alias":
|
# Skip non-metrics.
|
||||||
|
if metric in ["name", "alias", "sample_len"]:
|
||||||
|
continue
|
||||||
|
|
||||||
if first_row and not first_benchmark:
|
if first_row and not first_benchmark:
|
||||||
if benchmark_original_model:
|
if benchmark_original_model:
|
||||||
table.add_row("", "", "", "")
|
table.add_row("", "", "", "")
|
||||||
else:
|
else:
|
||||||
table.add_row("", "", "")
|
table.add_row("", "", "")
|
||||||
|
|
||||||
def format_value(value: Any) -> str:
|
|
||||||
if isinstance(
|
|
||||||
value,
|
|
||||||
(float, np.floating),
|
|
||||||
):
|
|
||||||
return f"{value:.4f}"
|
|
||||||
else:
|
|
||||||
return f"{value}"
|
|
||||||
|
|
||||||
cells = [
|
cells = [
|
||||||
benchmark.name if first_row else "",
|
benchmark.name if first_row else "",
|
||||||
metric,
|
metric,
|
||||||
@@ -1373,9 +1376,7 @@ def run():
|
|||||||
]
|
]
|
||||||
if benchmark_original_model:
|
if benchmark_original_model:
|
||||||
cells.append(
|
cells.append(
|
||||||
format_value(
|
format_value(original_results[metric])
|
||||||
original_results[metric]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
table.add_row(*cells)
|
table.add_row(*cells)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user