ITADN
huggingface/transformers

版本发布 8

Release v5.4.0: PaddlePaddle models 🙌, Mistral 4, PI0, VidEoMT, UVDoc, SLANeXt, Jina Embeddings v3v5.4.0
? · 2026-03-27

## New Model additions ### VidEoMT <img width="1480" height="460" alt="image" src="https://github.com/user-attachments/assets/bec6fc25-b0ab-4227-8c2b-a838554f37f3" /> 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](https://huggingface.co/docs/transformers/main/en/model_doc/videomt) | [Paper](https://huggingface.co/papers/2602.17807) * Add VidEoMT (#44285) by @NielsRogge in [#44285](https://github.com/huggingface/transformers/pull/44285) ### UVDoc <img width="1765" height="875" alt="image" src="https://github.com/user-attachments/assets/365e510e-8fb8-46cb-8f4b-e8b7082f0ae2" /> 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](https://huggingface.co/docs/transformers/main/en/model_doc/uvdoc) * [Model] Add UVDoc Model Support (#43385) by @XingweiDeng in [#43385](https://github.com/huggingface/transformers/pull/43385) ### Jina Embeddings v3 <img width="595" height="513" alt="image" src="https://github.com/user-attachments/assets/2aee0692-8286-4c6b-98db-847b95ab2d40" /> 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](https://huggingface.co/docs/transformers/main/en/model_doc/jina_embeddings_v3) | [Paper](https://huggingface.co/papers/2409.10173) * Add `Jina-Embeddings-V3` Model (#44251) by @Sai-Suraj-27 in [#44251](https://github.com/huggingface/transformers/pull/44251) ### Mistral4 <img width="2429" height="1787" alt="image" src="https://github.com/user-attachments/assets/a6feb0da-8504-4eab-be65-22d6c676336f" /> 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](https://huggingface.co/docs/transformers/main/en/model_doc/mistral4) * Add Mistral 4 (#44760) by @juliendenize in [#44760](https://github.com/huggingface/transformers/pull/44760) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/pi0) | [Paper](https://huggingface.co/papers/2410.24164) * Add model lerobot PI0 to transformers (#44160) by @molbap in [#44160](https://github.com/huggingface/transformers/pull/44160) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/slanext) * [Model] Add SLANeXt Model Support (#43707) by @liu-jiaxuan in [#43707](https://github.com/huggingface/transformers/pull/43707) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/pp_ocrv5_mobile_rec) * [Model] Add PP-OCRv5_server_rec and PP-OCRv5_mobile_rec models Support (#44808) by @zhang-prog in [#44808](https://github.com/huggingface/transformers/pull/44808) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/pp_ocrv5_server_rec) * [Model] Add PP-OCRv5_server_rec and PP-OCRv5_mobile_rec models Support (#44808) by @zhang-prog in [#44808](https://github.com/huggingface/transformers/pull/44808) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/pp_ocrv5_mobile_det) * [Model] Add PP-OCRV5_mobile_det Model Support (#43247) by @XingweiDeng in [#43247](https://github.com/huggingface/transformers/pull/43247) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/pp_lcnet) * [Model] Add PP-OCRV5_mobile_det Model Support (#43247) by @XingweiDeng in [#43247](https://github.com/huggingface/transformers/pull/43247) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/pp_lcnet_v3) | [Paper](https://huggingface.co/papers/2109.15099) * [Model] Add PP-OCRV5_mobile_det Model Support (#43247) by @XingweiDeng in [#43247](https://github.com/huggingface/transformers/pull/43247) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/pp_ocrv5_server_det) * [Model] Add PP-OCRV5_server_det Model Support (#43274) by @XingweiDeng in [#43274](https://github.com/huggingface/transformers/pull/43274) ### 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](https://huggingface.co/docs/transformers/main/en/model_doc/chmv2) | [Paper](https://huggingface.co/papers/2603.06382) | [Blog Post](http://ai.meta.com/blog/world-resources-institute-dino-canopy-height-maps-v2) * Add CHMv2 (#44595) by @yonigozlan in [#44595](https://github.com/huggingface/transformers/pull/44595) ## 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. * :rotating_light: Validate config attributes (#41250) by @zucchini-nlp 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. * :rotating_light: [`FA4`] Initial support (#42435) by @vasqu 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`. * [core] 🚨 Completely remove cache positions (#44181) by @Cyrilvallez ## 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. * Fix several based models' pipeline parallel support (#44699) by @hmellor in [#44699] * [Model] Add PP-Chart2Table Model Support (#43767) by @XingweiDeng in [#43767] * enable tp for benchmark (#43750) by @sywangyi in [#43750] * Fix `supports_{tp/pp}_plan` (#44696) by @hmellor in [#44696] * Allow to disable stdout hiding for TP (#44608) by @michaelbenayoun in [#44608] * fix FSDP loading with meta devices (#44473) by @winglian in [#44473] * Fix: Conditionally import `torch.distributed.fsdp` in `trainer_seq2seq.py` (#44507) by @0xDELUXA in [#44507] * Supplement skip logic for XPU in the CPU-only tp tests (#44536) by @YangKai0616 in [#44536] * Update parent module attributes when sharding with TP (#44421) by @michaelbenayoun in [#44421] * trigger tensor parallel utils test in the CI (#44460) by @3outeille in [#44460] ## 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. * fix: split MXFP4 dependency checks for specific error messages (#44930) by @javierdejesusda in [#44930] * Add static FP8 expert support (#44895) by @SunMarc in [#44895] * Bump torchao >=0.15 and fix quantization CI (#44604) by @SunMarc in [#44604] * Fix AWQ tests for GPTQModel migration (#44654) by @jiqing-feng in [#44654] * [Performance] FP8 Grouped and Batched Matmuls (#44231) by @IlyasMoutawwakil in [#44231] * Fix PR comment CI for quantization job (#44579) by @ydshieh in [#44579] ## 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. * [`FA4`] Add kernels fallback (#44797) by @vasqu in [#44797] * Bump kernels version dependency to avoid crashes (#44887) by @Cyrilvallez in [#44887] * Fix lfm2 kernel path (#44634) by @Cyrilvallez in [#44634] * [CB] Add paged_attention kernel (#44379) by @remi-or in [#44379] * Neuron kernels integration (#44417) by @michaelbenayoun in [#44417] ## 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. * Align lfm2 cache to other mamba caches (#44866) by @Cyrilvallez in [#44866] * feat: added cache to the model linter (#44790) by @tarekziade in [#44790] * Fix tensor indexing crash in serve generate_response KV cache continuation (#44735) by @mango766 in [#44735] * Idefics3 without cache fix (#44607) by @gabe-l-hart in [#44607] ## 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"`. * Fix backward compatibility for full path imports of Fast Image Processors (#44926) by @yonigozlan in [#44926] * fix(models, testing): Fix Llama4 vision rotary meta tensor initialization and MyT5 get_tokenizer signature (#44581) by @harshaljanjani in [#44581] * Fix AMD Docker image build timeout by pinning Flash Attention commit (#44546) by @Abdennacer-Badaoui in [#44546] ## 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 * Dynamic weight conversion is recursive (#44300) by @zucchini-nlp in [#44300] * Don't run `tests_hub` if no tests found (#45014) by @ydshieh in [#45014] * Fix type hint for `attention_chunk_size` in `Llama4TextConfig` (#45002) by @hmellor in [#45002] * Fix AutoProcessor.from_pretrained silently dropping hub kwargs (#44710) by @he-yufeng in [#44710] * Fix `maybe_autocast` crashing on meta device tensors (#44984) by @Butanium in [#44984] * fix: remove Copied from comments between @torch.jit.script and def for Python 3.13 compat (#44986) by @Krishnachaitanyakc in [#44986] * More small vllm fixes (#44990) by @ArthurZucker in [#44990] * fix(models): Fix Perceiver interpolate_pos_encoding interpolating to the source size (#44899) by @harshaljanjani in [#44899] * Allow `mm_token_type` be non-padded lists (#44563) by @zucchini-nlp in [#44563] * Fix CPU 16 bytes alignment issue using equivalent fallback (#44970) by @IlyasMoutawwakil in [#44970] * refactor: unify QA calls (#44879) by @tarekziade in [#44879] * Fix tie_word_embedding issues with `Qwen2VL` (#44976) by @hmellor in [#44976] * Support Modular (!!) + Configs in `check_auto_docstrings` (#44803) by @yonigozlan in [#44803] * [ `vllm x v5`] nit (#44971) by @ArthurZucker in [#44971] * LwDetrImageLoss: Fix dtype casting to prevent crash when using amp on cuda device (#44886) by @m-matthias in [#44886] * [AMD CI] Gemma3/Gemma3n Expectations (#44972) by @Abdennacer-Badaoui in [#44972] * Officially launch parse_response (#44674) by @Rocketknight1 in [#44674] * fix load_best_model_checkpoint_at_end do not load the best model chec… (#44583) by @wilnn in [#44583] * Fix failing `T5ModelIntegrationTest` (#44934) by @Sai-Suraj-27 in [#44934] * Config kwargs (#44953) by @zucchini-nlp in [#44953] * [CB] [Minor] Simplify test suite (#44858) by @remi-or in [#44858] * Allow arbitrary template kwargs in processors (#44881) by @zucchini-nlp in [#44881] * Fix missing post_processor in DebertaV2Tokenizer causing no special t… (#44570) by @umbilnm in [#44570] * incorrect model list update (#44880) by @itazap in [#44880] * refactor: mlinter as its own package (#44939) by @tarekziade in [#44939] * [CB] Add an option to return logprobs (#44835) by @remi-or in [#44835] * [docs] peft (#44804) by @stevhliu in [#44804] * Continuous batching thread safety (#44924) by @Qubitium in [#44924] * Fix variable shadowing in pipeline example and typo in BART docs (BERT → BART) (#44935) by @VanshikaSohal in [#44935] * Fix failing job `Update Transformers metadata` after #43514 (#44941) by @ydshieh in [#44941] * Clearer type hints and fix rope validation in configs (#44943) by @zucchini-nlp in [#44943] * Correct docstrings for `from_pretrained` (url input deprecated) (#44946) by @BSchilperoort in [#44946] * fix(i18n): replace broken relative links to awesome-transformers.md with absolute URLs (#44905) by @NicoleRobin in [#44905] * chore(typing): added rule 11 (#44865) by @tarekziade in [#44865] * fix(camembert): add tie_word_embeddings=True to CamembertConfig (#44931) by @r266-tech in [#44931] * Support SizeDict import in get_size_dict (#44903) by @yonigozlan in [#44903] * Add big angry code agent warnings! (#44890) by @Rocketknight1 in [#44890] * [docs] model cards (#44837) by @stevhliu in [#44837] * Add backward compatibility for direct imports from legacy `image_processing_utils_fast` (#44897) by @yonigozlan in [#44897] * Fix core dumped when `NemotronH` is torch compiled (#44854) by @ydshieh in [#44854] * fix(testing): Fix PaliGemma 2 and PaddleOCR-VL test failures on main (#44765) by @harshaljanjani in [#44765] * Fix dtype guessing from state dict (#44883) by @Cyrilvallez in [#44883] * Add missing dunder methods to `SizeDict` (#44884) by @hmellor in [#44884] * Fix VL model rope_deltas batch size mismatch in online RL training (#44873) by @sergiopaniego in [#44873] * Fix `layer_types` type hint for `AFMoE` and `Llama4` (#44874) by @hmellor in [#44874] * Fix nemotron config docstrings (#44878) by @Cyrilvallez in [#44878] * Fix nemotron_h modular (#44876) by @Cyrilvallez in [#44876] * [Mistral] Fix query scaling for Mistral4 and Ministral3 (#44860) by @Cyrilvallez in [#44860] * Update some type hints (#44851) by @zucchini-nlp in [#44851] * Fix glm dsa (#44564) by @ArthurZucker in [#44564] * Update AFMoE architecture to use v5-style MoE impl (#44063) by @AutumnAurelium in [#44063] * Fix KeyError in convert_to_native_format for dict vocab (#44452) by @<NOT FOUND> in [#44452] * fix: XLNet: relative_positional_encoding computes on CPU every forward (#44782) by @JiwaniZakir in [#44782] * Fix annotations reader for python 3.14 in `PreTrainedModel` (#44672) by @neo in [#44672] * [CB] Better parametrization for compile (#44578) by @remi-or in [#44578] * Fix `KeyError` when patching mistral regex (#43376) by @LeonardoEmili in [#43376] * Correct code block formatting in weightconverter.md (#44839) by @zhulinchng in [#44839] * feat(ci): added a network debug report (#44636) by @tarekziade in [#44636] * Add GreedyLR adaptive learning rate scheduler (#44271) by @balak4 in [#44271] * Fix unexpected `position_ids` keys when loading OwlViT models (#44508) by @KartikPawade in [#44508] * Update more modular examples (#44834) by @Cyrilvallez in [#44834] * Fix and re-run modular converter on examples (#44833) by @Cyrilvallez in [#44833] * Remove cache_position in more models (4 and last one) (#44828) by @Cyrilvallez in [#44828] * Fix loading issue in Sam3 (#44831) by @zucchini-nlp in [#44831] * feat(integration): Add KubeflowCallback to enable automatic progress … (#44487) by @abhijeet-dhumal in [#44487] * Add GGUF support for MiniMax-M2.1 model (#44526) by @JoursBleu in [#44526] * Centralize AI agent templates in `.ai` (#44489) by @tarekziade in [#44489] * support xxxFast alias in v5 tokenizers (#44766) by @itazap in [#44766] * Remove cache_position in more models (3) (#44759) by @Cyrilvallez in [#44759] * [CI] Temporarily skip Mistral4 tests as they almost all fail (#44825) by @Cyrilvallez in [#44825] * [Gemma] Update conversion scripts for Transformers v5 Comaptibility (#44631) by @RyanMullins in [#44631] * fix bug embedding_size mismatch with hidden_size in electra model test (#44657) by @kaixuanliu in [#44657] * Fix pegasus conversion (#44571) by @ArthurZucker in [#44571] * Fix repo-check bot (#44812) by @ydshieh in [#44812] * [docs] is_causal feature (#44777) by @stevhliu in [#44777] * docs(tasks): remove references to removed question-answering pipeline (#44787) by @<NOT FOUND> in [#44787] * Fix configs with `@strict` (#44770) by @zucchini-nlp in [#44770] * [AMD CI] Fix test failures across important models (#44632) by @Abdennacer-Badaoui in [#44632] * Move VLM conversions to the main mapping (#44627) by @zucchini-nlp in [#44627] * Fix config loading issues (type issues) (#44789) by @ydshieh in [#44789] * Remove `is_causal` from `EuroBertConfig` (#44774) by @ydshieh in [#44774] * model-linter: Added rule 10 (#44761) by @tarekziade in [#44761] * [fix] mistral 4 docs (#44776) by @stevhliu in [#44776] * Fix: Eurobert model was missing @strict decorator and invalid test kwargs (#44767) by @tarekziade in [#44767] * fix: sig lip import (#44764) by @tarekziade in [#44764] * Disable async loading when quantizing on the fly (#44576) by @SunMarc in [#44576] * [MistralCommonBackend] Upgrade mistral-common to v1.10.0 (#44656) by @juliendenize in [#44656] * Fix `mlcd` auto config/model/mapping issues (#44730) by @ydshieh in [#44730] * Fix bug and add XPU Expectations for qwen2 and jamba tests (#44733) by @kaixuanliu in [#44733] * [medasr] doc update (#44633) by @eustlb in [#44633] * Fix missing / incorrect `config` class in some model class definitions (#44715) by @ydshieh in [#44715] * Update Nvidia CI docker file to use torch 2.10 (#44712) by @ydshieh in [#44712] * [`FA`] Fix fa detection (#44703) by @vasqu in [#44703] * Fix `set_encoder` (#44698) by @hmellor in [#44698] * [docs] cb config (#44675) by @stevhliu in [#44675] * Fix more model tester missing `parent` issue (#44685) by @ydshieh in [#44685] * Add register method for `ParallelInterface` (#44640) by @michaelbenayoun in [#44640] * [CB] [Bug] Fix crashes when running without cuda (#44673) by @remi-or in [#44673] * Another (small) set of fixes required for tiny model creation (#44666) by @ydshieh in [#44666] * Fix CookieCutter (#44334) by @NielsRogge in [#44334] * pipelines do not have modelcard (#44621) by @KoichiYasuoka in [#44621] * [`Chmv2`] Fix conversion after capture refactor (#44665) by @vasqu in [#44665] * [CB] Add dedicated config (#44434) by @remi-or in [#44434] * fix(models): Forward timm model kwargs to timm.create_model for OmDet-Turbo (#44611) by @harshaljanjani in [#44611] * Ensure same `dtype` for subconfig when `_from_config` (#44629) by @zucchini-nlp in [#44629] * Remove `cache_position` in more models (2) (#44602) by @Cyrilvallez in [#44602] * fix: cast to proper dtype in EmbeddingParallel (#44612) by @michaelbenayoun in [#44612] * Remove many output_attentions and other traced outputs on 100+ models (#43590) by @molbap in [#43590] * fix: raise error if mm_token_type_ids not supplied (#44433) by @leopold-tzafon in [#44433] * Fix output capturing for Backbones (#44638) by @Cyrilvallez in [#44638] * Fix for `VibeVoiceAcousticTokenizer` (#44628) by @ydshieh in [#44628] * Fix off-by-one in decode_spans boundary check (#44584) by @mvanhorn in [#44584] * Fix more wrong HF hub checkpoint names (#44624) by @ydshieh in [#44624] * Update agentic contributions guidelines in AGENTS.md to force yielding. (#44411) by @burtenshaw in [#44411] * Expand model-structure lint rules with a fast AST-based, ruff-like framework (#44174) by @tarekziade in [#44174] * feat: add neuron in tensor parallelism initialization (#44498) by @michaelbenayoun in [#44498] * [WIP] FIX Make Mixtral LoRA loading work (#44478) by @BenjaminBossan in [#44478] * Fix Llava tests for torch too! (#44476) by @Rocketknight1 in [#44476] * Fix training ci and clean some tests (#44491) by @SunMarc in [#44491] * Remove useless identity assignment (#44600) by @Cyrilvallez in [#44600] * Add Yoni to run-slow workflow (#44598) by @vasqu in [#44598] * Add shared VLM tests (#42964) by @Rocketknight1 in [#42964] * Fix wrong (non-existing) checkpoints (#44549) by @ydshieh in [#44549] * Remove `cache_position` in more models (#44330) by @Cyrilvallez in [#44330] * Fix CircleCI summary report not showing due to missing dependency (#44597) by @ydshieh in [#44597] * Fix typos in add_new_model_like docstrings (#43544) by @Olexandr88 in [#43544] * Fix UnboundLocalError for tp_plan_alt when tp_plan is empty (#44540) by @YangKai0616 in [#44540] * FIX Multiple PEFT errors after v5 transition (#44592) by @BenjaminBossan in [#44592] * Fix missing BPE token conversion step in Chameleon (#44582) by @yonigozlan in [#44582] * Make paligemma embed tokens standard (#44432) by @zucchini-nlp in [#44432] * chore(typing): Add type checking to `src/transformers/quantizers` (#44412) by @tarekziade in [#44412] * Fix: AQLM quantizer to match updated replace_with_aqlm_linear signature (#44577) by @tarekziade in [#44577] * [device_map] Fix device_map computation by correctly adjusting memory available (#44565) by @Cyrilvallez in [#44565] * Fix error message label and docstring default in load_sharded_checkpoint (#44523) by @jnMetaCode in [#44523] * Correct Tapas initialization (#44575) by @Rocketknight1 in [#44575] * [`fix`] Prevent crash with Apertus without xielu installed (#44567) by @tomaarsen in [#44567] * Fix failing `MusicgenStereo` integration tests (#44527) by @Sai-Suraj-27 in [#44527] * Fix zamba2 rotary embedding call when use_mem_rope is False (#44551) by @echarlaix in [#44551] * [Bugfix] fix video inference of qwen3vl and qwen3.5 series (#44474) by @JJJYmmm in [#44474] * add XPU Expectations for `higgs_audio_v2` tests (#44482) by @kaixuanliu in [#44482] * chameleon added to MODELS_WITH_INCORRECT_HUB_TOKENIZER_CLASS (#44475) by @itazap in [#44475] * Revert "test merge queue 1" (#44552) by @ydshieh in [#44552] * test merge queue 1 (#44529) by @ydshieh2 in [#44529] * fix(testing): Fix MoonshineEncoder UnboundLocalError and Florence2VisionBackbone dtype mismatch (#44503) by @harshaljanjani in [#44503] * Fix: Remove references to transformers run command (#44513) by @math-hiyoko in [#44513] * [LW-DETR] Fix training (#44441) by @NielsRogge in [#44441] * Make `_prepare_input_fn` and `_prepare_output_fn` instance methods (#44499) by @michaelbenayoun in [#44499] * Fix ShieldGemma2 non-reproducible outputs by adding _tied_weights_keys (#44358) by @hardikmeisheri in [#44358] * Tensor Parallelism and `mps` device (#44506) by @michaelbenayoun in [#44506] * Fix failing `GPTNeoModelLanguageGenerationTest` (#44515) by @Sai-Suraj-27 in [#44515] * Fix failing `MarianIntegrationTests` (#44519) by @Sai-Suraj-27 in [#44519] * fix pin_memory for contiguous batching (#44455) by @jiqing-feng in [#44455] * Fix continuous batching for multimodal models (#44436) by @jw9603 in [#44436] * Fix KeyError in _parse_type_hint when Union contains Any (#44525) by @jnMetaCode in [#44525] * Fix AssistantTracker.is_active() returning False after activation with empty lists (#44524) by @jnMetaCode in [#44524] * Fix and re-enable extra_state tests (#43510) by @pstjohn in [#43510] * Fix ansi codes in loading reports when not connected to terminal (#44544) by @Cyrilvallez in [#44544] * Follow-up typing checking fixes (#44500) by @tarekziade in [#44500] * Fix backend dependency (#44542) by @Cyrilvallez in [#44542] * Add a new job in `build_pr_documentation.yml` (will be the new required job) (#44538) by @ydshieh in [#44538] * Update `build_pr_documentation` workflow for `merge_group` event (#44532) by @ydshieh in [#44532] * Fixed typo in docs/source/en/kv_cache.md (#44501) by @frogNotToad in [#44501] * Docs: fix SigLIP2 usage examples (#43641) by @KOKOSde in [#43641] * Fix type checker (#44502) by @Cyrilvallez in [#44502] * Add MLU bf16 support to is_torch_bf16_gpu_available (#44381) by @carcel-yu in [#44381] * fix model parallelism bug for eurobert model (#44490) by @kaixuanliu in [#44490] * Update `ty` to 0.0.20 (#44494) by @tarekziade in [#44494] * Add auto-docstring on configs (#44296) by @zucchini-nlp in [#44296] * Fix failed unit tests for moonshine_streaming model (#43936) by @kaixuanliu in [#43936] * Update distributed tests (#44338) by @SunMarc in [#44338] * Add `diffusers` to CI docker file (#44480) by @ydshieh in [#44480] * Replace placeholder tokens as specified in added_tokens_decoder (#44468) by @itazap in [#44468] * [vLLM] Fix backward compatibility with hardcoded subprocessors classes in processors (#44447) by @yonigozlan in [#44447] * [remote code/vllm] Fix incorrect tied weights (#44469) by @Cyrilvallez in [#44469] * Integrate the Neuron device to TrainingArguments (#44302) by @michaelbenayoun in [#44302] * Fix failing `DepthProModelIntegrationTest` (#44456) by @Sai-Suraj-27 in [#44456] * [timesfm2_5] fix loss scaling (#44465) by @kashif in [#44465] * Fix failing `ProphetNetModelIntegrationTest` (#44439) by @Sai-Suraj-27 in [#44439] * [Trainer] fix SP loss (#44461) by @kashif in [#44461] * skip 1 invalid test case for higgs_audio_v2 (#44350) by @kaixuanliu in [#44350] * Fix position_ids typo in Qwen3_5TextModel forward pass (#44399) by @<NOT FOUND> in [#44399] ## 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 * Add VidEoMT (#44285) * Fix CookieCutter (#44334) * [LW-DETR] Fix training (#44441) * @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) * :rotating_light: [`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)

