2025-02-02 14:58:18 -05:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2024-10-10 00:28:08 +08:00
|
|
|
"""Test model set-up and inference for quantized HF models supported
|
2024-11-19 02:18:05 +08:00
|
|
|
on the CPU/GPU backend using IPEX (including AWQ/GPTQ).
|
2024-10-10 00:28:08 +08:00
|
|
|
|
|
|
|
Validating the configuration and printing results for manual checking.
|
|
|
|
|
|
|
|
Run `pytest tests/quantization/test_ipex_quant.py`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from vllm.platforms import current_platform
|
|
|
|
|
|
|
|
MODELS = [
|
2024-11-19 02:18:05 +08:00
|
|
|
"AMead10/Llama-3.2-1B-Instruct-AWQ",
|
|
|
|
"shuyuej/Llama-3.2-1B-Instruct-GPTQ", # with g_idx
|
2024-10-10 00:28:08 +08:00
|
|
|
]
|
|
|
|
DTYPE = ["bfloat16"]
|
|
|
|
|
|
|
|
|
2024-11-19 02:18:05 +08:00
|
|
|
@pytest.mark.skipif(not current_platform.is_cpu()
|
|
|
|
and not current_platform.is_xpu(),
|
|
|
|
reason="only supports Intel CPU/XPU backend.")
|
2024-10-10 00:28:08 +08:00
|
|
|
@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)
|