【问题标题】:OpenAI Whisper producing errorsOPEN AI WHISPER:这些错误让我很生气(请帮忙)
【发布时间】:2022-12-05 05:24:56
【问题描述】:

我有一个问题,所以我希望一些程序员可以帮助我解决它。


基本上我运行这个:

import whisper
 
model = whisper.load_model("base")
result = model.transcribe('test.mp3', fp16=False)

我明白了:

Output exceeds the  size limit. Open the full output data in a text editor.  
 
Error Traceback (most recent call last)

File
     38 try:
     39     # This launches a subprocess to decode audio while down-mixing and resampling as necessary.
     40     # Requires the ffmpeg CLI and `ffmpeg-python` package to be installed.
     41     out, _ = (
---> 42         ffmpeg.input(file, threads=0)
     43         .output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=sr)
     44         .run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True)
     45     )
     46 except ffmpeg.Error as e:
File 
    324 if retcode:
--> 325     raise Error('ffmpeg', out, err)
    326 return out, err `

Error: ffmpeg error (see stderr output for detail)
 
The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
Cell In[25], line 4
      1 import whisper
...
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
test.mp3: No such file or directory

我的目标只是通过 OpenAI 的 AI Whisper 将 mp3 音频文件“test.mp3”转录为文本。

我只想让 Whisper 使用一些音频文件,但这些错误阻止我这样做。

老实说,我已经处理了两天了,但我一无所获,我已经打开了位于第 42 和 325 行的相关文件,但我不知道下一步该怎么做。

预先感谢您的帮助和解释。

【问题讨论】:

  • 确保 mp3 文件的路径正确。

标签: python runtime-error speech-to-text openai whisper


【解决方案1】:

使用操作系统模块。

import os

# get the current working dir
cwd = os.getcwd()

# construct the full path to the file
file_path = os.path.join(cwd, 'test.mp3')

# transcribe the file
result = model.transcribe(file_path, fp16=False)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-10
    • 2010-12-04
    • 1970-01-01
    • 2022-10-17
    • 2011-01-18
    • 1970-01-01
    • 2011-05-09
    • 1970-01-01
    相关资源
    最近更新 更多