A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 16, 23:15 UTC
Revert "[CI/Build] Add `is_quant_method_supported` to control quantization test configurations" (#5463)
Simon Mo committed
Jun 12, 2024 at 12:03 UTC
e3c12bf6d22999cfbe267a7c788f6875340616cd
8 files changed
+68
-30
tests/models/test_aqlm.py
+11
-2
@@ -4,8 +4,17 @@ Run `pytest tests/models/test_aqlm.py`.
4
"""
5
6
import pytest
7
+import torch
8
8
-from tests.quantization.utils import is_quant_method_supported
9
+from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
10
+
11
+aqlm_not_supported = True
12
+
13
+if torch.cuda.is_available():
14
+ capability = torch.cuda.get_device_capability()
15
+ capability = capability[0] * 10 + capability[1]
16
+ aqlm_not_supported = (capability <
17
+ QUANTIZATION_METHODS["aqlm"].get_min_capability())
18
19
# In this test we hardcode prompts and generations for the model so we don't
20
# need to require the AQLM package as a dependency
@@ -58,7 +67,7 @@ ground_truth_generations = [
67
]
68
69
61
-@pytest.mark.skipif(not is_quant_method_supported("aqlm"),
70
+@pytest.mark.skipif(aqlm_not_supported,
71
reason="AQLM is not supported on this GPU type.")
72
@pytest.mark.parametrize("model", ["ISTA-DASLab/Llama-2-7b-AQLM-2Bit-1x16-hf"])
73
@pytest.mark.parametrize("dtype", ["half"])
tests/models/test_fp8.py
+10
-2
@@ -8,8 +8,8 @@ import pytest
8
import torch
9
from transformers import AutoTokenizer
10
11
-from tests.quantization.utils import is_quant_method_supported
11
from vllm import LLM, SamplingParams
12
+from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
13
14
os.environ["TOKENIZERS_PARALLELISM"] = "true"
15
@@ -67,8 +67,16 @@ EXPECTED_STRS_MAP = {
67
},
68
}
69
70
+fp8_not_supported = True
71
71
-@pytest.mark.skipif(not is_quant_method_supported("fp8"),
72
+if torch.cuda.is_available():
73
+ capability = torch.cuda.get_device_capability()
74
+ capability = capability[0] * 10 + capability[1]
75
+ fp8_not_supported = (capability <
76
+ QUANTIZATION_METHODS["fp8"].get_min_capability())
77
+
78
+
79
+@pytest.mark.skipif(fp8_not_supported,
80
reason="fp8 is not supported on this GPU type.")
81
@pytest.mark.parametrize("model_name", MODELS)
82
@pytest.mark.parametrize("kv_cache_dtype", ["auto", "fp8"])
tests/models/test_gptq_marlin.py
+11
-2
@@ -11,8 +11,9 @@ Run `pytest tests/models/test_gptq_marlin.py`.
11
import os
12
13
import pytest
14
+import torch
15
15
-from tests.quantization.utils import is_quant_method_supported
16
+from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
17
from vllm.model_executor.layers.rotary_embedding import _ROPE_DICT
18
19
from .utils import check_logprobs_close
@@ -21,6 +22,14 @@ os.environ["TOKENIZERS_PARALLELISM"] = "true"
22
23
MAX_MODEL_LEN = 1024
24
25
+gptq_marlin_not_supported = True
26
+
27
+if torch.cuda.is_available():
28
+ capability = torch.cuda.get_device_capability()
29
+ capability = capability[0] * 10 + capability[1]
30
+ gptq_marlin_not_supported = (
31
+ capability < QUANTIZATION_METHODS["gptq_marlin"].get_min_capability())
32
+
33
MODELS = [
34
# act_order==False, group_size=channelwise
35
("robertgshaw2/zephyr-7b-beta-channelwise-gptq", "main"),
@@ -44,7 +53,7 @@ MODELS = [
53
54
55
@pytest.mark.flaky(reruns=3)
47
-@pytest.mark.skipif(not is_quant_method_supported("gptq_marlin"),
56
+@pytest.mark.skipif(gptq_marlin_not_supported,
57
reason="gptq_marlin is not supported on this GPU type.")
58
@pytest.mark.parametrize("model", MODELS)
59
@pytest.mark.parametrize("dtype", ["half", "bfloat16"])
tests/models/test_gptq_marlin_24.py
+11
-2
@@ -9,9 +9,18 @@ Run `pytest tests/models/test_marlin_24.py`.
9
from dataclasses import dataclass
10
11
import pytest
12
+import torch
13
14
from tests.models.utils import check_logprobs_close
14
-from tests.quantization.utils import is_quant_method_supported
15
+from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
16
+
17
+marlin_not_supported = True
18
+
19
+if torch.cuda.is_available():
20
+ capability = torch.cuda.get_device_capability()
21
+ capability = capability[0] * 10 + capability[1]
22
+ marlin_not_supported = (
23
+ capability < QUANTIZATION_METHODS["marlin"].get_min_capability())
24
25
26
@dataclass
@@ -38,7 +47,7 @@ model_pairs = [
47
48
49
@pytest.mark.flaky(reruns=2)
41
-@pytest.mark.skipif(not is_quant_method_supported("gptq_marlin_24"),
50
+@pytest.mark.skipif(marlin_not_supported,
51
reason="Marlin24 is not supported on this GPU type.")
52
@pytest.mark.parametrize("model_pair", model_pairs)
53
@pytest.mark.parametrize("dtype", ["half"])
tests/models/test_marlin.py
+11
-2
@@ -13,11 +13,20 @@ Run `pytest tests/models/test_marlin.py`.
13
from dataclasses import dataclass
14
15
import pytest
16
+import torch
17
17
-from tests.quantization.utils import is_quant_method_supported
18
+from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
19
20
from .utils import check_logprobs_close
21
22
+marlin_not_supported = True
23
+
24
+if torch.cuda.is_available():
25
+ capability = torch.cuda.get_device_capability()
26
+ capability = capability[0] * 10 + capability[1]
27
+ marlin_not_supported = (
28
+ capability < QUANTIZATION_METHODS["marlin"].get_min_capability())
29
+
30
31
@dataclass
32
class ModelPair:
@@ -36,7 +45,7 @@ model_pairs = [
45
46
47
@pytest.mark.flaky(reruns=2)
39
-@pytest.mark.skipif(not is_quant_method_supported("marlin"),
48
+@pytest.mark.skipif(marlin_not_supported,
49
reason="Marlin is not supported on this GPU type.")
50
@pytest.mark.parametrize("model_pair", model_pairs)
51
@pytest.mark.parametrize("dtype", ["half"])
tests/quantization/test_bitsandbytes.py
+7
-3
@@ -5,12 +5,16 @@ Run `pytest tests/quantization/test_bitsandbytes.py`.
5
import pytest
6
import torch
7
8
-from tests.quantization.utils import is_quant_method_supported
8
from vllm import SamplingParams
9
+from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
10
11
+capability = torch.cuda.get_device_capability()
12
+capability = capability[0] * 10 + capability[1]
13
12
-@pytest.mark.skipif(not is_quant_method_supported("bitsandbytes"),
13
- reason='bitsandbytes is not supported on this GPU type.')
14
+
15
+@pytest.mark.skipif(
16
+ capability < QUANTIZATION_METHODS['bitsandbytes'].get_min_capability(),
17
+ reason='bitsandbytes is not supported on this GPU type.')
18
def test_load_bnb_model(vllm_runner) -> None:
19
with vllm_runner('huggyllama/llama-7b',
20
quantization='bitsandbytes',
tests/quantization/test_fp8.py
+7
-3
@@ -5,12 +5,16 @@ Run `pytest tests/quantization/test_fp8.py --forked`.
5
import pytest
6
import torch
7
8
-from tests.quantization.utils import is_quant_method_supported
8
+from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
9
from vllm.model_executor.layers.quantization.fp8 import Fp8LinearMethod
10
11
+capability = torch.cuda.get_device_capability()
12
+capability = capability[0] * 10 + capability[1]
13
12
-@pytest.mark.skipif(not is_quant_method_supported("fp8"),
13
- reason="FP8 is not supported on this GPU type.")
14
+
15
+@pytest.mark.skipif(
16
+ capability < QUANTIZATION_METHODS["fp8"].get_min_capability(),
17
+ reason="FP8 is not supported on this GPU type.")
18
def test_load_fp16_model(vllm_runner) -> None:
19
with vllm_runner("facebook/opt-125m", quantization="fp8") as llm:
20
tests/quantization/utils.py
deleted
-14
@@ -1,14 +0,0 @@
1
-import torch
2
-
3
-from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
4
-
5
-
6
-def is_quant_method_supported(quant_method: str) -> bool:
7
- # Currently, all quantization methods require Nvidia or AMD GPUs
8
- if not torch.cuda.is_available():
9
- return False
10
-
11
- capability = torch.cuda.get_device_capability()
12
- capability = capability[0] * 10 + capability[1]
13
- return (capability <
14
- QUANTIZATION_METHODS[quant_method].get_min_capability())