我试图使一个程序,除其他事项外,是能够转录的音频文件选择的用户以及自愿选择的语言,其中特定的音频是在。
但我遇到了以下问题:
ERROR:root:Error at division
Traceback (most recent call last):
File "C:\Users\...\AppData\Local\Temp\ipykernel_27364\1513539390.py", line 136, in transcribir
result = model.transcribe(audio, language=f"{actual_language}", fp16=False, verbose=True)
File "C:\Users\...\anaconda3\envs\python39\lib\site-packages\whisper\transcribe.py", line 181, in transcribe
):
File "C:\Users\...\anaconda3\envs\python39\lib\site-packages\whisper\transcribe.py", line 117, in decode_with_fallback
File "C:\Users\...\anaconda3\envs\python39\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\Users\...\anaconda3\envs\python39\lib\site-packages\whisper\decoding.py", line 705, in decode
if completed or tokens.shape[-1] > self.n_ctx:
File "C:\Users\...\anaconda3\envs\python39\lib\site-packages\whisper\decoding.py", line 468, in __init__
if last_was_timestamp:
ValueError: tuple.index(x): x not in tuple
字符串
我在应用程序的这一部分的代码是这样的:
actual_language=combo.get()
archivo=filedialog.askopenfilename(initialdir = "./",
title = "Seleccione archivo",filetypes = (("all files","*.*"),("mp3 files","*.mp3"),
("wav files","*.wav")))
torch.cuda.is_available()
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
model = whisper.load_model("medium")
if archivo!="":
try:
audio = whisper.load_audio(archivo)
audio_trim = whisper.pad_or_trim(audio)
mel = whisper.log_mel_spectrogram(audio_trim).to(model.device)
result = model.transcribe(audio, language=f"{actual_language}", fp16=False, verbose=True)
print(result["text"])
except Exception as e:
actual_status.set("¡Error!")
logging.error('Error at %s', 'division', exc_info=e)
型
在添加语言选择之前,我尝试了自动语言识别,但错误是一样的。
result = model.transcribe(audio)
型
或
audio = whisper.load_audio(file)
audio_trim = whisper.pad_or_trim(audio)
mel = whisper.log_mel_spectrogram(audio_trim).to(model.device)
_, probs = model.detect_language(mel)
options = whisper.DecodingOptions()
result = whisper.decode(model, mel, options)
型
随着选择,我尝试使用更少的选项
result = model.transcribe(archivo,language=f"{actual_language}")
型
我用的是python 3.9,我也升级到了wishper的最新版本。
1条答案
按热度按时间xhv8bpkk1#
嗯.
在这一刻是工作正常。