Skip to content

feat(backend): add SpiritLM backend for text, TTS, and ASR#8589

Open
MkDev11 wants to merge 10 commits intomudler:masterfrom
MkDev11:feat/spiritlm-backend
Open

feat(backend): add SpiritLM backend for text, TTS, and ASR#8589
MkDev11 wants to merge 10 commits intomudler:masterfrom
MkDev11:feat/spiritlm-backend

Conversation

@MkDev11
Copy link

@MkDev11 MkDev11 commented Feb 17, 2026

Description

Fixes #3966

Adds a new LocalAI backend for Meta Spirit LM: an interleaved text and speech model that supports text generation, text-to-speech (TTS), and automatic speech recognition (ASR) in a single 7B model.

Changes:

  • backend/python/spiritlm/ – New Python gRPC backend implementing:
    • LoadModel: loads spirit-lm-base-7b or spirit-lm-expressive-7b
    • Predict / PredictStream: text generation via OutputModality.TEXT
    • TTS / TTSStream: text → speech via OutputModality.SPEECH (float32 → 16 kHz WAV)
    • AudioTranscription: speech → text via OutputModality.TEXT from audio path (request.dst)
    • Health, options parsing (sample_rate, etc.)
  • backend/index.yaml – New &spiritlm meta with description, tags (text-to-text, TTS, ASR, LLM, multimodal), capabilities (cpu-spiritlm, cuda12-spiritlm).

Notes for Reviewers

  • SpiritLM is not on PyPI; requirements-install.txt installs from git+https://github.com/facebookresearch/spiritlm.git. Checkpoints must be set up separately per the SpiritLM repo.
  • Backend follows the same pattern as other Python backends (nemo, kokoro): libbackend.sh, protogen, Makefile, run.sh, install.sh. Docker builds copy backend.proto into the backend dir per existing Dockerfile.python.
  • License noted in index as fair-noncommercial (Meta FAIR Noncommercial Research License).

Signed commits

  • Yes, I signed my commits.

Implements LocalAI backend for Meta Spirit LM (interleaved text and speech).
- backend/python/spiritlm: gRPC servicer with LoadModel, Predict,
  PredictStream, TTS, TTSStream, AudioTranscription, Health
- Supports spirit-lm-base-7b and spirit-lm-expressive-7b
- Options: sample_rate (default 16000)
- backend/index.yaml: add spiritlm meta and capabilities

Ref: mudler#3966
Signed-off-by: mkdev11 <MkDev11@users.noreply.github.com>
@netlify
Copy link

netlify bot commented Feb 17, 2026

Deploy Preview for localai ready!

Name Link
🔨 Latest commit b2628f6
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/699efa49a0efc000086e0b5f
😎 Deploy Preview https://deploy-preview-8589--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@MkDev11
Copy link
Author

MkDev11 commented Feb 17, 2026

@mudler could you please review the PR and let me know your feedback?

@richiejp
Copy link
Collaborator

Can you add an entry in gallery/index.yaml similar to Qwen-ASR?

Add spirit-lm-base-7b and spirit-lm-expressive-7b to model gallery,
following the same pattern as Qwen-ASR (per PR mudler#8589 review).

Signed-off-by: mkdev11 <MkDev11@users.noreply.github.com>
@MkDev11
Copy link
Author

MkDev11 commented Feb 18, 2026

Can you add an entry in gallery/index.yaml similar to Qwen-ASR?

@richiejp Thanks for your feedback. I added SpiritLM to gallery/index.yaml following the Qwen-ASR pattern.

@richiejp
Copy link
Collaborator

Thanks, the bottleneck on our end is testing. If you provide e2e tests then we can verify these and get it merged faster.

@MkDev11
Copy link
Author

MkDev11 commented Feb 19, 2026

Thanks, the bottleneck on our end is testing. If you provide e2e tests then we can verify these and get it merged faster.

@richiejp I added e2e tests, please review the update again and let me know your feedback.

@MkDev11
Copy link
Author

MkDev11 commented Feb 23, 2026

@mudler @richiejp can you please let me review again?

@richiejp
Copy link
Collaborator

you still need to add e2e tests

MkDev11 added a commit to MkDev11/LocalAI that referenced this pull request Feb 24, 2026
- Add 'SpiritLM backend e2e' context in core/http/app_test.go (label: spiritlm)
  with specs: chat completion, TTS, transcription; skip when backend/model not ready
- Add make test-spiritlm target; pass SPIRITLM_CHECKPOINTS_DIR when set
- Add backend/python/spiritlm/E2E.md with run instructions and full-pass steps
- Fix protogen.sh to use repo backend proto path; add backend/python/backend.proto
  symlink for runProtogen; run.sh executable

Ref: mudler#8589, mudler#3966
@MkDev11
Copy link
Author

MkDev11 commented Feb 24, 2026

you still need to add e2e tests

sorry, just pushed e2e tests

- Add 'SpiritLM backend e2e' context in core/http/app_test.go (label: spiritlm)
  with specs: chat completion, TTS, transcription; skip when backend/model not ready
- Add make test-spiritlm target; pass SPIRITLM_CHECKPOINTS_DIR when set
- Add backend/python/spiritlm/E2E.md with run instructions and full-pass steps
- Fix protogen.sh to use repo backend proto path; add backend/python/backend.proto
  symlink for runProtogen; run.sh executable

Ref: mudler#8589, mudler#3966
Signed-off-by: mkdev11 <MkDev11@users.noreply.github.com>
- Add tests/e2e/spiritlm_e2e_test.go with chat, TTS, and transcription specs
- Register spiritlm mock backend and spirit-lm-base-7b model in e2e_suite_test.go
- Add make test-e2e-spiritlm target; fix protogen-go PATH for protoc plugins
- Update backend/python/spiritlm/E2E.md with tests/e2e coverage and run instructions

Signed-off-by: mkdev11 <MkDev11@users.noreply.github.com>
@MkDev11 MkDev11 force-pushed the feat/spiritlm-backend branch from 87ef862 to bdc4829 Compare February 24, 2026 11:05
@MkDev11
Copy link
Author

MkDev11 commented Feb 26, 2026

Hi @richiejp Can you please let me know what I need to update or change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for SpiritLM

2 participants