From 814241a4cd4aeef0e2a032b6cb758a9bd9d00abb Mon Sep 17 00:00:00 2001 From: GeLee <865038696@qq.com> Date: Fri, 6 Sep 2024 20:19:29 +0800 Subject: [PATCH] add self.head_dim for VisionAttention in Qwen2-VL (#33211) * add self.head_dim for VisionAttention in Qwen2-VL * add self.head_dim for VisionAttention in Qwen2-VL * fix ci * black the test_modeling_qwen2_vl.py * use ruff to format test_modeling_qwen2_vl.py * [run-slow] qwen2_vl * use tying for python3.8 * fix the import format * use ruff to fix the ci error I001 * [run-slow] qwen2_vl * remove unused import * commit for rebase * use ruff fix ci * [run-slow] qwen2_vl --------- Co-authored-by: root --- tests/models/qwen2_vl/test_modeling_qwen2_vl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/models/qwen2_vl/test_modeling_qwen2_vl.py b/tests/models/qwen2_vl/test_modeling_qwen2_vl.py index 536e0ab54abc45..4bd85f06a4f952 100644 --- a/tests/models/qwen2_vl/test_modeling_qwen2_vl.py +++ b/tests/models/qwen2_vl/test_modeling_qwen2_vl.py @@ -164,7 +164,9 @@ def prepare_config_and_inputs_for_common(self): attention_mask = torch.ones(input_ids.shape, dtype=torch.long, device=torch_device) input_ids[:, torch.arange(vision_seqlen, device=torch_device) + 1] = self.image_token_id labels = torch.zeros( - (self.batch_size, self.seq_length - 1 + vision_seqlen), dtype=torch.long, device=torch_device + (self.batch_size, self.seq_length - 1 + vision_seqlen), + dtype=torch.long, + device=torch_device, ) patch_size = self.vision_config["patch_size"] inputs_dict = {