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

Lake AI Service

Copy page
Download PDF
Audio understanding
Audio content understanding (Qwen Omni model)
Copy page
Download PDF
Audio content understanding (Qwen Omni model)

Operator introduction

Description

Qwen2.5-Omni multimodal audio understanding model – key features of audio content parsing and natural language description generation

Key features

  • Intelligent content understanding and description generation
  • Automatically generates detailed and accurate natural language descriptions based on audio signals, and supports custom prompts via the prompt parameter
  • Supports audio formats such as mp3, aac, and m4a
  • Efficient model loading and inference optimization
  • Supports multiple computation precision options (bfloat16, float16, float32) to meet different performance requirements
  • Integrated FlashAttention2 acceleration technology, significantly improves inference efficiency
  • Supports automatic or manual device allocation, and is fully compatible with single-card and multi-card environments
  • Resource usage
  • It is recommended to use a GPU with 48GB or more VRAM

Scenario optimization

  • Widely applicable to audio content analysis, intelligent audio description, multimedia content understanding, and many other application scenarios
  • Built-in batch processing mechanism efficiently supports large-scale parallel inference of audio data
  • Flexible configuration of audio data return options to meet diverse business requirements

Daft invocation

Operator parameters

Input

Input column name

Note

contents

An array containing audio data, with element type as string (file path or URL).

user_prompts

The prompt for audio understanding, defaults to None. If not provided, the prompt specified in the parameters is used by default.

Output

The processed array, where each element is the text result of the audio understanding. For audio files that fail to process, an empty string is returned.

Parameters

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

Parameter name

Type

Default value

Description

model_path

str

/opt/las/models

The absolute path for storing local model files, which defaults to the preset path inside the container. When using a custom model, this path must be modified. Default value: "/opt/las/models"

model_name

str

Qwen/Qwen2.5-Omni-7B

Supported multimodal model versions. Currently supports the Qwen2.5-Omni series models. Optional values: ["Qwen/Qwen2.5-Omni-7B"] Default value: "Qwen/Qwen2.5-Omni-7B"

prompt

str

Please provide a detailed description of this audio.

The prompt that helps the user understand the audio content; the model generates an audio description based on the prompt. Default value: "Please provide a detailed description of this audio."

batch_size

int

4

The number of samples processed per inference. A larger batch_size can improve throughput but increases GPU memory consumption. It is recommended to adjust according to the GPU memory capacity. Default value: 4

dtype

str

bfloat16

Model inference precision options: - bfloat16: balances precision and speed - float16: faster inference speed - float32: highest precision but consumes the most GPU memory Available values: ["bfloat16", "float16", "float32"] Default value: "bfloat16"

use_flash_attention_2

bool

True

Whether to use Flash Attention 2 to optimize attention computation (effective when CUDA-compatible and dtype is 16-bit floating point). Default value: True

max_caption_length

int

256

The maximum number of tokens for model-generated descriptions. Longer generations may include more details but increase computation time. Default value: 256

rank

int or None

None

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 for audio content understanding and generate descriptions as specified.

from __future__ import annotations

import os

import daft
from daft import col
from daft.las.functions.multimodal.qwen_omni_audio_understanding import QwenOmniAudioUnderstanding
from daft.las.functions.udf import las_udf

if __name__ == "__main__":

    if os.getenv("DAFT_RUNNER", "native") == "ray":
        import logging

        import 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)

        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/.mp3"
        ],
        "prompt": [""],

    }

    model_path = os.getenv("MODEL_PATH", "/opt/las/models")
    model_name = "Qwen/Qwen2.5-Omni-7B"
    dtype = "bfloat16"
    use_flash_attention_2 = True
    default_prompt = None
    max_caption_length = 256
    batch_size = 1
    rank = 0
    num_gpus = int(os.getenv("NUM_GPUS", 1))
    num_gpus = 1

    ds = daft.from_pydict(samples)
    ds = ds.with_column(
        "caption",
        las_udf(
            QwenOmniAudioUnderstanding,
            construct_args={
                "model_path": model_path,
                "model_name": model_name,
                "dtype": dtype,
                "use_flash_attention_2": use_flash_attention_2,
                "prompt": default_prompt,
                "max_caption_length": max_caption_length,
                "batch_size": batch_size,
                "rank": rank,
            },
            num_gpus=num_gpus,
            batch_size=1,
            concurrency=1,
        )(col("audio_path"), col("prompt")),
    )
    print(ds.to_pandas()["caption"][0])

    ds.show()

    # ╭────────────────────────────────┬───────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
    # │ audio_path                     ┆ prompt                                        ┆ caption                                                     │
    # │ ---                            ┆ ---                                           ┆ ---                                                         │
    # │ Utf8                           ┆ Utf8                                          ┆ Utf8                                                        │
    # ╞════════════════════════════════╪═══════════════════════════════════════════════╪═════════════════════════════════════════════════════════════╡
    # │ tos://las-cn-beijing-public-o… ┆ Please convert this audio directly into text without any explanation. …        ┆ I have saved the person and retrieved what I needed. I, Old Sun, do not seek any fame or fortune, only wish to return to the Mountain of Flowers and Fruit…           │
    # ╰────────────────────────────────┴───────────────────────────────────────────────┴─────────────────────────────────────────────────────────────╯
Last updated: 2026.05.12 19:06:34