Skip to content

Commit

Permalink
Fixed code style issue
Browse files Browse the repository at this point in the history
Signed-off-by: Cheng, Penghui <[email protected]>
  • Loading branch information
PenghuiCheng committed Jun 24, 2024
1 parent 3898e37 commit a141b3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
12 changes: 6 additions & 6 deletions optimum/exporters/openvino/model_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ def _llama_gemma_update_causal_mask_legacy(self, attention_mask, input_tensor, c
offset = 0
mask_shape = attention_mask.shape
mask_slice = (attention_mask.eq(0.0)).to(dtype=dtype) * min_dtype
causal_mask[
: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]
] = mask_slice
causal_mask[: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]] = (
mask_slice
)

if (
self.config._attn_implementation == "sdpa"
Expand Down Expand Up @@ -1640,9 +1640,9 @@ def _dbrx_update_causal_mask_legacy(
offset = 0
mask_shape = attention_mask.shape
mask_slice = (attention_mask.eq(0.0)).to(dtype=dtype) * min_dtype
causal_mask[
: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]
] = mask_slice
causal_mask[: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]] = (
mask_slice
)

if (
self.config._attn_implementation == "sdpa"
Expand Down
2 changes: 1 addition & 1 deletion optimum/intel/neural_compressor/quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import torch
from datasets import Dataset, load_dataset
from neural_compressor.config import PostTrainingQuantConfig
from neural_compressor.utils.export import torch_to_int8_onnx
from neural_compressor.model.onnx_model import ONNXModel
from neural_compressor.model.torch_model import IPEXModel, PyTorchModel
from neural_compressor.quantization import fit
from neural_compressor.utils.export import torch_to_int8_onnx
from packaging.version import parse
from torch.utils.data import DataLoader, RandomSampler
from transformers import (
Expand Down
8 changes: 5 additions & 3 deletions optimum/intel/openvino/modeling_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,11 @@ def _expand_outputs_for_generation(self, indicies, logits: torch.Tensor, past_ke
):
past_key_values = tuple(
tuple(
past_state[indicies]
if not self.config.model_type == "chatglm"
else past_state[:, indicies, ...]
(
past_state[indicies]
if not self.config.model_type == "chatglm"
else past_state[:, indicies, ...]
)
for past_state in layer_past
)
for layer_past in past_key_values
Expand Down

0 comments on commit a141b3b

Please sign in to comment.