Skip to content

Commit 4c8cb0e

Browse files
committed
small refactoring
1 parent d854863 commit 4c8cb0e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

optimum/exporters/openvino/model_patcher.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ def _llama_gemma_update_causal_mask(self, attention_mask, input_tensor, cache_po
329329
offset = 0
330330
mask_shape = attention_mask.shape
331331
mask_slice = (attention_mask.eq(0.0)).to(dtype=dtype) * min_dtype
332-
causal_mask[
333-
: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]
334-
] = mask_slice
332+
causal_mask[: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]] = (
333+
mask_slice
334+
)
335335

336336
if (
337337
self.config._attn_implementation == "sdpa"
@@ -636,9 +636,6 @@ def _baichuan13b_atten_forward(
636636
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
637637
attn_output = self.o_proj(attn_output)
638638

639-
if not output_attentions:
640-
attn_weights = None
641-
642639
return attn_output, attn_weights, past_key_value
643640

644641

0 commit comments

Comments
 (0)