0

How can I use whisper-timestamped's transcribe method? I have audio file "example.mp3", I want to generate it's timestamped transcription, as I have done my research open Ai's whisper-timestamped is great option. when i try to use transcribe method I get error.

my code:

import whisper_timestamped as whisper
import json


audio = whisper.load_audio('example.mp3')

model = whisper.load_model("small", device="cpu")

result = whisper.transcribe(model, audio, language="en")

print(json.dumps(result, indent = 2, ensure_ascii = False))

error:


  File "/home/luka/PycharmProjects/CreateAutoShorts/.venv/lib/python3.12/site-packages/whisper_timestamped-1.15.4-py3.12.egg/whisper_timestamped/transcribe.py", line 882, in <lambda>
    lambda layer, ins, outs, index=j: hook_attention_weights(layer, ins, outs, index))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/luka/PycharmProjects/CreateAutoShorts/.venv/lib/python3.12/site-packages/whisper_timestamped-1.15.4-py3.12.egg/whisper_timestamped/transcribe.py", line 777, in hook_attention_weights
    if w.shape[-2] > 1:
       ^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'

I tried reinstalling packages but without any success

1 Answer 1

1

I faced the same issue, using old version(20231117) of openai-whisper worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.