Fix vision config num_heads key in Qwen VL tiny model scripts and revert torch pin#5792
Merged
albertvillanova merged 3 commits intoMay 20, 2026
Conversation
|
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. |
Member
|
I have regenerated the tiny models and run the CI tests using the new tiny model PRs. Once CI is green, I will merge the tiny model PRs and revert my last commit. |
This reverts commit 53a925b.
albertvillanova
approved these changes
May 20, 2026
Member
There was a problem hiding this comment.
Awesome! Thanks for your great investigation!
The CI is green with the new tiny models: https://github.com/huggingface/trl/actions/runs/26144698369?pr=5792
I have merged the tiny model PRs and reverted my last commit.
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #5768
Reverts #5769
The three Qwen VL tiny model generation scripts were passing
num_attention_headsinvision_config, but the vision config class (Qwen2_5_VLVisionConfig,Qwen2VLVisionConfig,Qwen3VLVisionConfig) expectsnum_heads. The wrong key is silently ignored,num_headsstays at its default of 16, which withhidden_size=16giveshead_dim=1androtary_dim=0. PyTorch's SDPA then returns all-zeros for the attention output, causing zero gradients on all visual encoder parameters.The torch pin added in #5769 is not needed.
Note: a maintainer with write access to
trl-internal-testingon the Hub will need to rerun the generation scripts to upload the fixed tiny models before CI passes.Before submitting
AI writing disclosure
Who can review?
@albertvillanova since you opened #5768 and #5769.
Note
Medium Risk
Medium risk because it changes how Qwen VL tiny test models are generated (affecting CI artifacts) and removes a previously-added
torchversion constraint that could re-expose version-specific failures.Overview
Fixes the Qwen VL tiny-model generation scripts to pass the correct vision-config field (
num_headsinstead ofnum_attention_heads) for Qwen2-VL, Qwen2.5-VL, and Qwen3-VL, ensuring the intended attention head count is used during tiny model creation.Also removes the temporary
torch<2.12.0dev-dependency pin frompyproject.toml.Reviewed by Cursor Bugbot for commit 0365e1e. Bugbot is set up for automated code reviews on this repo. Configure here.