From 9c68e78bc6cf58afb6e15c69c87ac733eba2528c Mon Sep 17 00:00:00 2001 From: Dinghao Zhou Date: Tue, 28 May 2024 12:54:37 +0800 Subject: [PATCH] fix th_accuracy when th_accuracy is misssing (#2541) --- wenet/utils/executor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wenet/utils/executor.py b/wenet/utils/executor.py index 45f2739e2..999a23e17 100644 --- a/wenet/utils/executor.py +++ b/wenet/utils/executor.py @@ -140,7 +140,7 @@ def cv(self, model, cv_data_loader, configs): num_seen_utts += num_utts total_acc.append(_dict['th_accuracy'].item( - ) if _dict['th_accuracy'] is not None else 0.0) + ) if _dict.get('th_accuracy', None) is not None else 0.0) for loss_name, loss_value in _dict.items(): if loss_value is not None and "loss" in loss_name \ and torch.isfinite(loss_value):