From ae8da14ea34b83be42f7ad4f140c0875a356bfac Mon Sep 17 00:00:00 2001 From: Yihao Wang <42559837+AgainstEntropy@users.noreply.github.com> Date: Wed, 8 Apr 2026 08:45:42 -0700 Subject: [PATCH] [fix] [whisper] ensure inputs are moved to the correct device before processing. (#22293) --- python/sglang/srt/models/whisper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/sglang/srt/models/whisper.py b/python/sglang/srt/models/whisper.py index d9190a2f1..987d230ff 100644 --- a/python/sglang/srt/models/whisper.py +++ b/python/sglang/srt/models/whisper.py @@ -292,6 +292,10 @@ class WhisperEncoder(torch.nn.Module): position_ids: torch.Tensor, forward_batch: ForwardBatch, ): + device = self.conv1.weight.device + input_features = input_features.to(device=device) + position_ids = position_ids.to(device=device) + inputs_embeds = torch.nn.functional.gelu(self.conv1(input_features)) inputs_embeds = torch.nn.functional.gelu(self.conv2(inputs_embeds))