Skip to main content

Speech to text using Parakeet TDT model

Project description



Sinapsis Parakeet TDT

Templates for advanced speech-to-text transcription with NVIDIA Parakeet TDT

🐍 Installation 🚀 Features 📚 Usage example🌐 Webapp📙 Documentation🔍 License

This Sinapsis Parakeet TDT package provides a template for seamlessly integrating, configuring, and running speech-to-text (STT) functionalities powered by NVIDIA's Parakeet TDT model.

🐍 Installation

Install using your favourite package manager. We strongly encourage the use of uv, although any other package manager should work too. If you need to install uv please see the official documentation.

Example with uv:

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

or with raw pip:

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

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

with uv:

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

or with raw pip:

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

🚀 Features

Templates Supported

This module includes a template for speech-to-text transcription using the Parakeet TDT model:

ParakeetTDTInference: Advanced speech-to-text transcription template powered by NVIDIA's Parakeet TDT 0.6B model, designed for high-quality English transcription with exceptional accuracy across a wide array of accents and dialects, vocal ranges, and diverse domains and noise conditions. The template features comprehensive support for punctuation, capitalization, and accurate timestamp prediction, ensuring professional-grade transcription results. It seamlessly processes audio packets from the input container or specified file paths.

Attributes
  • model_name (str): Name or path of the Parakeet TDT model. Defaults to "nvidia/parakeet-tdt-0.6b-v2".
  • audio_paths (list[str] | None): Optional list of audio file paths to transcribe. If None, audio will be taken from the AudioPackets in the DataContainer. Defaults to None.
  • enable_timestamps (bool): Whether to generate timestamps for the transcription. Defaults to False.
  • timestamp_level (Literal["char", "word", "segment"]): Level of timestamp detail. Defaults to "word".
  • device (Literal["cpu", "cuda"]): Device to run the model on. Defaults to "cuda".
  • refresh_cache (bool): Whether to refresh the cache when downloading the model. Defaults to False.

[!TIP] Use CLI command sinapsis info --example-template-config TEMPLATE_NAME to produce an example Agent config for the Template specified in TEMPLATE_NAME.

For example, for ParakeetTDTInference use sinapsis info --example-template-config ParakeetTDTInference to produce an example config like:

agent:
  name: my_test_agent
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: ParakeetTDTInference
  class_name: ParakeetTDTInference
  template_input: InputTemplate
  attributes:
    model_name: "nvidia/parakeet-tdt-0.6b-v2"
    audio_paths: []
    enable_timestamps: false
    timestamp_level: "word"
    device: "cuda"
    refresh_cache: false

📚 Usage example

This example illustrates how to use the ParakeetTDTInference template for speech-to-text transcription. It converts audio input into text using NVIDIA's Parakeet TDT model.

Config
agent:
  name: parakeet_tdt_agent
  description: "Agent that transcribes speech to text using the NVIDIA Parakeet TDT model."

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

- template_name: AudioReaderSoundfile
  class_name: AudioReaderSoundfile
  template_input: InputTemplate
  attributes:
    audio_file_path: "artifacts/sample.wav"
    source: "artifacts/sample.wav"

- template_name: ParakeetTDTInference
  class_name: ParakeetTDTInference
  template_input: AudioReaderSoundfile
  attributes:
    model_name: "nvidia/parakeet-tdt-0.6b-v2"
    enable_timestamps: true
    timestamp_level: "word"
    device: "cuda"

This configuration defines a complete pipeline for speech-to-text transcription:

  1. First, an audio file is read using the AudioReaderSoundfile template
  2. The audio is then processed by the ParakeetTDTInference template, which transcribes it to text
  3. The transcription is saved to a text file using the TextWriter template

[!IMPORTANT] The AudioReaderSoundfile and TextWriter templates correspond to sinapsis-data-readers. If you want to use the example, please make sure you install these packages.

To run the config, use the CLI:

sinapsis run name_of_config.yml

🌐 Webapp

The webapp included in this project showcases the capabilities of the Parakeet TDT model for speech recognition 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-parakeet-tdt
  1. Check the logs
docker logs -f sinapsis-parakeet-tdt
  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/speech_to_text_apps/parakeet_tdt_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 for different projects within sinapsis are available at sinapsis tutorials page

🔍 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sinapsis_parakeet_tdt-0.1.2.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sinapsis_parakeet_tdt-0.1.2-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file sinapsis_parakeet_tdt-0.1.2.tar.gz.

File metadata

File hashes

Hashes for sinapsis_parakeet_tdt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 112ee673bab26a07146615249ac1ea73033a5b4e3156e77ff5cb4e54ccd94d2b
MD5 1a0fefbbb9c50a967dad261645a99d1d
BLAKE2b-256 316fc6b5d0c86aaf1d5cadee65dc05d3f4aa7565a5d16a086991c9b3606cb135

See more details on using hashes here.

File details

Details for the file sinapsis_parakeet_tdt-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sinapsis_parakeet_tdt-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5cbc52b00e177097c2cb8fa502ac89b837ed47a0d7ecef4cfe20f1ff83a3b716
MD5 7b3557926e8a48a232d0f8d82b10fa3d
BLAKE2b-256 9b871a7177d783ddab1b57c728473cf022c70719972502b33d9f07777d9558f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page