Skip to content

Arm backend: Add Qwen3-VL_2B_IT FP32 layer tests#19628

Open
tom-arm wants to merge 3 commits into
pytorch:mainfrom
tom-arm:add_qwen_layer_tests
Open

Arm backend: Add Qwen3-VL_2B_IT FP32 layer tests#19628
tom-arm wants to merge 3 commits into
pytorch:mainfrom
tom-arm:add_qwen_layer_tests

Conversation

@tom-arm
Copy link
Copy Markdown
Collaborator

@tom-arm tom-arm commented May 18, 2026

Change-Id: I62d3848e0a6546e21d508b4ed565c2403b63f72d

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

Signed-off-by: Tom Allsop <tom.allsop@arm.com>

Change-Id: I62d3848e0a6546e21d508b4ed565c2403b63f72d
Co-authored-by: Baris Demir <baris.demir@arm.com>
Copilot AI review requested due to automatic review settings May 18, 2026 07:47
@tom-arm tom-arm requested a review from digantdesai as a code owner May 18, 2026 07:47
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 18, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19628

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 18, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels May 18, 2026
@tom-arm tom-arm added the release notes: none Do not include this in the release notes label May 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds per-layer FP32 export/lowering tests for the Qwen3-VL 2B Instruct model on the Arm TOSA-FP and VGF (no-quant) pipelines, including a checkpoint-shaped config helper and a directory of test modules covering both the vision and text sub-stacks.

Changes:

  • New qwen3_vl_test_config.py builds a Qwen3-VL 2B Instruct-like Qwen3VLConfig (text + vision) for tests.
  • New test_qwen3_vl_layers.py defines wrapper nn.Modules for each vision/text sub-layer and parametrizes them through TosaPipelineFP and VgfPipeline.
  • MODELS.md lists Qwen3-VL among supported models.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
backends/arm/test/models/Qwen3_VL/qwen3_vl_test_config.py Factory for a Qwen3-VL 2B Instruct test config.
backends/arm/test/models/Qwen3_VL/test_qwen3_vl_layers.py Layer-level wrappers + TOSA-FP and VGF (no-quant) test parametrizations.
backends/arm/MODELS.md Adds Qwen3-VL to supported models list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backends/arm/test/models/Qwen3_VL/test_qwen3_vl_layers.py Outdated
Comment thread backends/arm/test/models/Qwen3_VL/test_qwen3_vl_layers.py
Comment thread backends/arm/test/models/Qwen3_VL/test_qwen3_vl_layers.py
Comment thread backends/arm/test/models/Qwen3_VL/test_qwen3_vl_layers.py Outdated
Comment thread backends/arm/test/models/Qwen3_VL/test_qwen3_vl_layers.py Outdated
Comment thread backends/arm/test/models/Qwen3_VL/qwen3_vl_test_config.py
Comment thread backends/arm/test/models/Qwen3_VL/qwen3_vl_test_config.py
Signed-off-by: Tom Allsop <tom.allsop@arm.com>

Change-Id: I397e651fa8ac7dd48cb8deb595bf52e306a3f469
Copy link
Copy Markdown
Collaborator

@zingo zingo left a comment

Choose a reason for hiding this comment

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

OK to merge if/when CI is ok
I do not know but assume the MYPY errors need to be handled.

@tom-arm
Copy link
Copy Markdown
Collaborator Author

tom-arm commented May 18, 2026

OK to merge if/when CI is ok I do not know but assume the MYPY errors need to be handled.

Yes I can fix the MyPy errors.

Also adding the Qwen model seems to cause the runner to run out of memory. Either the model is too big or we have a memory leak, I'll take a look

* Remove very large test that is running out of memory

Signed-off-by: Tom Allsop <tom.allsop@arm.com

Change-Id: I15d9802e30445230427441e7623747f85f1824a3
Copilot AI review requested due to automatic review settings May 19, 2026 09:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +134 to +149
def __init__(self, config, max_hw: int) -> None:
super().__init__()
head_dim = config.vision_config.hidden_size // config.vision_config.num_heads
self.rotary = Qwen3VLVisionRotaryEmbedding(head_dim // 2)
self.max_hw = max_hw

def forward(self, grid_thw: torch.Tensor) -> torch.Tensor:
rotary = self.rotary(self.max_hw)
return rotary

@classmethod
def prepare_model_and_inputs(cls):
config = _make_qwen3_vl_2b_instruct_layer_config()
grid_thw = _make_image_grid_thw(torch.device("cpu"))
max_hw = int(grid_thw[:, 1:].max().item())
model = cls(config, max_hw).eval()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants