[NPU][Bugfix] Fix qwen3 error when enable-dp-lm-head (#16115)

This commit is contained in:
chenxu214
2026-01-08 15:15:43 +08:00
committed by GitHub
parent 3d51ae18a1
commit 7dd679cbb9
8 changed files with 52 additions and 16 deletions

View File

@@ -294,8 +294,8 @@ class RotaryEmbedding(MultiPlatformOp):
assert (
fused_set_kv_buffer_arg is None
), "fused_set_kv_buffer_arg is not supported for npu implementation"
rotary_mode = "half"
if query.dtype == torch.bfloat16 and self.cos_sin_cache.dtype == torch.float:
return self.forward_native(positions, query, key, offsets)
if self.is_neox_style:
rotary_mode = "half"
else:

View File

@@ -31,6 +31,7 @@ from sglang.srt.utils import (
cpu_has_amx_support,
get_compiler_backend,
is_cpu,
is_npu,
set_weight_attrs,
)
@@ -38,6 +39,7 @@ DEFAULT_VOCAB_PADDING_SIZE = 64
_is_cpu_amx_available = cpu_has_amx_support()
_is_cpu = is_cpu()
_is_npu = is_npu()
logger = logging.getLogger(__name__)
@@ -123,7 +125,7 @@ class VocabParallelEmbeddingShardIndices:
assert self.num_added_elements <= self.num_added_elements_padded
@torch.compile(dynamic=True, backend=get_compiler_backend())
@torch.compile(dynamic=True, backend=get_compiler_backend(), disable=_is_npu)
def get_masked_input_and_mask(
input_: torch.Tensor,
org_vocab_start_index: int,