Skip to content

Commit

Permalink
Use PyTorch as logits transpose for ONNX support (openai#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoin authored Sep 26, 2022
1 parent 2037b65 commit 9c8183a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion whisper/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def forward(self, x: Tensor, xa: Tensor, kv_cache: Optional[dict] = None):
x = block(x, xa, mask=self.mask, kv_cache=kv_cache)

x = self.ln(x)
logits = (x @ self.token_embedding.weight.to(x.dtype).T).float()
logits = (x @ torch.transpose(self.token_embedding.weight.to(x.dtype), 0, 1)).float()

return logits

Expand Down

0 comments on commit 9c8183a

Please sign in to comment.