ml-explore / mlx

MLX: An array framework for Apple silicon
https://ml-explore.github.io/mlx/
MIT License
17.06k stars 988 forks source link

[BUG] mx.load with whisper.transcribe "Input must be a zip file" #966

Closed cdreetz closed 7 months ago

cdreetz commented 7 months ago

Describe the bug Trying to run whisper.transcribe but get an error stating that the file must be a zip file, which I don't believe is correct.

To Reproduce I installed the requirements.txt from the mlx examples whisper repo. I have a mp3 file, and running the below code.

Include code snippet

import whisper
result = whisper.transcribe("downloaded_file_30s.mp3", path_or_hf_repo="mlx-community/whisper-large-v3-mlx-8bit")

print(result)

Expected behavior Transcribe and print the corresponding text.

Desktop (please complete the following information):

Additional context `(env) ➜ annotate python try_mlx_whisper.py Fetching 4 files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 55553.70it/s] Traceback (most recent call last): File "/Users/christianreetz/Desktop/annotate/try_mlx_whisper.py", line 42, in result = whisper.transcribe("downloaded_file_30s.mp3", path_or_hf_repo="mlx-community/whisper-large-v3-mlx-8bit") File "/Users/christianreetz/Desktop/annotate/whisper/transcribe.py", line 150, in transcribe mel = log_mel_spectrogram(audio, n_mels=model.dims.n_mels, padding=N_SAMPLES) File "/Users/christianreetz/Desktop/annotate/whisper/audio.py", line 167, in log_mel_spectrogram filters = mel_filters(n_mels) File "/Users/christianreetz/Desktop/annotate/whisper/audio.py", line 96, in melfilters return mx.load(filename)[f"mel{n_mels}"]

ValueError: [load_npz] Input must be a zip file or a file-like object that can be opened with zipfile.ZipFile`

cdreetz commented 7 months ago

this was my mistake, didn't have mel_filters.npz in a assets folder within my local repo.