Skip to content

Fix text2text generation_kwargs leaking across compute calls - #796

Open
tonycoder-hub wants to merge 1 commit into
huggingface:mainfrom
tonycoder-hub:cursor/fix-text2text-generation-kwargs-leak-73d7
Open

Fix text2text generation_kwargs leaking across compute calls#796
tonycoder-hub wants to merge 1 commit into
huggingface:mainfrom
tonycoder-hub:cursor/fix-text2text-generation-kwargs-leak-73d7

Conversation

@tonycoder-hub

Copy link
Copy Markdown

Description

Text2TextGenerationEvaluator.compute() did self.PIPELINE_KWARGS.update(generation_kwargs). PIPELINE_KWARGS is a class attribute, so kwargs from one compute() leaked into later calls, including on a freshly constructed evaluator. SummarizationEvaluator and TranslationEvaluator inherit the same leak.

Build a per-call dict from the class defaults instead of mutating them.

Distinct from #794/#795. Not the same as #775 (task validation) or #754 (proposal to delete these evaluators).

Tests

python -m pytest tests/test_evaluator.py -k Text2Text -v → 7 passed, 1 skipped (new test failed on main).
python -m pytest tests/test_evaluator.py → 43 passed, 14 skipped.

Text2TextGenerationEvaluator.compute() updated the class attribute
PIPELINE_KWARGS in place, so generation_kwargs passed to one call kept
being forwarded to the pipeline on every later call and on every other
instance of the evaluator.

Co-authored-by: Tony Coder <407243179@qq.com>
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.

2 participants