[Bug fix] Fix Gemma 2 and fix Gemma 3 multimodal with bs > 1 on NPU (#9871)
Co-authored-by: Maksim <makcum888e@mail.ru>
This commit is contained in:
@@ -46,10 +46,12 @@ from sglang.srt.model_executor.forward_batch_info import (
|
||||
ForwardBatch,
|
||||
ForwardMode,
|
||||
)
|
||||
from sglang.srt.utils import dump_to_file, use_intel_amx_backend
|
||||
from sglang.srt.utils import dump_to_file, is_npu, use_intel_amx_backend
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_is_npu = is_npu()
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class LogitsProcessorOutput:
|
||||
@@ -517,7 +519,12 @@ class LogitsProcessor(nn.Module):
|
||||
logits = logits[:, : self.config.vocab_size].float()
|
||||
|
||||
if self.final_logit_softcapping:
|
||||
fused_softcap(logits, self.final_logit_softcapping)
|
||||
if not _is_npu:
|
||||
fused_softcap(logits, self.final_logit_softcapping)
|
||||
else:
|
||||
logits = self.final_logit_softcapping * torch.tanh(
|
||||
logits / self.final_logit_softcapping
|
||||
)
|
||||
|
||||
return logits
|
||||
|
||||
|
||||
Reference in New Issue
Block a user