whisper/convert.py outputs `model.safetensors` but `mlx_whisper.load_models` expects `weights.safetensors`
The pip-installed mlx-whisper package looks for weights.safetensors or
weights.npz, but the upstream whisper/convert.py script in this repo
writes the converted weights to model.safetensors. After running the
documented conversion command, mlx_whisper.transcribe(path_or_hf_repo=...)
fails to find the weights and crashes.
Repro
python3 whisper/convert.py \
--torch-name-or-path nectec/Pathumma-whisper-th-large-v3 \
--mlx-path /tmp/pathumma-mlx \
--dtype float16
ls /tmp/pathumma-mlx
# config.json
# model.safetensors <-- written by convert.pyimport mlx_whisper
mlx_whisper.transcribe("audio.wav", path_or_hf_repo="/tmp/pathumma-mlx")
# FileNotFoundError / load failure: weights.safetensors not foundSource
whisper/convert.py(this repo) writesmodel.safetensors: https://github.com/ml-explore/mlx-examples/blob/main/whisper/convert.py#L385mx.save_safetensors(str(mlx_path / "model.safetensors"), weights)mlx_whisper/load_models.py(PyPI mlx-whisper 0.4.3) expectsweights.safetensors:wf = model_path / "weights.safetensors" if not wf.exists(): wf = model_path / "weights.npz" weights = mx.load(str(wf))
Workaround
Rename after conversion:
mv /tmp/pathumma-mlx/model.safetensors /tmp/pathumma-mlx/weights.safetensorsPossible fix
Either:
convert.pywrites toweights.safetensors, orload_models.pyalso acceptsmodel.safetensors
The latter seems more backwards-compatible since pre-converted models on the Hub
(e.g. mlx-community/whisper-large-v3-mlx) currently ship weights.npz.
Versions: mlx-whisper==0.4.3, mlx==0.31.2, mlx-examples HEAD e52c128.
Source: ml-explore/mlx-examples