test_ipex_quant.py 1.16 KB
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 CPU/GPU backend using IPEX (including AWQ/GPTQ).
5
6
7
8
9
10
 
 Validating the configuration and printing results for manual checking.

 Run `pytest tests/quantization/test_ipex_quant.py`.
"""

zhuwenwen's avatar
zhuwenwen committed
11
import os
12
13
14
import pytest

from vllm.platforms import current_platform
zhuwenwen's avatar
zhuwenwen committed
15
from ..utils import models_path_prefix
16
17

MODELS = [
zhuwenwen's avatar
zhuwenwen committed
18
19
    os.path.join(models_path_prefix, "AMead10/Llama-3.2-1B-Instruct-AWQ"),
    os.path.join(models_path_prefix, "shuyuej/Llama-3.2-1B-Instruct-GPTQ"),  # with g_idx
20
21
22
23
]
DTYPE = ["bfloat16"]


24
25
26
@pytest.mark.skipif(not current_platform.is_cpu()
                    and not current_platform.is_xpu(),
                    reason="only supports Intel CPU/XPU backend.")
27
28
29
30
31
32
33
34
@pytest.mark.parametrize("model", MODELS)
@pytest.mark.parametrize("dtype", DTYPE)
def test_ipex_quant(vllm_runner, model, dtype):
    with vllm_runner(model, dtype=dtype) as llm:
        output = llm.generate_greedy(["The capital of France is"],
                                     max_tokens=32)
    assert output
    print(output)