Vendor mlx-lm generation loop, loader and conversion helpers
Adds mlx_audio/lm/{generate,load,convert}.py and flips the remaining call
sites: generate_step/stream_generate/generate across 13 STT and 4 TTS models,
the conversion helpers used by mlx_audio/convert.py and the per-model convert
scripts, and dramabox's text-encoder loader. Retargets the fun_asr_nano
monkeypatch, which patched mlx_lm.generate by module name and would otherwise
have passed vacuously.
Two bugs fixed in the vendored conversion helpers:
- save_model's donate_model path passed flattened dotted keys to
model.update(), which expects a nested tree; use tree_map over
model.parameters() as upstream does. This broke every quantized-checkpoint
round trip (caught by the cohere_asr 4-bit and 8-bit generate tests).
- quantize_model dropped upstream's fine-grained branch, so re-quantizing an
already-quantized config recorded no per-layer parameters.
Only sts/voice_pipeline.py still imports mlx-lm, by design.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> A
Alazar Manakelew committed
ee1d78aab30966a13d55ee2c1be495cffeec7dfc
Parent: 987098e