Skip to content

fix: treat sentiment-analysis and text-classification as the same evaluator task - #798

Open
tonycoder-hub wants to merge 1 commit into
huggingface:mainfrom
tonycoder-hub:cursor/fix-evaluator-task-alias-mismatch-368c
Open

fix: treat sentiment-analysis and text-classification as the same evaluator task#798
tonycoder-hub wants to merge 1 commit into
huggingface:mainfrom
tonycoder-hub:cursor/fix-evaluator-task-alias-mismatch-368c

Conversation

@tonycoder-hub

Copy link
Copy Markdown

transformers treats sentiment-analysis as an alias of text-classification (and ner of token-classification). evaluate documents evaluator("sentiment-analysis") as supported, but prepare_pipeline compared the raw task strings, so a text-classification pipeline passed to evaluator("sentiment-analysis") raised ValueError.

Both sides are now resolved through transformers TASK_ALIASES before comparing.

Tests: python3 -m pytest tests/test_evaluator.py::TestTextClassificationEvaluator -q — 8 passed, 2 skipped. Distinct from #790-#797.

`evaluator("sentiment-analysis")` rejected a `text-classification` pipeline (and
vice versa) because `prepare_pipeline` compared the raw task strings, even though
`sentiment-analysis` is a documented alias of `text-classification`. Resolve both
task names through `transformers`' `TASK_ALIASES` before comparing them.

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