Speech processing templates and pipelines for transcription, speaker diarization, and emotion analysis
Project description
Sinapsis Diarization
Templates for Automatic Speech Recognition, Diarization and Emotion Recognition.
🐍 Installation • 🚀 Features • 📚 Example usage • CLI 📙 Documentation • 🔍 License
The sinapsis-diarization module provides templates for Automatic Speech Recognition, Speaker Diarization, and Emotion Recognition, enabling efficient and accurate audio analysis pipelines.
🐍 Installation
Install using your package manager of choice. We encourage the use of uv
uv pip install sinapsis-diarization
or with raw pip
pip install sinapsis-diarization
[!IMPORTANT] Templates in sinapsis-diarization package may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
uv pip install sinapsis-diarization[all] --extra-index-url https://pypi.sinapsis.tech
or
pip install sinapsis-diarization[all] --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] Templates in sinapsis-diarization package may require a Huggingface Token. Set the environment variable for Hugginface using
export HF_TOKEN="your_huggingface_token"
🚀 Features
Templates
The Sinapsis Diarization module provides multiple templates for Automatic Speech Recognition, Diarization, Emotion Recognition and combined pipelines.
Automatic Speech Recognition (ASR)
These templates provide transcriptions of audios.
- SinapsisParakeetASR: Runs Parakeet speech recognition for audio transcription.
- SinapsisCanaryASR: Runs Canary speech recognition for audio transcription
Diarization
These templates identify speakers in a conversation and their turn times during the audio.
- SinapsisSortformerDiarizer: Runs Sortformer to get diarization of the speakers in an audio.
- SinapsisPyannoteDiarizer: Runs Pyannote to get diarization of speakers in an audio.
ASR plus Diarization
These templates combine ASR with Diarization to transcribe a conversation and identify the speakers automatically.
- PyannoteDiarizedTranscription: Runs Parakeet and Pyannote to transcribe a conversation with speaker identification.
- SortformerDiarizedTranscription: Runs Parakeet and Sortformer to transcribe a conversation with speaker identification.
- WhisperxDiarizedTranscription: Runs Whisperx to transcribe an audio and divide it by speaker and time.
ASR plus Diarization and Emotion Recognition
These templates combine the diarized transcription templates with an emotion recognition pipeline to show the emotions detected by each speaker in the audio.
- PyannoteEmotionTranscription: Runs Parakeet, Pyannote and Speechbrain to transcribe an audio, divide it by speaker and assign emotions to the segments.
- SortformerEmotionTranscription: Runs Parakeet, Sortformer and Speechbrain to transcribe an audio, divide it by speaker and assign emotions to the segments.
Examples for template use can be found at src/sinapsis_diarization/configs
To get information on any of the templates use uv run sinapsis info --template TemplateName and substitute TemplateName for any of the sinapsis-diarization templates
📚 Example usage
All templates can be run through YAML configuration files using the sinapsis run command. The example below shows how to set up the WhisperxDiarizedTranscription template, which performs ASR and speaker diarization in a single pipeline.
Configuration attributes:
- root_dir: Base directory for resolving relative file paths.
- audio_file_path: Path to the audio file to process (relative to
root_dir). - asr_model_name: WhisperX model size. Available options:
"tiny","base","small","medium","large-v1","large-v2","large-v3". - device:
"cuda"or"cpu". - chunk_size_in_secs: Split audio into chunks of n seconds for processing. Use
-1to process the full audio at once. - min_speakers / max_speakers: Expected speaker count range.
Config file
agent:
name: whisperx_asr_diarization
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: WhisperxDiarizedTranscription
class_name: WhisperxDiarizedTranscription
template_input: InputTemplate
attributes:
root_dir: path_to_root_dir
audio_file_path: audio_sample.mp3
asr_model_name: large-v3
device: cuda
sample_rate: 16000
chunk_size_in_secs: 20
min_speakers: 2
max_speakers: 2
To run the agent with the config above:
sinapsis run /path/to/sinapsis-diarization/src/sinapsis_diarization/configs/transcription_with_diarization/whisperx_asr_diarization.yaml
More config examples for all available templates can be found in src/sinapsis_diarization/configs/.
📙 CLI
The pipelines for ASR, Diarization and Emotion diarization are available as CLI commands. Each command takes an audio file and model options as input, then writes results to a given output directory (by default results). Required arguments are marked with (required).
Sinapsis ASR
Transcribe an audio file using a single ASR engine.
Run using uv run sinapsis-asr
Example:
uv run sinapsis-asr --audio "path to audio" --model parakeet --chunk-size-in-secs 20 --device cuda
This command has the following options:
--audio AUDIO_PATH Path to audio (required)
--model MODEL Type of model to run (required)
--device DEVICE Device to run the model (required)
--chunk-size-in-secs CHUNK_SIZE Size of chunks in seconds
--model-name MODEL_NAME Name of model to use
--sample-rate SAMPLE_RATE Sample rate of audio
--output-dir OUTPUT_DIR Output directory for results
Models
- "parakeet"
- "canary"
Model names
-
Parakeet:
- "nvidia/parakeet-tdt-0.6b-v2"
- "nvidia/parakeet-tdt-0.6b-v3"
-
Canary:
- "nvidia/canary-qwen-2.5b"
Device options
- "cuda"
- "cpu"
Sinapsis Diarize
Identify speakers and their turn times in an audio file using a single diarization engine.
Run using uv run sinapsis-diarize
Example:
uv run sinapsis-diarize --audio "path to audio" --model sortformer --chunk-size-in-secs 20 --device cuda
This command has the following options:
--audio AUDIO_PATH Path to audio (required)
--model MODEL Type of model to run (required)
--device DEVICE Device to run the model (required)
--chunk-size-in-secs CHUNK_SIZE Size of chunks in seconds
--model-name MODEL_NAME Name of model to use
--sample-rate SAMPLE_RATE Sample rate of audio
--output-dir OUTPUT_DIR Output directory for results
Models
- "sortformer"
- "pyannote"
Model names
-
Sortformer:
- "nvidia/diar_streaming_sortformer_4spk-v2.1"
-
Pyannote:
- "pyannote/speaker-diarization-community-1"
Device options
- "cuda"
- "cpu"
Sinapsis ASR Diarize
Transcribe and diarize an audio file by composing separate ASR and diarization engines. Produces a speaker-attributed transcript.
Run using uv run sinapsis-asr-diarize
Example:
uv run sinapsis-asr-diarize --audio "path to audio" --asr-model parakeet --diarization-model sortformer --chunk-size-in-secs 20 --device cuda
This command has the following options:
--audio AUDIO_PATH Path to audio (required)
--asr-model ASR_MODEL Type of ASR model to run (required)
--diarization-model DIARIZATION_MODEL Type of Diarization model to run (required)
--device DEVICE Device to run the model (required)
--chunk-size-in-secs CHUNK_SIZE Size of chunks in seconds
--asr-model-name ASR_MODEL_NAME Name of ASR model to use
--diarization-model-name DIARIZATION_MODEL_NAME Name of Diarization model to use
--sample-rate SAMPLE_RATE Sample rate of audio
--output-dir OUTPUT_DIR Output directory for results
--num-speakers NUM_SPEAKERS Number of speakers for models that require it
ASR Models
- "parakeet"
- "canary"
Diarization Models
- "sortformer"
- "pyannote"
Model names
-
Parakeet:
- "nvidia/parakeet-tdt-0.6b-v2"
- "nvidia/parakeet-tdt-0.6b-v3"
-
Canary:
- "nvidia/canary-qwen-2.5b"
-
Sortformer:
- "nvidia/diar_streaming_sortformer_4spk-v2.1"
-
Pyannote:
- "pyannote/speaker-diarization-community-1"
Device options
- "cuda"
- "cpu"
Sinapsis Whisperx ASR Diarize
Transcribe and diarize an audio file using the WhisperX monolithic pipeline. Unlike sinapsis-asr-diarize, this uses a single model for both ASR and diarization.
Run using uv run sinapsis-whisperx-asr-diarize
Example:
uv run sinapsis-whisperx-asr-diarize --audio "path to audio" --model-name large-v3 --chunk-size-in-secs 20 --device cuda
This command has the following options:
--audio AUDIO_PATH Path to audio (required)
--model-name MODEL WhisperX model size (required)
--device DEVICE Device to run the model (required)
--chunk-size-in-secs CHUNK_SIZE Size of chunks in seconds
--sample-rate SAMPLE_RATE Sample rate of audio
--output-dir OUTPUT_DIR Output directory for results
--min-speakers MIN_SPEAKERS Minimum number of speakers
--max-speakers MAX_SPEAKERS Maximum number of speakers
Model names
- "tiny"
- "base"
- "small"
- "medium"
- "large-v1"
- "large-v2"
- "large-v3"
Device options
- "cuda"
- "cpu"
Sinapsis ASR Diarize Emotion
Transcribe, diarize, and detect emotions in an audio file. Composes ASR, diarization, and emotion detection engines to produce a speaker-attributed transcript with per-segment emotions.
Run using uv run sinapsis-asr-diarize-emotion
Example:
uv run sinapsis-asr-diarize-emotion --audio "path to audio" --asr-model parakeet --diarization-model sortformer --emotion-model speechbrain --chunk-size-in-secs 20 --device cuda
This command has the following options:
--audio AUDIO_PATH Path to audio (required)
--asr-model ASR_MODEL Type of ASR model to run (required)
--diarization-model DIARIZATION_MODEL Type of Diarization model to run (required)
--emotion-model EMOTION_MODEL Type of Emotion model to run (required)
--device DEVICE Device to run the model (required)
--chunk-size-in-secs CHUNK_SIZE Size of chunks in seconds
--asr-model-name ASR_MODEL_NAME Name of ASR model to use
--diarization-model-name DIARIZATION_MODEL_NAME Name of Diarization model to use
--emotion-model-name EMOTION_MODEL_NAME Name of emotion model to use
--sample-rate SAMPLE_RATE Sample rate of audio
--output-dir OUTPUT_DIR Output directory for results
--num-speakers NUM_SPEAKERS Number of speakers for models that require it
ASR Models
- "parakeet"
- "canary"
Diarization Models
- "sortformer"
- "pyannote"
Emotion Models
- "speechbrain"
Model names
-
Parakeet:
- "nvidia/parakeet-tdt-0.6b-v2"
- "nvidia/parakeet-tdt-0.6b-v3"
-
Canary:
- "nvidia/canary-qwen-2.5b"
-
Sortformer:
- "nvidia/diar_streaming_sortformer_4spk-v2.1"
-
Pyannote:
- "pyannote/speaker-diarization-community-1"
Device options
- "cuda"
- "cpu"
📙 Documentation
Documentation is available on the sinapsis website
Tutorials for different projects within sinapsis are available at sinapsis tutorials page
🔍 License
The templates in this project are licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.
The command line interface and pipelines in this project are licensed under the MIT license, which allows for unrestricted use of the software and encourages open collaboration. 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sinapsis_diarization-0.2.0.tar.gz.
File metadata
- Download URL: sinapsis_diarization-0.2.0.tar.gz
- Upload date:
- Size: 47.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
082a2651fd3a3305451b2cad3907b89508479262a41fea2e351036aaa03bece8
|
|
| MD5 |
b8029c6687dffe7f47087e0c998c8f34
|
|
| BLAKE2b-256 |
b57ac20dce3abf578ea84e0341de6f39e557ce8c06098fd1b3b6202bf27585ed
|
File details
Details for the file sinapsis_diarization-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sinapsis_diarization-0.2.0-py3-none-any.whl
- Upload date:
- Size: 70.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5197bfa320ddb8ffa0aa32718d554c1cf0d441d6a7b402b09a92a3bc74ea9ebc
|
|
| MD5 |
9266c0f421e897c11480946f974a646e
|
|
| BLAKE2b-256 |
1ea86db39b134262ccadff387d642db6c65ce1d03fcf9fc77471fbbd91414012
|