cnbeining / Whisper_Notebook

A Colab Notebook for OpenAI Whisper and DeepL API, aiming to create human-comparable results of translation and transcription.
GNU General Public License v3.0
22 stars 4 forks source link

Error in step 6 #1

Closed ubanning closed 1 year ago

ubanning commented 1 year ago

Hello, first thanks for the work. 😊

I have an error when I execute step number 6, more precisely in the cell: "Create SRT with transcription"

The error I get is:

TypeError                                 Traceback (most recent call last)
[<ipython-input-15-b68dc325f8e3>](https://localhost:8080/#) in <module>
      1 #@title Create SRT with transcription
      2 result_srt_list = []
----> 3 for i in result_merged['segments']:
      4     result_srt_list.append(srt.Subtitle(index=i['id'], start=timedelta(seconds=i['start']), end=timedelta(seconds=i['end']), content=i['text'].strip()))
      5 

TypeError: list indices must be integers or slices, not str

Can you help me?

Another thing I noticed is that in step 3: Prepare audio for transcription

An example is provided for converting the audio: ffmpeg -i aci.mp4 -vn -c:a aci.wav but if you run just that command, a warning appears in the console: At least one output file must be specified

So I modified it to: ffmpeg -i aci.mp4 -vn -c:a pcm_s16le aci.wav or just: ffmpeg -i aci.mp4 aci.wav I don't know if this modification has anything to do with the error I got.

Thanks.

cnbeining commented 1 year ago

Thanks for bug report - gonna review ASAP.

ubanning commented 1 year ago

Thanks for bug report - gonna review ASAP.

Ok, thanks a lot for the quick reply, I sent you an email too with basically the same message, sorry.

Thanks 😊

pkompiel commented 1 year ago

Obviously, you already changed the script to get rid of the bug. But now, I still get an error at step 6. It now says that the variable "result_merged" is not defined:

NameError                                 Traceback (most recent call last)
[<ipython-input-17-01c09ad3d31b>](https://localhost:8080/#) in <module>
      1 #@title Create SRT with transcription
      2 result_srt_list = []
----> 3 for i, v in enumerate(result_merged):
      4     result_srt_list.append(srt.Subtitle(index=i, start=timedelta(seconds=v['start']), end=timedelta(seconds=v['end']), content=v['text'].strip()))
      5 

NameError: name 'result_merged' is not defined

Another error I get is at step 2.2: "Select and Load Model"

ImportError                               Traceback (most recent call last)
<ipython-input-5-c9ab7d1f63d9> in <module>
      1 #@title Step 2.2: Select and load Model.
      2 if vad_filter:
----> 3     from whisperx.vad import VADSegmentPipeline
      4     vad_pipeline = VADSegmentPipeline(model_name = vad_model,
      5                                           device = device,

ImportError: cannot import name 'VADSegmentPipeline' from 'whisperx.vad' (/usr/local/lib/python3.9/dist-packages/whisperx/vad.py)

As a result, I had to turn off the vad filter.