Skip to content

AttributeError: 'Qwen2_5_VLModel' object has no attribute 'embed_tokens' #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gray114514 opened this issue May 25, 2025 · 6 comments
Open

Comments

@gray114514
Copy link

VLM-R1-main/src/open-r1-multimodal/src/open_r1/qwen2_5vl_monkey_patch.py", line 79, in qwen2_5vl_forward
[rank0]: inputs_embeds = self.model.embed_tokens(input_ids)

I encountered the following error when trying to access model.embed_tokens:

AttributeError: 'Qwen2_5_VLModel' object has no attribute 'embed_tokens'.

Is it possible that the embedding layer has been renamed or moved in this model? How can I correctly access the token embeddings for the Qwen2.5-VL model?

Thanks for your help!

@xLalalala
Copy link

same problem

@XuZhengzhuo
Copy link

it works for qwen2.5VL:

  is_embed_trainable = any(
      param.requires_grad for param in self.get_input_embeddings().parameters()
  )

@CuteClaire
Copy link

Did you change the transformers version? I ran into this issue too and changing transformers versions worked for me.

@gray114514
Copy link
Author

Did you change the transformers version? I ran into this issue too and changing transformers versions worked for me.

Which transformers version did you use?

@CuteClaire
Copy link

Did you change the transformers version? I ran into this issue too and changing transformers versions worked for me.

Which transformers version did you use?

Using transformers version 4.51.3 or less worked for me (both 4.51.3 and 4.49.0 worked for me)

@LizzyEw
Copy link

LizzyEw commented May 28, 2025

Did you change the transformers version? I ran into this issue too and changing transformers versions worked for me.

Which transformers version did you use?

Using transformers version 4.51.3 or less worked for me (both 4.51.3 and 4.49.0 worked for me)

Thanks for your share! It works again now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants