Skip to content

Moss tts server - #506

Closed
voxmenthe wants to merge 10 commits into
Blaizzy:mainfrom
voxmenthe:moss-tts-server
Closed

voxmenthe wants to merge 10 commits into
Blaizzy:mainfrom
voxmenthe:moss-tts-server

Conversation

@voxmenthe

Copy link
Copy Markdown
Contributor

Server API Surface: Request Fields, Reserved model_kwargs Safety, Optional Fallbacks

This PR focuses on server-facing request handling and validation behavior for audio endpoints, with emphasis on safe passthrough semantics and clear failure modes.

Scope (Included)

This PR includes:

  • mlx_audio/server.py
  • mlx_audio/tests/test_server.py
  • mlx_audio/sts/voice_pipeline.py
  • mlx_audio/sts/tests/test_voice_pipeline.py
  • mlx_audio/stt/models/qwen3_forced_aligner/__init__.py

Primary behavior in scope:

  • OpenAI-compatible /v1/audio/speech request-surface expansion for advanced generation controls.
  • Validation guard for reserved model_kwargs collisions to prevent ambiguous/duplicate generation arguments.
  • Explicit HTTP 400 response for reserved collisions with clear error detail.
  • Server-side passthrough hygiene for strict model signatures.
  • Optional dependency fallback behavior on server/STS paths covered by tests.

Scope (Intentionally Excluded)

This PR does not include:

  • Realtime runtime internals in mlx_audio/tts/models/moss_tts_realtime/**.
  • Non-realtime TTS runtime internals in mlx_audio/tts/models/moss_tts/**.
  • General CLI gateway behavior in mlx_audio/tts/generate.py.
  • Broad docs/readme/example expansion.

Validation

uv run pytest -q \
  mlx_audio/tests/test_server.py \
  mlx_audio/sts/tests/test_voice_pipeline.py

Targeted safety check executed:

uv run pytest -q mlx_audio/tests/test_server.py -k tts_speech_rejects_reserved_model_kwargs

Result: 1 passed.

Manual Verification Notes

  • Reserved model_kwargs collisions return HTTP 400 and include clear guidance:
    • Server validation path: _validate_reserved_model_kwargs(...) in mlx_audio/server.py.
    • Error detail includes:
      • model_kwargs contains reserved generation arguments (...)
      • Pass these as top-level request fields instead.
  • Confirmed PR diff scope is server-focused with no model-runtime internal files:
    • mlx_audio/server.py
    • mlx_audio/tests/test_server.py
    • mlx_audio/sts/voice_pipeline.py
    • mlx_audio/sts/tests/test_voice_pipeline.py
    • mlx_audio/stt/models/qwen3_forced_aligner/__init__.py

Reviewer Guide

Suggested review order:

  1. mlx_audio/tests/test_server.py (especially reserved model_kwargs rejection case).
  2. mlx_audio/server.py request parsing + validation flow.
  3. mlx_audio/sts/voice_pipeline.py and mlx_audio/sts/tests/test_voice_pipeline.py.
  4. mlx_audio/stt/models/qwen3_forced_aligner/__init__.py (scope-limited integration touchpoint).

The STS LFM output contract test intermittently fails on macOS CI with:
[metal::Device] Unable to load kernel rbitsc (Compilation failed).

Changes:
- Add an exact matcher for the known MLX Metal `rbitsc` compile failure.
- Wrap `mx.eval(...)` calls in a helper that retries once after `mx.clear_cache()`.
- If retry still fails, skip only when `CI` is set.
- Re-raise locally and re-raise all non-matching RuntimeErrors (no masking of real
regressions).
@lucasnewman

Copy link
Copy Markdown
Collaborator

Closing for now. We'll reopen if work on #501 is resumed.

@lucasnewman lucasnewman closed this Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants