test_rtn.py 948 Bytes
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
# Copyright © 2025, Oracle and/or its affiliates.
4
"""Tests RTN quantization startup and generation,
5
6
doesn't test correctness
"""
7

8
9
10
11
import pytest

from tests.quantization.utils import is_quant_method_supported

12
13
14
MODELS = [
    "ai21labs/Jamba-tiny-dev",  # MoE model
]
15
16


17
18
19
20
@pytest.mark.skipif(
    not is_quant_method_supported("rtn"),
    reason="RTN is not supported on this GPU type.",
)
21
22
23
24
25
26
27
28
29
30
31
@pytest.mark.parametrize("model", MODELS)
@pytest.mark.parametrize("dtype", ["bfloat16"])
@pytest.mark.parametrize("max_tokens", [10])
def test_model_rtn_startup(
    hf_runner,
    vllm_runner,
    example_prompts,
    model: str,
    dtype: str,
    max_tokens: int,
) -> None:
32
33
34
    with vllm_runner(
        model, enforce_eager=True, dtype=dtype, quantization="rtn"
    ) as vllm_model:
35
        vllm_model.generate_greedy(example_prompts, max_tokens)