Skip to content

fix(metrics): handle period-only text in ROUGE evaluation - #10089

Open
Excelius-Wang wants to merge 1 commit into
modelscope:mainfrom
Excelius-Wang:fix/rouge-period-only-output
Open

fix(metrics): handle period-only text in ROUGE evaluation#10089
Excelius-Wang wants to merge 1 commit into
modelscope:mainfrom
Excelius-Wang:fix/rouge-period-only-output

Conversation

@Excelius-Wang

Copy link
Copy Markdown
Contributor

NLG evaluation can abort when a generated response contains only periods. Such responses pass the existing nonempty-token check, but rouge removes periods as sentence delimiters and raises ValueError: Hypothesis is empty. A period-only reference can similarly raise Reference is empty.

Give ROUGE metrics a zero contribution when either joined token sequence consists only of periods. Keep these samples in the existing MeanMetric averages and preserve the original tokens for BLEU. Ordinary text still uses the existing Rouge implementation.

Validation: eight CPU regression tests pass, including mixed-batch weighting, period-only references, BLEU preservation, existing whitespace/period behavior and unrelated-error propagation. A separate probe with real jieba/rouge/nltk also verifies the serialized NlgMetrics entry point and reproduces the upstream failures. An additional 307-pair public-text compatibility check preserves 304 existing results and fixes failures on three original SQuAD period annotations. These are text/annotation comparisons, not model-generated benchmark predictions. Applicable pre-commit hooks pass. No full model training run was performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant