Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 1,497 Bytes
5f0f535 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | """Diarization table: missing cells rank last; displayed numbers stay numeric."""
from diarization_config import CONDITION_KEYS, metric_column
from diarization_results import (
MODEL_COL,
PARAMS_COL,
RANK_COL,
RTF_COL,
build_table,
overall_col_name,
)
def _complete(model_id: str, der: float) -> dict:
row = {
"model_id": model_id,
"eval_family": "pyannote",
"eval_rtf": "10.55",
"num_params": "1234000000",
}
for key in CONDITION_KEYS:
row[metric_column("der", key)] = str(der)
row[metric_column("jer", key)] = str(der)
return row
def test_missing_cells_rank_last_and_numbers_are_rounded():
partial = {"model_id": "someone/partial-run", "eval_family": "nemo", "eval_rtf": "3"}
partial[metric_column("der", CONDITION_KEYS[0])] = "0.01"
frame = build_table(
[
partial,
_complete("good/model", 0.2),
_complete("best/model", 0.1),
]
)
models = list(frame[MODEL_COL])
assert "best/model" in models[0]
assert "good/model" in models[1]
assert "partial-run" in models[2]
assert list(frame[RANK_COL])[:2] == [1, 2]
assert frame[RANK_COL].isna().iloc[2]
der_col = overall_col_name("der")
assert frame[der_col].iloc[0] == 10.0
assert frame[RTF_COL].iloc[0] == 10.6
assert frame[PARAMS_COL].iloc[0] == 1.23
assert str(frame[der_col].dtype) == "Float64"
assert str(frame[RTF_COL].dtype) == "Float64"
|