Skip to content

Commit

Permalink
[NPU] Fix baichuan2-13b-chat infer
Browse files Browse the repository at this point in the history
  • Loading branch information
ronny1996 committed Sep 2, 2024
1 parent e204b6d commit cffca66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
"The paddlenlp_ops package is not installed. you can read the docs and install it by hand, "
"you can refer to: https://github.com/PaddlePaddle/PaddleNLP/blob/develop/csrc/README.md"
)
if core.is_compiled_with_xpu() or core.is_compiled_with_cuda():
from paddlenlp_ops import rebuild_padding_v2
from paddlenlp_ops import rebuild_padding_v2

Check warning on line 41 in paddlenlp/experimental/transformers/fused_transformer_layers.py

View check run for this annotation

Codecov / codecov/patch

paddlenlp/experimental/transformers/fused_transformer_layers.py#L41

Added line #L41 was not covered by tests

if core.is_compiled_with_cuda():
from paddlenlp_ops import (
Expand Down
2 changes: 1 addition & 1 deletion paddlenlp/utils/llm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def get_alibi_slopes(num_heads):
extra_base = 2 ** (-(2 ** -(math.log2(2 * closest_power_of_2) - 3)))
num_remaining_heads = min(closest_power_of_2, num_heads - closest_power_of_2)
extra_powers = np.arange(1, 1 + 2 * num_remaining_heads, 2)
slopes = np.concatante([slopes, np.power(extra_base, extra_powers)], axis=0)
slopes = np.concatenate([slopes, np.power(extra_base, extra_powers)], axis=0)

Check warning on line 464 in paddlenlp/utils/llm_utils.py

View check run for this annotation

Codecov / codecov/patch

paddlenlp/utils/llm_utils.py#L464

Added line #L464 was not covered by tests

return slopes.astype("float32")

Expand Down

0 comments on commit cffca66

Please sign in to comment.