test_experts_int8.py 1.16 KB
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3

4
# flake8: noqa
5
"""Tests experts_int8 quantization startup and generation,
6
7
doesn't test correctness
"""
8

9
10
11
12
import pytest

from tests.quantization.utils import is_quant_method_supported

13
14
from ..models.registry import HF_EXAMPLE_MODELS

15
MODELS = ["ai21labs/Jamba-tiny-random", "pfnet/plamo-2-1b"]
16
17


18
19
20
21
@pytest.mark.skipif(
    not is_quant_method_supported("experts_int8"),
    reason="ExpertsInt8 is not supported on this GPU type.",
)
22
23
@pytest.mark.parametrize("model", MODELS)
@pytest.mark.parametrize("dtype", ["bfloat16"])
24
@pytest.mark.parametrize("max_tokens", [4])
25
26
27
28
29
30
31
32
def test_model_experts_int8_startup(
    hf_runner,
    vllm_runner,
    example_prompts,
    model: str,
    dtype: str,
    max_tokens: int,
) -> None:
33
34
    model_info = HF_EXAMPLE_MODELS.find_hf_info(model)
    model_info.check_transformers_version(on_fail="skip")
35

36
    with vllm_runner(
37
38
39
40
41
        model,
        dtype=dtype,
        enforce_eager=True,
        quantization="experts_int8",
        allow_deprecated_quantization=True,
42
    ) as vllm_model:
43
        vllm_model.generate_greedy(example_prompts, max_tokens)