Skip to content

Commit a141b3b

Browse files
committed
Fixed code style issue
Signed-off-by: Cheng, Penghui <penghui.cheng@intel.com>
1 parent 3898e37 commit a141b3b

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

optimum/exporters/openvino/model_patcher.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ def _llama_gemma_update_causal_mask_legacy(self, attention_mask, input_tensor, c
367367
offset = 0
368368
mask_shape = attention_mask.shape
369369
mask_slice = (attention_mask.eq(0.0)).to(dtype=dtype) * min_dtype
370-
causal_mask[
371-
: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]
372-
] = mask_slice
370+
causal_mask[: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]] = (
371+
mask_slice
372+
)
373373

374374
if (
375375
self.config._attn_implementation == "sdpa"
@@ -1640,9 +1640,9 @@ def _dbrx_update_causal_mask_legacy(
16401640
offset = 0
16411641
mask_shape = attention_mask.shape
16421642
mask_slice = (attention_mask.eq(0.0)).to(dtype=dtype) * min_dtype
1643-
causal_mask[
1644-
: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]
1645-
] = mask_slice
1643+
causal_mask[: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]] = (
1644+
mask_slice
1645+
)
16461646

16471647
if (
16481648
self.config._attn_implementation == "sdpa"

optimum/intel/neural_compressor/quantization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
import torch
2626
from datasets import Dataset, load_dataset
2727
from neural_compressor.config import PostTrainingQuantConfig
28-
from neural_compressor.utils.export import torch_to_int8_onnx
2928
from neural_compressor.model.onnx_model import ONNXModel
3029
from neural_compressor.model.torch_model import IPEXModel, PyTorchModel
3130
from neural_compressor.quantization import fit
31+
from neural_compressor.utils.export import torch_to_int8_onnx
3232
from packaging.version import parse
3333
from torch.utils.data import DataLoader, RandomSampler
3434
from transformers import (

optimum/intel/openvino/modeling_decoder.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,11 @@ def _expand_outputs_for_generation(self, indicies, logits: torch.Tensor, past_ke
571571
):
572572
past_key_values = tuple(
573573
tuple(
574-
past_state[indicies]
575-
if not self.config.model_type == "chatglm"
576-
else past_state[:, indicies, ...]
574+
(
575+
past_state[indicies]
576+
if not self.config.model_type == "chatglm"
577+
else past_state[:, indicies, ...]
578+
)
577579
for past_state in layer_past
578580
)
579581
for layer_past in past_key_values

0 commit comments

Comments
 (0)