hotfix whisper main script (#11184)

This commit is contained in:
chenyu
2025-07-11 12:34:00 -04:00
committed by GitHub
parent 0b7e9b5db7
commit b072be0e2d

View File

@@ -321,7 +321,7 @@ if __name__ == "__main__":
log_spec = prep_audio(total.reshape(1, -1), model.batch_size, truncate=True)
encoded_audio = model.encoder.encode(Tensor(log_spec))
# pass the previously inferred tokens as 'prefix' - https://github.com/openai/whisper/discussions/117#discussioncomment-3727051
out = model.decoder(Tensor([lst]), 0, encoded_audio, streaming=True).realize()
out = model.decoder(Tensor([lst]), 0, encoded_audio).realize()
idx = int(out[0,-1].argmax().numpy().item())
lst.append(idx)
dec = enc.decode(lst)