Skip to main content



Sinapsis CSM

🐍 Installation • 🚀 Features • 📚 Usage example • 📙 Documentation • 🔍 License

This Sinapsis CSM package integrates a lightweight, efficient text-to-speech engine using the CSM model. It provides a simple template to convert input text into speech using Sinapsis.


🐍 Installation

[!IMPORTANT] Sinapsis project requires Python 3.10 or higher.

Install using your preferred package manager. We strongly recommend using uv. To install uv, refer to the official documentation.

Install with uv:

uv pip install sinapsis-csm --extra-index-url https://pypi.sinapsis.tech

Or with raw pip:

pip install sinapsis-csm --extra-index-url https://pypi.sinapsis.tech

[!IMPORTANT] Templates in each package may require additional dependencies. For development, we recommend installing the package with all the optional dependencies:

With uv:

uv pip install sinapsis-csm[all] --extra-index-url https://pypi.sinapsis.tech

Or with raw pip:

pip install sinapsis-csm[all] --extra-index-url https://pypi.sinapsis.tech

To run this package you need a HuggingFace token. See the official instructions and set it using

export HF_TOKEN=<token-provided-by-hf>

and test it through the cli or the webapp.

Access to the following models is needed:


🚀 Features

Templates Supported

  • CSMTTS: Converts text into speech using the CSM model.

    Attributes
    • speaker_id (int, default: 0): Speaker identity index.
    • max_audio_length_ms (int, default: 10000): Max audio length in milliseconds.
    • device ("cpu" or "cuda", default: "cpu"): Device used for inference.
    • context (context: list[str] | None = None): Optional list of past utterances for context.
    • sample_rate_hz (int, default: 24000): Output audio sample rate.

📚 Usage example

This example shows how to use the CSMTTS template to convert text into speech and save it to disk.

Agent config
agent:
  name: csm_tts_agent
  description: Agent that synthesizes speech from text using the CSM model.

templates:
  - template_name: InputTemplate
    class_name: InputTemplate
    attributes: {}

  - template_name: TextInput
    class_name: TextInput
    template_input: InputTemplate
    attributes:
      text: "Hi, my name is Taylor and this is Sinapsis"

  - template_name: CSMTTS
    class_name: CSMTTS
    template_input: TextInput
    attributes:
      speaker_id: 0
      max_audio_length_ms: 10000
      device: cpu
      context: null
      sample_rate_hz: 24000

  - template_name: AudioWriterSoundFile
    class_name: AudioWriterSoundFile
    template_input: CSMTTS
    attributes:
      save_dir: csm_tts
      extension: wav

To run the config, use:

sinapsis run packages/sinapsis_csm/src/sinapsis_csm/configs/csm_agent.yml

[!NOTE] The TextInput and AudioWriterSoundFile templates come from the sinapsis-data-readers and sinapsis-data-writers packages. Make sure they are installed to use this example.


🌐 Webapp

The webapp included in this project showcases the modularity of the CSM template for speech generation tasks.

[!IMPORTANT] To run the app you first need to clone this repository:

git clone git@github.com:Sinapsis-ai/sinapsis-speech.git
cd sinapsis-speech

[!NOTE] If you'd like to enable external app sharing in Gradio, export GRADIO_SHARE_APP=True

🐳 Docker

IMPORTANT This docker image depends on the sinapsis-nvidia:base image. Please refer to the official sinapsis instructions to Build with Docker.

  1. Build the sinapsis-speech image:
docker compose -f docker/compose.yaml build
  1. Start the app container:
docker compose -f docker/compose_apps.yaml up -d sinapsis-csm
  1. Check the logs
docker logs -f sinapsis-csm
  1. The logs will display the URL to access the webapp, e.g.,::
Running on local URL:  http://127.0.0.1:7860

NOTE: The url may be different, check the output of logs.

  1. To stop the app:
docker compose -f docker/compose_apps.yaml down
💻 UV

To run the webapp using the uv package manager, follow these steps:

  1. Sync the virtual environment:
uv sync --frozen
  1. Install the wheel:
uv pip install sinapsis-speech[all] --extra-index-url https://pypi.sinapsis.tech
  1. Run the webapp:
uv run webapps/packet_tts_apps/csm_tts_app.py
  1. The terminal will display the URL to access the webapp (e.g.):
Running on local URL:  http://127.0.0.1:7860

NOTE: The URL may vary; check the terminal output for the correct address.

📙 Documentation

Documentation is available on the Sinapsis website.

Tutorials and guides for different templates and agents are available at docs.sinapsis.tech/tutorials.


🔍 License

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.

For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.

Metadata

Release files for sinapsis-csm 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sinapsis-csm 0.1.2
File Size Uploaded
sinapsis_csm-0.1.2.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sinapsis-csm 0.1.2
File Interpreter ABI Platform
sinapsis_csm-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / sinapsis_csm-0.1.2.tar.gz

Download URL sinapsis_csm-0.1.2.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7bd672d2bec8c16928fe852d4bae96939439740df8e6b699093a0c718ee2f516
BLAKE2b-256 checksum
How to use checksums
4f6933eb200bfd38f7a001cc052412b16922b0217f4dde29c66b2e793759f432
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.16

Release files / sinapsis_csm-0.1.2-py3-none-any.whl

Download URL sinapsis_csm-0.1.2-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b3e63440718dcecc6df4cbc9fc924b47b0e347b86883d8b85a4d2c703922fe8
BLAKE2b-256 checksum
How to use checksums
c5d366bebfe8b3eb3b0451133caea07cb770a2c2d7bf802621735086b4daf535
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.16

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page