From 6f253a65fb9ead101621b1c855d8bb74edc2b865 Mon Sep 17 00:00:00 2001 From: Rushikesh Ajest Date: Wed, 31 Dec 2025 14:36:16 +0530 Subject: [PATCH 1/2] Add input validation for predictions and references in accuracy metric --- metrics/accuracy/accuracy.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/metrics/accuracy/accuracy.py b/metrics/accuracy/accuracy.py index aa5a07328..98d0cbe14 100644 --- a/metrics/accuracy/accuracy.py +++ b/metrics/accuracy/accuracy.py @@ -99,6 +99,15 @@ def _info(self): ) def _compute(self, predictions, references, normalize=True, sample_weight=None): + if len(predictions) != len(references): + raise ValueError( + f"Predictions and references must have the same length, " + f"got {len(predictions)} and {len(references)}." + ) + + if len(predictions) == 0: + raise ValueError("Predictions and references must not be empty.") + return { "accuracy": float( accuracy_score(references, predictions, normalize=normalize, sample_weight=sample_weight) From 7881fd12b0040aa1c41822a82524ce7afe816506 Mon Sep 17 00:00:00 2001 From: Rushikesh Ajest Date: Thu, 1 Jan 2026 14:37:46 +0530 Subject: [PATCH 2/2] Fix meteor metric loading by adding missing __init__.py --- metrics/meteor/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 metrics/meteor/__init__.py diff --git a/metrics/meteor/__init__.py b/metrics/meteor/__init__.py new file mode 100644 index 000000000..e69de29bb