test_experts_int8.py 1.32 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
import pytest
10
import os
11
12

from tests.quantization.utils import is_quant_method_supported
13
from ..utils import models_path_prefix
zhuwenwen's avatar
zhuwenwen committed
14
from vllm.platforms import current_platform
15
16


17
18
from ..models.registry import HF_EXAMPLE_MODELS

19
MODELS = [os.path.join(models_path_prefix, "ai21labs/Jamba-tiny-random"), os.path.join(models_path_prefix, "pfnet/plamo-2-1b")]
20
21


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

40
    with vllm_runner(
41
42
43
44
45
        model,
        dtype=dtype,
        enforce_eager=True,
        quantization="experts_int8",
        allow_deprecated_quantization=True,
46
    ) as vllm_model:
47
        vllm_model.generate_greedy(example_prompts, max_tokens)