test_weight_loading.py 1.16 KB
Newer Older
1
2
# SPDX-License-Identifier: Apache-2.0

3
4
import os

5
import pytest
6
import torch
7
from ..utils import models_path_prefix
8

9
10
from vllm.platforms import current_platform

11
12
MAX_MODEL_LEN = 1024
MODEL_NAME = os.environ.get("MODEL_NAME",
13
                            os.path.join(models_path_prefix, "robertgshaw2/zephyr-7b-beta-channelwise-gptq"))
14
15
REVISION = os.environ.get("REVISION", "main")
QUANTIZATION = os.environ.get("QUANTIZATION", "gptq_marlin")
16
MIN_CAPABILITY = os.environ.get("MIN_CAPABILITY", "80")
17
18


19
20
21
@pytest.mark.skipif(
    not current_platform.has_device_capability(int(MIN_CAPABILITY)),
    reason="Current system does not have minimum capability.")
22
def test_weight_loading(vllm_runner):
23
24
25
    """
    Test parameter weight loading with tp>1.
    """
26
27
    with vllm_runner(
            model_name=MODEL_NAME,
zhuwenwen's avatar
zhuwenwen committed
28
            # revision=REVISION,
29
30
31
32
            dtype=torch.half if QUANTIZATION == "gptq" else "auto",
            quantization=None if QUANTIZATION == "None" else QUANTIZATION,
            max_model_len=MAX_MODEL_LEN,
            tensor_parallel_size=2) as model:
33
34
35
36

        output = model.generate_greedy("Hello world!", max_tokens=20)
        print(output)
        assert output