Skip to content

Fix tie_word_embeddings for multimodal models in Transformers v5#33359

Merged
hmellor merged 2 commits intovllm-project:mainfrom
hmellor:fix-tie-word-embeds
Jan 30, 2026
Merged

Fix tie_word_embeddings for multimodal models in Transformers v5#33359
hmellor merged 2 commits intovllm-project:mainfrom
hmellor:fix-tie-word-embeds

Conversation

@hmellor
Copy link
Member

@hmellor hmellor commented Jan 29, 2026

In Transformers v5, tie_word_embeddings belongs to the config of the class that can see both layers to be tied. For example:

SomeVLModel:
    self.language_model = SomeLanguageModel()
    self.vision_model = SomeVisionModel()

SomeVLModelForMultimodalLM:
    self.model = SomeVLModel()
    self.lm_head = nn.Linear()

Therefore, tie_word_embeddings is defined in SomeVLModelForMultimodalLM's config and is not present in SomeVLModel's config. In vLLM, the lm_head belongs to the language_model, so we must ensure that tie_word_embeddings is set in the language_model's config.

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses an issue with tie_word_embeddings for multimodal models in Transformers v5 by propagating the setting from the main model config to the text-specific config. I've added one high-severity comment to improve the robustness of the implementation and prevent a potential AttributeError for certain multimodal models.

Copy link
Member

@yewentao256 yewentao256 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the work!

@yewentao256 yewentao256 added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 29, 2026
@hmellor hmellor enabled auto-merge (squash) January 29, 2026 20:16
@hmellor hmellor merged commit 80b918f into vllm-project:main Jan 30, 2026
42 checks passed
@hmellor hmellor deleted the fix-tie-word-embeds branch January 30, 2026 03:37
@hmellor hmellor restored the fix-tie-word-embeds branch January 30, 2026 08:53
@hmellor hmellor deleted the fix-tie-word-embeds branch January 30, 2026 08:53
PiratePai pushed a commit to PiratePai/epd_shm that referenced this pull request Feb 3, 2026
…llm-project#33359)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Pai <416932041@qq.com>
ItzDEXX pushed a commit to ItzDEXX/vllm that referenced this pull request Feb 19, 2026
…llm-project#33359)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants