Migrating to Transformers v5.0.0rc1
Version v5.0.0rc1 introduces 4 breaking changes. This guide details how to update your code.
Released: 1/8/2026
⚠️ Check Your Code
If you use any of these symbols, you need to read this guide:
PreTrainedModel.from_pretrainedPreTrainedModel.save_pretrainedPreTrainedModel.forwardFastVLMLasrPaddleOCR-VLdynamic_weight_loadertokenizationBreaking Changes
●Issue #1
The default data type (`dtype`) when loading a model using `from_pretrained` is no longer inferred based on hardware or configuration, but defaults to 'auto'.
✓Solution
If you explicitly require a specific dtype (e.g., `torch.float32` or `torch.bfloat16`), you must now pass it explicitly via the `torch_dtype` argument in `from_pretrained`.
●Issue #2
The default shard size when saving a model has increased significantly to 50GB.
✓Solution
This change is generally safe and intended for convenience with large models on the Hub. If you rely on smaller shard sizes for specific workflows, you must now explicitly set the `max_shard_size` argument when saving the model.
●Issue #3
Model forward passes now strictly require `**kwargs` to be accepted, even if they are unused, to ensure compatibility with tools like vLLM.
✓Solution
Update all custom model forward methods (`forward`) to accept `**kwargs` as the last argument. If you don't use them, simply pass them along or ignore them.
●Issue #4
The logic for defaulting `rope_parameters` has changed; it will only default to an empty dictionary if there is nothing to populate it with.
✓Solution
If you manually configure model configurations, ensure that if `rope_parameters` is present, it is correctly structured, or remove it entirely if it should be empty/defaulted by the model class.
Migration Steps
- 1Review all calls to `from_pretrained` and explicitly set the desired `torch_dtype` (e.g., `torch_dtype=torch.float16`) if you were relying on the previous default behavior.
- 2If you are saving large models, be aware that the default shard size is now 50GB. Adjust `max_shard_size` in your saving calls if smaller shards are required.
- 3Inspect all custom model implementations (especially those inheriting from `PreTrainedModel`) and ensure that the `forward` method signature accepts `**kwargs` as the final argument.
- 4If you encounter issues related to model configuration initialization, check how `rope_parameters` is being set, ensuring it aligns with the new stricter defaulting logic.
Release Summary
This release introduces major breaking changes including 'auto' as the default dtype, 50GB shard sizes for saving, and mandatory **kwargs in forward methods. It also adds support for new models (FastVLM, Lasr, PaddleOCR-VL) and a new dynamic weight loader for quantization.
Need More Details?
View the full release notes and all changes for Transformers v5.0.0rc1.
View Full Changelog