Compatible with transformers 5.0 at TurboMind side#4304
Open
lvhan028 wants to merge 7 commits intoInternLM:mainfrom
Open
Compatible with transformers 5.0 at TurboMind side#4304lvhan028 wants to merge 7 commits intoInternLM:mainfrom
lvhan028 wants to merge 7 commits intoInternLM:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make lmdeploy compatible with transformers 5.0 at the TurboMind side. Transformers 5.0 introduced a breaking change where rope-related parameters (including rope_theta and rope_scaling) are now aggregated into a single rope_parameters dictionary in the model configuration.
Changes:
- Removed unused utility functions from
lmdeploy/vl/model/utils.pyincluding weight loading helpers and import hacks - Added support for the new
rope_parametersstructure in transformers 5.0 for LlamaModel while maintaining backward compatibility with older versions - Added similar rope_parameters support for DeepSeek2Model
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lmdeploy/vl/model/utils.py | Cleaned up by removing unused functions: load_weight_ckpt, get_used_weight_files, load_model_from_weight_files, add_sys_path, and hack_import_with |
| lmdeploy/turbomind/deploy/source_model/llama.py | Added conditional logic to check for rope_parameters (transformers 5.0) and extract rope_theta and rope_scaling from it, with fallback to the old structure for backward compatibility |
| lmdeploy/turbomind/deploy/source_model/deepseek2.py | Added similar conditional logic to handle rope_parameters for DeepSeek2 models |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RunningLeon
reviewed
Jan 30, 2026
Collaborator
RunningLeon
left a comment
There was a problem hiding this comment.
v5 broke for vl model
lmdeploy/lmdeploy/vl/model/utils.py", line 12, in <module>
from transformers.utils import (SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, WEIGHTS_INDEX_NAME, WEIGHTS_NAME,
ImportError: cannot import name 'is_safetensors_available' from 'transformers.utils' (/nvme1/xxx/miniconda3/envs/py310/lib/python3.10/site-packages/transformers/utils/__init__.py)
This was referenced Feb 4, 2026
b855b0c to
2e214ad
Compare
d305d5b to
eb70216
Compare
Collaborator
Author
fixed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.