dmarx / video-killed-the-radio-star

Notebook and tools for end-to-end automation of music video production with generative AI
https://colab.research.google.com/github/dmarx/video-killed-the-radio-star/blob/main/Video_Killed_The_Radio_Star_Defusion.ipynb#scrollTo=oPbeyWtesAoh
MIT License
196 stars 35 forks source link

Infer speech from audio wont complete: module 'whisper.utils' has no attribute 'write_vtt' " #101

Closed Brethitmanhart closed 1 year ago

Brethitmanhart commented 1 year ago

I really have no idea of coding so I hope I'm not being painful here - but the infer speech step won't run for me. The error is below

" AttributeError: module 'whisper.utils' has no attribute 'write_vtt' "

Here is a paste of a bit more of the code.

Transcribing audio with whisper-large elapsed: 24.86028742790222 Transcribing audio with whisper-tiny elapsed: 9.15235447883606

AttributeError Traceback (most recent call last) in 215 with open(outpath,'w') as f: 216 # to do: upstream PR to control verbosity --> 217 whisper.utils.write_vtt( 218 whispers[k]["segments"], # ...really? 219 file=f

AttributeError: module 'whisper.utils' has no attribute 'write_vtt'

If I need to do anything else please let me know. Thanks!!!

tbugg commented 1 year ago

I am getting the same error. Whisper worked fine a few days ago when I ran this. Not sure what changed.

GaelSauzet commented 1 year ago

Same here, was working fine before tho

mirio1247 commented 1 year ago

I literally have the same problem, I even installed whisper again and tried to update it including utils, but to no avail. Really wanted to use this program

mattpetters commented 1 year ago

same issue here!

mattpetters commented 1 year ago

Oh I see, API change for whisper.utils happened on 1/21/23, see this commit https://github.com/openai/whisper/commit/da600abd2b296a5450770b872c3765d0a5a5c769

I'll post the changes required in a sec when I get it working. Basically they changed to a new pattern for writing diff filetypes

mattpetters commented 1 year ago

Someone helped me out over at OpenAI's repo

pip uninstall whisper
pip install openai-whisper==20230117

to install the older version, or for new usage:

from whisper.utils import get_writer

writer = get_writer("vtt", str(transcription_root))
writer(whispers[k], f"{audio_fpath}.{k}")

Source: https://github.com/openai/whisper/discussions/880#discussioncomment-4761006

Meysmerized commented 1 year ago

OH!!! Thank you so much @mattpetters !! I'm new to this whole thing so it took me a bit of trial and error to understand what to do but it ended up working when I went here

image

And replaced this here !pip install git+https://github.com/openai/whisper image

With this !pip install openai-whisper==20230117 image

Had to restart the whole session from scratch too, make the change before running anything...

Hope this helps someone!

mattpetters commented 1 year ago

OH!!! Thank you so much @mattpetters !! I'm new to this whole thing so it took me a bit of trial and error to understand what to do but it ended up working when I went here

image

And replaced this here !pip install git+https://github.com/openai/whisper image

With this !pip install openai-whisper==20230117 image

Had to restart the whole session from scratch too, make the change before running anything...

Hope this helps someone!

Not a problem, happy to help! I also forked this project and may be making some QOL updates on that. Super fun stuff

HarlanBrothers commented 1 year ago

!pip install openai-whisper==20230117 did the trick! Thanks!!

DrSharoo commented 1 year ago

I'm still getting that error even after doing the "!pip install openai-whisper==20230117" what else should I do? @mattpetters ? Any recommendations? Is it just that one line of code?

dmarx commented 1 year ago

updated the notebook to work with the latest whisper, should be all good now! thanks for your patience folks.

IamKaliber commented 1 year ago

I'm getting this error on the infer speech from audio step. Anyone else getting this error? If so, how did you fix it?

image