conftest.py 1.36 KB
Newer Older
1
2
3
4
5
6
7
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import pytest

from vllm.assets.audio import AudioAsset


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def add_attention_backend(server_args, attention_config):
    """Append attention backend CLI arg if specified.

    Args:
        server_args: List of server arguments to extend in-place.
        attention_config: Dict with 'backend' key, or None.
    """
    if attention_config and "backend" in attention_config:
        server_args.extend(["--attention-backend", attention_config["backend"]])


@pytest.fixture(scope="module")
def rocm_aiter_fa_attention():
    """Return attention config for transcription/translation tests on ROCm.

    On ROCm, audio tests require ROCM_AITER_FA attention backend.
    """
    from vllm.platforms import current_platform

    if current_platform.is_rocm():
        return {"backend": "ROCM_AITER_FA"}
    return None


32
33
@pytest.fixture
def mary_had_lamb():
34
    path = AudioAsset("mary_had_lamb").get_local_path()
35
36
37
38
39
40
    with open(str(path), "rb") as f:
        yield f


@pytest.fixture
def winning_call():
41
    path = AudioAsset("winning_call").get_local_path()
42
43
44
45
46
47
48
    with open(str(path), "rb") as f:
        yield f


@pytest.fixture
def foscolo():
    # Test translation it->en
49
    path = AudioAsset("azacinto_foscolo").get_local_path()
50
51
    with open(str(path), "rb") as f:
        yield f