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 <liji>
This commit is contained in:
GeLee
2024-09-06 20:19:29 +08:00
committed by GitHub
parent 3314fe1760
commit 2b18354106

View File

@@ -164,7 +164,9 @@ class Qwen2VLVisionText2TextModelTester:
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 = {