pypi transformers 5.4.0
Release v5.4.0: PaddlePaddle models 🙌, Mistral 4, PI0, VidEoMT, UVDoc, SLANeXt, Jina Embeddings v3

5 hours ago

New Model additions

VidEoMT

image

Video Encoder-only Mask Transformer (VidEoMT) is a lightweight encoder-only model for online video segmentation built on a plain Vision Transformer (ViT). It eliminates the need for dedicated tracking modules by introducing a lightweight query propagation mechanism that carries information across frames and employs a query fusion strategy that combines propagated queries with temporally-agnostic learned queries. VidEoMT achieves competitive accuracy while being 5x-10x faster than existing approaches, running at up to 160 FPS with a ViT-L backbone.

Links: Documentation | Paper

UVDoc

image

UVDoc is a machine learning model designed for document image rectification and correction. The main purpose of this model is to carry out geometric transformation on images to correct document distortion, inclination, perspective deformation and other problems in document images. It provides both single input and batched inference capabilities for processing distorted document images.

Links: Documentation

Jina Embeddings v3

image

The Jina-Embeddings-v3 is a multilingual, multi-task text embedding model designed for a variety of NLP applications. Based on the XLM-RoBERTa architecture, this model supports Rotary Position Embeddings (RoPE) replacing absolute position embeddings to support long input sequences up to 8192 tokens. Additionally, it features 5 built-in Task-Specific LoRA Adapters that allow the model to generate task-specific embeddings (e.g., for retrieval vs. classification) without increasing inference latency significantly.

Links: Documentation | Paper

Mistral4

image

Mistral 4 is a powerful hybrid model with the capability of acting as both a general instruction model and a reasoning model. It unifies the capabilities of three different model families - Instruct, Reasoning (previously called Magistral), and Devstral - into a single, unified model. The model features a MoE architecture with 128 experts and 4 active, 119B parameters with 6.5B activated per token, 256k context length, and supports multimodal input with both text and image processing capabilities.

Links: Documentation

PI0

PI0 is a vision-language-action model for robotics manipulation that jointly processes visual observations and language instructions to generate robot actions. It uses a novel flow matching architecture built on top of a pre-trained vision-language model to inherit Internet-scale semantic knowledge. The model can perform complex dexterous tasks like laundry folding, table cleaning, and assembling boxes across multiple robot platforms including single-arm robots, dual-arm robots, and mobile manipulators.

Links: Documentation | Paper

SLANeXt

SLANeXt is a series of dedicated lightweight models for table structure recognition, focusing on accurately recognizing table structures in documents and natural scenes. The SLANeXt series is a new generation of table structure recognition models independently developed by the Baidu PaddlePaddle Vision Team, with dedicated weights trained separately for wired and wireless tables. The recognition ability for all types of tables has been significantly improved, especially for wired tables.

Links: Documentation

PP-OCRv5_mobile_rec

PP-OCRv5_mobile_rec is a dedicated lightweight model for text recognition, focusing specifically on efficient recognition and understanding of text elements in multi-language documents and natural scenes. It is designed to efficiently and accurately support the recognition of Simplified Chinese, Traditional Chinese, English, Japanese, as well as complex text scenarios such as handwriting, vertical text, pinyin, and rare characters with a single model. While maintaining recognition performance, it also balances inference speed and model robustness, providing efficient and accurate technical support for document understanding in various scenarios.

Links: Documentation

PP-OCRv5_server_rec

PP-OCRv5_server_rec is a dedicated lightweight model for text recognition, focusing specifically on efficient recognition and understanding of text elements in multi-language documents and natural scenes. It is designed to efficiently and accurately support the recognition of Simplified Chinese, Traditional Chinese, English, Japanese, as well as complex text scenarios such as handwriting, vertical text, pinyin, and rare characters with a single model. While maintaining recognition performance, it also balances inference speed and model robustness, providing efficient and accurate technical support for document understanding in various scenarios.

Links: Documentation

PP-OCRv5_mobile_det

