Skip to content

Relax transformers upper bound to <6.0.0 (fixes CVE-2026-1839)#3694

Open
denniszag wants to merge 2 commits intoflairNLP:masterfrom
denniszag:fix/relax-transformers-upper-bound
Open

Relax transformers upper bound to <6.0.0 (fixes CVE-2026-1839)#3694
denniszag wants to merge 2 commits intoflairNLP:masterfrom
denniszag:fix/relax-transformers-upper-bound

Conversation

@denniszag
Copy link
Copy Markdown

Summary

  • Relaxes transformers[sentencepiece] upper bound from <5.0.0 to <6.0.0 so downstream users can upgrade to transformers 5.x+ and resolve CVE-2026-1839 (unsafe torch.load() in Trainer._load_rng_state(), CVSS 6.5)
  • Replaces deprecated FeatureExtractor imports with ImageProcessor equivalents (AutoFeatureExtractorAutoImageProcessor, FeatureExtractionMixinImageProcessingMixin, LayoutLMv2FeatureExtractorLayoutLMv2ImageProcessor)
  • Removes obsolete pytest warning filters that referenced transformers v5 deprecation messages

Closes #3691

Files changed

  • requirements.txt — bump upper bound to <6.0.0
  • requirements-dev.txt — prefer transformers>=5.0.0
  • flair/embeddings/transformer.py — migrate deprecated imports
  • pyproject.toml — remove stale warning filters

Test plan

  • pytest flair passes (type checks + formatting)
  • pytest tests/ passes with transformers 5.x installed
  • Verify LayoutLMv2 embedding loading still works with LayoutLMv2ImageProcessor

…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
Copilot AI review requested due to automatic review settings April 8, 2026 11:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.0 to <6.0.0 (and update dev dependency preference).
  • Replace deprecated AutoFeatureExtractor/FeatureExtractionMixin/LayoutLMv2FeatureExtractor usage with AutoImageProcessor/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.
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.

Security: transformers 4.41.2 flagged by Veracode (6 High / 7 Medium) — please upgrade

2 participants