test_weight_loading.py 1.12 KB
Newer Older
1
2
import os

3
import pytest
4
import torch
5
from ..utils import models_path_prefix
6

7
8
from vllm.platforms import current_platform

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


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

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