Update eval.py
Browse files
eval.py
CHANGED
@@ -13,7 +13,8 @@ def log_results(result: Dataset, args: Dict[str, str]):
|
|
13 |
"""DO NOT CHANGE. This function computes and logs the result metrics."""
|
14 |
|
15 |
log_outputs = args.log_outputs
|
16 |
-
|
|
|
17 |
|
18 |
# load metric
|
19 |
wer = load_metric("wer")
|
@@ -24,7 +25,7 @@ def log_results(result: Dataset, args: Dict[str, str]):
|
|
24 |
cer_result = cer.compute(references=result["target"], predictions=result["prediction"])
|
25 |
|
26 |
# print & log results
|
27 |
-
result_str = f"
|
28 |
print(result_str)
|
29 |
|
30 |
with open(f"{dataset_id}_eval_results.txt", "w") as f:
|
|
|
13 |
"""DO NOT CHANGE. This function computes and logs the result metrics."""
|
14 |
|
15 |
log_outputs = args.log_outputs
|
16 |
+
model_id = args.model_id.replace("/", "_").replace(".", "")
|
17 |
+
dataset_id = "_".join(args.dataset.split("/") + [model_id, args.config, args.split])
|
18 |
|
19 |
# load metric
|
20 |
wer = load_metric("wer")
|
|
|
25 |
cer_result = cer.compute(references=result["target"], predictions=result["prediction"])
|
26 |
|
27 |
# print & log results
|
28 |
+
result_str = f"{dataset_id}\nWER: {wer_result}\nCER: {cer_result}"
|
29 |
print(result_str)
|
30 |
|
31 |
with open(f"{dataset_id}_eval_results.txt", "w") as f:
|