"vscode:/vscode.git/clone" did not exist on "04cf435d95fee3e4c0ba521583c1a64bc348c89d"
test_weight_loading.py 1.09 KB
Newer Older
1
2
# SPDX-License-Identifier: Apache-2.0

3
4
import os

5
import pytest
6
7
import torch

8
9
from vllm.platforms import current_platform

10
11
12
13
14
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")
15
MIN_CAPABILITY = os.environ.get("MIN_CAPABILITY", "80")
16
17


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

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