Python Forum
How could I fix these errors ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How could I fix these errors ?
#1
Exclamation 
Hello, I have a problem so I hope some programmers can help me solve it.

Basically I run this:

import whisper

model = whisper.load_model("base")
result = model.transcribe('test.mp3', fp16=False)
And I get this:

Error:
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:
Error: ffmpeg error (see stderr output for detail) The above exception was the direct cause of the following exception:
Error:
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
For those who are wondering, my goal is just to transcribe an mp3 audio file "test.mp3" into text, via the AI Whisper of OpenAI.

And honestly, I've been at it for two days now and I'm not getting anywhere, I've opened the files in question, located lines 42 and 325 but I don't know what to do next.

Thank you in advance for your help and your explanations.
Reply
#2
Look at this blog post.
So you most be in folder where test.mp3 is,do this from command line.
The first do whisper test.mp3 then try to run python script in all in same folder.
Reply
#3
Hi, first of all, thank you for your help

I followed the instructions in your link to the letter, unfortunately the same error message appeared.

Now I renamed my audio file test.mp3 to "audio.wav" to follow the tutorial.

But I got the same error message whether it was on WindowsPowerShell or VScode.

I think indeed that the heart of the problem is the fact that it can't find the audio file.

How can I make it find it ?
Reply
#4
(Dec-04-2022, 08:21 PM)needhelp Wrote: But I got the same error message whether it was on WindowsPowerShell or VScode.

I think indeed that the heart of the problem is the fact that it can't find the audio file.

How can I make it find it ?
I have tested this this and it work as expected with a test.mp3 file.
You should be using virtual environment as it install a lot to avoid conflicts.
Example:
# Make
G:\div_code
λ python -m venv whisper_env

# Cd in
G:\div_code
λ cd whisper_env\

# Activate
G:\div_code\whisper_env
λ G:\div_code\whisper_env\Scripts\activate.bat

# Install
(whisper_env) G:\div_code\whisper_env
λ pip install git+https://github.com/openai/whisper.git
Collecting .....
Successfully installed certifi-2022.9.24 charset-normalizer-2.1.1 colorama-0.4.6 ffmpeg-python-0.2.0 filelock-3.8.0 future-0.18.2 huggingface-hub-0.11.1 
idna-3.4 more-itertools-9.0.0 numpy-1.23.5 packaging-21.3 pyparsing-3.0.9 pyyaml-6.0 regex-2022.10.31 requests-2.28.1
tokenizers-0.13.2 torch-1.13.0 tqdm-4.64.1 transformers-4.25.1 typing-extensions-4.4.0 urllib3-1.26.13 whisper-1.0
Also install update, whisper setup .
(whisper_env) G:\div_code\whisper_env
λ pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git
Collecting .....
Successfully installed whisper-1.0
Now if look in folder,use dir if ls not work.
(whisper_env) G:\div_code\whisper_env
λ ls
Connection  Lib/      audio.wav      audio.wav.txt  pyvenv.cfg  test.mp3.srt  test.mp3.vtt
Include/    Scripts/  audio.wav.srt  audio.wav.vtt  test.mp3    test.mp3.txt  ws.py
See that i have ws.py and test.mp3 is in same folder.

Run first:
(whisper_env) G:\div_code\whisper_env
λ whisper test.mp3
.....
The run code:
# ws.py
import whisper

model = whisper.load_model("base")
result = model.transcribe("test.mp3")
print(result["text"])
Output:
(whisper_env) G:\div_code\whisper_env λ python ws.py Okay, we are trying this for a second time to test the ability to upload an MP3 file. Hopefully this will work.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020