Skip to content

Commit 307a5da

Browse files
committed
disable patch on idefics
1 parent 1d2f851 commit 307a5da

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

_unittests/ut_tasks/test_tasks_image_text_to_text.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ def test_image_text_to_text_idefics(self):
2222
self.assertEqual(data["task"], "image-text-to-text")
2323
model, inputs, ds = data["model"], data["inputs"], data["dynamic_shapes"]
2424
model(**torch_deepcopy(inputs))
25-
print("***", self.string_type(data["inputs2"], with_shape=True))
2625
model(**data["inputs2"])
27-
with torch_export_patches(patch_transformers=True, verbose=10):
26+
with torch_export_patches(patch_transformers=True, verbose=10, patch_torch=False):
2827
torch.export.export(
2928
model, (), kwargs=inputs, dynamic_shapes=use_dyn_not_str(ds), strict=False
3029
)

onnx_diagnostic/torch_export_patches/patches/patch_transformers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,8 @@ def forward(self, x, seq_len=None):
13801380

13811381
def _set_cos_sin_cache_then(x, inv_freq, seq_len, _cos_cached, _sin_cached):
13821382
t = torch.arange(seq_len, device=x.device, dtype=torch.int64).type_as(inv_freq)
1383-
freqs = torch.einsum("i,j->ij", t, inv_freq)
1383+
# freqs = torch.einsum("i,j->ij", t, inv_freq)
1384+
freqs = t.reshape((-1, 1)) * inv_freq.reshape((1, -1))
13841385
emb = torch.cat((freqs, freqs), dim=-1)
13851386
return emb.cos().to(x.dtype), emb.sin().to(x.dtype)
13861387

0 commit comments

Comments
 (0)