You need to enable JavaScript to run this app.
Lake AI Service

Lake AI Service

Copy page
Download PDF
Audio recognition
Speaker verification (ERes2Net)
Copy page
Download PDF
Speaker verification (ERes2Net)

Operator introduction

Description

AudioSpeakerVerificationEres2net audio speaker verification processor

Key features

  • Speaker verification: Determines whether two audio segments are from the same speaker and outputs a similarity score.
  • Multi-source audio support: Supports various audio input types including local files, URLs, object storage, base64, and binary.
  • Batch processing: Efficiently verifies and handles exceptions for batches of audio pairs.

Technical features

  • Loads the ERes2Net speaker verification model based on the ModelScope framework.
  • Supports multi-GPU inference, with automatic device selection or manual specification.
  • 16kHz sample rate audio preprocessing, compatible with multiple audio formats.

Typical application scenarios

  • ✅ Voice identity authentication – Speaker consistency verification
  • ✅ Intelligent customer service – Multi-channel voice normalization and verification
  • ✅ Voice data cleansing – Automated speaker deduplication

Recommendations

  • It is recommended to standardize the input audio sample rate to 16kHz to improve verification accuracy.
  • In multi-GPU environments, the GPU device can be flexibly specified using the rank parameter.

Daft invocation

Operator parameters

Input

Input column name

Note

speaker_a_audios

Audio for speaker A. Supported formats: - Audio file path (such as TOS url, S3 url, http(s) url, local path) - Audio binary data - Audio base64 encoding

speaker_b_audios

Audio for speaker B. Supported formats as above.

Output

The speaker similarity score (float) for each audio pair; abnormal samples are returned as None.

Parameters

If a parameter does not have a default value, it is required.

Parameter name

Type

Default value

Description

audio_src_type

str

Audio format type. Supported audio format types include: - tos/http address (audio_url) - base64 encoding (audio_base64) - binary stream (audio_binary) Optional values: ["audio_binary", "audio_url", "audio_base64"]

model_path

str

/opt/las/models

Model storage path. Default value: "/opt/las/models"

model_name

str

iic/speech_eres2net_sv_zh-cn_16k-common

Model name. Default value: "iic/speech_eres2net_sv_zh-cn_16k-common"

rank

int or None

None

Specifies the GPU device number to use (effective in multi-GPU environments). For example: 0 refers to the first GPU, 1 refers to the second GPU. Default value: None (automatically selects available device) Default value: None

Examples

The following code demonstrates how to use daft to run the operator to verify whether the speakers in two audio files are the same person.

from __future__ import annotations

import logging
import os

import ray

import daft
from daft import col
from daft.las.functions.audio.audio_speaker_verification_eres2net import AudioSpeakerVerificationEres2net
from daft.las.functions.udf import las_udf

if __name__ == "__main__":
    if os.getenv("DAFT_RUNNER", "ray") == "ray":

        def configure_logging():
            logging.basicConfig(
                level=logging.INFO,
                format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
                datefmt="%Y-%m-%d %H:%M:%S.%s".format(),
            )
            logging.getLogger("tracing.span").setLevel(logging.WARNING)
            logging.getLogger("daft_io.stats").setLevel(logging.WARNING)
            logging.getLogger("DaftStatisticsManager").setLevel(logging.WARNING)
            logging.getLogger("DaftFlotillaScheduler").setLevel(logging.WARNING)
            logging.getLogger("DaftFlotillaDispatcher").setLevel(logging.WARNING)

        import ray

        ray.init(dashboard_host="0.0.0.0", runtime_env={"worker_process_setup_hook": configure_logging})
        daft.set_runner_ray()

    daft.set_execution_config(actor_udf_ready_timeout=600)
    daft.set_execution_config(min_cpu_per_task=0)

    tos_dir_url = os.getenv("TOS_DIR_URL", "las-cn-beijing-public-online.tos-cn-beijing.volces.com")
    samples = {
        "speaker_a": [f"https://{tos_dir_url}/public/shared_audio_dataset/.wav"],
        "speaker_b": [f"https://{tos_dir_url}/public/shared_audio_dataset/.wav"],
    }

    model_path = os.getenv("MODEL_PATH", "/opt/las/models")
    model_name = "iic/speech_eres2net_sv_zh-cn_16k-common"
    audio_src_type = "audio_url"
    rank = 0

    df = daft.from_pydict(samples)
    df = df.with_column(
        "speaker_verification_result",
        las_udf(
            AudioSpeakerVerificationEres2net,
            construct_args={
                "audio_src_type": audio_src_type,
                "model_path": model_path,
                "model_name": model_name,
                "rank": rank,
            },
            num_gpus=1,
            batch_size=1,
            concurrency=1,
        )(col("speaker_a"), col("speaker_b")),
    )

    df.show()

    # ╭────────────────────────────────┬────────────────────────────────┬─────────────────────────────╮
    # │ speaker_a                      ┆ speaker_b                      ┆ speaker_verification_result │
    # │ ---                            ┆ ---                            ┆ ---                         │
    # │ Utf8                           ┆ Utf8                           ┆ Float32                     │
    # ╞════════════════════════════════╪════════════════════════════════╪═════════════════════════════╡
    # │ tos://las-cn-beijing-public-o… ┆ tos://las-cn-beijing-public-o… ┆ 1                           │
    # ╰────────────────────────────────┴────────────────────────────────┴─────────────────────────────╯
Last updated: 2026.05.12 19:06:34