Release candidate v5.0.0rc3v5.0.0rc3预发布
? · 2026-01-26

# Release candidate v5.0.0rc3 ## New models: * [GLM-4.7] GLM-Lite Supoort by @zRzRzRzRzRzRzR in https://github.com/huggingface/transformers/pull/43031 * [GLM-Image] AR Model Support for GLM-Image by @zRzRzRzRzRzRzR in https://github.com/huggingface/transformers/pull/43100 * Add LWDetr model by @sbucaille in https://github.com/huggingface/transformers/pull/40991 * Add LightOnOCR model implementation by @baptiste-aubertin in https://github.com/huggingface/transformers/pull/41621 ## What's Changed We are getting closer and closer to the official release! This RC is focused on removing more of the deprecated stuff, fixing some minors issues, doc updates. * Update Japanese README to match English version by @lilin-1 in https://github.com/huggingface/transformers/pull/43069 * [docs] Deploying by @stevhliu in https://github.com/huggingface/transformers/pull/42263 * [docs] inference engines by @stevhliu in https://github.com/huggingface/transformers/pull/42932 * Fix typos: Remove duplicate duplicate words words by @efeecllk in https://github.com/huggingface/transformers/pull/43040 * [style] Rework ruff rules and update all files by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43144 * [CB] Minor fix in kwargs by @remi-or in https://github.com/huggingface/transformers/pull/43147 * [Bug] qwen2_5_omni: cap generation length to be less than the max_position_embedding in DiT by @sniper35 in https://github.com/huggingface/transformers/pull/43068 * Fix some deprecated practices in torch 2.9 by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43167 * Fix Fuyu processor width dimension bug in `_get_num_multimodal_tokens` by @Abhinavexists in https://github.com/huggingface/transformers/pull/43137 * Inherit from PreTrainedTokenizerBase by @juliendenize in https://github.com/huggingface/transformers/pull/43143 * Generation config boolean defaults by @zucchini-nlp in https://github.com/huggingface/transformers/pull/43000 * Fix failing `BartModelIntegrationTest` by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43160 * fix failure of llava/pixtral by @sywangyi in https://github.com/huggingface/transformers/pull/42985 * GemmaTokenizer: remove redundant whitespace pre-tokenizer by @vaibhav-research in https://github.com/huggingface/transformers/pull/43106 * Support `auto_doctring` in Processors by @yonigozlan in https://github.com/huggingface/transformers/pull/42101 * Fix failing `BitModelIntegrationTest` by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43164 * [`Fp8`] Fix experts by @vasqu in https://github.com/huggingface/transformers/pull/43154 * Docs: improve wording for documentation build instructions by @Sailnagale in https://github.com/huggingface/transformers/pull/43007 * [makefile] Cleanup and improve the rules by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43171 * Some new models added stuff that was already removed by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43179 * Fixes and compilation warning in torchao docs by @merveenoyan in https://github.com/huggingface/transformers/pull/42909 * [cache] Remove all deprecated classes by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43168 * Bump huggingface_hub minimal version by @Wauplin in https://github.com/huggingface/transformers/pull/43188 * Rework check_config_attributes.py by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43191 * Fix generation config validation by @zucchini-nlp in https://github.com/huggingface/transformers/pull/43175 * [style] Use 'x | y' syntax for processors as well by @Wauplin in https://github.com/huggingface/transformers/pull/43189 * Remove deprecated objects by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43170 * fix chunked prefill implementation issue-43082 by @marcndo in https://github.com/huggingface/transformers/pull/43132 * Reduce add_dates verbosity by @yonigozlan in https://github.com/huggingface/transformers/pull/43184 * Add support for MiniMax-M2 by @rogeryoungh in https://github.com/huggingface/transformers/pull/42028 * Fix failing `salesforce-ctrl`, `xlm` & `gpt-neo` model generation tests by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43180 * Less verbose library helpers by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43197 * run all test files on CircleCI by @ydshieh in https://github.com/huggingface/transformers/pull/43146 * Clamp temperature to >=1.0 for Dia generation by @Haseebasif7 in https://github.com/huggingface/transformers/pull/43029 * Fix spelling typos in comments and code by @raimbekovm in https://github.com/huggingface/transformers/pull/43046 * [docs] llama.cpp by @stevhliu in https://github.com/huggingface/transformers/pull/43185 * [docs] gptq formatting fix by @victorywwong in https://github.com/huggingface/transformers/pull/43216 * Grouped beam search from config params by @zucchini-nlp in https://github.com/huggingface/transformers/pull/42472 * [`Generate`] Allow custom config values in generate config by @vasqu in https://github.com/huggingface/transformers/pull/43181 * Fix failing `Pix2StructIntegrationTest` by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43229 * Fix missing UTF-8 encoding in check_repo.py for Windows compatibility by @aarushisingh04 in https://github.com/huggingface/transformers/pull/43123 * [Tokenizer] Change default value of return_dict to True in doc string for apply_chat_template by @kashif in https://github.com/huggingface/transformers/pull/43223 * Fix failing `PhiIntegrationTests` by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43214 * Use `HF_TOKEN` directly and remove `require_read_token` by @ydshieh in https://github.com/huggingface/transformers/pull/43233 * Fix failing `Owlv2ModelIntegrationTest` & `OwlViTModelIntegrationTest` by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43182 * Fix flashattn wrt quantized models by @SunMarc in https://github.com/huggingface/transformers/pull/43145 * Remove unused imports by @cyyever in https://github.com/huggingface/transformers/pull/43078 * Fix unsafe torch.load() in _load_rng_state allowing arbitrary code execution by @ColeMurray in https://github.com/huggingface/transformers/pull/43140 * Reapply modular to examples by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43234 * More robust diff checks in `add_dates` by @yonigozlan in https://github.com/huggingface/transformers/pull/43199 * docs: fix grammatical error in README.md by @davidfertube in https://github.com/huggingface/transformers/pull/43236 * Fix typo: seperately → separately in lw_detr converter by @skyvanguard in https://github.com/huggingface/transformers/pull/43235 * Qwen-VL video processor accepts min/max pixels by @zucchini-nlp in https://github.com/huggingface/transformers/pull/43228 * Deprecate dtype per sub config by @zucchini-nlp in https://github.com/huggingface/transformers/pull/42990 * Remove more deprecated objects/args by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43195 * [CB] Soft-reset offloading by @remi-or in https://github.com/huggingface/transformers/pull/43150 * Make benchmark-v2 to be device agnostic, to support more torch built-in devices like xpu by @yao-matrix in https://github.com/huggingface/transformers/pull/43153 * Fix benchmark script by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43253 * Adding to run slow by @IlyasMoutawwakil in https://github.com/huggingface/transformers/pull/43250 * Fix failing `Vip-llava` model integration test by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43252 * Remove deprecated and unused `position_ids` in all `apply_rotary_pos_emb` by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43255 * fix `_get_test_info` in `testing_utils.py` by @ydshieh in https://github.com/huggingface/transformers/pull/43259 * Fix failing `Hiera`, `SwiftFormer` & `LED` Model integration tests by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43225 * [style] Fix init isort and align makefile and CI by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43260 * [docs] tensorrt-llm by @stevhliu in https://github.com/huggingface/transformers/pull/43176 * [consistency] Ensure models are added to the `_toctree.yml` by @Cyrilvallez in https://github.com/huggingface/transformers/pull/43264 * Fix failing `PegasusX`, `Mvp` & `LED` model integration tests by @Sai-Suraj-27 in https://github.com/huggingface/transformers/pull/43245 * [CB] Ensure parallel decoding test passes using FA by @remi-or in https://github.com/huggingface/transformers/pull/43277 * fix crash in when running FSDP2+TP by @sywangyi in https://github.com/huggingface/transformers/pull/43226 * [ci] Fixing some failing tests for important models by @Abdennacer-Badaoui in https://github.com/huggingface/transformers/pull/43231 ## New Contributors * @efeecllk made their first contribution in https://github.com/huggingface/transformers/pull/43040 * @sniper35 made their first contribution in https://github.com/huggingface/transformers/pull/43068 * @Abhinavexists made their first contribution in https://github.com/huggingface/transformers/pull/43137 * @vaibhav-research made their first contribution in https://github.com/huggingface/transformers/pull/43106 * @Sailnagale made their first contribution in https://github.com/huggingface/transformers/pull/43007 * @rogeryoungh made their first contribution in https://github.com/huggingface/transformers/pull/42028 * @Haseebasif7 made their first contribution in https://github.com/huggingface/transformers/pull/43029 * @victorywwong made their first contribution in https://github.com/huggingface/transformers/pull/43216 * @aarushisingh04 made their first contribution in https://github.com/huggingface/transformers/pull/43123 * @ColeMurray made their first contribution in https://github.com/huggingface/transformers/pull/43140 * @davidfertube made their first contribution in https://github.com/huggingface/transformers/pull/43236 * @skyvanguard made their first contribution in https://github.com/huggingface/transformers/pull/43235 * @baptiste-aubertin made their first contribution in https://github.com/huggingface/transformers/pull/41621 **Full Changelog**: https://github.com/huggingface/transformers/compare/v5.0.0rc2...v5.0.0rc3

Release candidate 5.0.0rc1v5.0.0rc1预发布
? · 2026-01-08

## What's Changed This release candidate was focused mostly on `quantization` support with the new dynamic weight loader, and a few notable 🚨 breaking changes🚨: 1. Default dtype for any model when using `from_pretrained` is now `auto`! * Default auto 🚨 🚨 by @ArthurZucker in https://github.com/huggingface/transformers/pull/42805 2. Default shard size when saving a model is now 50GB: * 🚨🚨 [saving] Default to 50GB shards, and remove non-safe serialization by @Cyrilvallez in https://github.com/huggingface/transformers/pull/42734 This is now as fast as before thanks to xet, and is just more convenient on the hub. 3. Kwargs. They are fundamental to enable integration with vllm and other toosl: * Every model forward() should have **kwargs by @Rocketknight1 in https://github.com/huggingface/transformers/pull/42603 ### Dynamic weight loader updates: Mostly QOL and fixed + support back CPU offloading. * mark params as _is_hf_initialized with DS Zero3 from weight conversion by @winglian in https://github.com/huggingface/transformers/pull/42626 * [loading] Allow loading to happen without threading by @Cyrilvallez in https://github.com/huggingface/transformers/pull/42619 * [loading] Correctly load params during offloading & careful memory considerations by @Cyrilvallez in https://github.com/huggingface/transformers/pull/42632 * allow registration of custom checkpoint conversion mappings by @winglian in https://github.com/huggingface/transformers/pull/42634 ### New models: * Add FastVLM by @camilla-deckard in https://github.com/huggingface/transformers/pull/41112 * Lasr model by @eustlb in https://github.com/huggingface/transformers/pull/42648 * [Model] Add PaddleOCR-VL Model Support by @zhang-prog in https://github.com/huggingface/transformers/pull/42178 ### Some notable quantization fixes: Mostly added support for `fbgemme` , `quanto`, * Fix fp8 + some enhancement by @SunMarc in https://github.com/huggingface/transformers/pull/42455 * Fix eetq quanto quant methods by @SunMarc in https://github.com/huggingface/transformers/pull/42557 * [Quantization] per tensor quantization kernel by @MekkCyber in https://github.com/huggingface/transformers/pull/42560 * [Quantization] fix fbgemm by @MekkCyber in https://github.com/huggingface/transformers/pull/42561 * [Quantization] Fix FP8 experts replacing by @MekkCyber in https://github.com/huggingface/transformers/pull/42654 * [Quantization] Fix Static FP8 Quantization by @MekkCyber in https://github.com/huggingface/transformers/pull/42775 * [core] fix fp-quant by @MekkCyber in https://github.com/huggingface/transformers/pull/42613 ### Peft: The dynamic weight loader broke small things, this adds glue for all models but MoEs. * FIX Error when trying to load non-LoRA PEFT by @BenjaminBossan in https://github.com/huggingface/transformers/pull/42663 * Fix PEFT integration with new weight loader by @Cyrilvallez in https://github.com/huggingface/transformers/pull/42701 ### Misc Tokenization needed more refactoring, this time its a lot cleaner! * Refactor-tokenization-more by @ArthurZucker in https://github.com/huggingface/transformers/pull/42563 * Only default `rope_parameters` to empty `dict` if there is something to put in it by @hmellor in https://github.com/huggingface/transformers/pull/42651 We omitted a lot of other commits for clarity, but thanks to everyone and the new contributors! ## New Contributors * @camilla-deckard made their first contribution in https://github.com/huggingface/transformers/pull/41112 * @Aaraviitkgp made their first contribution in https://github.com/huggingface/transformers/pull/42466 * @ngazagna-qc made their first contribution in https://github.com/huggingface/transformers/pull/40691 * @arrdel made their first contribution in https://github.com/huggingface/transformers/pull/42577 * @marconaguib made their first contribution in https://github.com/huggingface/transformers/pull/42587 * @Xiao-Chenguang made their first contribution in https://github.com/huggingface/transformers/pull/42436 * @Furkan-rgb made their first contribution in https://github.com/huggingface/transformers/pull/42465 * @mertunsall made their first contribution in https://github.com/huggingface/transformers/pull/42615 * @anranlee99 made their first contribution in https://github.com/huggingface/transformers/pull/42438 * @UserChen666 made their first contribution in https://github.com/huggingface/transformers/pull/42335 * @efazal made their first contribution in https://github.com/huggingface/transformers/pull/41723 * @Harrisonyong made their first contribution in https://github.com/huggingface/transformers/pull/36416 * @hawon223 made their first contribution in https://github.com/huggingface/transformers/pull/42384 * @Bissmella made their first contribution in https://github.com/huggingface/transformers/pull/42647 * @AgainstEntropy made their first contribution in https://github.com/huggingface/transformers/pull/42689 * @dongluw made their first contribution in https://github.com/huggingface/transformers/pull/42642 * @hqkqn32 made their first contribution in https://github.com/huggingface/transformers/pull/42620 * @zhang-prog made their first contribution in https://github.com/huggingface/transformers/pull/42178 **Full Changelog**: https://github.com/huggingface/transformers/compare/v5.0.0rc0...v5.0.0rc1

Transformers v5.0.0rc0v5.0.0rc0预发布
? · 2025-12-01

