Skip to content

Commit 45dc3aa

Browse files
committed
Merge branch 'main' into transformers_future
2 parents 2f98dec + baf7cc8 commit 45dc3aa

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

optimum/habana/transformers/models/mllama/modeling_mllama.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,8 +1151,11 @@ def _update_model_kwargs_for_generation(self, outputs, model_kwargs, is_encoder_
11511151
# add cross-attn mask for new token
11521152
if cross_attention_mask_prev is not None:
11531153
token_idx = model_kwargs.get("token_idx", None)
1154+
token_idx_cpu = model_kwargs.get(
1155+
"token_idx_cpu", None
1156+
) # returns an integer so following slicing ops happen using int instead of tensor
11541157
if token_idx is not None:
1155-
mask = cross_attention_mask_prev[:, token_idx - 2 : token_idx - 1, ...]
1158+
mask = cross_attention_mask_prev[:, token_idx_cpu - 2 : token_idx_cpu - 1, ...]
11561159
cross_attention_mask_prev.index_copy_(1, token_idx - 1, mask)
11571160
model_kwargs["cross_attention_mask"] = cross_attention_mask_prev
11581161
else:

tests/baselines/fixture/tests/test_examples.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,20 @@
655655
"train_samples_per_second": 2845.068
656656
}
657657
},
658+
"tests/test_examples.py::MultiCardVisionLanguageExampleTester::test_run_clip_clip-roberta_multi_card": {
659+
"gaudi1": {
660+
"train_runtime": 314.7726,
661+
"train_samples_per_second": 2560.999
662+
},
663+
"gaudi2": {
664+
"train_runtime": 59.5,
665+
"train_samples_per_second": 14124
666+
},
667+
"gaudi3": {
668+
"train_runtime": 59.5,
669+
"train_samples_per_second": 14124
670+
}
671+
},
658672
"tests/test_examples.py::QuestionAnsweringExampleTester::test_run_qa_roberta-large_single_card": {
659673
"gaudi1": {
660674
"eval_f1": 94.2959,

0 commit comments

Comments
 (0)