Skip to content

Commit 93e77a1

Browse files
committed
small refactoring
1 parent 6713059 commit 93e77a1

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
@@ -341,9 +341,9 @@ def _llama_gemma_update_causal_mask(self, attention_mask, input_tensor, cache_po
341341
offset = 0
342342
mask_shape = attention_mask.shape
343343
mask_slice = (attention_mask.eq(0.0)).to(dtype=dtype) * min_dtype
344-
causal_mask[
345-
: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]
346-
] = mask_slice
344+
causal_mask[: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]] = (
345+
mask_slice
346+
)
347347

348348
if (
349349
self.config._attn_implementation == "sdpa"
@@ -648,9 +648,6 @@ def _baichuan13b_atten_forward(
648648
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
649649
attn_output = self.o_proj(attn_output)
650650

651-
if not output_attentions:
652-
attn_weights = None
653-
654651
return attn_output, attn_weights, past_key_value
655652

656653

0 commit comments

Comments
 (0)