[quantization][config] enable override existing quant_config (#28510)
Signed-off-by: Hank <hcc.mayday@gmail.com> Co-authored-by: Michael Goin <mgoin64@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@ See https://github.com/vllm-project/vllm/issues/11926 for more details.
|
||||
Run `pytest tests/quantization/test_register_quantization_config.py`.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
@@ -100,17 +101,22 @@ class CustomQuantConfig(QuantizationConfig):
|
||||
return None
|
||||
|
||||
|
||||
def test_register_quantization_config():
|
||||
def test_register_quantization_config(caplog_vllm):
|
||||
"""Test register custom quantization config."""
|
||||
|
||||
# The quantization method `custom_quant` should be registered.
|
||||
assert get_quantization_config("custom_quant") == CustomQuantConfig
|
||||
|
||||
# The quantization method `custom_quant` is already exists,
|
||||
# should raise an error.
|
||||
with pytest.raises(ValueError):
|
||||
# should raise a warning when re-registering it.
|
||||
with caplog_vllm.at_level(logging.WARNING):
|
||||
register_quantization_config("custom_quant")(CustomQuantConfig)
|
||||
|
||||
assert any(
|
||||
"The quantization method 'custom_quant' already exists" in message
|
||||
for message in caplog_vllm.messages
|
||||
), "Expected a warning when re-registering custom_quant"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
argnames="model",
|
||||
|
||||
Reference in New Issue
Block a user