"vscode:/vscode.git/clone" did not exist on "6d0e3d372446cde48b387d4d3530e25fc6e06320"
untest_weight_loading.py 1.41 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(
    MODEL_NAME == "casperhansen/deepseek-coder-v2-instruct-awq",
    reason="OOM in the CI")
22
23
24
@pytest.mark.skipif(
    not current_platform.has_device_capability(int(MIN_CAPABILITY)),
    reason="Current system does not have minimum capability.")
25
def test_weight_loading(vllm_runner):
26
27
28
    """
    Test parameter weight loading with tp>1.
    """
29
30
31
32

    # MoE models need fp16.
    NEEDS_FP16 = (QUANTIZATION == "gptq" or MODEL_NAME
                  == "nm-testing/test-w4a16-mixtral-actorder-group")
33
34
    with vllm_runner(
            model_name=MODEL_NAME,
zhuwenwen's avatar
zhuwenwen committed
35
            # revision=REVISION,
36
            dtype=torch.half if NEEDS_FP16 else "auto",
37
38
39
            quantization=None if QUANTIZATION == "None" else QUANTIZATION,
            max_model_len=MAX_MODEL_LEN,
            tensor_parallel_size=2) as model:
40
41
42
43

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