Relax transformers upper bound to <6.0.0 (fixes CVE-2026-1839)#3694
Open
denniszag wants to merge 2 commits intoflairNLP:masterfrom
Open
Relax transformers upper bound to <6.0.0 (fixes CVE-2026-1839)#3694denniszag wants to merge 2 commits intoflairNLP:masterfrom
denniszag wants to merge 2 commits intoflairNLP:masterfrom
Conversation
…2026-1839) - Bump transformers constraint from <5.0.0 to <6.0.0 in requirements.txt - Update requirements-dev.txt to prefer transformers>=5.0.0 - Replace deprecated FeatureExtractor imports with ImageProcessor equivalents (AutoFeatureExtractor -> AutoImageProcessor, FeatureExtractionMixin -> ImageProcessingMixin, LayoutLMv2FeatureExtractor -> LayoutLMv2ImageProcessor) - Remove obsolete pytest warning filters for transformers v5 deprecations
There was a problem hiding this comment.
Pull request overview
This PR updates Flair’s Hugging Face Transformers integration to allow upgrading to transformers 5.x (addressing CVE-2026-1839) by relaxing the dependency upper bound and migrating away from deprecated FeatureExtractor APIs, while also removing now-obsolete pytest warning filters.
Changes:
- Relax
transformers[sentencepiece]upper bound from<5.0.0to<6.0.0(and update dev dependency preference). - Replace deprecated
AutoFeatureExtractor/FeatureExtractionMixin/LayoutLMv2FeatureExtractorusage withAutoImageProcessor/ImageProcessingMixin/LayoutLMv2ImageProcessor. - Remove pytest warning filters that referenced transformers v5 deprecation messages.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| requirements.txt | Relaxes transformers upper bound to allow 5.x releases. |
| requirements-dev.txt | Pins dev installs to transformers 5.x+. |
| flair/embeddings/transformer.py | Migrates deprecated transformers feature-extractor imports/typing to image-processor equivalents. |
| pyproject.toml | Removes warning filters that are no longer relevant after the transformers migration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove redundant !=4.40.x exclusions (unreachable with >=5.0.0) and add <6.0.0 cap to match requirements.txt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
transformers[sentencepiece]upper bound from<5.0.0to<6.0.0so downstream users can upgrade to transformers 5.x+ and resolve CVE-2026-1839 (unsafetorch.load()inTrainer._load_rng_state(), CVSS 6.5)FeatureExtractorimports withImageProcessorequivalents (AutoFeatureExtractor→AutoImageProcessor,FeatureExtractionMixin→ImageProcessingMixin,LayoutLMv2FeatureExtractor→LayoutLMv2ImageProcessor)Closes #3691
Files changed
requirements.txt— bump upper bound to<6.0.0requirements-dev.txt— prefertransformers>=5.0.0flair/embeddings/transformer.py— migrate deprecated importspyproject.toml— remove stale warning filtersTest plan
pytest flairpasses (type checks + formatting)pytest tests/passes with transformers 5.x installedLayoutLMv2ImageProcessor