PP-OCRv5_mobile_det is a dedicated lightweight model for text detection, focusing specifically on efficient detection and understanding of text elements in multi-language documents and natural scenes. It is part of the latest generation of text detection models developed by the PaddleOCR team that efficiently and accurately supports the detection of text in diverse scenarios—including handwriting, vertical, rotated, and curved text—across multiple languages such as Simplified Chinese, Traditional Chinese, English, and Japanese. The model features robust handling of complex layouts, varying text sizes, and challenging backgrounds, making it suitable for practical applications like document analysis, license plate recognition, and scene text detection.

Links: Documentation

PPLCNet

PP-LCNet is a family of efficient, lightweight convolutional neural networks designed for real-world document understanding and OCR tasks. It balances accuracy, speed, and model size, making it ideal for both server-side and edge deployment. The model has three main variants optimized for specific tasks: document image orientation classification, table classification, and text line orientation classification.

Links: Documentation

PPLCNetV3

PPLCNetV3 is a lightweight CPU-optimized convolutional backbone designed for efficient image classification and downstream vision tasks. It builds on the PP-LCNet architecture with improved training strategies and structural refinements for better accuracy-latency tradeoffs on CPU hardware.

Links: Documentation | Paper

PP-OCRv5_server_det

PP-OCRv5_server_det is a high-performance text detection model optimized for server-side applications, focusing on accurate detection of multi-language text in documents and natural scenes. It supports the detection of text in diverse scenarios—including handwriting, vertical, rotated, and curved text—across multiple languages such as Simplified Chinese, Traditional Chinese, English, and Japanese. The model features robust handling of complex layouts, varying text sizes, and challenging backgrounds, making it suitable for practical applications like document analysis, license plate recognition, and scene text detection.

Links: Documentation

CHMv2

CHMv2 is a global, meter-resolution canopy height mapping model that uses DINOv3 to estimate forest canopy heights from high-resolution optical satellite imagery. Building on the original canopy height maps released in 2024, CHMv2 delivers substantial improvements in accuracy, detail, and global consistency by leveraging Meta's self-supervised vision model. The model is trained against airborne laser scanning data and provides essential information for quantifying forest carbon, monitoring restoration and degradation, and assessing habitat structure.

Links: Documentation | Paper | Blog Post

Breaking changes

