Skip to content
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

Error with Qwen2VL When Images Are Missing #2452

Open
LukeForeverYoung opened this issue Nov 14, 2024 · 2 comments
Open

Error with Qwen2VL When Images Are Missing #2452

LukeForeverYoung opened this issue Nov 14, 2024 · 2 comments

Comments

@LukeForeverYoung
Copy link
Contributor

Describe the bug
What the bug is, and how to reproduce, better with screenshots(描述bug以及复现过程,最好有截图)

I encountered an issue while training Qwen2VL with Flash Attention enabled. When the training data contains samples without images, the following error occurs:

RuntimeError: cu_seqlens_q must be on CUDA

It appears that media_inputs['image_grid_thw'] needs to be moved to the appropriate device when there are no images in the sample.

https://github.com/modelscope/ms-swift/blob/78b6f781550aa19281c26ba5b41120156032f349/swift/llm/utils/template.py#L1655C17-L1655C99

Add a media_inputs['image_grid_thw'].to(device) can resolve the issue.

Your hardware and system info
Write your system info like CUDA version/system/GPU/torch version here(在这里给出硬件信息和系统信息,如CUDA版本,系统,GPU型号和torch版本等)

Additional context
Add any other context about the problem here(在这里补充其他信息)

@Jintao-Huang
Copy link
Collaborator

What versions are acclerate and transformers?

@LukeForeverYoung
Copy link
Contributor Author

What versions are acclerate and transformers?

accelerate 0.34.2
transformers 4.45.0.dev0

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

2 participants