Skip to content

fix npu llama #8628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

from paddlenlp_ops import rebuild_padding_v2

if core.is_compiled_with_cuda():
if not core.is_compiled_with_xpu():

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

View check run for this annotation

Codecov / codecov/patch

paddlenlp/experimental/transformers/fused_transformer_layers.py#L40

Added line #L40 was not covered by tests
from paddlenlp_ops import (
dequant_int8,
encode_rotary_qk,
Expand Down Expand Up @@ -1349,7 +1349,7 @@
class FusedBlockMultiTransformer(FusedMultiTransformerBase):
def __init__(self, config: FusedMultiTransformerConfig):
super().__init__(config)
if not core.is_compiled_with_cuda():
if core.is_compiled_with_xpu():

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

View check run for this annotation

Codecov / codecov/patch

paddlenlp/experimental/transformers/fused_transformer_layers.py#L1352

Added line #L1352 was not covered by tests
self.cache_k_per_batch_maxs = paddle.full(shape=[10, 6], fill_value=0, dtype="float32")
self.cache_v_per_batch_maxs = paddle.full(shape=[10, 6], fill_value=0, dtype="float32")

Expand Down Expand Up @@ -1379,7 +1379,7 @@
v_quant_scales = self.cache_v_scales
k_dequant_scales = self.cache_k_out_scales
v_dequant_scales = self.cache_v_out_scales
if not core.is_compiled_with_cuda():
if core.is_compiled_with_xpu():

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

View check run for this annotation

Codecov / codecov/patch

paddlenlp/experimental/transformers/fused_transformer_layers.py#L1382

Added line #L1382 was not covered by tests
fmha_out = paddle.incubate.nn.functional.block_multihead_attention_xpu(
qkv_out,
caches[2 * i],
Expand Down
Loading