The dual BaseImageProcessor/BaseImageProcessorFast design has been replaced with a unified backend architecture, and the image_processing_utils_fast module has been removed — users should migrate to the new unified image_processing_utils module.

  • 🚨🚨 Refactor Image Processors to support different backends (#43514) by @yonigozlan

PreTrainedConfig and model config classes have been refactored to use @dataclass and no longer accept positional arguments — users must update any config instantiation calls to use keyword arguments only.

Flash Attention 2 (FA2) support now requires version 2.3.3 or newer, and initial Flash Attention 4 (FA4) support has been added — users on older FA2 versions must upgrade to at least 2.3.3.

Weight tying behavior has changed so that weights are now tied even when both keys are already present in a checkpoint — users relying on the previous behavior (e.g., with .bin checkpoints containing duplicate keys) should verify their models load as expected.

  • [tie weights] 🚨 If both weights are present with same weights, still tie them (#44497) by @Cyrilvallez

The cache_position argument has been removed from the forward signatures of most major models — users passing cache_position directly to these models should remove it, as it is now handled internally by generate.

Parallelization

Several bug fixes and improvements were made to pipeline parallel (PP) and tensor parallel (TP) support, including fixing supports_tp/pp_plan detection, resolving attribute errors in PP for Qwen2VL-based models, correcting FSDP loading with meta devices, and ensuring TP weight sharding properly updates parent module attributes (e.g., in_features/out_features) to improve compatibility with libraries like PEFT.

Quantization

Quantization support was improved with up to 30x faster FP8 grouped and batched matmuls, static FP8 expert support for multi-GPU setups, and a torchao minimum version bump to 0.15.0. Additionally, MXFP4 dependency error messages were made more actionable, and AWQ tests were updated to align with the GPTQModel migration.

Tokenization

Several performance improvements were made to tokenizer loading and saving, including eliminating redundant file parsing and unnecessary deep copies of large vocabularies that caused significant overhead. Additionally, bug fixes were applied for incorrect tokenizer class names on the Hub (DeepSeek V2/V3, ModernBERT), a clean_up_tokenization_spaces misconfiguration in Llama 3 tokenizer conversion, and a string replacement issue in AutoTokenizer class name resolution.

  • fix: improve processor loading performance by avoiding redundant tokenizer parsing (#44927) by @ydshieh in [#44927]
  • fix processing_utils.py: avoid deepcopying tokenizer in ProcessorMixin to improve performance (#44894) by @ydshieh in [#44894]
  • fix: set clean_up_tokenization_spaces=False in Llama 3 tokenizer conversion (#44914) by @maxsloef-goodfire in [#44914]
  • deepseek_v2, deepseek_v3, and modernbert fix for having incorrect tokenizer class on the hub (#44801) by @itazap in [#44801]
  • Add XPU Expectations for vibe voice acoustic tokenizer tests (#44428) by @kaixuanliu in [#44428]
  • fix(tokenizer): Only strip Fast from class names in AutoTokenizer if used as a suffix (#44443) by @harshaljanjani in [#44443]

Kernels

Kernel support has been expanded with Flash Attention 4 fallback integration, a paged_attention kernel for continuous batching, and Neuron device support for custom kernels. Several stability fixes were also made, including bumping the kernels version dependency to prevent crashes and correcting the LFM2 kernel path.

Cache

Several cache-related fixes and improvements were made, including aligning LFM2's cache implementation with other Mamba caches, fixing a tensor indexing crash in KV cache continuation for the transformers serve streaming endpoint, and resolving a generation bug in Idefics3 when using use_cache=False. A caching layer was also added to the model linter to skip unchanged valid files and improve build performance.

Vision

Fixed backward compatibility for full-path imports of Fast Image Processors and resolved a Llama4 vision rotary embedding initialization error where freqs_ci was not registered as a buffer, causing failures when loading models with device_map="auto".

Generation

The cache_position argument has been fully removed from the generation pipeline, as all models have been updated to no longer use it (with a backward-compatibility path retained for remote code models). Additionally, integration tests for LASR with chunked decoding were added, and outdated references to deprecated pipeline tasks were cleaned up.

  • [generate] Never use cache_position anymore in generation (#44816) by @Cyrilvallez in [#44816]
  • Add an integration test for LASR using pipe and chunked decoding (#42823) by @kho in [#42823]
  • Fix: Remove references to text2text-generation, summarization and translation pipeline tasks (#44510) by @math-hiyoko in [#44510]

Bugfixes and improvements

Significant community contributions

The following contributors have made significant changes to the library over the last release:

  • @ydshieh
    • Don't run tests_hub if no tests found (#45014)
    • Fix failing job Update Transformers metadata after #43514 (#44941)
    • fix: improve processor loading performance by avoiding redundant tokenizer parsing (#44927)
    • fix processing_utils.py: avoid deepcopying tokenizer in ProcessorMixin to improve performance (#44894)
    • Fix core dumped when NemotronH is torch compiled (#44854)
    • Fix repo-check bot (#44812)
    • Fix config loading issues (type issues) (#44789)
    • Remove is_causal from EuroBertConfig (#44774)
    • Fix mlcd auto config/model/mapping issues (#44730)
    • Fix missing / incorrect config class in some model class definitions (#44715)
    • Update Nvidia CI docker file to use torch 2.10 (#44712)
    • Fix more model tester missing parent issue (#44685)
    • Another (small) set of fixes required for tiny model creation (#44666)
    • Fix for VibeVoiceAcousticTokenizer (#44628)
    • Fix more wrong HF hub checkpoint names (#44624)
    • Fix wrong (non-existing) checkpoints (#44549)
    • Fix CircleCI summary report not showing due to missing dependency (#44597)
    • Fix PR comment CI for quantization job (#44579)
    • Revert "test merge queue 1" (#44552)
    • Add a new job in build_pr_documentation.yml (will be the new required job) (#44538)
    • Update build_pr_documentation workflow for merge_group event (#44532)
    • Add diffusers to CI docker file (#44480)
  • @NielsRogge
  • @tarekziade
    • refactor: unify QA calls (#44879)
    • refactor: mlinter as its own package (#44939)
    • chore(typing): added rule 11 (#44865)
    • feat: added cache to the model linter (#44790)
    • feat(ci): added a network debug report (#44636)
    • Centralize AI agent templates in .ai (#44489)
    • model-linter: Added rule 10 (#44761)
    • Fix: Eurobert model was missing @strict decorator and invalid test kwargs (#44767)
    • fix: sig lip import (#44764)
    • Expand model-structure lint rules with a fast AST-based, ruff-like framework (#44174)
    • chore(typing): Add type checking to src/transformers/quantizers (#44412)
    • Fix: AQLM quantizer to match updated replace_with_aqlm_linear signature (#44577)
    • Follow-up typing checking fixes (#44500)
    • Update ty to 0.0.20 (#44494)
  • @Sai-Suraj-27
    • Fix failing T5ModelIntegrationTest (#44934)
    • Add Jina-Embeddings-V3 Model (#44251)
    • Fix failing MusicgenStereo integration tests (#44527)
    • Fix failing GPTNeoModelLanguageGenerationTest (#44515)
    • Fix failing MarianIntegrationTests (#44519)
    • Fix failing DepthProModelIntegrationTest (#44456)
    • Fix failing ProphetNetModelIntegrationTest (#44439)
  • @remi-or
    • [CB] [Minor] Simplify test suite (#44858)
    • [CB] Add an option to return logprobs (#44835)
    • [CB] Better parametrization for compile (#44578)
    • [CB] [Bug] Fix crashes when running without cuda (#44673)
    • [CB] Add dedicated config (#44434)
    • [CB] Add paged_attention kernel (#44379)
  • @XingweiDeng
    • [Model] Add UVDoc Model Support (#43385)
    • [Model] Add PP-Chart2Table Model Support (#43767)
    • [Model] Add PP-OCRV5_mobile_det Model Support (#43247)
    • [Model] Add PP-OCRV5_server_det Model Support (#43274)
  • @vasqu
    • [FA4] Add kernels fallback (#44797)
    • [FA] Fix fa detection (#44703)
    • 🚨 [FA4] Initial support (#42435)
    • [Chmv2] Fix conversion after capture refactor (#44665)
    • Add Yoni to run-slow workflow (#44598)
  • @liu-jiaxuan
    • [Model] Add SLANeXt Model Support (#43707)
  • @zhang-prog
    • [Model] Add PP-OCRv5_server_rec and PP-OCRv5_mobile_rec models Support (#44808)
  • @balak4
    • Add GreedyLR adaptive learning rate scheduler (#44271)
  • @kaixuanliu
    • fix bug embedding_size mismatch with hidden_size in electra model test (#44657)
    • Fix bug and add XPU Expectations for qwen2 and jamba tests (#44733)
    • Add XPU Expectations for vibe voice acoustic tokenizer tests (#44428)
    • add XPU Expectations for higgs_audio_v2 tests (#44482)
    • fix model parallelism bug for eurobert model (#44490)
    • Fix failed unit tests for moonshine_streaming model (#43936)
    • skip 1 invalid test case for higgs_audio_v2 (#44350)
  • @juliendenize
    • Add Mistral 4 (#44760)
    • [MistralCommonBackend] Upgrade mistral-common to v1.10.0 (#44656)
  • @molbap
    • Add model lerobot PI0 to transformers (#44160)
    • Remove many output_attentions and other traced outputs on 100+ models (#43590)
  • @JJJYmmm
    • [Bugfix] fix video inference of qwen3vl and qwen3.5 series (#44474)
  • @math-hiyoko
    • Fix: Remove references to text2text-generation, summarization and translation pipeline tasks (#44510)
    • Fix: Remove references to transformers run command (#44513)

Don't miss a new transformers release

NewReleases is sending notifications on new releases.