简体   繁体   中英

Calls error on ffmpeg module which doesnt have error attribute

Basically im using OpenAI whisper. Im using the code they give as a sample in the github repo. When i run it on command line or normally, it says the module ffmpeg doesnt have an attribute called error which whisper is calling for some reason.

Code(Just the sample code they supply on the github):

import whisper

model = whisper.load_model("base")

# load audio and pad/trim it to fit 30 seconds
audio = whisper.load_audio("audio.mp3")
audio = whisper.pad_or_trim(audio)

# make log-Mel spectrogram and move to the same device as the model
mel = whisper.log_mel_spectrogram(audio).to(model.device)

# detect the spoken language
_, probs = model.detect_language(mel)
print(f"Detected language: {max(probs, key=probs.get)}")

# decode the audio
options = whisper.DecodingOptions()
result = whisper.decode(model, mel, options)

# print the recognized text
print(result.text)

Im running on VScode, and i tried on the terminal with whisper audio.mp3 as well, all of them give the same error:

AttributeError: module 'ffmpeg' has no attribute 'Error

Edit: Why is the error coming? i have the code right, and have the module installed to

Make sure you install whisper using the command pip install git+https://github.com/openai/whisper.git

You can watch the answer in https://github.com/openai/whisper/discussions/251

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM