Skip to content

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Sep 17, 2025

What does this PR do?

This test is failing on GPU due to

FAILED tests/models/glm4v/test_modeling_glm4v.py::Glm4vModelTest::test_eager_matches_fa2_generate - RuntimeError: cu_seqlens_q must be on CUDA

see here

We need to change from

"image_grid_thw": torch.tensor([[1, patches_per_side, patches_per_side]] * self.batch_size),

to

"image_grid_thw": torch.tensor([[1, patches_per_side, patches_per_side]] * self.batch_size, device=torch_device),it

Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: glm4v, glm4v_moe

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@vasqu vasqu left a comment

Choose a reason for hiding this comment

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

Makes sense, thank you

Just to be sure, other vlms don't have the issue? Just checked with qwen3 vl and they do the same in the prep function as you do here (with the fix)

@ydshieh
Copy link
Collaborator Author

ydshieh commented Sep 17, 2025

I did a search (when opening the PR) "image_grid_thw": and only find these two without using torch_device. Should be good.

@vasqu
Copy link
Contributor

vasqu commented Sep 17, 2025

Perfect, thx for looking 🙏

@ydshieh ydshieh merged commit 529d3a2 into main Sep 17, 2025
18 checks passed
@ydshieh ydshieh deleted the fix_glm4vmoe_flash branch September 17, 2025 17:54
ErfanBaghaei pushed a commit to ErfanBaghaei/transformers that referenced this pull request Sep 25, 2025
)

* fix

* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/transformers that referenced this pull request Oct 2, 2025
)

* fix

* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
yuchenxie4645 pushed a commit to yuchenxie4645/transformers that referenced this pull request Oct 4, 2025
)

* fix

* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

3 participants