fix models for transformers>=5#4381
Merged
lvhan028 merged 2 commits intoInternLM:mainfrom Mar 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates several VLM/model integration points to restore compatibility with newer Hugging Face Transformers (>=5), including config nesting changes (e.g., text_config) and updated processor/model configuration fields.
Changes:
- Adjust Qwen2-VL/Qwen2.5-VL PyTorch model construction to use
text_configfor LLM components (model + LM head). - Update Qwen2-VL image preprocessing call signature to align with newer
image_processorAPIs. - Add a dedicated
Qwen2VLModelConfigBuilderand harden a few config reads (bos_token_id, Gemma hidden activation / RoPE handling).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lmdeploy/vl/model/qwen2.py | Removes videos=None arg from image_processor call for newer processor signatures. |
| lmdeploy/vl/model/cogvlm.py | Pins Vicuna eoa to </s> when building an internal chat template. |
| lmdeploy/pytorch/models/qwen2_vl.py | Uses config.text_config (when present) for building the text model + lm_head. |
| lmdeploy/pytorch/models/qwen2_5_vl.py | Same text_config handling for Qwen2.5-VL. |
| lmdeploy/pytorch/models/llama4.py | Removes unused pad_token_id attribute assignment. |
| lmdeploy/pytorch/models/gemma.py | Makes Gemma activation/rope construction more tolerant of config differences, adds Gemma3-specific RoPE building logic. |
| lmdeploy/pytorch/configurations/qwen2_vl.py | New config builder to route Qwen2-VL configs through text_config and propagate quantization/dtype. |
| lmdeploy/pytorch/configurations/deepseek_v2.py | Avoids attribute errors by reading bos_token_id via getattr. |
| lmdeploy/pytorch/configurations/chatglm.py | Same bos_token_id hardening via getattr. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
You'll also need to ensure that llm-compressor updates it's library as well since it's still requiring lower versions of transformers and other libraries... |
lvhan028
approved these changes
Mar 2, 2026
Collaborator
|
Hi @BBC-Esq, thanks for pointing this out. We'll address the |
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.
Fix failed model for transformers>=5
Gemma3 force linear rope.