## Transformers v5 release notes <img width="1800" height="1013" alt="image" src="https://github.com/user-attachments/assets/7b5187d7-6945-4108-a546-6d1d7bfb55e3" /> - Highlights - Significant API changes: dynamic weight loading, tokenization - Backwards Incompatible Changes - Bugfixes and improvements ## Highlights We are excited to announce the initial release of Transformers v5. This is the first major release in five years, and the release is significant: 800 commits have been pushed to `main` since the latest minor release. This release removes a lot of long-due deprecations, introduces several refactors that significantly simplify our APIs and internals, and comes with a large number of bug fixes. We give an overview of our focus for this release in the [following blogpost](https://huggingface.co/blog/transformers-v5). In these release notes, we'll focus directly on the refactors and new APIs coming with v5. This release is a release candidate (RC). It is not the final v5 release, and we will push on pypi as a pre-release. This means that the current release is purely opt-in, as installing `transformers` without specifying this exact release will install the latest version instead (v4.57.3 as of writing). In order to install this release, please do so with the following: ```shell pip install transformers --pre ``` For us to deliver the best package possible, it is imperative that we have feedback on how the toolkit is currently working for you. Please try it out, and [open an issue](https://github.com/huggingface/transformers/issues/) in case you're facing something inconsistent/a bug. Transformers version 5 is a community endeavor, and this is the last mile. Let's ship this together! ## Significant API changes > [!NOTE] > 👀 Nothing is final and things are still actively in movement. We have a section dedicated to what is planned for future release candidates, yet is known not to work in the RC0. Look for "Disclaimers for the RC0". > > We'll be eagerly awaiting your feedback in our GitHub issues! ### Tokenization Just as we moved towards a single backend library for model definition, we want our tokenizers, and the `Tokenizer` object to be a lot more intuitive. With v5, tokenizer definition is much simpler; one can now initialize an empty `LlamaTokenizer` and train it directly on your corpus. Defining a new tokenizer object should be as simple as this: ```python from transformers import TokenizersBackend, generate_merges from tokenizers import pre_tokenizers, Tokenizer from tokenizers.model import BPE class Llama5Tokenizer(TokenizersBackend): def __init__(self, unk_token="<unk>",bos_token="<s>", eos_token="</s>", vocab=None, merges=None ): if vocab is None: self._vocab = { str(unk_token): 0, str(bos_token): 1, str(eos_token): 2, } else: self._vocab = vocab if merges is not None: self._merges = merges else: self._merges = generate_merges(filtered_vocab) self._tokenizer = Tokenizer( BPE(vocab=self._vocab, merges=self._merges, fuse_unk=True) ) self._tokenizer.pre_tokenizer = pre_tokenizers.Metaspace( replacement="▁", prepend_scheme=_get_prepend_scheme(self.add_prefix_space, self), split=False ) super().__init__( tokenizer_object=self._tokenizer, unk_token=unk_token, bos_token=bos_token, eos_token=eos_token, ) ``` Once the tokenizer is defined as above, you can load it with the following: `Llama5Tokenizer()`. Doing this returns you an empty, trainable tokenizer that follows the definition of the authors of `Llama5` (it does not exist yet :wink:). The above is the main motivation towards refactoring tokenization: we want tokenizers to behave similarly to models: trained or empty, and with exactly what is defined in their class definition. ### Backend Architecture Changes: moving away from the slow/fast tokenizer separation Up to now, transformers maintained two parallel implementations for many tokenizers: - "Slow" tokenizers (`tokenization_<model>.py`) - Python-based implementations, often using [SentencePiece](https://github.com/google/sentencepiece) as the backend. - "Fast" tokenizers (`tokenization_<model>_fast.py`) - Rust-based implementations using the 🤗 [tokenizers](https://github.com/huggingface/tokenizers) library. In v5, we consolidate to a single tokenizer file per model: `tokenization_<model>.py`. This file will use the most appropriate backend available: 1. **TokenizersBackend** (preferred): Rust-based tokenizers from the 🤗 [tokenizers](https://github.com/huggingface/tokenizers) library. In general it provides optimal performance, but it also offers a lot more features that are commonly adopted across the ecosystem: - handling additional tokens - a full python API for setting and updating - automatic parallelization, - automatic offsets - customization - training 2. **SentencePieceBackend**: for tokenizers requiring the `sentencepiece` library. It inherits from `PythonBackend`. 3. **PythonBackend**: a Python implementations of the features provided by `tokenizers`. Basically allows adding tokens. 4. **MistralCommonBackend**: relies on `MistralCommon`'s tokenization library. (Previously known as the `MistralCommonTokenizer`) The `AutoTokenizer` automatically selects the appropriate backend based on available files and dependencies. This is transparent, you continue to use `AutoTokenizer.from_pretrained()` as before. This allows transformers to be future-proof and modular to easily support future backends. ### Defining a tokenizers outside of the existing backends We enable users and tokenizer builders to define their own tokenizers from top to bottom. Tokenizers are usually defined using a backend such as `tokenizers`, `sentencepiece` or `mistral-common`, but we offer the possibility to design the tokenizer at a higher-level, without relying on those backends. To do so, you can import the `PythonBackend` (which was previously known as `PreTrainedTokenizer`). This class encapsulates all the logic related to added tokens, encoding, and decoding. If you want something even higher up the stack, then `PreTrainedTokenizerBase` is what `PythonBackend` inherits from. It contains the very basic tokenizer API features: - `encode` - `decode` - `vocab_size` - `get_vocab` - `convert_tokens_to_ids` - `convert_ids_to_tokens` - `from_pretrained` - `save_pretrained` - among a few others ### API Changes #### 1. Direct tokenizer initialization with vocab and merges Starting with v5, we now enable initializing blank, untrained `tokenizers`-backed tokenizers: ```py from transformers import LlamaTokenizer tokenizer = LlamaTokenizer() ``` This tokenizer will therefore follow the definition of the `LlamaTokenizer` as defined in its class definition. It can then be trained on a corpus as can be seen in [the `tokenizers` documentation](https://huggingface.co/docs/tokenizers/training_from_memory). These tokenizers can also be initialized from vocab and merges (if necessary), like the previous "slow" tokenizers: ```py from transformers import LlamaTokenizer vocab = {"<unk>": 0, "<s>": 1, "</s>": 2, "hello": 3, "world": 4} merges = [("h", "e"), ("l", "l"), ("o", " ")] tokenizer = LlamaTokenizer(vocab=vocab, merges=merges) ``` This tokenizer will behave as a Llama-like tokenizer, with an updated vocabulary. This allows comparing different tokenizer classes with the same vocab; therefore enabling the comparison of different pre-tokenizers, normalizers, etc. ⚠️ The `vocab_file` (as in, a path towards a file containing the vocabulary) cannot be used to initialize the `LlamaTokenizer` as loading from files is reserved to the `from_pretrained` method. #### 2. Simplified decoding API The `batch_decode` and `decode` methods have been unified to reflect behavior of the `encode` method. Both single and batch decoding now use the same `decode` method. See an example of the new behavior below: ```python from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("t5-small") inputs = ["hey how are you?", "fine"] tokenizer.decode(tokenizer.encode(inputs)) ``` Gives: ```diff - 'hey how are you?</s> fine</s>' + ['hey how are you?</s>', 'fine</s>'] ``` We expect `encode` and `decode` to behave, as two sides of the same coin: `encode`, `process`, `decode`, should work. > [!NOTE] > A common use-case would be: `encode`, `model.generate`, `decode`. However, using `generate` would return `list[list[int]]`, which would then be incompatible with `decode`. #### 3. Unified encoding API The `encode_plus` method is deprecated in favor of the single `__call__` method. #### 4. `apply_chat_template` returns `BatchEncoding` Previously, `apply_chat_template` returned `input_ids` for backward compatibility. Starting with v5, it now consistently returns a `BatchEncoding` dict like other tokenizer methods. ```python # v5 messages = [ {"role": "user", "content": "Hello!"}, {"role": "assistant", "content": "Hi there!"} ] # Now returns BatchEncoding with input_ids, attention_mask, etc. outputs = tokenizer.apply_chat_template(messages, return_tensors="pt") print(outputs.keys()) # dict_keys(['input_ids', 'attention_mask']) ``` #### 5. Removed legacy configuration file saving: We simplify the serialization of tokenization attributes: - `special_tokens_map.json` - special tokens are now stored in `tokenizer_config.json`. - `added_tokens.json` - added tokens are now stored in `tokenizer.json`. - `added_tokens_decoder` is only stored when there is no `tokenizer.json`. When loading older tokenizers, these files are still read for backward compatibility, but new saves use the consolidated format. We're gradually moving towards consolidating attributes to fewer files so that other libraries and implementations may depend on them more reliably. #### 6. Model-Specific Changes Several models that had identical tokenizers now import from their base implementation: - **LayoutLM** → uses BertTokenizer - **LED** → uses BartTokenizer - **Longformer** → uses RobertaTokenizer - **LXMert** → uses BertTokenizer - **MT5** → uses T5Tokenizer - **MVP** → uses BartTokenizer These modules will eventually be removed altogether. **Removed T5-specific workarounds** The internal `_eventually_correct_t5_max_length` method has been removed. T5 tokenizers now handle max length consistently with other models. ### Testing Changes A few testing changes specific to tokenizers have been applied: - Model-specific tokenization test files now focus on integration tests. - Common tokenization API tests (e.g., `add_tokens`, `encode`, `decode`) are now centralized and automatically applied across all tokenizers. This reduces test duplication and ensures consistent behavior For legacy implementations, the original BERT Python tokenizer code (including `WhitespaceTokenizer`, `BasicTokenizer`, etc.) is preserved in `bert_legacy.py` for reference purposes. #### 7. Deprecated / Modified Features **Special Tokens Structure:** - `SpecialTokensMixin`: Merged into `PreTrainedTokenizerBase` to simplify the tokenizer architecture. - `special_tokens_map`: Now only stores named special token attributes (e.g., `bos_token`, `eos_token`). Use `extra_special_tokens` for additional special tokens (formerly `additional_special_tokens`). `all_special_tokens` includes both named and extra tokens. ```python # v4 tokenizer.special_tokens_map # Included 'additional_special_tokens' # v5 tokenizer.special_tokens_map # Only named tokens tokenizer.extra_special_tokens # Additional tokens ``` - `special_tokens_map_extended` and `all_special_tokens_extended`: Removed. Access `AddedToken` objects directly from `_special_tokens_map` or `_extra_special_tokens` if needed. - `additional_special_tokens`: Still accepted for backward compatibility but is automatically converted to `extra_special_tokens`. **Deprecated Methods:** - `sanitize_special_tokens()`: Already deprecated in v4, removed in v5. - `prepare_seq2seq_batch()`: Deprecated; use `__call__()` with `text_target` parameter instead. ```python # v4 model_inputs = tokenizer.prepare_seq2seq_batch(src_texts, tgt_texts, max_length=128) # v5 model_inputs = tokenizer(src_texts, text_target=tgt_texts, max_length=128, return_tensors="pt") model_inputs["labels"] = model_inputs.pop("input_ids_target") ``` - `BatchEncoding.words()`: Deprecated; use `word_ids()` instead. **Removed Methods:** - `create_token_type_ids_from_sequences()`: Removed from base class. Subclasses that need custom token type ID creation should implement this method directly. - `clean_up_tokenization()`: Removed from base class. Now defined at model class level for models that need it (e.g., PLBart, CLVP, Wav2Vec2). - `prepare_for_model()`, `build_inputs_with_special_tokens()`, `truncate_sequences()`: Moved from `tokenization_utils_base.py` to `tokenization_python.py` for `PythonBackend` tokenizers. `TokenizersBackend` provides model-ready input via `tokenize()` and `encode()`, so these methods are no longer needed in the base class. - `_switch_to_input_mode()`, `_switch_to_target_mode()`, `as_target_tokenizer()`: Removed from base class. Use `__call__()` with `text_target` parameter instead. ```python # v4 with tokenizer.as_target_tokenizer(): labels = tokenizer(tgt_texts, ...) # v5 labels = tokenizer(text_target=tgt_texts, ...) ``` - `parse_response()`: Removed from base class. ## Disclaimers for the RC0 ### PEFT + MoE: Because we are switching from the naive MOE (`nn.ModuleList` for experts) we currently have an issue with MoEs that have adapters. For more details see https://github.com/huggingface/transformers/issues/42491#issuecomment-3591485649. _We aim for this to be fixed and released in a following release candidate in the week that follows RC0._ ### Tensor parallel and Expert parallel + MoE We are streamlining the MoE support with vLLM; while this is being implemented, tensor parallelism and expert parallelism aren't working as expected. This is known and actively being worked on. _We aim for this to be fixed and released in a following release candidate in the week that follows RC0._ ### Custom pretrained models: For anyone inheriting from a `transformers` `PreTrainedModel`, the weights are automatically initialized with the common scheme: ```python @torch.no_grad() def _init_weights(self, module): """ Initialize the weights. This is quite general on purpose, in the spirit of what we usually do. For more complex initialization scheme, it should be overridden by the derived `PreTrainedModel` class. In case a model adds an explicit `nn.Parameter`, this method should also be overridden in order to initialize it correctly. """ if hasattr(self.config, "initializer_range"): std = self.config.initializer_range or 0.02 elif hasattr(self.config, "init_std"): std = self.config.init_std elif hasattr(self.config, "initializer_factor"): std = self.config.initializer_factor else: # 0.02 is the standard default value across the library std = getattr(self.config.get_text_config(), "initializer_range", 0.02) if isinstance(module, (nn.Linear, nn.Conv1d, nn.Conv2d, nn.Conv3d, nn.ConvTranspose1d, nn.ConvTranspose2d)): if getattr(module, "weight", None) is not None: init.normal_(module.weight, mean=0.0, std=std) if getattr(module, "bias", None) is not None: init.zeros_(module.bias) elif isinstance(module, nn.Embedding): if getattr(module, "weight", None) is not None: init.normal_(module.weight, mean=0.0, std=std) # Here we need the check explicitly, as we slice the weight in the `zeros_` call, so it looses the flag if module.padding_idx is not None and not getattr(module.weight, "_is_hf_initialized", False): init.zeros_(module.weight[module.padding_idx]) elif isinstance(module, nn.MultiheadAttention): # This uses torch's original init module._reset_parameters() # We cannot use `isinstance` on the RMSNorms or LayerNorms, as they usually are custom modules which change names # between modelings (because they are prefixed with the model name) elif ( isinstance(module, (nn.GroupNorm, nn.BatchNorm1d, nn.BatchNorm2d, nn.BatchNorm3d)) or "LayerNorm" in module.__class__.__name__ or "RMSNorm" in module.__class__.__name__ ): # Norms can exist without weights (in which case they are None from torch primitives) if hasattr(module, "weight") and module.weight is not None: init.ones_(module.weight) if hasattr(module, "bias") and module.bias is not None: init.zeros_(module.bias) ``` If you want to avoid that, for now you should just do: ```python class CustomModel(Qwen3VLForConditionalGeneration): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.action_head = nn.Linear(1024, 7) self.positional_embedding = nn.Parameter(torch.randn(16, 1152)) self.post_init() def _init_weights(self, module): pass ``` There is a tracker for that here: https://github.com/huggingface/transformers/issues/42418. ## Library-wide changes with lesser impact ### `use_auth_token` The `use_auth_token` argument/parameter is deprecated in favor of `token` everywhere. You should be able to search and replace `use_auth_token` with `token` and get the same logic. Linked PR: https://github.com/huggingface/transformers/pull/41666 ### Attention-related features We decided to remove some features for the upcoming v5 as they are currently only supported in a few old models and no longer integrated in current model additions. It's recommended to stick to v4.x in case you need them. Following features are affected: - No more head masking, see [#41076](https://github.com/huggingface/transformers/pull/41076). This feature allowed to turn off certain heads during the attention calculation and only worked for eager. - No more relative positional biases in Bert-like models, see [#41170](https://github.com/huggingface/transformers/pull/41170). This feature was introduced to allow relative position scores within attention calculations (similar to T5). However, this feature is barely used in official models and a lot of complexity instead. It also only worked with eager. - No more head pruning, see [#41417](https://github.com/huggingface/transformers/pull/41417) by @gante. As the name suggests, it allowed to prune heads within your attention layers. ### Updates to supported torch APIs We dropped support for two torch APIs: - `torchscript` in https://github.com/huggingface/transformers/pull/41688 - `torch.fx` in https://github.com/huggingface/transformers/pull/41683 Those APIs were deprecated by the PyTorch team, and we're instead focusing on the supported APIs `dynamo` and `export`. ## Quantization changes We clean up the quantization API in transformers, and significantly refactor the weight loading as highlighted above. We drop support for two quantization arguments that have been deprecated for some time: - `load_in_4bit` - `load_in_8bit` We remove them in favor of the `quantization_config` argument which is much more complete. As an example, here is how you would load a 4-bit bitsandbytes model using this argument: ```python from transformers import AutoModelForCausalLM, BitsAndBytesConfig quantization_config = BitsAndBytesConfig(load_in_4bit=True) model_4bit = AutoModelForCausalLM.from_pretrained( "meta-llama/Llama-3.2-3B", device_map="auto", quantization_config=quantization_config ) ``` ## Configuration - Methods to init a nested config such as `from_xxx_config` are deleted. Configs can be init from the `__init__` method in the same way. See [#41314](https://github.com/huggingface/transformers/pull/41314). - It is no longer possible to load a config class from a URL file. Configs must be loaded from either a local path or a repo on the Hub. See [#42383](https://github.com/huggingface/transformers/pull/42383). - All parameters for configuring model's rotary embedding are now stored under `mode.rope_parameters`, including the `rope_theta` and `rope_type`. Model's `config.rope_parameters` is a simple dictionaty in most cases, and can also be a nested dict in special cases (i.e. Gemma3 and ModernBert) with different rope parameterization for each layer type. Trying to get `config.rope_theta` will throw an attribute error from now on. See [#39847](https://github.com/huggingface/transformers/pull/39847) and [#42255](https://github.com/huggingface/transformers/pull/42255) - Qwen-VL family configuration is in a nested format and trying to access keys directly will throw an error (e.g. `config.vocab_size`). Users are expected to access keys from their respective sub-configs (`config.text_config.vocab_size`). - Configurations of non-generative models (any model that doesn't call `model.generate()`) will no longer have a `generation_config` and `model.config.generation_config` will throw an attribute error. ## Processing ### Tokenization - Slow tokenizer files (aka: `tokenization_<model>.py` ) will be removed in favor of using fast tokenizer files `tokenization_<model>_fast.py` --> will be renamed to `tokenization_<model>.py`. As fast tokenizers are :hugs:`tokenizers` - backend, they include a wider range of features that are maintainable and reliable. - Other backends (sentence piece, tokenizers, etc.) will be supported with a light layer if loading a fast tokenizer fails - Remove legacy files like special_tokens_map.json and added_tokens.json - Remove _eventually_correct_t5_max_length - `encode_plus` --> `__call__` - `batch_decode` --> `decode` `apply_chat_template` by default returns naked `input_ids` rather than a `BatchEncoding` dict. This was inconvenient - it should return a `BatchEncoding` dict like `tokenizer.__call__()`, but we were stuck with it for backward compatibility. The method now returns a `BatchEncoding`. Linked PRs: - https://github.com/huggingface/transformers/issues/40938 - https://github.com/huggingface/transformers/pull/40936 - https://github.com/huggingface/transformers/pull/41626 ### Processing classes - In processing classes each attribute will be serialized under `processor_config.json` as a nested dict, instead of serializing attributes in their own config files. Loading will be supported for all old format processors (https://github.com/huggingface/transformers/pull/41474) - `XXXFeatureExtractors` classes are completely removed in favor of `XXXImageProcessor` class for all vision models (https://github.com/huggingface/transformers/pull/41174) - Minor change: `XXXFastImageProcessorKwargs` is removed in favor of `XXXImageProcessorKwargs` which will be shared between fast and slow processors (https://github.com/huggingface/transformers/pull/40931) ## Modeling - Some `RotaryEmbeddings` layers will start returning a dict of tuples, in case the model uses several RoPE configurations (Gemma2, ModernBert). Each value will be a tuple of "cos, sin" per RoPE type. - Config attribute for `RotaryEmbeddings` layer will be unified and accessed via `config.rope_parameters`. Config attr for `rope_theta` might not be accessible anymore for some models, and instead will be in `config.rope_parameters['rope_theta']`. BC will be supported for a while as much as possible, and in the near future we'll gradually move to the new RoPE format (https://github.com/huggingface/transformers/pull/39847) - Vision Language models will not have a shortcut access to its language and vision component from the generative model via `model.language_model`. It is recommended to either access the module with `model.model.language_model` or `model.get_decoder()`. See [#42156](https://github.com/huggingface/transformers/pull/42156/) ### Generate - Old, deprecated output type aliases were removed (e.g. `GreedySearchEncoderDecoderOutput`). We now only have 4 output classes built from the following matrix: decoder-only vs encoder-decoder, uses beams vs doesn't use beams (https://github.com/huggingface/transformers/pull/40998) - Removed deprecated classes regarding decoding methods that were moved to the Hub due to low usage (constraints and beam scores) (https://github.com/huggingface/transformers/pull/41223) - If `generate` doesn't receive any KV Cache argument, the default cache class used is now defined by the model (as opposed to always being `DynamicCache`) (https://github.com/huggingface/transformers/pull/41505) - Generation parameters are no longer accessible via model's config. If generation paramaters are serialized in `config.json` for any old model, it will be loaded back into model's generation config. Users are expected to access or modify generation parameters only with `model.generation_config.do_sample = True`. ## Trainer ### Removing arguments without deprecation cycle in `TrainingArguments` due to low usage - `mp_parameters` -> legacy param that was later on added to sagemaker trainer - `_n_gpu` -> not intended for users to set, we will initialize it correctly instead of putting it in the `TrainingArguments` - `overwrite_output_dir` - > replaced by `resume_from_checkpoint` and it was only used in examples script, no impact on Trainer. - `logging_dir` -> only used for tensorboard, set `TENSORBOARD_LOGGING_DIR` env var instead - `jit_mode_eval` -> use `use_torch_compile` instead as torchscript is not recommended anymore - `tpu_num_cores`-> It is actually better to remove it as it is not recommended to set the number of cores. By default, all tpu cores are used . Set `TPU_NUM_CORES` env var instead - `past_index` -> it was only used for a very small number of models that have special architecture like transformersxl + it was not documented at all how to train those model - `ray_scope` -> only for a minor arg for ray integration. Set `RAY_SCOPE` var env instead - `warmup_ratio` -> use `warmup_step` instead. We combined both args together by allowing passing float values in `warmup_step`. ### Removing deprecated arguments in `TrainingArguments` - `fsdp_min_num_params` and `fsdp_transformer_layer_cls_to_wrap` -> use `fsdp_config` - `tpu_metrics_debug` -> `debug` - `push_to_hub_token` -> `hub_token` - `push_to_hub_model_id` and `push_to_hub_organization` -> `hub_model_id` - `include_inputs_for_metrics` -> `include_for_metrics` - `per_gpu_train_batch_size` -> `per_device_train_batch_size` - `per_gpu_eval_batch_size` -> `per_device_eval_batch_size` - `use_mps_device` -> mps will be used by default if detected - `fp16_backend` and `half_precision_backend` -> we will only rely on torch.amp as everything has been upstream to torch - `no_cuda` -> `use_cpu` - ` include_tokens_per_second` -> `include_num_input_tokens_seen` - `use_legacy_prediction_loop` -> we only use `evaluation_loop` function from now on ### Removing deprecated arguments in `Trainer` - `tokenizer` in initialization -> `processing_class` - `model_path` in train() -> `resume_from_checkpoint` ### Removed features for `Trainer` - sigpot integration for hp search was removed as the library was archived + the api stopped working - drop support for sagemaker API <1.10 - bump accelerate minimum version to 1.1.0 ### New defaults for `Trainer` - `use_cache` in the model config will be set to `False`. You can still change the cache value through `TrainingArguments` `usel_cache` argument if needed. ## Pipeline - Image text to text pipelines will no longer accept images as a separate argument along with conversation chats. Image data has to be embedded in the chat's "content" field. See [#42359](https://github.com/huggingface/transformers/pull/42359) ## PushToHubMixin - removed deprecated `organization` and `repo_url` from `PushToHubMixin`. You must pass a `repo_id` instead. - removed `ignore_metadata_errors` from `PushToMixin`. In practice if we ignore errors while loading the model card, we won't be able to push the card back to the Hub so it's better to fail early and not provide the option to fail later. - `push_to_hub` do not accept `**kwargs` anymore. All accepted parameters are explicitly documented. - arguments of `push_to_hub` are now keyword-only to avoid confusion. Only `repo_id` can be positional since it's the main arg. - removed `use_temp_dir` argument from `push_to_hub`. We now use a tmp dir in all cases. Linked PR: https://github.com/huggingface/transformers/pull/42391. ## CLI The deprecated `transformers-cli ...` command was deprecated, `transformers ...` is now the only CLI entry point. `transformers` CLI has been migrated to `Typer`, making it easier to maintain + adding some nice features out of the box (improved `--help` section, autocompletion). Biggest breaking change is in `transformers chat`. This command starts a terminal UI to interact with a chat model. It used to also be able to start a Chat Completion server powered by `transformers` and chat with it. In this revamped version, this feature has been removed in favor of `transformers serve`. The goal of splitting `transformers chat` and `transformers serve` is to define clear boundaries between client and server code. It helps with maintenance but also makes the commands less bloated. The new signature of `transformers chat` is: ``` Usage: transformers chat [OPTIONS] BASE_URL MODEL_ID [GENERATE_FLAGS]... Chat with a model from the command line. ``` It works hand in hand with `transformers serve`, which means that if `transformers serve` is running on its default endpoint, `transformers chat` can be launched as follows: ```sh transformers chat HuggingFaceTB/SmolLM3-3B ``` It can however use any OpenAI API compatible HTTP endpoint: ```sh transformers chat HuggingFaceTB/SmolLM3-3B https://router.huggingface.co/v1 ``` Linked PRs: - https://github.com/huggingface/transformers/pull/40997 - https://github.com/huggingface/transformers/pull/41487 ### Removal of the `run` method The `transformers run` (previously `transformers-cli run`) is an artefact of the past, was not documented nor tested, and isn't part of any public documentation. We're removing it for now and ask you to please let us know in case this is a method you are using; in which case we should bring it back with better support. Linked PR: https://github.com/huggingface/transformers/pull/42447 ## Environment variables - Legacy environment variables like `TRANSFORMERS_CACHE`, `PYTORCH_TRANSFORMERS_CACHE`, and `PYTORCH_PRETRAINED_BERT_CACHE` have been removed. Please use `HF_HOME` instead. - Constants `HUGGINGFACE_CO_EXAMPLES_TELEMETRY`, `HUGGINGFACE_CO_EXAMPLES_TELEMETRY`, `HUGGINGFACE_CO_PREFIX`, and `HUGGINGFACE_CO_RESOLVE_ENDPOINT` have been removed. Please use `huggingface_hub.constants.ENDPOINT` instead. Linked PR: https://github.com/huggingface/transformers/pull/42391. ## Requirements update `transformers` v5 pins the `huggingface_hub` version to `>=1.0.0`. See this [migration guide](https://huggingface.co/docs/huggingface_hub/concepts/migration) to learn more about this major release. Here are to main aspects to know about: - switched the HTTP backend from `requests` to `httpx`. This change was made to improve performance and to support both synchronous and asynchronous requests the same way. If you are currently catching `requests.HTTPError` errors in your codebase, you'll need to switch to `httpx.HTTPError`. - related to 1., it is not possible to set proxies from your script. To handle proxies, you must set the `HTTP_PROXY` / `HTTPS_PROXY` environment variables - `hf_transfer` and therefore `HF_HUB_ENABLE_HF_TRANSFER` have been completed dropped in favor of `hf_xet`. This should be transparent for most users. Please let us know if you notice any downside! `typer-slim` has been added as required dependency, used to implement both `hf` and `transformers` CLIs. ## New model additions in v5 ### CWM <img width="809" height="471" alt="image" src="https://github.com/user-attachments/assets/58bb9c70-d481-48ed-ab8f-6553be7c240f" /> The Code World Model (CWM) model was proposed in [CWM: An Open-Weights LLM for Research on Code Generation with World Models](https://ai.facebook.com/research/publications/cwm) by Meta FAIR CodeGen Team. CWM is an LLM for code generation and reasoning about code that has, in particular, been trained to better represent and reason about how code and commands affect the state of a program or system. Specifically, we mid-trained CWM on a large number of observation-action trajectories from Python execution traces and agentic interactions in containerized environments. We post-trained with extensive multi-task RL in verifiable coding, math, and multi-turn software engineering environments. * Add Code World Model (CWM) by @jacobkahn in #41199 ### SAM3 <img width="1505" height="915" alt="image" src="https://github.com/user-attachments/assets/eec48633-f02b-464a-ae5c-c65473387e53" /> SAM3 (Segment Anything Model 3) was introduced in [SAM 3: Segment Anything with Concepts](https://ai.meta.com/research/publications/sam-3-segment-anything-with-concepts/). The SAM3 addition adds four new architectures: - Sam3 - Sam3Tracker - Sam3TrackerVideo - Sam3Video SAM3 performs Promptable Concept Segmentation (PCS) on images. PCS takes text and/or image exemplars as input (e.g., "yellow school bus"), and predicts instance and semantic masks for every single object matching the concept. Sam3Tracker and Sam3TrackerVideo perform Promptable Visual Segmentation (PVS) on images. PVS takes interactive visual prompts (points, boxes, masks) or text inputs to segment a specific object instance per prompt. This is the task that SAM 1 and SAM 2 focused on, and SAM 3 improves upon it. Sam3Tracker and Sam3TrackerVideo are updated versions of SAM2 Video that maintain the same API while providing improved performance and capabilities. SAM3 Video performs Promptable Concept Segmentation (PCS) on videos. PCS takes text as input (e.g., "yellow school bus"), and predicts instance and semantic masks for every single object matching the concept, while preserving object identities across video frames. The model combines a detection module (SAM3) with a tracking module (SAM2-style tracker) to enable robust object tracking across video frames using text prompts. * Add SAM3 to 🤗 Transformers by @yonigozlan in #42285 ### LFM2 MoE <img width="1080" height="849" alt="image" src="https://github.com/user-attachments/assets/a9fa1b81-114d-4054-9699-5083ac69d830" /> LFM2-MoE is a Mixture-of-Experts (MoE) variant of [LFM2](https://huggingface.co/collections/LiquidAI/lfm2-686d721927015b2ad73eaa38). The LFM2 family is optimized for on-device inference by combining short‑range, input‑aware gated convolutions with grouped‑query attention (GQA) in a layout tuned to maximize quality under strict speed and memory constraints. LFM2‑MoE keeps this fast backbone and introduces sparse MoE feed‑forward networks to add representational capacity without significantly increasing the active compute path. The first LFM2-MoE release is LFM2-8B-A1B, with 8.3B total parameters and 1.5B active parameters. The model excels in quality (comparable to 3-4B dense models) and speed (faster than other 1.5B class models). * [Model] Lfm2Moe by @paulpak58 in #41401 ### VideoLlama 3 <img width="812" height="366" alt="image" src="https://github.com/user-attachments/assets/21c82c6e-cf0a-4d6c-a707-b9e57663ca85" /> The [VideoLLaMA3](https://huggingface.co/papers/2501.13106) model is a major update to [VideoLLaMA2](https://huggingface.co/papers/2406.07476) from Alibaba DAMO Academy. * [model] Add VideoLLaMA3 implementation by @lkhl in #40499 ### AudioFlamingo 3 <img width="621" height="475" alt="image" src="https://github.com/user-attachments/assets/c9616758-b3aa-41d0-bd58-695966ba146d" /> Audio Flamingo 3 (AF3) is a fully open large audio–language model designed for robust understanding and reasoning over speech, environmental sounds, and music. AF3 pairs a Whisper-style audio encoder with a causal language model and performs replace-in-place audio–text fusion: the processor aligns post-pool audio frames to a dedicated placeholder token and the model replaces those token slots with projected audio embeddings during the forward pass. The model checkpoint is available at: [nvidia/audio-flamingo-3-hf](https://huggingface.co/nvidia/audio-flamingo-3-hf) Highlights: - Unified audio encoder across speech, sound, and music. - Long-audio support via windowing and post-pool alignment (up to 10 minutes maximum). The model processes audio in 30-second windows with a hard limit of 20 windows (10 minutes total). Audio longer than 10 minutes will be truncated. - Deterministic fusion that preserves sequence length by replacing audio placeholder tokens with audio embeddings. * [models] Add AudioFlamingo3 integration by @lashahub in #40290 ### Nanochat [NanoChat](https://huggingface.co/karpathy/nanochat-d32) is a compact decoder-only transformer model designed for educational purposes and efficient training. The model features several fundamental architectural innovations which are common in modern transformer models. Therefore, it is a good model to use as a starting point to understand the principles of modern transformer models. NanoChat is a variant of the [Llama](https://huggingface.co/docs/transformers/en/model_doc/llama) architecture, with simplified attention mechanism and normalization layers. * [MODEL] Nanochat implementation by @burtenshaw in #41634 ## Bugfixes and improvements * `JetMoe` Fix jetmoe after #40132 by @ArthurZucker in #41324 * Fixed tiny incorrect import in `gemma3` by @Sai-Suraj-27 in #41354 * Rope for Qwen2--5-vl by @zucchini-nlp in #41173 * 🚨 Bump to Python 3.10 and rework how we check 3rd-party libraries existence by @Cyrilvallez in #41268 * Standardize `PretrainedConfig` to `PreTrainedConfig` by @Cyrilvallez in #41300 * Fix trainer for py3.9 by @SunMarc in #41359 * Check model inputs - hidden states by @zucchini-nlp in #40994 * [`ModularChecker`] QOL for the modular checker by @ArthurZucker in #41361 * Fixing a typo for BLT model by @Narsil in #41325 * :rotating_light: [`v5`] Remove relative position embeddings (for bert like models) by @vasqu in #41170 * Fix typo in model proposal template by @Ombucha in #41352 * Better typehints for `apply_chat_template` by @Samoed in #41355 * 🚨 Remove BetterTransformer by @Cyrilvallez in #41367 * [testing] update `test_longcat_generation_cpu` by @ydshieh in #41368 * Fix flash_attention.py: wrong argument passing for attn_implementation by @TKONIY in #41347 * Use canonical get_size_with_aspect_ratio (with max_size) from transformers.image_transforms to fix #37939 by @sonianuj287 in #41284 * Fixes in check_model_inputs, GPTBigCodeModel and ImageGPTModel by @IlyasMoutawwakil in #40811 * Remove unnecessary list comprehension by @cyyever in #41305 * make some ut cases pass on xpu w/ latest torch by @yao-matrix in #41337 * Remove unused function patameters by @cyyever in #41358 * [`CB`] Refactors the way we access paged by @ArthurZucker in #41370 * serve: add non-streaming mode to /v1/responses; stream event parity; remove placeholder logprobs by @antznette1 in #41353 * Update from pretrained error when loading by @ArthurZucker in #33380 * [`v5`] Sync Bert and Bart eager attention by @vasqu in #41248 * fix asr ut failures by @yao-matrix in #41332 * fix resample in asr pipeline by @yhzx233 in #41298 * Correct numerical regression in vision embeddings by @i3hz in #41374 * [kernels] Kernel Config by @MekkCyber in #41232 * [Cache] lfm2 cache: allocate empty kv layers during init by @paulpak58 in #41396 * Fix test for model with dotted name and relative imports by @st81 in #41343 * Prefer raising `TypeError` exception for invalid type by @Sai-Suraj-27 in #41346 * [v5] Bump accelerate to 1.1.0 by @SunMarc in #41234 * Fix incorrect assignment in `update_device_map` for GPTQ quantizer by @Sai-Suraj-27 in #41328 * [v5] Delete left traces of feature extractor by @zucchini-nlp in #41321 * Remove deprecation warning by @Cyrilvallez in #41425 * Fix overriding common_kwargs defaults in processor calls by @yonigozlan in #41381 * v5 dev version by @LysandreJik in #41436 * Tiny Cleanup - Removed duplicate class field definition's by @Sai-Suraj-27 in #41293 * 🚨🚨 Remove all traces of legacy cache format by @Cyrilvallez in #41378 * 🚨 [v5] Prune `prune_heads` by @gante in #41417 * [v5] Bump min version of bitsandbytes to 0.46.1 by @SunMarc in #41283 * Fixing comments in __init__ file by @MekkCyber in #41414 * Use accelerator API to free device memory by @cyyever in #41195 * enable new model uts to xpu and fix some failures on xpu by @yao-matrix in #41386 * [torchao] Add regex support for ModuleFqnToConfig by @jerryzh168 in #41242 * :facepalm: CB nit! by @ArthurZucker in #41413 * Remove Python 3.9 classifier by @cyyever in #41410 * [`JetMoe`] Fix KV head repetition and padding free by @vasqu in #41423 * [testing] Fix `JetMoeIntegrationTest` by @ydshieh in #41377 * Add Top-H decoding (entropy-bounded truncation) as a LogitsWarper for text generation by @ErfanBaghaei in #40837 * Validate processing kwargs with @strict from huggingface_hub by @zucchini-nlp in #40793 * Update hqq.md by @prathamesh-chavan-22 in #41452 * enable some falcon-mamba uts on xpu by @yao-matrix in #41428 * Fix generate outputs and simplify cache tests by @Cyrilvallez in #41440 * Fix doc by @Cyrilvallez in #41457 * 🚨 [v5] Rename left traces of `past_key_value` in BERT-like models by @zucchini-nlp in #41448 * Subconfig is a class attribute by @zucchini-nlp in #41308 * [v5] rm `utils/tf_ops/` by @gante in #41402 * Update GLM-4.1V MMRope implementation by @zRzRzRzRzRzRzR in #41182 * [kernels] Cleanup deta kernel by @MekkCyber in #41470 * 🚨 [v5] Rendundant code in nested configs by @zucchini-nlp in #41314 * Remove KERAS_NLP_IMPORT_ERROR by @cyyever in #41468 * Fix auto model configuration for encoder of perceptionlm by @fschlatt in #41464 * Fix tests fsdp by @SunMarc in #41422 * Import Callable from collections.abc by @cyyever in #41130 * Pickle - part 2 by @ydshieh in #41476 * Remove infer_device by @cyyever in #41088 * Change RT-Detr docs to reflect fixed 640x640 input size by @konstantinos-p in #41364 * Cleaning hub kernels by @MekkCyber in #41477 * [v5] remove load_in_4bit and load_in_8bit by @SunMarc in #41287 * :rotating_light: [`Attention Masks`] Bidirectional masks for encoder and encoder-decoder models by @vasqu in #41265 * [Fix] Fix test file error by @YangKai0616 in #40973 * enhance patched_tearDown to support python 3.11+ by @yao-matrix in #41429 * RT-Detr correct 2d positional embeddings for non-square images by @konstantinos-p in #41380 * Fix bnb fsdp loading for pre-quantized checkpoint by @SunMarc in #41415 * Remove SigOpt by @SunMarc in #41479 * Remove `past_index` by @SunMarc in #41384 * Remove deprecated args in Trainer for v5 by @SunMarc in #41404 * Update GLM-4.6 doc by @zRzRzRzRzRzRzR in #41471 * `report_to` default changed to "none" + cleaning deprecated env var by @SunMarc in #41375 * deprecate `overwrite_output_dir` by @SunMarc in #41323 * [`CI`] Fix copies on main by @vasqu in #41486 * [Trainer] deprecate ray scope by @SunMarc in #41403 * deprecate `jit_mode_eval` by @SunMarc in #41376 * Remove `local_rank` arg from `TrainingArguments` by @SunMarc in #41382 * Update philosophy by @molbap in #41438 * Remove DISABLE_KERNEL_MAPPING flag by @MekkCyber in #41475 * Streaming should be handled at the request-level rather than at the istance level by @LysandreJik in #41444 * fix bnb model loading by @jiqing-feng in #41499 * [kernels] Remove RWKV kernel finally ! by @MekkCyber in #41493 * [kernels] rm yoso kernel by @MekkCyber in #41495 * Try to remove `pickle` - `BloomTokenizerFast` by @ydshieh in #41466 * Fixed tiny incorrect imports in `glm4v` by @Sai-Suraj-27 in #41483 * [Parakeet] unnecessary warning & auto mapping by @eustlb in #41412 * [causallm tester] automate pipeline mappings + bloom tests by @gante in #41318 * Fix some tests by @Cyrilvallez in #41503 * fix gemma3n case failure by @yao-matrix in #41426 * [voxtral] language detection + skipping lang:xx by @eustlb in #41225 * Set `truncation` to `False` in Qwen3Omni to avoid default truncation by @BakerBunker in #41473 * [QoL] modular conversion shows LoC saved by @molbap in #41500 * More trainer cleaning by @SunMarc in #41489 * Bump to hfh 1.0.0.rc5 to fix test by @Wauplin in #41508 * Revert `local_rank` deletion and some cleaning by @SunMarc in #41504 * Fix detectron2 import by @Cyrilvallez in #41510 * add Trainer import to .md in appropriate cell block for training.ipynb transformers_doc by @benkeene in #41484 * Remove outdated flags by @Cyrilvallez in #41512 * remove `tpu_num_cores` by @SunMarc in #41383 * Allow optuna's catch kwargs passthrough by @nicha-api in #41496 * Fix Latex typesetting in documentation by @cyyever in #41177 * [testing] reduce runtime of `HunYuanMoEV1IntegrationTest:test_model_generation` by @ydshieh in #41373 * [Qwen3VL] fix: hidden_states in place modification error by @HollowMan6 in #41535 * Add MLlama fast image processor by @yonigozlan in #41391 * Fixed Type-hints in function defintions by @Sai-Suraj-27 in #41525 * [SAM] Fix typing hints by @zucchini-nlp in #41506 * Restore cuda graphs to continuous batching by @remi-or in #41421 * Add AMD developer cloud support by @fan-amd in #41126 * Enable modular files from other libraries by @regisss in #41372 * 🚨 [v5] `generate` delegates default cache initialization to the model by @gante in #41505 * Fixed typos and formatting by @julian-st in #34215 * Add VideoMAE video processor by @Aki-07 in #41534 * [`from_pretrained`] Small refactor `from_pretrained`: move around unrelated stuff by @ArthurZucker in #41445 * Remove references to AutoModelForVision2Seq by @Rocketknight1 in #41513 * [Qwen3VL] fix device mismatch error for FSDP2 training by @HollowMan6 in #41536 * Patch MistralCommonTokenizer by @juliendenize in #41439 * Fix an import error with PreTrainModel by @remi-or in #41571 * [Qwen3VLMoe] Fixed: Expected self.dtype to be equal to src.dtype - routing_weights casting by @danielquintas8 in #41420 * [kernels] rm mra kernels by @MekkCyber in #41507 * delete some tokenizer tests using pickle by @ydshieh in #41514 * Add DINOv3Backbone for ConvNext variant by @merveenoyan in #40651 * Add conditional checks to _check_and_adjust_attn_implementation() by @zheliuyu in #41542 * add rmsnorm kernels support for Intel XPU by @kaixuanliu in #41563 * Revert "add rmsnorm kernels support for Intel XPU" by @MekkCyber in #41579 * [VisionEncoderDecoderModel] Update loss function by @NielsRogge in #40863 * Add __iter__ to DynamicCache by @remi-or in #41569 * Revert some breaking changes bnb by @SunMarc in #41581 * Fix typsetting and content of llm_tutorial_optimization.md by @cyyever in #41172 * Gemma3 fixes by @remi-or in #41572 * Benchmark overhaul by @remi-or in #41408 * Enable non-streaming mode in `transformers serve` by @LysandreJik in #41446 * [device_map] Accelerate loading by computing device_map much faster by @Cyrilvallez in #41548 * Add `logits_to_keep` to many older CausalLM models by @philiproeleveld in #41335 * fix some case failures lead by "`torch.compile` recompiled part of th… by @sywangyi in #41558 * remove ray_scope and check_quantized_param by @SunMarc in #41587 * Update issue template by @SunMarc in #41573 * [`Docs`] Fix changed references by @vasqu in #41614 * Import `expand_device_map` instead of redefining it by @Cyrilvallez in #41608 * Fix trainer simple tests by @SunMarc in #41449 * More markdown file fixes by @cyyever in #41599 * torch 2.9 don't ❤️ torchcodec 💔 by @ydshieh in #41610 * Update a dataset reop link by @ydshieh in #41618 * Add fast path for bidirectional mask creation to fix regression by @i3hz in #41586 * enable sdpa enable gqa logic for Ascend NPU by @FightingZhen in #41601 * Fix video processing channel format by @zucchini-nlp in #41603 * [chat template] update when "push_to_hub" by @zucchini-nlp in #39815 * Remove the head masking block in some vision models by @ydshieh in #41620 * Remove deprecated code by @SunMarc in #41616 * Fix quantization base class by @SunMarc in #41613 * [docs] Duplicate entry by @stevhliu in #41591 * Update executorch.md by @jackzhxng in #41582 * Add Backbone API fine-tuning tutorial by @merveenoyan in #41590 * 🚨 [v5] Toggle the serialization format in processors by @zucchini-nlp in #41474 * Add aux loss for GLM-4.5V by @zRzRzRzRzRzRzR in #41564 * Allow passing `tp_plan` in `from_pretrained` directly by @Cyrilvallez in #41435 * Fix tokenization test by @Cyrilvallez in #41649 * Remove randomly added script by @Cyrilvallez in #41650 * Add missing dates to docs by @yonigozlan in #41576 * Migrate transformers cli to Typer by @Wauplin in #41487 * Fix FP-Quant quantization fallback CPU dispatch. by @BlackSamorez in #41619 * fix check inputs for text2text pipeline by @jiqing-feng in #41556 * [`Executorch`] Simplify for encoder models by @vasqu in #41627 * [`Ernie 4.5 Moe`] Fix Moe and offloading by @vasqu in #41385 * [CI] Build translated docs by @stevhliu in #41632 * Fix fp32_ln for various models by @remi-or in #41605 * Adjust device logging level and add minor fixes by @mario-koddenbrock in #41636 * Fix EncoderDecoder cache by @remi-or in #41612 * Format MarkDown documentation and tiny fixes by @cyyever in #41638 * Fix typos in documentation by @cyyever in #41641 * Fix confusing cls assignment by @cyyever in #41642 * Double router compute? by @molbap in #41653 * [kernels] refactor function kernel calling by @MekkCyber in #41577 * [Fix] Deepseek V3 expert bias routing by @fjosw in #41647 * purge HF_HUB_ENABLE_HF_TRANSFER; promote Xet by @Vaibhavs10 in #41656 * [`Masks`] Fix mask handling in eager for vision models by @vasqu in #41625 * Use | for Optional and Union typing by @cyyever in #41646 * Switch to CB if cache_implementation == paged by @remi-or in #41655 * Add in-out modalities as class attribute per model by @zucchini-nlp in #41366 * Fix dtype casting with quantization by @Cyrilvallez in #41665 * Fix serving continuous batching by @SunMarc in #41624 * Small changes to benchmarking script by @remi-or in #41662 * Improve package version check by @Cyrilvallez in #41661 * improve `utils/check_bad_commit.py` by @ydshieh in #41658 * Erroring when KernelConfig is passed without use_kernels = True by @MekkCyber in #41657 * [Trainer] [Breaking change] `use_cache` default to `False` by @SunMarc in #41585 * 🌐 [i18n-KO] Translated `chat_extras.md` to Korean by @Judy-Choi in #39863 * 🌐 [i18n-KO] Translated sam_hq.md to Korean by @HyunZ118 in #41340 * [i18n-KO] Translated `big_bird.md` to Korean by @ssum21 in #40445 * 🌐 [i18n-KO] Translated `code_llama.md` to Korean by @Judy-Choi in #40558 * 🌐 [i18n-KO] Translated llama4.md to Korean by @TaskerJang in #40396 * :globe_with_meridians: [i18n-KO] Translated `ko-LFM2.md` to Korean by @ssum21 in #41502 * Adding superglue fast image processing by @AlphaOrOmega in #41394 * Fix ckpt in docs by @zucchini-nlp in #41659 * torch 2.9 still don't ❤️ torchcodec 0.8 💔 by @ydshieh in #41686 * Remove deprecated `use_auth_token` parameter by @Wauplin in #41666 * Remove require_torch_bf16_gpu by @cyyever in #40979 * path validation for security reason by @ydshieh in #41256 * 🚨 Remove torchscript support by @Cyrilvallez in #41688 * Fix MarkDown syntax by @cyyever in #41676 * Use | for Optional and Union typing by @cyyever in #41675 * 🚨 [v5] Refactor RoPE for layer types by @zucchini-nlp in #39847 * Enable faiss-cpu on Windows by @cyyever in #41678 * Fix Pylint warnings by @cyyever in #41644 * 🚨 Remove torch.fx support by @Cyrilvallez in #41683 * Remove skipped tests without parents by @Cyrilvallez in #41691 * Enable FURB rules in ruff by @cyyever in #41395 * Remove upper version bound of pandas by @cyyever in #41677 * [`Attn`] Allow dynamic causality in SDPA via Kwargs by @vasqu in #41692 * Simplify GQA conditions in sdpa_attention.py by @justinchuby in #41699 * [docs] Manual tp-plan by @stevhliu in #41674 * 🌐 [i18n-KO] Translated gemma3n.md to Korean by @HyunZ118 in #40873 * pin torchcodec on CI docker image by @ydshieh in #41703 * Update `run_name` docs in TrainingArguments by @tobiasofsn in #41705 * further improve `utils/check_bad_commit.py` by @ydshieh in #41658) * feat: add benchmark v2 ci with results pushed to dataset by @McPatate in #41672 * Gemma3 conversion script maintenance by @RyanMullins in #41704 * Fix Qwen3-Omni inference when mixing video and image inputs in one batch by @BakerBunker in #41741 * Fix typo in LFM-VL by @zucchini-nlp in #41742 * Revert "Remove upper version bound of pandas" by @ydshieh in #41744 * [doc] remove broken notebooks on AMD Dev Cloud by @pagezyhf in #41743 * Update type hints in tokenization_utils.py to use | syntax by @faizan842 in #41713 * Fix documentation issues by @cyyever in #41726 * Apply RUFF PIE rules by @cyyever in #41727 * Small Fix for imports by @MekkCyber in #41411 * Docs(zh-hans): Refine wording for professionalism in README by @Ri-Nai in #40943 * Add vision contribution guide by @molbap in #41456 * upgrade xpu docker file to torch 2.8 by @yao-matrix in #41551 * [v5] Delete `videos` from image processing classes by @zucchini-nlp in #41607 * Fixed incorrect model_type for qwen2vl and qwen2.5vl when config is saved and loaded again by @i3hz in #41758 * [kernels] Add version to function mapping by @MekkCyber in #41685 * Reduce warning noise caused by Tensor.new_tensor by @st81 in #41748 * Fix graphormer model compilation with Cython 3.1.4 by @alexmalyshev in #41671 * Update type hints in modeling_rope_utils.py to use | syntax by @faizan842 in #41714 * [v5] Remove deprecated tranformers.onnx by @echarlaix in #41700 * Modernize CLIP modeling code by @molbap in #41546 * Simplify pipeline padding logic by @Rocketknight1 in #41667 * Chat response parsing by @Rocketknight1 in #40894 * Add LightGlue fast image processor by @yonigozlan in #41670 * Fix bark after #41445 by @ydshieh in #41645 * Remove invalid `@staticmethod` from module-level get_device_and_memory_breakdown by @albertvillanova in #41747 * Fix CUDA index out of bounds for q_idx in VLM token type masking for Gemma3, PaliGemma, and example modular by @albertvillanova in #41757 * fix: Gemma 3 weights conversion vision and multimodal projector paths by @RyanMullins in #41767 * [v5] Delete legacy chat template saving by @zucchini-nlp in #41648 * [quantization] fix compressed_tensors tests by @MekkCyber in #41780 * [quantization] Skip Fp8 tests when hardware capability < 8.9 by @MekkCyber in #41785 * Swap columns and rows of the grid layout in LFM2-VL by @ankke in #41755 * fix type annotation typo in docstring by @johntheprime in #41788 * Fix chat schema tests by @Rocketknight1 in #41793 * Fix attention mask in mamba layers by @zucchini-nlp in #41790 * [quantization] fix torchao tests after 0.14.0 release by @MekkCyber in #41777 * [`Onnx docs`] Remove some traces by @vasqu in #41791 * flash attn pytest marker by @ydshieh in #41781 * Bump AMD docker by @remi-or in #41792 * make apollo test case pass by @yao-matrix in #41805 * Add a safeguard around a flaky test in gemma2 by @remi-or in #41811 * Fix Qwen3Next dtype API usage by @SrijanUpadhyay in #41735 * [Trainer] remove env vars by @SunMarc in #41697 * Fixed grammar mistakes by @FrogWarlord in #41799 * Fixed some grammar mistakes by @FrogWarlord in #41802 * transformers cli default flag fix by @ArjunPimpale in #41761 * Deprecate warmup_ratio by @SunMarc in #41326 * transformers serve quantization docs + some api fixes for bitsandbytes by @SunMarc in #41253 * [Parakeet] add output_attention_mask by @eustlb in #41694 * unpin torch/torchcodec for CircleCI by @ydshieh in #41839 * extend bitnet cases to xpu, all 8 cases pass by @yao-matrix in #41831 * extend 2 trainer test cases to xpu by @yao-matrix in #41829 * extend 2 blip2 and falcon_h1 test cases to xpu by @yao-matrix in #41825 * further reducing flakiness in `utils/check_bad_commit.py` by @ydshieh in #41658) * Remove redundant code from Qwen3VLProcessor by @Xqle in #41836 * Fix MXFP4 quantizer to support variable num_local_experts and hidden_size by @marksverdhei in #41795 * Fix Qwen2Audio flash attention mask format for generation by @Abdennacer-Badaoui in #41843 * Fix const parsing for dict inputs in chat schemas by @Rocketknight1 in #41824 * Share embedding modules in BART, not only weights by @githubnemo in #41821 * Fix TypeError: find_adapter_config_file() got an unexpected keyword argument '_adapter_model_path' by @albertvillanova in #41604 * :rotating_light: [`Clip`] Fix masking and enable flash attention on all model types by @vasqu in #41750 * CI workflow for Flash Attn by @ydshieh in #41857 * Fix torch.no_grad decorator in VLMS by @yaswanth19 in #41888 * Fix installation cmds in docs by @yaswanth19 in #41887 * revert changes in _is_package_available by @MekkCyber in #41891 * make lfm2_moe integration test pass on XPU by @yao-matrix in #41796 * Fix: avoid duplicate token in maybe_load_adapters by @luaenrique in #41903 * speed up loading checkpoints for zero stage 3 by @ri938 in #41850 * evaluate>=0.4.6 is needed by @stas00 in #41920 * Add 6 huggingface notebooks on AMD dev cloud by @fan-amd in #41883 * Fix invalid examples in QwenVL model docstrings and add Qwen3VL example by @Xqle in #41812 * Allow parse_response to accept token IDs by @Rocketknight1 in #41849 * Fix Florence2 conversion script model_type KeyError by @i3hz in #41866 * Update some workflow files by @ydshieh in #41892 * fix some ut failures on XPU w/ torch 2.9 by @yao-matrix in #41923 * Cache latest pytorch amd image locally on mi325 CI runner cluster by @jitesh-gupta in #41926 * Minor fix in docker image build workflow by @ydshieh in #41949 * fix some ut failures on XPU w/ torch 2.9 by @yao-matrix in #41941 * Fix rope_parameters for gemma3 weights conversion script by @douglas-reid in #41922 * Fix: Gemma3TextConfig rope scaling assignments by @RyanMullins in #41934 * fix prepare_config_and_inputs_for_common bug in llava test by @yao-matrix in #41942 * Fix: prevent .gitignore truncation in run_clm_no_trainer.py by @luaenrique in #41957 * V4.57.1 training ci: Refactor `test_tensor_parallel.py` by @3outeille in #41918 * [v5] Return a BatchEncoding dict from apply_chat_template by default by @Rocketknight1 in #41626 * make recurrent_gemma and voxtral cases pass on xpu by @yao-matrix in #41958 * Fix typo in image_processing_lfm2_vl_fast by @yonigozlan in #41940 * Run slow v2 by @ydshieh in #41914 * Fix `detectron2` installation in docker files by @ydshieh in #41975 * Fix `autoawq[kernels]` installation in quantization docker file by @ydshieh in #41978 * add support for saving encoder only so any parakeet model can be loaded for inference by @nithinraok in #41969 * Use indices as position_ids in modernebert by @remi-or in #41789 * test tensor parallel: make tests for dense model more robust by @3outeille in #41968 * fix: dict[RopeParameters] to dict[str, RopeParameters] by @RyanMullins in #41963 * docs: add continuous batching page by @McPatate in #41847 * Fix `torchcodec` version in quantization docker file by @ydshieh in #41988 * [kernels] Add Tests & CI for kernels by @MekkCyber in #41765 * Move the Mi355 to regular docker by @remi-or in #41989 * More data in benchmarking by @remi-or in #41848 * fix (CI): Refactor SSH runners by @glegendre01 in #41991 * fix 3 failed test cases for video_llama_3 model on Intel XPU by @kaixuanliu in #41931 * Integrate colqwen2.5 using colqwen2 modelling code by @sahil-kabir in #40600 * Fixed wrong padding value in OWLv2 by @gjamesgoenawan in #41938 * Fix `run slow v2`: empty report when there is only one model by @ydshieh in #42002 * [kernels] change import time in KernelConfig by @MekkCyber in #42004 * DOC Fix typo in argument name: pseudoquant by @BenjaminBossan in #41994 * Fix `torch+deepspeed` docker file by @ydshieh in #41985 * Correct syntax error in trainer.md by @Yacklin in #42001 * Reduce the number of benchmark in the CI by @remi-or in #42008 * Fix continuous batching tests by @Rocketknight1 in #42012 * add back `logging_dir` by @SunMarc in #42013 * Fix issue with from pretrained and kwargs in image processors by @yonigozlan in #41997 * Fix default image_rows and image_cols initialization in Idefics3 and SmolVLM processors by @MilkClouds in #41871 * Add GLPNImageProcessorFast by @Aravind-11 in #41725 * add fuyu fast image processors by @DeXtAr47-oss in #41817 * [kernels] Fix XPU layernorm kernel by @MekkCyber in #41583 * [v5] Deprecate Text2Text and related pipelines by @Rocketknight1 in #41996 * [FPQuant] MXFP8 and MXFP4 backwards support by @BlackSamorez in #41897 * fix `deeepspeed` in AMD docker file by @ydshieh in #42025 * CodeQL workflow for security analysis by @paulinebm in #42015 * [tests] Add Context-parallel CI tests by @kashif in #41860 * extend fp_quant cases to xpu by @yao-matrix in #41833 * Change trigger time for AMD CI by @ydshieh in #42034 * Fix the order of methods in processor loading by @zucchini-nlp in #42031 * 🔴 Isolate prefill from generation loops by @manueldeprada in #40652 * update `huggingface_hub` dependency version by @hanouticelina in #42033 * Remove some custom datasets defined in codebase by @ydshieh in #41511 * Cleanup workflow - part 1 by @ydshieh in #42023 * Fix `pr_slow_ci_suggestion.yml` after #42023 by @ydshieh in #42049 * Fix AutoImageProcessor.register and documentation in auto processing modules by @MilkClouds in #41864 * Fix Qwen3-Omni RoPE by @zucchini-nlp in #41778 * Avoid explicit checkout in workflow by @ydshieh in #42057 * Annoying typo in attention error message by @manueldeprada in #42037 * Be careful at explicit checkout actions by @ydshieh in #42060 * Fix another `Argument list too long` in `pr_slow_ci_suggestion.yml` by @ydshieh in #42061 * Fix KeyError in GPT-OSS weight conversion script by @Aznix07 in #42007 * Fix KeyError in _is_package_available for packages with dotted names by @yashwantbezawada in #42050 * Revert back to use GitHub context by @ydshieh in #42066 * Fix missing arg in check_docstring by @yonigozlan in #42054 * [deepspeed tests fixes] by @stas00 in #41925 * Fix logic in setting self.fsdp when it is False by @roychan in #41974 * fix tensor device placement issue of 2 UT cases by @yao-matrix in #41921 * add workflow to check permissions and advise a set of permissions req… by @paulinebm in #42071 * Fix security issue 5 by @paulinebm in #42072 * Fix inconsistency of commit sha during the workflow run by @ydshieh in #42074 * QwenVL: add skipped keys in `setattr` as well by @zucchini-nlp in #41808 * permissions worflows fix by @paulinebm in #42080 * 4.1V Model and GLM-4.5V Model Conversion Code Updates by @zRzRzRzRzRzRzR in #41784 * feat(ci): add continuous batching to benchmarks by @McPatate in #41916 * Fix modular docstring for Mixtral by @diegoakel in #42041 * Fix Auto classes to support dynamically registered processors by @MilkClouds in #41865 * Reinstate self.scaling in Gemma3nTextAttention by @RyanMullins in #41751 * [v5] 🚨Refactor subprocessors handling in processors by @yonigozlan in #41633 * add xpu support in test_modeling_janus.py::JanusIntegrationTest::test… by @sywangyi in #41986 * Revert "permissions worflows fix" by @ydshieh in #42110 * Fix return metadata checking logic by @Xqle in #42108 * Correctly handle unbatched audio inputs in Gemma3nAudioFeatureExtractor by @kho in #42076 * [Bugfix] fix qwen3vl expand generation with video by @JJJYmmm in #42089 * Fix base model prefix in VLMs by @zucchini-nlp in #42059 * fix continuous batching issues, extend ut cases to xpu by @yao-matrix in #41830 * 📝 docs(smolvlm): fix variable name in batch inference example by @gorkachea in #42123 * fix qwen2vl/qwen3vl video processor temporal padding when num_frames%temporal_patch_size!=1 by @yaogang2060 in #42083 * [`Attn Masks`] Non-vmap default for attention masks by @vasqu in #41852 * Fix GPT-2 Flash Attention 2 generation with left-padding by @Abdennacer-Badaoui in #41966 * Fix model name test for compressed tensors by @SunMarc in #42128 * Fix MaskFormer/Mask2Former fast image processors by @yonigozlan in #41393 * Remove unused functions in `image_transforms.py` by @yaswanth19 in #42044 * update deps table by @ArthurZucker in #42120 * fix: improve video processing fps assignment logic by @Xqle in #42009 * Fix T5Gemma module structure by @Cyrilvallez in #42145 * DataCollatorForLanguageModeling warning error fixed by @mjaliz in #42144 * Bugfix/remove emojis from print by @7amim in #42091 * Avoid mutating user-provided arguments in preprocessing utils by @LeonardoEmili in #42126 * Enforce check_auto_docstring by @yonigozlan in #41635 * Add dinov3 autobackbone by @vijayabhaskar-ev in #41276 * Fix logic error in `prepare_inputs_for_generation` cache slicing condition by @albertvillanova in #41764 * :rotating_light: Fix gradient checkpointing for several models and improve test robustness by @githubnemo in #41818 * [`T5Gemma`] Fix cross attention cache by @vasqu in #41890 * T5 migration to new masking interface by @Aravind-11 in #41804 * fix: improve visibility of ValueError root causes in model config loading by @scottzh8 in #41972 * add xpu to valid hardware for torch.compile by @sywangyi in #42079 * extend test_beam_search_early_stop_heuristic case to other device by @sywangyi in #42078 * fix failure of tests/models/shieldgemma2/test_modeling_shieldgemma2.p… by @sywangyi in #42022 * Fixes Flash Attention implementation for models by @i3hz in #42149 * fix test failure of speculative_generation on xpu by @sywangyi in #42052 * add rmsnorm kernels support for npu by @zheliuyu in #42106 * update torchao doc by @jiqing-feng in #42139 * feat(kernels): add opt-out flag to disable kernels hub usage through the lib by @mfuntowicz in #41990 * handle inputs from Siglip/Siglip2 non-automapped encoder layers by @molbap in #41930 * Add slow to some examples tests by @SunMarc in #42164 * fix(ci): unexpected keyword argument `streaming` by @McPatate in #42102 * pin `pytest<9` for now by @ydshieh in #42162 * Docs/i18n updates by @lilin-1 in #42006 * Fix in-place modification of user-input in SAM2 embed boxes by @xenova in #42173 * [`Pop2Piano`] Fix cache usage by @vasqu in #42170 * Fix helper fn for new processor config format by @zucchini-nlp in #42085 * Remove unnecessary slicing in sdpa_attention_forward by @justinchuby in #41900 * [`PEFT`] Fix prefix tuning by @vasqu in #41696 * [typo] fix mrope-interleave annotation to avoid ambiguity by @JJJYmmm in #42177 * Update transformers to support `FqnToConfig` by @jcaip in #41894 * [`PEFT`] Fix the general test for prefix tuning by @vasqu in #42185 * [TP] Fix parameter detection issue and some invalid TP-plans by @Cyrilvallez in #42129 * Refactor weight loading by @ArthurZucker in #41580 * 🚨 Delete deprecations with end-cycle in v4.xx and v5.0 by @zucchini-nlp in #41681 * Add AutoTokenizer mapping for mistral3 and ministral by @patrickvonplaten in #42198 * Fix checkpoint loading with DeepSpeed ZeRO3 by @tohtana in #42201 * [`Pop2Piano`] Fix tied weights by @vasqu in #42193 * New docker from AMD by @remi-or in #42208 * Add cross links for model contribution by @zucchini-nlp in #42207 * Stop inheriting tests! by @Rocketknight1 in #42192 * Refactor check_auto_docstring using AST by @yonigozlan in #41432 * [`BLT`] Fix cache usage by @vasqu in #42188 * Update `test_dynamic_cache_exportability_multiple_run` (failing on torch 2.10 nightly) by @ydshieh in #42212 * Much more efficient and clear weight initialization and tie weights by @Cyrilvallez in #42191 * GLM-V update with new processor by @zRzRzRzRzRzRzR in #42122 * Fix initialization guard for pytest by @Cyrilvallez in #42234 * Fix TP plans for MoE models by @Cyrilvallez in #42236 * Add prefix sharing to continuous batching by @remi-or in #42094 * Loading optimization by @Cyrilvallez in #42239 * calls `AttentionMaskConverter._unmask_unattended` for xpu device before by @kaixuanliu in #42230 * FIX Broken PEFT adapter loading by @BenjaminBossan in #42187 * Fix processor test for glm by @molbap in #42233 * Fix UnboundLocalError in RT-DETR loss computation by @yashwantbezawada in #42224 * Stop inheriting tests (again) by @Rocketknight1 in #42247 * [loading] Fix device when source and target are different by @Cyrilvallez in #42246 * Reduce timing on CircleCI - part 1 (Use @slow for IntegrationTests) by @ydshieh in #42206 * 🚨 Delete generation params from model config by @zucchini-nlp in #41695 * Allow VLMs to have a correct `base_model` by @zucchini-nlp in #41589 * Make tests run in less time by reducing `batch_size` by @ydshieh in #42213 * Revert "Make tests run in less time by reducing `batch_size`" by @ydshieh in #42258 * Cleanup reference to TFBertTokenizer and TFGPT2Tokenizer by @Rocketknight1 in #42182 * delete already deprecated models by @ydshieh in #42235 * Fix bnb for the weights refactor by @SunMarc in #42043 * Fix looping in torch guard decorator by @Cyrilvallez in #42260 * 🚨 Generalize `get_decoder()` for multimodal and delete redundant code 🔪 by @zucchini-nlp in #42156 * Audio Flamingo3 - fix attention masking by @zucchini-nlp in #42278 * Add support for torch device objects in device validator by @yonigozlan in #42267 * Remove doc files of other langs for deleted models by @ydshieh in #42276 * [testing] fix `cwm` by @ydshieh in #42261 * fix a typo: pbd -> pdb by @jaeminoh in #42268 * Enable glm46v UTs on XPU by @YangKai0616 in #42274 * [testing] fix some cases in xpu by @sywangyi in #42273 * Remove random flag by @Cyrilvallez in #42282 * Fix accelerate integration by @Cyrilvallez in #42264 * Fix validation checks order in benchmark_v2 by @Abdennacer-Badaoui in #42280 * Update torchcodec to match torchaudio version by @remi-or in #42288 * Use `torch.get_autocast_dtype` instead of `torch.get_autocast_gpu_dtype` by @qgallouedec in #42055 * perf: Optimization for Min-p sampling implementation by @casinca in #42248 * Fix device_map computation part 2 by @Cyrilvallez in #42290 * Fixed the docstring for `WhisperFeatureExtractor` by @TopCoder2K in #42286 * avoiding conditional indexing in positionalencoding to avoid possibil… by @ppadjinTT in #42090 * ENH: Add support for LoRA hotswapping by @BenjaminBossan in #41297 * Fix Break change of AWQ FusedModules due to Attention Refactor by @fanqiNO1 in #41909 * Remove error string test that was failing by @Rocketknight1 in #42301 * Properly protect the is_compiling checks by @Cyrilvallez in #42304 * Remove outdated methods in modeling_utils.py by @Cyrilvallez in #42302 * Fix Mac mps dataloader_num_workers > 1 causes RuntimeError: _share_filename_: only available on CPU by @AmitMY in #38819 * Fix the init_weights for the MoE models by @Cyrilvallez in #42306 * Update link to generation strategies documentation by @omkar-334 in #42252 * Update conversion mapping to separate renaming from converting by @ArthurZucker in #42254 * fix(granitemoe*): Only create block_sparse_moe if num_local_experts > 0 by @gabe-l-hart in #42036 * [SAM3 Video] Add support for multi prompts by @yonigozlan in #42293 * Add Pix2Struct fast image processor by @yonigozlan in #42020 * Fix post processing methods in keypoints matching models by @yonigozlan in #42018 * fix tests/models/xcodec/test_modeling_xcodec.py::XcodecIntegrationTest by @sywangyi in #42272 * [loading] Fix device detection by @Cyrilvallez in #42323 * Fix typo from side_dict to size_dict by @nihui in #42319 * HF Trainer: ALST/Ulysses sequence parallelism integration via HF Accelerate by @stas00 in #41832 * Fix gpt2 modeling tests by @Abdennacer-Badaoui in #42321 * [loading] Use fewer threads by default for much better performances by @Cyrilvallez in #42324 * Allow LayoutLMV3Processor to accept rescale_factor by @Rocketknight1 in #42305 * Correctly create tied key mapping in post_init, and dynamic tie weight by @Cyrilvallez in #42270 * [`CI`] Skip `EfficientLoFTR` test by @vasqu in #42327 * [XPU] Add flash_attn2 support for XPU by @YangKai0616 in #41956 * [`Attn Masks`] Lift bidirectional mask restriction on eager by @vasqu in #42325 * fix bug when gemma3n model run on multiple device by @kaixuanliu in #42303 * Fix ChineseCLIPModel.get_text_features by @JiangJQ2000 in #42351 * Gemma3 hybrid fix by @remi-or in #42287 * fix(benchmarks): correct sdpa_backend inconsistency and attn_implementation for continuous batching by @engmohamedsalah in #42339 * Auto convert tekken.json by @ArthurZucker in #42299 * [loading] Re-add and improve disk offloading support by @Cyrilvallez in #42242 * Fix typo - indentation in JSON dump example by @anthropikos in #42332 * Fix tied weight for Bart (for BC) by @Cyrilvallez in #42355 * Fix reference to yelp dataset by @JuanFKurucz in #42349 * Fix documentation reference to pytorch max memory allocated by @JuanFKurucz in #42350 * Fix reference to imagenet 1k dataset by @JuanFKurucz in #42348 * Fix typos by @omahs in #42354 * Protect `torch.distributed` imports by @Cyrilvallez in #42361 * Expand npu device for KernelConfig by @zheliuyu in #42358 * Replace Optional and Union typing with | in some source files by @cyyever in #42294 * Fix code examples to load gpt 1 openai community model by @JuanFKurucz in #42347 * fix tekken pattern matching by @ArthurZucker in #42363 * Fixed-wrong-ZeRO3-json-snippet-found-in-deepspeed-markdown-file by @Yacklin in #42346 * Make benchmarking lighter: clean-up result files and remove non-needed arguments by @remi-or in #42357 * Add image processor fast vitpose by @yonigozlan in #42021 * Small tp fix by @ArthurZucker in #42366 * Remove test inheritance for EfficientLoftr, rename KeypointMatchingOutput to model specific name by @yonigozlan in #42365 * Tiny doc fix by @molbap in #42296 * Fix TimesFM patch normalization instability by @AnMakc in #42099 * [core] Fix torchao by @MekkCyber in #42289 * Fix tp by @ArthurZucker in #42368 * [`Attn Masks`] Add skip option for non-packed sequences by @vasqu in #42367 * 📚 docs(granite-speech): add comprehensive usage examples by @gorkachea in #42125 * Xcodec fix by @eustlb in #42095 * Replace Optional and Union typing with | in some source files by @cyyever in #42372 * [`Mistral Tokenizers`] Fix tokenizer detection by @vasqu in #42389 * misc don't recreate it by @ArthurZucker in #42394 * [SAM3] Fix precompute vision_embeds or text_embeds for inference by @yonigozlan in #42407 * 🚨 Image-text pipeline expects correctly formatted chat by @zucchini-nlp in #42359 * Many small fixes for the CI by @remi-or in #42364 * [core] fix mxfp4 by @MekkCyber in #42382 * fixed json syntax error for zero2 configuration file found in deepspeed.md by @Yacklin in #42406 * GLM4V - delete duplicate config attribute by @zucchini-nlp in #42416 * 🚨 Remove generic output_attentions warning by @Aravind-11 in #42334 * Bart config doesn't need generation parameters by @zucchini-nlp in #42337 * Simplify and standardize processor tests by @yonigozlan in #41773 * Clean bnb integration using weight converter by @SunMarc in #42426 * Any to any pipeline and auto-mapping by @zucchini-nlp in #40884 * Fix processor usage + add chat_template support to TTS pipeline, and shift common chat template logic to base class. by @ebezzam in #42326 * [fp8] fix scales param name by @MekkCyber in #42434 * Fix an edge case for `get_encoder()` by @zucchini-nlp in #42295 * Disable loss rounding in training stats log by @AnMakc in #42104 * Benchmark simplification by @remi-or in #42408 * Future annotations break FastAPI by @LysandreJik in #42450 * [cleanup] Don't use Repository in create_dummy_models.py script by @Wauplin in #42380 * [cleanup] Remove deprecated load config from file by @Wauplin in #42383 * [`FA`] Cleanup loading logic by @vasqu in #41427 * tiny fix for deepseekocr support [vllm] by @molbap in #42423 * fix: Restore explicit .keys() calls for TensorDict compatibility by @pankajbaid567 in #42373 * Transformers serve -> list all generative models from the cache by @LysandreJik in #42146 * 🚨 [v5][PEFT] Bump min version requirement of PEFT to 0.18.0 by @BenjaminBossan in #41889 * [cleanup] Offline mode and cache dir from `huggingface_hub` constants + cleanup in `PushToHubMixin` by @Wauplin in #42391 * Correctly return finish reason length when finished by @LysandreJik in #42157 * FIX: Minimal fix for loading PEFT weights by @BenjaminBossan in #42387 * Let's break Qwen-VL 🚨 by @zucchini-nlp in #42420 * [`CI`] Add to run slow by @vasqu in #42459 * Fix the "test_offline" test by @LysandreJik in #42458 * `transformers chat` launched without base_url has a direct tie to localhost:8000 by @LysandreJik in #42463 * update with more recent tts models by @Deep-unlearning in #42328 * rm slow tokenizers by @itazap in #40936 * [loading/saving] Reverse all loading operations when saving by @Cyrilvallez in #42396 * Fix T5 tests: use generation_config for generation parameters by @Abdennacer-Badaoui in #42419 * remove reference to TF models from docs by @zucchini-nlp in #42443 * [Trainer] use output.loss when using liger-kernel by @kashif in #42444 * replace source_keys and target_keys by @SunMarc in #42471 * Update migration guide - generation config by @zucchini-nlp in #42470 * 🚨 Move `rotary_partial_emb` to RopeParams and delete unnecessary code 🔪 by @zucchini-nlp in #42255 * Fix doc builds by @Rocketknight1 in #42478 * extend CwmIntegrationTest to xpu by @sywangyi in #42314 * add require_deterministic_for_xpu to make the case pass in xpu by @sywangyi in #42439 * Skip failing irrelevant test for ColQwen2 by @Rocketknight1 in #42480 * [quantization] make torchao tests slow by @MekkCyber in #42482 * Fix gpt2 tokenizer `add_prefix_space` default value by @SunMarc in #42481 ## Significant community contributions The following contributors have made significant changes to the library over the last release: * @ArthurZucker * `JetMoe` Fix jetmoe after #40132 (#41324) * [`ModularChecker`] QOL for the modular checker (#41361) * [`CB`] Refactors the way we access paged (#41370) * Update from pretrained error when loading (#33380) * :facepalm: CB nit! (#41413) * [`from_pretrained`] Small refactor `from_pretrained`: move around unrelated stuff (#41445) * update deps table (#42120) * Refactor weight loading (#41580) * Update conversion mapping to separate renaming from converting (#42254) * Auto convert tekken.json (#42299) * fix tekken pattern matching (#42363) * Small tp fix (#42366) * Fix tp (#42368) * misc don't recreate it (#42394) * @vasqu * :rotating_light: [`v5`] Remove relative position embeddings (for bert like models) (#41170) * [`v5`] Sync Bert and Bart eager attention (#41248) * [`JetMoe`] Fix KV head repetition and padding free (#41423) * :rotating_light: [`Attention Masks`] Bidirectional masks for encoder and encoder-decoder models (#41265) * [`CI`] Fix copies on main (#41486) * [`Docs`] Fix changed references (#41614) * [`Executorch`] Simplify for encoder models (#41627) * [`Ernie 4.5 Moe`] Fix Moe and offloading (#41385) * [`Masks`] Fix mask handling in eager for vision models (#41625) * [`Attn`] Allow dynamic causality in SDPA via Kwargs (#41692) * [`Onnx docs`] Remove some traces (#41791) * :rotating_light: [`Clip`] Fix masking and enable flash attention on all model types (#41750) * [`Attn Masks`] Non-vmap default for attention masks (#41852) * [`T5Gemma`] Fix cross attention cache (#41890) * [`Pop2Piano`] Fix cache usage (#42170) * [`PEFT`] Fix prefix tuning (#41696) * [`PEFT`] Fix the general test for prefix tuning (#42185) * [`Pop2Piano`] Fix tied weights (#42193) * [`BLT`] Fix cache usage (#42188) * [`CI`] Skip `EfficientLoFTR` test (#42327) * [`Attn Masks`] Lift bidirectional mask restriction on eager (#42325) * [`Attn Masks`] Add skip option for non-packed sequences (#42367) * [`Mistral Tokenizers`] Fix tokenizer detection (#42389) * [`FA`] Cleanup loading logic (#41427) * [`CI`] Add to run slow (#42459) * @ydshieh * [testing] update `test_longcat_generation_cpu` (#41368) * [testing] Fix `JetMoeIntegrationTest` (#41377) * Pickle - part 2 (#41476) * Try to remove `pickle` - `BloomTokenizerFast` (#41466) * [testing] reduce runtime of `HunYuanMoEV1IntegrationTest:test_model_generation` (#41373) * delete some tokenizer tests using pickle (#41514) * torch 2.9 don't ❤️ torchcodec 💔 (#41610) * Update a dataset reop link (#41618) * Remove the head masking block in some vision models (#41620) * improve `utils/check_bad_commit.py` (#41658) * torch 2.9 still don't ❤️ torchcodec 0.8 💔 (#41686) * path validation for security reason (#41256) * pin torchcodec on CI docker image (#41703) * further improve `utils/check_bad_commit.py` (#41658) (#41690) * Revert "Remove upper version bound of pandas" (#41744) * Fix bark after #41445 (#41645) * flash attn pytest marker (#41781) * unpin torch/torchcodec for CircleCI (#41839) * further reducing flakiness in `utils/check_bad_commit.py` (#41658) (#41815) * CI workflow for Flash Attn (#41857) * Update some workflow files (#41892) * Minor fix in docker image build workflow (#41949) * Run slow v2 (#41914) * Fix `detectron2` installation in docker files (#41975) * Fix `autoawq[kernels]` installation in quantization docker file (#41978) * Fix `torchcodec` version in quantization docker file (#41988) * Fix `run slow v2`: empty report when there is only one model (#42002) * Fix `torch+deepspeed` docker file (#41985) * fix `deeepspeed` in AMD docker file (#42025) * Change trigger time for AMD CI (#42034) * Remove some custom datasets defined in codebase (#41511) * Cleanup workflow - part 1 (#42023) * Fix `pr_slow_ci_suggestion.yml` after #42023 (#42049) * Avoid explicit checkout in workflow (#42057) * Be careful at explicit checkout actions (#42060) * Fix another `Argument list too long` in `pr_slow_ci_suggestion.yml` (#42061) * Revert back to use GitHub context (#42066) * Fix inconsistency of commit sha during the workflow run (#42074) * Revert "permissions worflows fix" (#42110) * pin `pytest<9` for now (#42162) * Update `test_dynamic_cache_exportability_multiple_run` (failing on torch 2.10 nightly) (#42212) * Reduce timing on CircleCI - part 1 (Use @slow for IntegrationTests) (#42206) * Make tests run in less time by reducing `batch_size` (#42213) * Revert "Make tests run in less time by reducing `batch_size`" (#42258) * delete already deprecated models (#42235) * Remove doc files of other langs for deleted models (#42276) * [testing] fix `cwm` (#42261) * @cyyever * Remove unnecessary list comprehension (#41305) * Remove unused function patameters (#41358) * Use accelerator API to free device memory (#41195) * Remove Python 3.9 classifier (#41410) * Remove KERAS_NLP_IMPORT_ERROR (#41468) * Import Callable from collections.abc (#41130) * Remove infer_device (#41088) * Fix Latex typesetting in documentation (#41177) * Fix typsetting and content of llm_tutorial_optimization.md (#41172) * More markdown file fixes (#41599) * Format MarkDown documentation and tiny fixes (#41638) * Fix typos in documentation (#41641) * Fix confusing cls assignment (#41642) * Use | for Optional and Union typing (#41646) * Remove require_torch_bf16_gpu (#40979) * Fix MarkDown syntax (#41676) * Use | for Optional and Union typing (#41675) * Enable faiss-cpu on Windows (#41678) * Fix Pylint warnings (#41644) * Enable FURB rules in ruff (#41395) * Remove upper version bound of pandas (#41677) * Fix documentation issues (#41726) * Apply RUFF PIE rules (#41727) * Replace Optional and Union typing with | in some source files (#42294) * Replace Optional and Union typing with | in some source files (#42372) * @yao-matrix * make some ut cases pass on xpu w/ latest torch (#41337) * fix asr ut failures (#41332) * enable new model uts to xpu and fix some failures on xpu (#41386) * enable some falcon-mamba uts on xpu (#41428) * enhance patched_tearDown to support python 3.11+ (#41429) * fix gemma3n case failure (#41426) * upgrade xpu docker file to torch 2.8 (#41551) * make apollo test case pass (#41805) * extend bitnet cases to xpu, all 8 cases pass (#41831) * extend 2 trainer test cases to xpu (#41829) * extend 2 blip2 and falcon_h1 test cases to xpu (#41825) * make lfm2_moe integration test pass on XPU (#41796) * fix some ut failures on XPU w/ torch 2.9 (#41923) * fix some ut failures on XPU w/ torch 2.9 (#41941) * fix prepare_config_and_inputs_for_common bug in llava test (#41942) * make recurrent_gemma and voxtral cases pass on xpu (#41958) * extend fp_quant cases to xpu (#41833) * fix tensor device placement issue of 2 UT cases (#41921) * fix continuous batching issues, extend ut cases to xpu (#41830) * @MekkCyber * [kernels] Kernel Config (#41232) * Fixing comments in __init__ file (#41414) * [kernels] Cleanup deta kernel (#41470) * Cleaning hub kernels (#41477) * Remove DISABLE_KERNEL_MAPPING flag (#41475) * [kernels] Remove RWKV kernel finally ! (#41493) * [kernels] rm yoso kernel (#41495) * [kernels] rm mra kernels (#41507) * Revert "add rmsnorm kernels support for Intel XPU" (#41579) * [kernels] refactor function kernel calling (#41577) * Erroring when KernelConfig is passed without use_kernels = True (#41657) * Small Fix for imports (#41411) * [kernels] Add version to function mapping (#41685) * [quantization] fix compressed_tensors tests (#41780) * [quantization] Skip Fp8 tests when hardware capability < 8.9 (#41785) * [quantization] fix torchao tests after 0.14.0 release (#41777) * revert changes in _is_package_available (#41891) * [kernels] Add Tests & CI for kernels (#41765) * [kernels] change import time in KernelConfig (#42004) * [kernels] Fix XPU layernorm kernel (#41583) * [core] Fix torchao (#42289) * [core] fix mxfp4 (#42382) * [fp8] fix scales param name (#42434) * [quantization] make torchao tests slow (#42482) * @paulpak58 * [Cache] lfm2 cache: allocate empty kv layers during init (#41396) * [Model] Lfm2Moe (#41401) * @gante * 🚨 [v5] Prune `prune_heads` (#41417) * [v5] rm `utils/tf_ops/` (#41402) * [causallm tester] automate pipeline mappings + bloom tests (#41318) * 🚨 [v5] `generate` delegates default cache initialization to the model (#41505) * @zRzRzRzRzRzRzR * Update GLM-4.1V MMRope implementation (#41182) * Update GLM-4.6 doc (#41471) * Add aux loss for GLM-4.5V (#41564) * 4.1V Model and GLM-4.5V Model Conversion Code Updates (#41784) * GLM-V update with new processor (#42122) * @jacobkahn * Add Code World Model (CWM) (#41199) * @molbap * Update philosophy (#41438) * [QoL] modular conversion shows LoC saved (#41500) * Double router compute? (#41653) * Add vision contribution guide (#41456) * Modernize CLIP modeling code (#41546) * handle inputs from Siglip/Siglip2 non-automapped encoder layers (#41930) * Fix processor test for glm (#42233) * Tiny doc fix (#42296) * tiny fix for deepseekocr support [vllm] (#42423) * @Wauplin * Bump to hfh 1.0.0.rc5 to fix test (#41508) * Migrate transformers cli to Typer (#41487) * Remove deprecated `use_auth_token` parameter (#41666) * added more breaking changes * [cleanup] Don't use Repository in create_dummy_models.py script (#42380) * [cleanup] Remove deprecated load config from file (#42383) * [cleanup] Offline mode and cache dir from `huggingface_hub` constants + cleanup in `PushToHubMixin` (#42391) * @remi-or * Restore cuda graphs to continuous batching (#41421) * Fix an import error with PreTrainModel (#41571) * Add __iter__ to DynamicCache (#41569) * Gemma3 fixes (#41572) * Benchmark overhaul (#41408) * Fix fp32_ln for various models (#41605) * Fix EncoderDecoder cache (#41612) * Switch to CB if cache_implementation == paged (#41655) * Small changes to benchmarking script (#41662) * Bump AMD docker (#41792) * Add a safeguard around a flaky test in gemma2 (#41811) * Use indices as position_ids in modernebert (#41789) * Move the Mi355 to regular docker (#41989) * More data in benchmarking (#41848) * Reduce the number of benchmark in the CI (#42008) * New docker from AMD (#42208) * Add prefix sharing to continuous batching (#42094) * Update torchcodec to match torchaudio version (#42288) * Gemma3 hybrid fix (#42287) * Make benchmarking lighter: clean-up result files and remove non-needed arguments (#42357) * Many small fixes for the CI (#42364) * Benchmark simplification (#42408) * @lkhl * [model] Add VideoLLaMA3 implementation (#40499) * @philiproeleveld * Add `logits_to_keep` to many older CausalLM models (#41335) * @AlphaOrOmega * Adding superglue fast image processing (#41394) * @echarlaix * [v5] Remove deprecated tranformers.onnx (#41700) * @Aravind-11 * Add GLPNImageProcessorFast (#41725) * T5 migration to new masking interface (#41804) * 🚨 Remove generic output_attentions warning (#42334) * @DeXtAr47-oss * add fuyu fast image processors (#41817) * @lashahub * [models] Add AudioFlamingo3 integration (#40290) * @lilin-1 * Docs/i18n updates (#42006) * @burtenshaw * [MODEL] Nanochat implementation (#41634) * @itazap * rm slow tokenizers (#40936)

