TypeError: Module.load_weights() got an unexpected keyword argument 'weights'
pip install mlx-audio
mlx_audio.tts.generate --text "Hello, world" Fetching 2 files: 100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 29537.35it/s] Error loading model: Module.load_weights() got an unexpected keyword argument 'weights' Traceback (most recent call last): File "/Users/vigo/.virtualenvs/trash/lib/python3.12/site-packages/mlx_audio/tts/generate.py", line 92, in generate_audio model = load_model(model_path=model_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/vigo/.virtualenvs/trash/lib/python3.12/site-packages/mlx_audio/tts/utils.py", line 201, in load_model model.load_weights(**kwargs) TypeError: Module.load_weights() got an unexpected keyword argument 'weights'
Seems to be an issue with formatting for the default model mlx-community/Kokoro-82M-4bit (maybe because it was converted with old version of mlx-audio?)
Fixed this by downloading the original from hugging face and converting to MLX with this command:
mlx_audio.tts.convert --hf-path mlx-community/Kokoro-82M-4bit --mlx-path mlx_model
Please install from source and try again.
pip install git+https://github.com/Blaizzy/mlx-audio
I tried and it works.
pip install -U mlx-audio
mlx_audio.tts.generate --text "Hello, world"
Error loading model: Module.load_weights() got an unexpected keyword argument 'weights'
Traceback (most recent call last):
File "/Users/vigo/.virtualenvs/trash/lib/python3.12/site-packages/mlx_audio/tts/generate.py", line 92, in generate_audio
model = load_model(model_path=model_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vigo/.virtualenvs/trash/lib/python3.12/site-packages/mlx_audio/tts/utils.py", line 201, in load_model
model.load_weights(**kwargs)
TypeError: Module.load_weights() got an unexpected keyword argument 'weights'
Did you install from source ?
Looks like it worked for me, but I'm getting another error below:
$ uv tool install git+https://github.com/Blaizzy/mlx-audio -U --python python3.11
Updated https://github.com/Blaizzy/mlx-audio (d521036cbb12f50437b42c224ef7946bbc54f685)
Resolved 171 packages in 1.88s
Built webrtcvad==2.0.10
Built mlx-audio @ git+https://github.com/Blaizzy/mlx-audio@d521036cbb12f50437b42c224ef7946bbc54f685
Prepared 7 packages in 1.56s
Uninstalled 5 packages in 41ms
Installed 7 packages in 9ms
+ antlr4-python3-runtime==4.9.3
+ dacite==1.9.2
+ einx==0.3.0
- encodec==0.1.1
+ frozendict==2.4.6
- mlx-audio==0.1.0
+ mlx-audio==0.2.0 (from git+https://github.com/Blaizzy/mlx-audio@d521036cbb12f50437b42c224ef7946bbc54f685)
- mlx-whisper==0.4.2
- more-itertools==10.7.0
+ omegaconf==2.3.0
- torchaudio==2.7.0
+ webrtcvad==2.0.10
Installed 2 executables: mlx_audio.server, mlx_audio.tts.generate
$ mlx_audio.tts.generate --text "Hello, world"
Fetching 2 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 2198.27it/s]
Model: mlx-community/Kokoro-82M-bf16
Text: Hello, world
Voice: None
Speed: 1.0x
Language: a
/Users/myuser/.local/share/uv/tools/mlx-audio/bin/python3: No module named pip
had the same error, do uv pip install pip and it'll work after that