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

Lake AI Service

Copy page
Download PDF
Audio recognition
Speech endpoint detection (FSMN model)
Copy page
Download PDF
Speech endpoint detection (FSMN model)

Operator introduction

Description

Speech endpoint detection module – an efficient audio segmentation solution based on FSMN VAD

Key features

  • Speech endpoint detection: Automatically identifies the start and end times of speech segments in audio, enabling precise segmentation between speech and silence
  • Batch processing: Supports efficient endpoint detection for large volumes of audio data
  • Multi-format input: Compatible with various audio input methods, including raw binary, Base64 encoding, and TOS/HTTP links
  • GPU acceleration: Supports high-performance inference in GPU environments

  • It is recommended to input WAV format audio with a 16k sample rate and mono channel to improve detection accuracy
  • For long audio files, segment processing is recommended; the duration for a single processing should not exceed 1 hour
  • Applicable to scenarios such as voice activity detection and speech segmentation

Supported models

  • iic/speech_fsmn_vad_zh-cn-16k-common-pytorch (General Chinese FSMN VAD)

Output description

  • Each audio outputs a two-dimensional floating-point list representing the start and end timestamps of all speech segments (unit: seconds), for example: [[0.0, 4.34], [5.50, 7.12]]
  • If processing fails, returns None

Daft invocation

Operator parameters

Input

Input column name

Description

videos

A column containing audio data, supporting the following formats: - audio_base64: base64-encoded audio string - audio_url: URL path of the audio file - audio_binary: raw audio byte data

Output

A column containing speech endpoint timestamps; each element is a two-dimensional floating-point list representing the start and end timestamps of each speech segment in the audio (unit: seconds),
for example: [[0.0, 4.34], [5.50, 7.12]]. If processing fails, returns 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"]

batch_size_s

int

3600

Batch calculation duration (seconds) The duration of audio processed per batch (seconds), effective only when using GPU. Default value: 3600

model_path

str

/opt/las/models

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

model_name

str

iic/speech_fsmn_vad_zh-cn-16k-common-pytorch

Model name The model name used includes: - iic/speech_fsmn_vad_zh-cn-16k-common-pytorch Optional values: ["iic/speech_fsmn_vad_zh-cn-16k-common-pytorch"] Default value: "iic/speech_fsmn_vad_zh-cn-16k-common-pytorch"

model_revision

str

v2.0.4

Model version Specifies the model version number, including: - v2.0.4 Optional values: ["v2.0.4"] Default value: "v2.0.4"

rank

int

0

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

Examples

The following code demonstrates how to use daft to run the operator and detect speech endpoints in audio.

from __future__ import annotations

import logging
import os

import ray

import daft
from daft import col
from daft.las.functions.audio.audio_vad_fsmn import AudioVadFsmn
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 = {
        "audio_path": [
            f"https://{tos_dir_url}/public/shared_audio_dataset/.wav"
        ]
    }

    model_path = os.getenv("MODEL_PATH", "/opt/las/models")
    model_name = "iic/speech_fsmn_vad_zh-cn-16k-common-pytorch"
    audio_src_type = "audio_url"
    batch_size_s = 3600
    model_revision = "v2.0.4"
    rank = 0

    df = daft.from_pydict(samples)
    df = df.with_column(
        "audio_vad_result",
        las_udf(
            AudioVadFsmn,
            construct_args={
                "audio_src_type": audio_src_type,
                "model_path": model_path,
                "model_name": model_name,
                "model_revision": model_revision,
                "batch_size_s": batch_size_s,
                "rank": rank,
            },
            num_gpus=1,
            batch_size=1,
            concurrency=1,
        )(col("audio_path")),
    )
    df.show()

    # ╭────────────────────────────────┬─────────────────────╮
    # │ audio_path                     ┆ audio_vad_result    │
    # │ ---                            ┆ ---                 │
    # │ Utf8                           ┆ List[List[Float32]] │
    # ╞════════════════════════════════╪═════════════════════╡
    # │ tos://las-cn-beijing-public-o… ┆ [[0.51, 2.8]]       │
    # ╰────────────────────────────────┴─────────────────────╯
Last updated: 2026.05.12 19:06:34