Patch release v4.57.3v4.57.3
? · 2025-11-25

There was a hidden bug when loading models with `local_files_only=True` and a typo related to the recent patch. The main fix is: https://github.com/huggingface/transformers/commit/b6055550a15a8fab367cf983b743ff68cc58d81a. We are really sorry that this slipped through, our CIs just did not catch it. As it affects a lot of users we are gonna yank the previous release

Patch release v4.56.2v4.56.2
? · 2025-09-17

- Processor load with multi-processing (#40786) - [Jetmoe] Fix RoPE (#40819) - Fix getter regression (#40824) - Fix config dtype parsing for Emu3 edge case (#40766)

Vault-Gemma (based on v4.56.1)v4.56.1-Vault-Gemma-preview
? · 2025-09-12

A new model is added to transformers: Vault-Gemma It is added on top of the v4.56.1 release, and can be installed from the following tag: `v4.56.1-Vault-Gemma-preview`. In order to install this version, please install with the following command: ``` pip install git+https://github.com/huggingface/transformers@v4.56.1-Vault-Gemma-preview ``` If fixes are needed, they will be applied to this release; this installation may therefore be considered as stable and improving. As the tag implies, this tag is a **_preview_** of the Vault-Gemma model. This tag is a tagged version of the `main` branch and does not follow semantic versioning. This model will be included in the next minor release: `v4.57.0`. ## Vault-Gemma [VaultGemma](https://services.google.com/fh/files/blogs/vaultgemma_tech_report.pdf) is a text-only decoder model derived from [Gemma 2](https://huggingface.co/docs/transformers/en/model_doc/gemma2), notably it drops the norms after the Attention and MLP blocks, and uses full attention for all layers instead of alternating between full attention and local sliding attention. VaultGemma is available as a pretrained model with 1B parameters that uses a 1024 token sequence length. VaultGemma was trained from scratch with sequence-level differential privacy (DP). Its training data includes the same mixture as the [Gemma 2 models](https://huggingface.co/collections/google/gemma-2-release-667d6600fd5220e7b967f315), consisting of a number of documents of varying lengths. Additionally, it is trained using [DP stochastic gradient descent (DP-SGD)](https://arxiv.org/abs/1607.00133) and provides a (ε ≤ 2.0, δ ≤ 1.1e-10)-sequence-level DP guarantee, where a sequence consists of 1024 consecutive tokens extracted from heterogeneous data sources. Specifically, the privacy unit of the guarantee is for the sequences after sampling and packing of the mixture. The example below demonstrates how to chat with the model with `pipeline`: ```python from transformers import pipeline pipe = pipeline( task="text-generation", model="google/vaultgemma-1b", dtype="auto", device_map="auto", ) text = "Tell me an unknown interesting biology fact about the brain." outputs = pipe(text, max_new_tokens=32) response = outputs[0]["generated_text"] print(response) ``` with the `AutoModelForCausalLM` class: ```python # pip install accelerate from transformers import AutoTokenizer, AutoModelForCausalLM model_id = "google/vaultgemma-1b" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", dtype="auto") text = "Tell me an unknown interesting biology fact about the brain." input_ids = tokenizer(text, return_tensors="pt").to(model.device) outputs = model.generate(**input_ids, max_new_tokens=32) print(tokenizer.decode(outputs[0])) ``` or with `transformers chat`: ``` transformers chat google/vaultgemma-1b ```

v4.56: Dino v3, X-Codec, Ovis 2, MetaCLIP 2, Florence 2, SAM 2, Kosmos 2.5, HunYuan, GLMV-4.5v4.56.0
? · 2025-08-29

## New model additions ### Dino v3 DINOv3 is a family of versatile vision foundation models that outperforms the specialized state of the art across a broad range of settings, without fine-tuning. DINOv3 produces high-quality dense features that achieve outstanding performance on various vision tasks, significantly surpassing previous self- and weakly-supervised foundation models. You can find all the original DINOv3 checkpoints under the [DINOv3](https://huggingface.co/collections/facebook/dinov3-68924841bd6b561778e31009) collection. <img width="814" height="658" alt="image" src="https://github.com/user-attachments/assets/740a5c3d-a5a1-45d9-9e4c-d9117837205d" /> * Add Dino v3 by @qubvel in #40167 ### X-Codec he X-Codec model was proposed in [Codec Does Matter: Exploring the Semantic Shortcoming of Codec for Audio Language Model](https://arxiv.org/abs/2408.17175) by Zhen Ye, Peiwen Sun, Jiahe Lei, Hongzhan Lin, Xu Tan, Zheqi Dai, Qiuqiang Kong, Jianyi Chen, Jiahao Pan, Qifeng Liu, Yike Guo, Wei Xue The X-Codec model is a neural audio codec that integrates semantic information from self-supervised models (e.g., HuBERT) alongside traditional acoustic information. This enables : - **Music continuation** : Better modeling of musical semantics yields more coherent continuations. - **Text-to-Sound Synthesis** : X-Codec captures semantic alignment between text prompts and generated audio. - **Semantic aware audio tokenization**: X-Codec is used as an audio tokenizer in the YuE lyrics to song generation model. <img width="1958" height="949" alt="image" src="https://github.com/user-attachments/assets/e36552d0-6465-4921-8208-3f7d3c9087f1" /> * Add X-Codec model by @Manalelaidouni in #38248 ### Ovis 2 The [Ovis2](https://github.com/AIDC-AI/Ovis) is an updated version of the [Ovis](https://arxiv.org/abs/2405.20797) model developed by the AIDC-AI team at Alibaba International Digital Commerce Group. Ovis2 is the latest advancement in multi-modal large language models (MLLMs), succeeding Ovis1.6. It retains the architectural design of the Ovis series, which focuses on aligning visual and textual embeddings, and introduces major improvements in data curation and training methods. <img src="https://cdn-uploads.huggingface.co/production/uploads/637aebed7ce76c3b834cea37/XB-vgzDL6FshrSNGyZvzc.png" width="600"> * Add Ovis2 model and processor implementation by @thisisiron in #37088 ### MetaCLIP 2 MetaCLIP 2 is a replication of the original CLIP model trained on 300+ languages. It achieves state-of-the-art (SOTA) results on multilingual benchmarks (e.g., XM3600, CVQA, Babel‑ImageNet), surpassing previous SOTA such as [mSigLIP](siglip) and [SigLIP‑2](siglip2). The authors show that English and non-English worlds can mutually benefit and elevate each other. <img width="805" height="408" alt="image" src="https://github.com/user-attachments/assets/72eaa441-9362-4a6a-a834-f505d6727a2a" /> * Add MetaCLIP 2 by @NielsRogge in #39826 ### Florence 2 [Florence-2](https://arxiv.org/abs/2311.06242) is an advanced vision foundation model that uses a prompt-based approach to handle a wide range of vision and vision-language tasks. Florence-2 can interpret simple text prompts to perform tasks like captioning, object detection, and segmentation. It leverages the FLD-5B dataset, containing 5.4 billion annotations across 126 million images, to master multi-task learning. The model's sequence-to-sequence architecture enables it to excel in both zero-shot and fine-tuned settings, proving to be a competitive vision foundation model. <img width="864" height="565" alt="image" src="https://github.com/user-attachments/assets/d09dfe3a-6dda-45a3-8dd3-0254d8503b4e" /> * Add support for Florence-2 by @ducviet00 in #38188 ### SAM 2 SAM2 (Segment Anything Model 2) was proposed in [Segment Anything in Images and Videos](https://ai.meta.com/research/publications/sam-2-segment-anything-in-images-and-videos/) by Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chaitanya Ryali, Tengyu Ma, Haitham Khedr, Roman Rädle, Chloe Rolland, Laura Gustafson, Eric Mintun, Junting Pan, Kalyan Vasudev Alwala, Nicolas Carion, Chao-Yuan Wu, Ross Girshick, Piotr Dollár, Christoph Feichtenhofer. The model can be used to predict segmentation masks of any object of interest given an input image or video, and input points or bounding boxes. <img width="960" height="540" alt="image" src="https://github.com/user-attachments/assets/0ab42e5c-6951-4cbc-9d5d-ff8bf0c2dbf1" /> * Add Segment Anything 2 (SAM2) by @SangbumChoi in #32317 ### Kosmos 2.5 The Kosmos-2.5 model was proposed in [KOSMOS-2.5: A Multimodal Literate Model](https://arxiv.org/abs/2309.11419/) by Microsoft. The abstract from the paper is the following: *We present Kosmos-2.5, a multimodal literate model for machine reading of text-intensive images. Pre-trained on large-scale text-intensive images, Kosmos-2.5 excels in two distinct yet cooperative transcription tasks: (1) generating spatially-aware text blocks, where each block of text is assigned its spatial coordinates within the image, and (2) producing structured text output that captures styles and structures into the markdown format. This unified multimodal literate capability is achieved through a shared Transformer architecture, task-specific prompts, and flexible text representations. We evaluate Kosmos-2.5 on end-to-end document-level text recognition and image-to-markdown text generation. Furthermore, the model can be readily adapted for any text-intensive image understanding task with different prompts through supervised fine-tuning, making it a general-purpose tool for real-world applications involving text-rich images. This work also paves the way for the future scaling of multimodal large language models.* <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/kosmos2_5_ocr.png" alt="drawing" width="600"/> * Add Kosmos-2.5 by @tic-top in #31711 ### HunYuan <img width="674" height="402" alt="image" src="https://github.com/user-attachments/assets/230f83f0-870c-4b31-b8b7-738116761457" /> More information at release 🤗 * HunYuan opensource by @yjc9696 in #39606 ### Seed OSS <img width="858" height="537" alt="image" src="https://github.com/user-attachments/assets/29ccc3c2-9b85-4d89-935a-1e1c28d173fd" /> More information at release 🤗 * Adding ByteDance Seed Seed-OSS by @Fazziekey in #40272 ### GLM-4.5V More information at release 🤗 * GLM-4.5V Model Support by @zRzRzRzRzRzRzR in #39805 ## Cache Beyond a large refactor of the caching system in Transformers, making it much more practical and general, models using sliding window attention/chunk attention do not waste memory anymore when caching past states. It was allowed most notable by: * New DynamicSlidingWindowLayer & associated Cache by @Cyrilvallez in #40039 See the following improvements on memory usage for Mistral (using only sliding layers) and GPT-OSS (1 out of 2 layers is sliding) respectively: <img width="569" height="431" alt="image" src="https://github.com/user-attachments/assets/7f1688f4-b077-4840-a62c-bfa6131fe806" /> <img width="574" height="431" alt="image" src="https://github.com/user-attachments/assets/bb4a284f-961e-413d-b7e1-783bb5d8fb39" /> Beyond memory usage, it will also improve generation/forward speed by a large margin for large contexts, as only necessary states are passed to the attention computation, which is very sensitive to the sequence length. ## Quantization ### MXFP4 Since the GPT-OSS release which introduced the MXPF4 quantization type, several improvements have been made to the support, which should now stabilize. * Fix MXFP4 quantizer validation to allow CPU inference with dequantize option by @returnL in #39953 * Enable gpt-oss mxfp4 on older hardware (sm75+) by @matthewdouglas in #39940 * Fix typo and improve GPU kernel check error message in MXFP4 quantization by @akintunero in #40349) * Default to dequantize if cpu in device_map for mxfp4 by @MekkCyber in #39993 * Fix GPT-OSS `swiglu_limit` not passed in for MXFP4 by @danielhanchen in #40197 * [`Mxfp4`] Add a way to save with a quantization method by @ArthurZucker in #40176 ## New standard Now that we deprecated tensorflow and jax, we felt that `torch_dtype` was not only misaligned with torch, but was redundant and hard to remember. For this reason, we switched to a much more standard `dtype` argument! * ⚠️⚠️ Use dtype instead of torch_dtype everywhere! by @Cyrilvallez in #39782 `torch_dtype` will still be a valid usage for as long as needed to ensure a smooth transition, but new code should use `dtype`, and we encourage you to update older code as well! ## Breaking changes The following commits are breaking changes in workflows that were either buggy or not working as expected. ### Saner hub-defaults for hybrid cache implementation On models where the hub checkpoint specifies cache_implementation="hybrid" (static sliding window hybrid cache), UNSETS this value. This will make the model use the dynamic sliding window layers by default. This default meant that there were widespread super slow 1st generate calls on models with hybrid caches, which should nol onger be the case. * 🚨🚨 [generate] ignore `cache_implementation="hybrid"` hub defaults by @gante in #40135 ### Sine positional embeddings for MaskFormer & LRU cache Cache the computation of sine positional embeddings for MaskFormer; results in a 6% performance improvement. * 🚨 Use lru_cache for sine pos embeddings MaskFormer by @yonigozlan in #40007 ### Explicit cache initialization Adds explicit cache initialization to prepare for the deprecation of the `from_legacy_cache` utility. * 🚨 Always return Cache objects in modelings (to align with generate) by @manueldeprada in #39765 ### Default compilation with `fullgraph=False` Having `fullgraph` set to `True` during compilation ended up being very restrictive, especially with the arrival of widely-used MoEs. * 🚨🚨 Switch default compilation to fullgraph=False by @Cyrilvallez in #40137 ### Remove decoding strategies The DoLa decoding strategy has been moved to the following remote-code repository a few versions ago: https://huggingface.co/transformers-community/dola The Contrastive Search decoding strategy has been moved to the following remote-code repository a few versions ago: https://huggingface.co/transformers-community/contrastive-search Both have now been removed from the library as a result. * 🚨 Remove DoLa decoding strategy by @manueldeprada in #40082 * 🚨 Remove Contrastive Search decoding strategy by @manueldeprada in #40428 ### Fix sliding window in flash attention Flash attention has used sliding window sizes which were off by one. This affected generations that had initially bigger contexts than the sliding window size. * :rotating_light: [`Flash Attention`] Fix sliding window size by @vasqu in #40163 ### Minimum Torch version is now 2.2 Torch 2.1 support has been unreliable for some time, so we've now made it official and bumped our minimum version to 2.2. * byebye torch 2.1 by @Rocketknight1 in #40317 ## Bugfixes and improvements * [CI] post-`GptOss` fixes for green CI by @gante in #39929 * Avoid `utils/check_bad_commit.py` failing due to rate limit (requesting `api.github.com`) by @ydshieh in #39918 * Fix CI: Tests failing on CPU due to `torch.device('cpu').index` being None by @manueldeprada in #39933 * circleci: pin torch 2.7.1 until `torchcodec` is updated by @ydshieh in #39951 * [docs] ko toc fix by @gante in #39927 * docs: fix typo in 'quantization-aware training' by @luckyvickyricky in #39904 * Fix grammatical error in MoE variable name: expert_hitted → expert_hit, hitted_experts → hit_experts by @Mihonarium in #39959 * fix typo by @Tialo in #39936 * [image processor] fix glm4v by @KeyKy in #39964 * remove `triton_kernels` dep with `kernels` instead by @SunMarc in #39926 * Fix `fix_and_overwrite` mode of `utils/check_docstring.py` by @manueldeprada in #39369 * [bugfix] fix flash_attention_2 unavailable error on Ascend NPU by @FightingZhen in #39844 * chore: update Deformable_Detr model card by @arpon-kapuria in #39902 * Modular fix: remove the model name in `find_file_type` by @yonigozlan in #39897 * Gemma3 fixes by @remi-or in #39960 * [superglue] Fixed the way batch mask was applied to the scores before match assignment computation by @sbucaille in #39968 * Support input_embeds in torch exportable decoders by @jackzhxng in #39836 * Various test fixes for AMD by @remi-or in #39978 * [Idefics] fix device mismatch by @zucchini-nlp in #39981 * Fix gemma3n feature extractor's incorrect squeeze by @Isotr0py in #39919 * [typing] Fix return typehint for decoder and inv_freq annotation by @qubvel in #39610 * Fix consistency by @Cyrilvallez in #39995 * Update expected output values after #39885 (part 1) by @ydshieh in #39990 * Fix int4 quantized model cannot work with cpu by @yuanwu2017 in #39724 * Fix missing video inputs for PerceptionLM. by @shuminghu in #39971 * fix: remove CHAT_TEMPLATE import in tests for deepseek-vl by @geetu040 in #40003 * Fix HGNetV2 Model Card and Image Classification Pipeline Usage Tips by @ducviet00 in #39965 * Fix default values of getenv by @cyyever in #39867 * FA2 can continue generation from cache by @zucchini-nlp in #39843 * unpin torch<2.8 on circleci by @ydshieh in #40012 * docs: fix duplication in 'en/optimizers.md' by @luckyvickyricky in #40014 * Raising error when quantizing a quantized model by @MekkCyber in #39998 * Update expected output values after #39885 (part 2) by @ydshieh in #40015 * pin torchcodec==0.5.0 for now with torch 2.7.1 on daily CI by @ydshieh in #40013 * Fix broken image inference for Fuyu model by @Isotr0py in #39915 * Higgs modules_to_not_convert standardization by @MekkCyber in #39989 * Fix an annoying flaky test by @zucchini-nlp in #40000 * Harmonize `past_key_value` to `past_key_valueS` everywhere by @Cyrilvallez in #39956 * Fix missing None default values for Gemma3n model in get_placeholder_mask by @Znerual in #39991) * [core] Refactor the Cache logic to make it simpler and more general by @Cyrilvallez in #39797 * Tie weights recursively on all submodels by @Cyrilvallez in #39996 * Bnb failling tests by @MekkCyber in #40026 * fix `notification_service.py` about `time_spent` by @ydshieh in #40037 * Revert "fix `notification_service.py` about `time_spent`" by @ydshieh in #40044 * Update HuBERT model card according to template by @reedrya in #39742 * unpin `torchcodec==0.5.0` and use `torch 2.8` on daily CI by @ydshieh in #40072 * fix: resolve triton version check compatibility on windows by @Tsumugii24 in #39986 * [qwen-vl] fix beam search with videos by @zucchini-nlp in #39726 * [gemma3] update conversion key mapping by @zucchini-nlp in #39778 * fix: move super().__init__ after vision_config init in Mistral3Config by @starcatmeow in #40063 * Remove deprecated cache-related objects by @Cyrilvallez in #40035 * guard on model.eval when using torch.compile + FSDP2 by @winglian in #37413 * Fix repo consistency by @zucchini-nlp in #40077 * added Textnet fast image processor by @rahzaazhar in #39884 * Fix `time_spent ` in `notification_service.py`. by @ydshieh in #40081 * chore: standardize DeBERTa model card by @Shoumik-Gandre in #37409 * [`GPT Big Code`] Fix attention scaling by @vasqu in #40041 * feat: extract rev in attn_implementation kernels via @ by @drbh in #40009 * Update notification service MI325 by @ivarflakstad in #40078 * Fix PerceptionLM image preprocessing for non-tiled image input. by @shuminghu in #40006 * Revert FA2 kwargs construction by @zucchini-nlp in #40029 * [fix] batch inference for llava_onevision by @cyr0930 in #40021 * [docs] Zero Shot Object Detection Task by @ariG23498 in #40096 * Update Glm4V processor and add tests by @zucchini-nlp in #39988 * Add glm4.5&&glm4.5V doc by @lambertwjh in #40095 * Causal loss for `ForConditionalGeneration` by @qgallouedec in #39973 * Audio encodings now match conv2d weight dtype in Gemma3nAudioSSCPConvBlock by @Malav-P in #39743 * New DynamicSlidingWindowLayer & associated Cache by @Cyrilvallez in #40039 * Enable SIM rules by @cyyever in #39806 * feat: add `is_fast` to ImageProcessor by @MilkClouds in #39603 * Re-apply make style by @Cyrilvallez in #40106 * Replace `logger.warning` with `logger.warning_once` in `GradientCheckpointingLayer` by @qgallouedec in #40091 * Fix regression in mllama vision encoder by @Isotr0py in #40083 * Switch the order of args in StaticCache (for BC and future logic) by @Cyrilvallez in #40100 * Fix Qwen3 MoE GGUF architecture mismatch by @ctcanbol in #39976 * Fix error on importing unavailable torch.distributed by @m-gallus in #40038 * [`Flash Attention`] Fix flash attention integration by @vasqu in #40002 * [trainer] ensure special tokens in model configs are aligned with tokenizer at train time by @gante in #38441 * Fix Causality Handling in Flash Attention to Support Bidirectional Attention by @lucaswychan in #39707 * [docs] Add reference to HF-maintained `custom_generate` collections by @gante in #39894 * Add model card for MobileViT by @Shivamjan in #40033 * remove sequence parallel in llama4 by @3outeille in #40084 * 🌐 [i18n-KO] Translated `tiny_agents.md` to Korean by @AhnJoonSung in #39913 * [bugfix] Fix tensor device in Idefics2, Idefics3, and SmolVLM by @qgallouedec in #39975 * changed xLSTMRMSNorm to RMSNorm by @nikitazuevblago in #40113 * Fix QuantoQuantizedCache import issues by @manueldeprada in #40109 * [serve] allow array `content` inputs for LLMs by @gante in #39829 * `decoding_method` argument in generate by @manueldeprada in #40085 * Collated reports by @ivarflakstad in #40080 * DOCS: Add missing space in SECURITY.md by @shivaheidari in #40087 * [trainer] handle case where EOS token is None in `generation_config` by @gante in #40127 * Fix hidden torchvision>=0.15 dependency issue by @yonigozlan in #39928 * 🌐 [i18n-KO] Translated `main_classes/processors.md` to Korean by @TaskerJang in #39519 * 🌐 [i18n-KO] Translated `jamba.md` to Korean by @skwh54 in #39890 * 🌐 [i18n-KO] Translated `main_classes/optimizer_schedules.md` to Korean by @luckyvickyricky in #39713 * 🌐 [i18n-KO] Translated `gpt2.md` to Korean by @taemincode in #39808 * 🌐 [i18n-KO] Translated `optimizers.md` to Korean by @chelsseeey in #40011 * 🌐 [i18n-KO] Translated grounding-dino.md to Korean by @TaskerJang in #39861 * 🌐 [i18n-KO] Translated `pipelines.md` to Korean by @xhaktm00 in #39577 * gpt oss is important by @ArthurZucker in #40139 * Fix Janus by @Cyrilvallez in #40140 * [docs] Fix ko toctree by @stevhliu in #40138 * Remove an old badly designed test by @Cyrilvallez in #40142 * updated visualBERT modelcard by @Anil-Red in #40057 * 🌐 [i18n-KO] Translated `gemma3.md` to Korean by @seopp in #39865 * Fix quantized cache with only cache_implementation in generate by @Cyrilvallez in #40144 * Add pytest marker: `torch_compile_test` and `torch_export_test` by @ydshieh in #39950 * Update Dockerfiles to install packages inside a virtual environment by @Sai-Suraj-27 in #39098 * Create self-scheduled-amd-mi355-caller.yml by @glegendre01 in #40134 * [Cohere2Vision] remove unused arg by @zucchini-nlp in #40103 * [efficientloftr] fix bugs and follow original cross attn implementation strictly by @sbucaille in #40141 * Fix CI: Use correct import in SAM for torchvision InterpolationMode by @manueldeprada in #40160 * [Continous Batching] set head_dim when config.head_dim is None by @kashif in #40159 * Replace `self.tokenizer` by `self.processing_class` by @qgallouedec in #40119 * [FA2] Fix it finally - revert fa kwargs preparation by @Cyrilvallez in #40161 * [bugfix] fix flash-attention2 unavailable error for Ascend NPU by @FightingZhen in #40151 * build: Add fast image processor tvp by @adutchengineer in #39529 * Add GptOssForSequenceClassification for GPT-OSS models by @zyfedward in #40043 * Standardize BARTpho model card: badges, new examples, fixed broken im… by @eshwanthkartitr in #40051 * Add dates to the model docs by @MHRDYN7 in #39320 * Pin torch to 2.7.1 on CircleCI for now by @ydshieh in #40174 * Update dynamic attnt setter for multimodals by @zucchini-nlp in #39908 * [MINOR:TYPO] Update base.py by @cakiki in #40169 * make model doc device agnostic by @yao-matrix in #40143 * fix to avoid modifying a view in place by @3outeille in #40162 * Fix fsdp for generic-task models by @Cyrilvallez in #40191 * Add repr to EncoderDecoderCache by @Cyrilvallez in #40195 * Fix typos by @cyyever in #40175 * Remove _prepare_flash_attention_from_position_ids by @cyyever in #40069 * Avoid CUDA stream sync by @cyyever in #40060 * Fix various Pylint warnings by @cyyever in #40107 * Update: add type hints to check_tokenizers.py by @ajeet214 in #40094 * Benchmarking improvements by @ahadnagy in #39768 * docs: Update LayoutLM model card according to new standardized format by @Jin-HoMLee in #40129 * Revert "Pin torch to 2.7.1 on CircleCI for now" + Final fix for `too long with no output` by @ydshieh in #40201 * Use correct `model_input_names` for PixtralImageProcessor by @rohitrango in #40226 * fix error vocab_size at Qwen2_5_VLForConditionalGeneration loss_function by @killight98 in #40130 * [SAM 2] Change checkpoints in docs and tests by @yonigozlan in #40213 * Fix more typos by @cyyever in #40212 * Fix ESM token_dropout crash when using inputs_embeds instead of input_ids by @notkisk in #40181 * AMD scheduled CI ref env file by @ivarflakstad in #40243 * Fix more pylint warnings by @cyyever in #40204 * remove transpose_for_scores call in ESM-2 by @pstjohn in #40210 * Add `chat_template` (`jinja2`) as an extra dependency by @tboerstad in #40128 * [typing] fix type annotation error in DepthPro model image processor by @MengAiDev in #40238 * [serve] guard imports by @gante in #39825 * [`CI`] Fix repo consistency by @vasqu in #40249 * Fixes for EncoderDecoderCache by @remi-or in #40008 * fix: Catch correct ConnectionError for additional_chat_templates by @akug in #39874 * Model card for NLLB by @sahil-kabir in #40074 * Correct typo and update notes in docs Readme by @PavloFesenko in #40234 * Fix benchmark workflow by @ahadnagy in #40254 * docs: Update OLMo model card by @rafakatri in #40233 * Skip broken tests by @zucchini-nlp in #40157 * Remove MI300 CI by @ivarflakstad in #40270 * set inputs_embeds to None while generate to avoid audio encoder forward in generation process by @BakerBunker in #40248 * [detection] fix attention mask for RT-DETR-based models by @materight in #40269 * Fix slow static cache export tests by @jackzhxng in #40261 * Fix setting attention for multimodal models by @zucchini-nlp in #39984 * [detection] fix correct `k_proj` weight and bias slicing in D-FINE by @notkisk in #40257 * Skipping pytree registration in case fsdp is enabled by @romitjain in #40075 * Update image_processing_perception_lm_fast.py to allow for proper override of vision_input_type by @tyleryzhu in #40252 * fix which routing method by @ArthurZucker in #40283 * Fix chat CLI GPU loading and request_id validation issues by @robin-ede in #40230) * docs(layoutlm): add missing `id=usage` to `<hfoptions>` tag in LayoutLM model card by @Jin-HoMLee in #40273 * Standardize RAG model card by @aayush226 in #40222 * docs: Update TrOCR model card to new format by @AceHunterr in #40240 * Update model card for gpt neox japanese by @ahnjj in #39862 * SmolVLM and InternVL: Ensure pixel values are converted to the correct dtype for fp16/bf16 by @qgallouedec in #40121 * Standardize BertGeneration model card by @nemitha2005 in #40250 * Adjust ROCm test output expectations by @ahadnagy in #40279 * SmolVLM test fixes by @ahadnagy in #40275 * make model docs device agnostic (2) by @yao-matrix in #40256 * [3/3] make docs device agnostic, all en docs for existing models done by @yao-matrix in #40298 * Allow to be able to run `torch.compile` tests with `fullgraph=True` by @ydshieh in #40164 * [`FA`] Fix dtype in varlen with position ids by @vasqu in #40295 * [docs] delete more TF/Flax docs by @gante in #40289 * Clean up X-Codec. by @ebezzam in #40271 * Remove OTel SDK dependencies by @anuraaga in #40305 * Fix GOT-OCR2 and Cohere2Vision image processor patches caculation by @Isotr0py in #40312 * [`fix`] Pass adamw optimizer parameters to StableAdamW by @emapco in #40184 * chore: fix typo in `find_executable_batch_size` to match new 0.9 ratio by @MilkClouds in #40206 * :rotating_light: [`Flash Attention`] Fix sliding window size by @vasqu in #40163 * Remove unnecessary contiguous calls for modern torch by @Rocketknight1 in #40315 * Qwen2.5-Omni test fixes by @ahadnagy in #40307 * Add back `_tp_plan` attribute by @rishub-tamirisa in #39944 * byebye torch 2.1 by @Rocketknight1 in #40317 * No more `natten` by @ydshieh in #40287 * [`GPT OSS`] Refactor the tests as it was not properly checking the outputs by @ArthurZucker in #40288 * Update CI with nightly torch workflow file by @ydshieh in #40306 * Fix: Apply `get_placeholder_mask` in Ovis2 by @thisisiron in #40280 * Update notification service amd_daily_ci_workflows definition by @ivarflakstad in #40314 * One cache class to rule them all by @Cyrilvallez in #40276 * Fix chunked attention mask with left-padding by @Cyrilvallez in #40324 * [docs] remove flax references from `/en/model_doc` by @gante in #40311 * Fix qwen-omni processor text only mode by @yuekaizhang in #40336 * Change Qwen2RMSNorm to RMSNorm from PyTorch by @cyyever in #40066 * Add DeepseekV3ForSequenceClassification for Deepseek V3 models by @abdokaseb in #40200 * Fix deprecation warning version by @Cyrilvallez in #40343 * Add missing arguments to class constructors by @cyyever in #40068 * [docs] remove TF references from `/en/model_doc` by @gante in #40344 * Fix: Only call Trainer.align_special_tokens if model has "config" attribute by @tomaarsen in #40322 * add type hints by @wirthual in #40319 * Fix an infinite loop bug in recursive search of relative imports by @eladsegal in #40326 * Fix links in Glm4vMoe configuration classes to point to the correct H… by @vvvdwbvvv in #40310 * T5 test and target device fixes by @ahadnagy in #40313 * Update `test_spm_converter_bytefallback_warning` by @ydshieh in #40284 * (small) fix conditional for input_ids and input_embeds in marian by @cyntqliu in #40045 * Fix attention vizualizer by @molbap in #40285 * [ModernBert] Prevent the attention mask from being None in ModernBertForSequenceClassification by @ashmikuz in #35991 * Clean up XCodec and other codecs by @ebezzam in #40348 * [serve] add cors warnings by @gante in #40112 * [detection] use consistent dtype for Conditional and DAB DETR positional embeddings by @agkphysics in #40300 * Remove more PyTorch 2.2 compatible code by @cyyever in #40337 * [`FA`] Fix some model tests by @vasqu in #40350 * Qwen2.5-VL test fixes for ROCm by @ahadnagy in #40308 * [generate] handle support for cache classes when num enc layers != num dec layers by @gante in #40277 * [4/N]more docs to device agnostic by @yao-matrix in #40355 * DOCS: Clarification on the use of `label_names` as an argument to TrainingArguments by @huzaifa-jawad367 in #40353 * Fix idefics3 vision embeddings indices dtype by @Isotr0py in #40360 * wav2vec2 fixes by @remi-or in #40341 * Change multimodal data links to HF hub by @zucchini-nlp in #40309 * [pipelines] add support to `skip_special_tokens` in the main text generation pipelines by @gante in #40356 * ⚠️⚠️ Use `dtype` instead of `torch_dtype` everywhere! by @Cyrilvallez in #39782 * [processor] move commonalities to mixin by @zucchini-nlp in #40339 * [configuration] allow to overwrite kwargs from subconfigs by @zucchini-nlp in #40241 * fix(example): align parameter names with the latest function definition for gdino by @developer0hye in #40369 * Add GptOssForTokenClassification for GPT-OSS models by @abdokaseb in #40190 * Bug Fix: Dynamically set return_lse flag in FlexAttention by @amd-lalithnc in #40352 * Chat Template Doc Fixes by @Rocketknight1 in #40173 * Rework the Cache documentation by @Cyrilvallez in #40373 * Update README_zh-hans.md by @TardC in #40380 * HF papers in doc by @qgallouedec in #40381 * Run FA2 tests in CI by @ydshieh in #40397 * Reactivate a lot of tests skipped for no reason anymore by @Cyrilvallez in #40378 * :broom: :broom: :broom: Get set decoder cleanup by @molbap in #39509 * fix to accept cumulative_seqlens from TransformersKwargs in FA by @Kurt232 in #40194 * [docs] flax/jax purge by @gante in #40372 * Fix typo: 'casual' -> 'causal' in code and documentation by @akintunero in #40371) * Fix CI (hunyuan moe does not support fullgraph) by @Cyrilvallez in #40423 * Fix typo: 'seperator' to 'separator' in variable names by @Prawal-Sharma in #40389 * Fix UnboundLocalError in WER metric computation by @prxshetty in #40402 * Gpt oss optim by @jiqing-feng in #40304 * Fix processing tests by @zucchini-nlp in #40379 * Fix label smoothing incompatibility with multi-label classification by @avchauzov in #40296 * Fix modular for modernbert-decoder by @Cyrilvallez in #40431 * Update collated reports working directory and --path by @ivarflakstad in #40433 * Add `tokenizer_kwargs` argument to the text generation pipeline by @Joshua-Chin in #40364 * [docs] remove last references to `transformers` TF classes/methods by @gante in #40429 * Remove working-dir from collated reports job by @ivarflakstad in #40435 * 🌐 [i18n-KO] Translated `models.md` to Korean by @Judy-Choi in #39518 * Gemma3 text fixes: Add expectations for MI325 by @ahadnagy in #40384 * Fix collated reports model directory traversal by @ivarflakstad in #40437 * Fix https://github.com/huggingface/transformers/issues/40292 by @id01 in #40439 * Fix collated reports uploading by @ivarflakstad in #40440 * InternVL MI325 test expectations by @ahadnagy in #40387 * Fix collated reports model name entry by @ivarflakstad in #40441 * Fix non FA2 tests after FA2 installed in CI docker image by @ydshieh in #40430 * Refactor ViT-like models by @qubvel in #39816 * [Trainer] accelerate contextparallel support in trainer by @kashif in #40205 * fix qwen25-vl grad acc by @iMountTai in #40333 * [video processors] decode only sampled videos -> less RAM and faster processing by @zucchini-nlp in #39600 * rename get_cuda_warm_up_factor to get_accelerator_warm_up_factor by @yao-matrix in #40363 * Make cache_config not mandatory by @remi-or in #40316 * Continuous batching refactor by @remi-or in #40426 * flash_paged: s_aux may not exist by @pcuenca in #40434 * Fix extra template loading by @Rocketknight1 in #40455 * deci gguf support by @ved1beta in #38669 * [fast_image_processor] fix image normalization for resize by @audioXD in #40436 * [RoPE] explicit factor > implicit factor in YaRN by @gante in #40320 * [pipeline] Add Keypoint Matching pipeline by @sbucaille in #39970 * Update SegFormer model card by @GSNCodes in #40417 * Not to shock AMD team by the cancelled workflow run notification ❤️ 💖 by @ydshieh in #40467 * Fix nightly torch CI by @ydshieh in #40469 * CI when PR merged to `main` by @ydshieh in #40451 * Validate GptOssConfig rope config after it's fully initialized by @zifeitong in #40474 * [modular] Use multi-processing + fix model import issue by @Cyrilvallez in #40481 * [modular] Remove ambiguity in all calls to parent class methods + fix dependency graph by @Cyrilvallez in #40456 * [ESM] support attention API by @zucchini-nlp in #40370 * [EfficientLoFTR] dynamic image size support by @sbucaille in #40329 * Fix `qwen2_moe` tests by @ydshieh in #40494 * [Whisper] Add rocm expected results to certain tests by @ivarflakstad in #40482 * Collated reports: no need to upload artifact by @ivarflakstad in #40502 * Fix the CI workflow of `merge to main` by @ydshieh in #40503 * docs(pixtral): Update Pixtral model card to new format by @BryanBradfo in #40442 * [modular] Classes can now be defined and referenced in arbitrary order (without bringing unwanted dependencies) by @Cyrilvallez in #40507 * Include machine type in collated reports filename by @ivarflakstad in #40514 ## Significant community contributions The following contributors have made significant changes to the library over the last release: * @remi-or * Gemma3 fixes (#39960) * Various test fixes for AMD (#39978) * Fixes for EncoderDecoderCache (#40008) * wav2vec2 fixes (#40341) * Make cache_config not mandatory (#40316) * Continuous batching refactor (#40426) * @sbucaille * [superglue] Fixed the way batch mask was applied to the scores before match assignment computation (#39968) * [efficientloftr] fix bugs and follow original cross attn implementation strictly (#40141) * [pipeline] Add Keypoint Matching pipeline (#39970) * [EfficientLoFTR] dynamic image size support (#40329) * @ducviet00 * Fix HGNetV2 Model Card and Image Classification Pipeline Usage Tips (#39965) * Add support for Florence-2 (#38188) * @cyyever * Fix default values of getenv (#39867) * Enable SIM rules (#39806) * Fix typos (#40175) * Remove _prepare_flash_attention_from_position_ids (#40069) * Avoid CUDA stream sync (#40060) * Fix various Pylint warnings (#40107) * Fix more typos (#40212) * Fix more pylint warnings (#40204) * Change Qwen2RMSNorm to RMSNorm from PyTorch (#40066) * Add missing arguments to class constructors (#40068) * Remove more PyTorch 2.2 compatible code (#40337) * @zRzRzRzRzRzRzR * GLM-4.5V Model Support (#39805) * @SangbumChoi * Add Segment Anything 2 (SAM2) (#32317) * @adutchengineer * build: Add fast image processor tvp (#39529) * @MHRDYN7 * Add dates to the model docs (#39320) * @yao-matrix * make model doc device agnostic (#40143) * make model docs device agnostic (2) (#40256) * [3/3] make docs device agnostic, all en docs for existing models done (#40298) * [4/N]more docs to device agnostic (#40355) * rename get_cuda_warm_up_factor to get_accelerator_warm_up_factor (#40363) * @Manalelaidouni * Add X-Codec model (#38248) * @thisisiron * Add Ovis2 model and processor implementation (#37088) * Fix: Apply `get_placeholder_mask` in Ovis2 (#40280) * @tic-top * Add Kosmos-2.5 (#31711) * @yjc9696 * HunYuan opensource (#39606) * @Fazziekey * Addiing ByteDance Seed Seed-OSS (#40272)