2024-08-13 14:30:11 -04:00
|
|
|
import os
|
|
|
|
|
2024-12-18 09:57:16 -05:00
|
|
|
import pytest
|
2024-09-03 17:21:44 -04:00
|
|
|
import torch
|
|
|
|
|
2024-12-18 09:57:16 -05:00
|
|
|
from vllm.platforms import current_platform
|
|
|
|
|
2024-08-13 14:30:11 -04:00
|
|
|
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")
|
2024-12-18 09:57:16 -05:00
|
|
|
MIN_CAPABILITY = os.environ.get("MIN_CAPABILITY", "89")
|
2024-08-13 14:30:11 -04:00
|
|
|
|
|
|
|
|
2024-12-18 09:57:16 -05:00
|
|
|
@pytest.mark.skipif(
|
|
|
|
not current_platform.has_device_capability(int(MIN_CAPABILITY)),
|
|
|
|
reason="Current system does not have minimum capability.")
|
2024-08-13 14:30:11 -04:00
|
|
|
def test_weight_loading(vllm_runner):
|
2024-09-03 17:21:44 -04:00
|
|
|
"""
|
|
|
|
Test parameter weight loading with tp>1.
|
|
|
|
"""
|
2024-08-13 14:30:11 -04:00
|
|
|
with vllm_runner(model_name=MODEL_NAME,
|
|
|
|
revision=REVISION,
|
2024-09-03 17:21:44 -04:00
|
|
|
dtype=torch.half if QUANTIZATION == "gptq" else "auto",
|
2024-08-13 14:30:11 -04:00
|
|
|
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
|