Fixes the failing test test_is_split_into_words in test_pipelines_token_classification.py (#39079)
Some checks failed
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Waiting to run
Build documentation / build (push) Waiting to run
Slow tests on important models (on Push - A10) / Get all modified files (push) Waiting to run
Slow tests on important models (on Push - A10) / Slow & FA2 tests (push) Blocked by required conditions
Self-hosted runner (push-caller) / Check if setup was changed (push) Waiting to run
Self-hosted runner (push-caller) / build-docker-containers (push) Blocked by required conditions
Self-hosted runner (push-caller) / Trigger Push CI (push) Blocked by required conditions
Secret Leaks / trufflehog (push) Waiting to run
Update Transformers metadata / build_and_package (push) Waiting to run
New model PR merged notification / Notify new model (push) Has been cancelled

* Fix test pipelines token classification for is_split_into_words

* Fix incorrect import format
This commit is contained in:
st81 2025-06-28 03:25:32 +09:00 committed by GitHub
parent 18143c76bf
commit a11f692895
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -328,8 +328,10 @@ class TokenClassificationPipelineTests(unittest.TestCase):
self.assertEqual(
nested_simplify(output),
[
{"entity_group": "PER", "score": ANY(float), "word": "Sarah", "start": 6, "end": 11},
{"entity_group": "LOC", "score": ANY(float), "word": "New York", "start": 21, "end": 29},
[
{"entity_group": "PER", "score": ANY(float), "word": "Sarah", "start": 6, "end": 11},
{"entity_group": "LOC", "score": ANY(float), "word": "New York", "start": 21, "end": 29},
]
],
)
@ -349,8 +351,8 @@ class TokenClassificationPipelineTests(unittest.TestCase):
{"entity_group": "LOC", "score": ANY(float), "word": "New York", "start": 21, "end": 29},
],
[
{"entity_group": "PER", "score": ANY(float), "word": "Wolfgang", "start": 12, "end": 20},
{"entity_group": "LOC", "score": ANY(float), "word": "Berlin", "start": 36, "end": 42},
{"entity_group": "PER", "score": ANY(float), "word": "Wolfgang", "start": 11, "end": 19},
{"entity_group": "LOC", "score": ANY(float), "word": "Berlin", "start": 34, "end": 40},
],
],
)