Skip to content

invalid model data and Error opening <_io.TextIOWrapper name='jfk.mp3' mode='r' encoding='UTF-8'>: Format not recognised. #24

@PlanetDestroyyer

Description

@PlanetDestroyyer

code i m using

`from whisper_cpp_python import Whisper

whisper = Whisper(model_path="ggml-tiny.en.bin")

output = whisper.transcribe(open('jfk.mp3'))

print(output)

output = whisper.transcribe(open('jfk.mp3'), response_format='verbose_json')

print(output)`

i tried with 3 different version of python 3.11, 3.12 and 3.13

in 3.13 it didnt got installed but for 3.11 and 3.12 its showing

➜  stt_packages python3 app.py
whisper_init_from_file_no_state: loading model from 'ggml-tiny.en.bin'
whisper_model_load: loading model
whisper_model_load: invalid model data (bad magic)
whisper_init_no_state: failed to load model
Exception ignored from cffi callback <function SoundFile._init_virtual_io.<locals>.vio_read at 0x750c8c8aafc0>:
Traceback (most recent call last):
  File "/home/x/stt_packages/whisper_cpp_env/lib/python3.11/site-packages/soundfile.py", line 1300, in vio_read
    buf[0:data_read] = data
    ~~~^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'str'
Traceback (most recent call last):
  File "/home/x/stt_packages/app.py", line 3, in <module>
    output = whisper.transcribe(open('jfk.mp3'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/stt_packages/whisper_cpp_env/lib/python3.11/site-packages/whisper_cpp_python/whisper.py", line 21, in transcribe
    data, sr = librosa.load(file, sr=Whisper.WHISPER_SR)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/stt_packages/whisper_cpp_env/lib/python3.11/site-packages/librosa/core/audio.py", line 186, in load
    raise exc
  File "/home/x/stt_packages/whisper_cpp_env/lib/python3.11/site-packages/librosa/core/audio.py", line 176, in load
    y, sr_native = __soundfile_load(path, offset, duration, dtype)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/stt_packages/whisper_cpp_env/lib/python3.11/site-packages/librosa/core/audio.py", line 209, in __soundfile_load
    context = sf.SoundFile(path)
              ^^^^^^^^^^^^^^^^^^
  File "/home/x/stt_packages/whisper_cpp_env/lib/python3.11/site-packages/soundfile.py", line 690, in __init__
    self._file = self._open(file, mode_int, closefd)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/stt_packages/whisper_cpp_env/lib/python3.11/site-packages/soundfile.py", line 1265, in _open
    raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
soundfile.LibsndfileError: Error opening <_io.TextIOWrapper name='jfk.mp3' mode='r' encoding='UTF-8'>: Format not recognised.
➜  stt_packages 

facing this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions