Signed-off-by: roG0d <rodgarcas98@gmail.com> Signed-off-by: roG0d <baonudesifeizhai@gmail.com> Signed-off-by: baonudesifeizhai <85092850+baonudesifeizhai@users.noreply.github.com> Co-authored-by: roG0d <rodgarcas98@gmail.com>
This commit is contained in:
1 parent
40a07e0d80
commit
c4a0990044
26 files changed
+1214
-176
No files matched your search
@@ -54,6 +54,25 @@ def test_build_quant_config_dict_not_mutated():
|
||||
assert original == copy
|
||||
|
||||
|
||||
def test_build_quant_config_modelopt_fp8_config_json():
|
||||
from vllm.model_executor.layers.quantization.modelopt import ModelOptFp8Config
|
||||
|
||||
from vllm_omni.quantization import build_quant_config
|
||||
|
||||
config = build_quant_config(
|
||||
{
|
||||
"quant_method": "modelopt",
|
||||
"quant_algo": "FP8",
|
||||
"ignore": ["proj_out"],
|
||||
"producer": {"name": "modelopt"},
|
||||
}
|
||||
)
|
||||
|
||||
assert isinstance(config, ModelOptFp8Config)
|
||||
assert config.get_name() == "modelopt"
|
||||
assert config.is_checkpoint_fp8_serialized
|
||||
|
||||
|
||||
def test_build_quant_config_per_component():
|
||||
from vllm_omni.quantization import ComponentQuantizationConfig, build_quant_config
|
||||
|
||||
@@ -91,7 +110,7 @@ def test_flat_dict_not_misdetected_as_per_component():
|
||||
as a per-component dict — it should raise ValueError for missing 'method'."""
|
||||
from vllm_omni.quantization import build_quant_config
|
||||
|
||||
with pytest.raises(ValueError, match="must have a 'method' key"):
|
||||
with pytest.raises(ValueError, match="must have a 'method' or 'quant_method' key"):
|
||||
build_quant_config({"activation_scheme": "static"})
|
||||
|
||||
|
||||
@@ -194,10 +213,30 @@ def test_integration_per_component():
|
||||
assert config.quantization_config.component_configs["vae"] is None
|
||||
|
||||
|
||||
def test_transformer_config_auto_detects_modelopt_fp8():
|
||||
from vllm.model_executor.layers.quantization.modelopt import ModelOptFp8Config
|
||||
|
||||
from vllm_omni.diffusion.data import TransformerConfig
|
||||
|
||||
config = TransformerConfig.from_dict(
|
||||
{
|
||||
"_class_name": "FluxTransformer2DModel",
|
||||
"quantization_config": {
|
||||
"quant_method": "modelopt",
|
||||
"quant_algo": "FP8",
|
||||
"ignore": ["proj_out"],
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
assert isinstance(config.quant_config, ModelOptFp8Config)
|
||||
assert config.quant_method == "modelopt"
|
||||
|
||||
|
||||
def test_supported_methods_includes_vllm():
|
||||
from vllm_omni.quantization import SUPPORTED_QUANTIZATION_METHODS
|
||||
|
||||
for method in ["fp8", "gguf", "awq", "gptq", "bitsandbytes", "modelopt", "modelopt_fp4"]:
|
||||
for method in ["fp8", "gguf", "awq", "gptq", "bitsandbytes", "modelopt"]:
|
||||
assert method in SUPPORTED_QUANTIZATION_METHODS, f"{method} missing"
|
||||
|
||||
|
||||
@@ -243,14 +282,10 @@ def test_per_component_routing_with_default():
|
||||
assert resolved.get_name() == "fp8"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"quant_algo",
|
||||
["FP8", "NVFP4"],
|
||||
ids=["modelopt_fp8", "modelopt_nvfp4"],
|
||||
)
|
||||
@pytest.mark.parametrize("quant_algo", ["FP8"], ids=["modelopt_fp8"])
|
||||
def test_omni_convertor_thinker_finds_text_config_quant(quant_algo):
|
||||
"""Thinker stage should discover quantization_config from
|
||||
thinker_config.text_config for both FP8 and NVFP4 modelopt checkpoints."""
|
||||
thinker_config.text_config for verified modelopt FP8 checkpoints."""
|
||||
from types import SimpleNamespace
|
||||
|
||||
from vllm_omni.config.model import OmniModelArchConfigConvertor
|
||||
|
||||
Reference in new issue
Block a user