[fix] [whisper] ensure inputs are moved to the correct device before processing. (#22293)
This commit is contained in:
@@ -292,6 +292,10 @@ class WhisperEncoder(torch.nn.Module):
|
|||||||
position_ids: torch.Tensor,
|
position_ids: torch.Tensor,
|
||||||
forward_batch: ForwardBatch,
|
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.conv1(input_features))
|
||||||
inputs_embeds = torch.nn.functional.gelu(self.conv2(inputs_embeds))
|
inputs_embeds = torch.nn.functional.gelu(self.conv2(inputs_embeds))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user