Skip to content

Commit

Permalink
[npu] fix where bug (#9573)
Browse files Browse the repository at this point in the history
* [npu] fix where bug

* fix
  • Loading branch information
tianhaodongbd authored Dec 9, 2024
1 parent 1917257 commit c565b77
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion paddlenlp/transformers/llama/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,6 @@ def _prepare_decoder_attention_mask(attention_mask, input_shape, past_key_values
if get_env_device() in ["npu", "mlu", "intel_hpu"]:
x = paddle.to_tensor(0.0, dtype="float32")
y = paddle.to_tensor(paddle.finfo(dtype).min, dtype="float32")
expanded_attn_mask = expanded_attn_mask.astype("float32")
expanded_attn_mask = paddle.where(expanded_attn_mask, x, y).astype(dtype)
elif get_env_device() in ["xpu", "gcu"]:
min_val = paddle.finfo(dtype).min if get_env_device() == "gcu" else -1e37 # mask value for xpu
Expand Down

0 comments on commit c565b77

Please sign in to comment.