Skip to content

Commit 91481fb

Browse files
committed
coreml: fix audio shape in whisper decoder conversion [no ci]
This commit fixes the audio shape in the whisper decoder conversion script. The motivation for this is that the audio shape was incorrect and was causing the conversion to fail.
1 parent 93282c6 commit 91481fb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

models/convert-whisper-to-coreml.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,11 @@ def convert_decoder(hparams, model, quantize=False):
269269
model.eval()
270270

271271
tokens_shape = (1, 1)
272-
audio_shape = (1, hparams.n_audio_state, 1, 1500)
272+
audio_shape = (1, hparams.n_audio_ctx, hparams.n_audio_state)
273273

274274
audio_data = torch.randn(audio_shape)
275-
token_data = torch.randint(50257, tokens_shape).long()
275+
token_data = torch.randint(hparams.n_vocab, tokens_shape).long()
276+
276277
traced_model = torch.jit.trace(model, (token_data, audio_data))
277278

278279
model = ct.convert(

0 commit comments

Comments
 (0)