SIGN IN SIGN UP

Fix EOS handling, weight sharding and extras found in review

generate.py: the EOS break happened before last_token was assigned, so the
terminal GenerationResponse could never report finish_reason='stop' and
re-emitted the previous token instead of the stop token. That matters for the
four TTS consumers that append response.token to input_ids: the appended value
was a duplicate audio code rather than the EOS the parsers filter, shifting
codec framing at the tail of an utterance. Also restores a final response when
the first sampled token is EOS, makes max_tokens=-1 unbounded again, and
restores upstream's wired-limit warning.

convert.py: save_model wrote a single monolithic safetensors file and donated
the model only after serializing. Restore 5 GB sharding with the index map, and
release references before writing so shards free as they go. mixed-quant now
gives lm_head high bits unconditionally, as upstream does - the previous gate
dropped it to low bits on models with fewer than eight layers.

load.py: load weights strictly, so a mismatched text encoder raises instead of
silently loading partly random weights.

pyproject: [sts] and [all] now include mlx-lm. Dropping it from core also
dropped it from those extras, which would have made the default S2S pipeline
raise at startup.

Adds parity coverage for the conversion helpers (all four mixed-quant recipes
across 4/8/32 layers, which is what caught the lm_head gate) and permanent
EOS-semantics tests that survive the parity teardown.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A
Alazar Manakelew committed
273c99ca608fe9b1e77b1e74daaf953ba63f7de7
Parent: 6e8e594