Docs /Templates/ sinapsis-huggingface-embeddings

SpeakerEmbeddingFromAudio

sinapsis-huggingface-embeddingsHuggingFaceembeddingshuggingfacemodelsaudio

Python template · sinapsis_huggingface_embeddings.templates.speaker_embedding_from_audio

Overview

The template provides functionality to generate embeddings for an audio provided in the DataContainer, using Huggingface models

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-huggingface-embeddings==1.0.0
uv pip install sinapsis-huggingface-embeddings==1.0.0
uv add sinapsis-huggingface-embeddings==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
normalize

Whether to apply normalization to the generated embeddings. If `True`, the embeddings will be normalized using the model's internal normalization mechanism, ensuring compatibility for tasks like voice verification. If `False`, the raw embeddings will be used without additional normalization. Defaults to `False`.

bool
Optional
Default: false
model_path

HuggingFace source used to load the model. Defaults to "speechbrain/spkrec-xvect-voxceleb".

str
Optional
Default: "speechbrain/spkrec-xvect-voxceleb"
target_packetRequired

Type of packet in the `DataContainer` to which the embedding will be attached. Must be either `"texts"` or `"audios"`.

typing.Literal['texts', 'audios']
Required
Default: null
data_cache_dir

Directory in which the artifacts of the loaded model will be stored. Defaults to `SINAPSIS_CACHE_DIR`.

str
Optional
Default: "/home/ariel/.cache/sinapsis"

Configuration example

Example from the Python docstring:

yaml
agent:
  name: my_test_agent
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: SpeakerEmbeddingFromAudio
  class_name: SpeakerEmbeddingFromAudio
  template_input: InputTemplate
  attributes:
    model_path: speechbrain/spkrec-xvect-voxceleb
    data_cache_dir: /path/to/cache/dir
    target_packet: 'audios'
    normalize: false
Show schema-based configuration skeleton
yaml
templates:
  - template_name: "SpeakerEmbeddingFromAudio"
    class_name: "SpeakerEmbeddingFromAudio"
    attributes:
      normalize: false
      model_path: "speechbrain/spkrec-xvect-voxceleb"
      target_packet: "<required>"
      data_cache_dir: "/home/ariel/.cache/sinapsis"

Inheritance

Immediate parent: sinapsis_core.template_base.template.Template

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_CACHE_DIR · defined elsewhere