Skip to content

Commit

Permalink
small fix (#12623)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeouSker77 authored Dec 27, 2024
1 parent 55ce091 commit 34dbdb8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/llm/src/ipex_llm/transformers/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def prepare_mask(mask, bsz, n_heads, seq_length, kv_length, is_causal, dtype, de
mask = None
else:
mask = torch.zeros([1, 1, 1, padding_kv_length], dtype=dtype, device=device)
mask[:, :, kv_length:padding_kv_length] = torch.finfo(dtype).min
mask[..., kv_length:padding_kv_length] = torch.finfo(dtype).min
mask = mask.expand([bsz, n_heads, seq_length, padding_kv_length])
else:
if seq_length != kv_length and seq_length <= 32:
Expand Down
1 change: 1 addition & 0 deletions python/llm/src/ipex_llm/transformers/models/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def llama_model_forward(
) -> Union[Tuple, BaseModelOutputWithPast]:
# IPEX-LLM OPT start: kv cache and quantize kv cache
inputs = input_ids if input_ids is not None else inputs_embeds
use_cache = use_cache if use_cache is not None else self.config.use_cache
use_cache = True if inputs.device.type == "xpu" else use_cache
use_quantize_kv = use_quantize_kv_cache(
self.layers[0].mlp.down_proj, inputs,
Expand Down

0 comments on commit 34dbdb8

Please sign in to comment.