Migrating to Transformers v5.1.0
Version v5.1.0 introduces 6 breaking changes. This guide details how to update your code.
Released: 2/5/2026
⚠️ Check Your Code
If you use any of these symbols, you need to read this guide:
T5Gemma2AfmoePreTrainedModel.__init__DETRJanusImageProcessorAnnotionFormatAnnotationFormatBeitConfigyoutu-llmSigLIP2Qwen3_omni_moeT5Gemma2EncoderCLIPOutputApertusSigLIPQwen3Breaking Changes
●Issue #1
T5Gemma2 model structure was modified to ensure attn implementation is set for all sub-configs, breaking previous assumptions where encoder text config attn was not set correctly. Users relying on the previous structure might need to verify attention settings.
●Issue #2
Generation cache initialization was refactored to properly respect sliding window configurations. Models using sliding window attention (like Afmoe) will now enforce window size limits during generation, potentially changing sequence length handling.
●Issue #3
Redundant configuration attributes for backbone loading were removed, consolidating logic into a single source of truth: `config.backbone_config`. Models must now rely on this attribute for backbone loading.
●Issue #4
The DETR model structure was refactored to align with other vision models in the library.
●Issue #5
Floating-point precision in JanusImageProcessor resize was fixed by replacing `int()` with `round()`, which may result in light numerical differences in output.
●Issue #6
The deprecated class `AnnotionFormat` was removed in favor of `AnnotationFormat`.
Migration Steps
- 1If using T5Gemma2, verify that attention implementation settings are correctly propagated across sub-configs.
- 2Review generation code for models using sliding window attention, as window size limits are now strictly enforced.
- 3Update model configuration files to use only `config.backbone_config` as the single source of truth for backbone loading.
- 4Replace usage of the removed `AnnotionFormat` with `AnnotationFormat`.
Release Summary
This release introduces four major new models: EXAONE-MoE, PP-DocLayoutV3, Youtu-LLM, and GlmOcr. It also includes several breaking changes related to model structure adjustments, cache initialization for sliding window attention, and configuration cleanup.
Need More Details?
View the full release notes and all changes for Transformers v5.1.0.
View Full Changelog