test_weight_loading.py 1.04 KB
Newer Older
1
2
import os

3
import pytest
4
5
import torch

6
7
from vllm.platforms import current_platform

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


16
17
18
@pytest.mark.skipif(
    not current_platform.has_device_capability(int(MIN_CAPABILITY)),
    reason="Current system does not have minimum capability.")
19
def test_weight_loading(vllm_runner):
20
21
22
    """
    Test parameter weight loading with tp>1.
    """
23
24
    with vllm_runner(model_name=MODEL_NAME,
                     revision=REVISION,
25
                     dtype=torch.half if QUANTIZATION == "gptq" else "auto",
26
27
28
29
30
31
32
                     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