| 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 | doesn't test correctness |
| 7 | """ |
| 8 | |
| 9 | import pytest |
| 10 | |
| 11 | from tests.quantization.utils import is_quant_method_supported |
| 12 | |
| 13 | from ..models.registry import HF_EXAMPLE_MODELS |
| 14 | |
| 15 | MODELS = ["ai21labs/Jamba-tiny-random"] |
| 16 | |
| 17 | |
| 18 | @pytest.mark.skipif( |
| 19 | not is_quant_method_supported("experts_int8"), |
| 20 | reason="ExpertsInt8 is not supported on this GPU type.", |
| 21 | ) |
| 22 | @pytest.mark.parametrize("model", MODELS) |
| 23 | @pytest.mark.parametrize("dtype", ["bfloat16"]) |
| 24 | @pytest.mark.parametrize("max_tokens", [4]) |
| 25 | def test_model_experts_int8_startup( |
| 26 | hf_runner, |
| 27 | vllm_runner, |
| 28 | example_prompts, |
| 29 | model: str, |
| 30 | dtype: str, |
| 31 | max_tokens: int, |
| 32 | ) -> None: |
| 33 | model_info = HF_EXAMPLE_MODELS.find_hf_info(model) |
| 34 | model_info.check_transformers_version(on_fail="skip") |
| 35 | |
| 36 | with vllm_runner( |
| 37 | model, |
| 38 | dtype=dtype, |
| 39 | enforce_eager=True, |
| 40 | quantization="experts_int8", |
| 41 | enable_chunked_prefill=True, |
| 42 | ) as vllm_model: |
| 43 | vllm_model.generate_greedy(example_prompts, max_tokens) |