Skip to content

fix models for transformers>=5#4381

Merged
lvhan028 merged 2 commits intoInternLM:mainfrom
grimoire:fix-models-trans5
Mar 2, 2026
Merged

fix models for transformers>=5#4381
lvhan028 merged 2 commits intoInternLM:mainfrom
grimoire:fix-models-trans5

Conversation

@grimoire
Copy link
Copy Markdown
Collaborator

Fix failed model for transformers>=5

Gemma3 force linear rope.

Copilot AI review requested due to automatic review settings February 28, 2026 12:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_config for LLM components (model + LM head).
  • Update Qwen2-VL image preprocessing call signature to align with newer image_processor APIs.
  • Add a dedicated Qwen2VLModelConfigBuilder and 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.

@lvhan028 lvhan028 added the Bug:P1 label Mar 1, 2026
@BBC-Esq
Copy link
Copy Markdown

BBC-Esq commented Mar 1, 2026

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 lvhan028 merged commit 20ae545 into InternLM:main Mar 2, 2026
5 checks passed
@lvhan028
Copy link
Copy Markdown
Collaborator

lvhan028 commented Mar 2, 2026

Hi @BBC-Esq, thanks for pointing this out. We'll address the lmdeploy-lite-package-compatible-transformers-5 issue in a follow-up PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants