test_auto_round.py 997 Bytes
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
"""Test model set-up and inference for quantized HF models supported
4
on the AutoRound.
5

6
Validating the configuration and printing results for manual checking.
7

8
Run `pytest tests/quantization/test_auto_round.py`.
9
10
11
12
13
14
15
16
"""

import pytest

from vllm.platforms import current_platform

MODELS = [
    "OPEA/Qwen2.5-0.5B-Instruct-int4-sym-inc",  ##auto_round:auto_gptq
17
    "Intel/Qwen2-0.5B-Instruct-int4-sym-AutoRound",  ##auto_round:auto_awq
18
19
20
]


21
22
23
24
25
26
@pytest.mark.skipif(
    not current_platform.is_cpu()
    and not current_platform.is_xpu()
    and not current_platform.is_cuda(),
    reason="only supports CPU/XPU/CUDA backend.",
)
27
28
@pytest.mark.parametrize("model", MODELS)
def test_auto_round(vllm_runner, model):
29
    with vllm_runner(model, enforce_eager=True) as llm:
30
        output = llm.generate_greedy(["The capital of France is"], max_tokens=8)
31
32
    assert output
    print(f"{output[0][1]}")