Merge branch 'main' into patches
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
+78
-28
@@ -47,6 +47,7 @@ from vllm.config.speculative import _validate_qwen3_omni_dspark
|
||||
from vllm.config.utils import get_field
|
||||
from vllm.config.vllm import OPTIMIZATION_LEVEL_TO_CONFIG, OptimizationLevel
|
||||
from vllm.platforms import current_platform
|
||||
from vllm.sampling_params import BeamSearchParams
|
||||
from vllm.transformers_utils.config import (
|
||||
_patch_hf_transformers_nested_rope_validation,
|
||||
get_pooling_config,
|
||||
@@ -502,6 +503,17 @@ def test_hisparse_rejects_pipeline_parallelism(monkeypatch):
|
||||
)
|
||||
|
||||
|
||||
def test_hisparse_rejects_full_cudagraph_mode(monkeypatch):
|
||||
monkeypatch.setattr(current_platform, "is_cuda", lambda: True)
|
||||
monkeypatch.setattr(current_platform, "support_static_graph_mode", lambda: True)
|
||||
monkeypatch.setattr("vllm.config.vllm.HAS_TRITON", True)
|
||||
with pytest.raises(ValueError, match="does not support cudagraph_mode=FULL"):
|
||||
VllmConfig(
|
||||
attention_config=AttentionConfig(hisparse_config=HiSparseConfig()),
|
||||
compilation_config=CompilationConfig(cudagraph_mode=CUDAGraphMode.FULL),
|
||||
)
|
||||
|
||||
|
||||
def test_hisparse_rejects_disabled_hybrid_kv_cache_manager(monkeypatch):
|
||||
monkeypatch.setattr(current_platform, "is_cuda", lambda: True)
|
||||
monkeypatch.setattr("vllm.config.vllm.HAS_TRITON", True)
|
||||
@@ -831,7 +843,6 @@ def test_breakable_cudagraph_platform_default(
|
||||
("bi-off", 2048, (16, 8), 6144, 1, False),
|
||||
("opt-out", 2048, (16, 8), 6144, 1, False),
|
||||
("eager", 2048, (16, 8), 6144, 1, False),
|
||||
("sp", 2048, (16, 8), 6144, 1, False),
|
||||
("fp16", 2048, (16, 8), 6144, 1, False),
|
||||
("quantized", 2048, (16, 8), 6144, 1, False),
|
||||
("untuned", 4096, (32, 32), 11008, 1, False),
|
||||
@@ -874,11 +885,7 @@ def test_batch_invariant_breakable_cudagraph(
|
||||
get_num_kv_heads=lambda pc: heads[1],
|
||||
)
|
||||
config.parallel_config = SimpleNamespace(tensor_parallel_size=tp)
|
||||
config.compilation_config = (
|
||||
CompilationConfig(pass_config=PassConfig(enable_sp=True))
|
||||
if case == "sp"
|
||||
else CompilationConfig()
|
||||
)
|
||||
config.compilation_config = CompilationConfig()
|
||||
try:
|
||||
assert config._maybe_enable_breakable_cudagraph() is expected
|
||||
if expected:
|
||||
@@ -910,12 +917,13 @@ def test_dsa_models_select_matching_mtp(model_type, expected_architecture):
|
||||
assert hf_config.architectures == [expected_architecture]
|
||||
|
||||
|
||||
def test_v2_model_runner_supports_extract_hidden_states():
|
||||
@pytest.mark.parametrize("method", ["extract_hidden_states", "ngram", "ngram_gpu"])
|
||||
def test_v2_model_runner_supports_speculative_method(method):
|
||||
config = VllmConfig()
|
||||
config.speculative_config = cast(
|
||||
SpeculativeConfig,
|
||||
SimpleNamespace(
|
||||
method="extract_hidden_states",
|
||||
method=method,
|
||||
parallel_drafting=False,
|
||||
enable_adaptive_verification=False,
|
||||
),
|
||||
@@ -924,6 +932,30 @@ def test_v2_model_runner_supports_extract_hidden_states():
|
||||
assert config._get_v2_model_runner_unsupported_features() == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize("use_heterogeneous_vocab", [False, True])
|
||||
def test_v2_model_runner_heterogeneous_vocab_draft_falls_back_to_v1(
|
||||
use_heterogeneous_vocab,
|
||||
):
|
||||
"""The V2 draft-model speculator exchanges token ids with the target
|
||||
without a vocab mapping, so a heterogeneous-vocab (TLI) draft must stay on
|
||||
V1, where VocabMapping translates them."""
|
||||
config = VllmConfig()
|
||||
config.speculative_config = cast(
|
||||
SpeculativeConfig,
|
||||
SimpleNamespace(
|
||||
method="draft_model",
|
||||
parallel_drafting=False,
|
||||
enable_adaptive_verification=False,
|
||||
use_heterogeneous_vocab=use_heterogeneous_vocab,
|
||||
),
|
||||
)
|
||||
|
||||
expected = ["heterogeneous-vocabulary draft models"]
|
||||
assert config._get_v2_model_runner_unsupported_features() == (
|
||||
expected if use_heterogeneous_vocab else []
|
||||
)
|
||||
|
||||
|
||||
def test_v2_model_runner_supports_custom_logits_processors():
|
||||
config = VllmConfig()
|
||||
config.model_config = cast(
|
||||
@@ -984,7 +1016,6 @@ def test_resolve_cudagraph_mode_adjusts_spec_decode_sizes_only_for_v1(
|
||||
"FakeAttentionBackend",
|
||||
uniform_decode_query_len=4,
|
||||
use_v2_model_runner=use_v2_model_runner,
|
||||
tensor_parallel_size=1,
|
||||
)
|
||||
|
||||
assert cudagraph_mode == CUDAGraphMode.FULL_AND_PIECEWISE
|
||||
@@ -1067,7 +1098,6 @@ def test_resolve_cudagraph_mode_skips_mamba_block_check_while_profiling():
|
||||
"FakeAttentionBackend",
|
||||
uniform_decode_query_len=1,
|
||||
use_v2_model_runner=True,
|
||||
tensor_parallel_size=1,
|
||||
kv_cache_config=kv_cache_config,
|
||||
max_num_reqs=256,
|
||||
)
|
||||
@@ -1080,7 +1110,6 @@ def test_resolve_cudagraph_mode_skips_mamba_block_check_while_profiling():
|
||||
"FakeAttentionBackend",
|
||||
uniform_decode_query_len=1,
|
||||
use_v2_model_runner=True,
|
||||
tensor_parallel_size=1,
|
||||
kv_cache_config=kv_cache_config,
|
||||
max_num_reqs=256,
|
||||
is_profiling=True,
|
||||
@@ -3359,8 +3388,6 @@ def test_vllm_config_explicit_overrides():
|
||||
take precedence over callable defaults, across different models and
|
||||
optimization levels.
|
||||
"""
|
||||
from vllm.config.compilation import PassConfig
|
||||
|
||||
quantized_model = ModelConfig("RedHatAI/Llama-3.2-1B-FP8")
|
||||
moe_model = ModelConfig("deepseek-ai/DeepSeek-V2-Lite")
|
||||
regular_model = ModelConfig("Qwen/Qwen1.5-7B")
|
||||
@@ -3656,7 +3683,7 @@ def test_target_only_gumbel_allows_speculative_decoding(caplog_vllm, disable_log
|
||||
)
|
||||
|
||||
with caplog_vllm.at_level(logging.WARNING):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
assert "Target-only watermarking leaves accepted draft tokens" in caplog_vllm.text
|
||||
|
||||
@@ -3677,7 +3704,7 @@ def test_speculative_watermarking_without_context_dedup_does_not_warn(
|
||||
|
||||
caplog_vllm.clear()
|
||||
with caplog_vllm.at_level(logging.WARNING):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
assert "dedup" not in caplog_vllm.text.lower()
|
||||
|
||||
@@ -3698,7 +3725,7 @@ def test_speculative_context_dedup_logs_no_unsupported_warning(
|
||||
|
||||
caplog_vllm.clear()
|
||||
with caplog_vllm.at_level(logging.WARNING):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
assert "dedup" not in caplog_vllm.text.lower()
|
||||
|
||||
@@ -3716,7 +3743,7 @@ def test_gumbel_rejects_speculative_decoding_without_target_only():
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="'gumbel'.*allow_target_only_watermarking"):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
|
||||
def test_dual_key_gumbel_warns_that_configured_alpha_is_unused(
|
||||
@@ -3734,7 +3761,7 @@ def test_dual_key_gumbel_warns_that_configured_alpha_is_unused(
|
||||
)
|
||||
|
||||
with caplog_vllm.at_level(logging.WARNING):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
assert "The configured alpha=0.25 is not used" in caplog_vllm.text
|
||||
|
||||
@@ -3760,7 +3787,7 @@ def test_dual_key_gumbel_alpha_warning_is_not_emitted(
|
||||
)
|
||||
|
||||
with caplog_vllm.at_level(logging.WARNING):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
assert "is not used" not in caplog_vllm.text
|
||||
|
||||
@@ -3776,7 +3803,7 @@ def test_dual_key_gumbel_requires_probabilistic_drafting():
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="draft_sample_method='probabilistic'"):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("method", ["eagle", "eagle3", "mtp"])
|
||||
@@ -3790,7 +3817,7 @@ def test_dual_key_gumbel_supports_probabilistic_speculative_decoding(method):
|
||||
parallel_drafting=False,
|
||||
)
|
||||
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
|
||||
def test_dual_key_gumbel_supports_dspark():
|
||||
@@ -3803,7 +3830,7 @@ def test_dual_key_gumbel_supports_dspark():
|
||||
parallel_drafting=True,
|
||||
)
|
||||
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
|
||||
def test_dual_key_gumbel_rejects_non_autoregressive_speculation():
|
||||
@@ -3817,7 +3844,7 @@ def test_dual_key_gumbel_rejects_non_autoregressive_speculation():
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="autoregressive model-based"):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -3841,17 +3868,40 @@ def test_dual_key_gumbel_rejects_incompatible_speculative_modes(overrides, match
|
||||
config.speculative_config = SimpleNamespace(**values)
|
||||
|
||||
with pytest.raises(ValueError, match=match):
|
||||
config._check_watermarking_unsupported()
|
||||
config._check_supports_watermarking()
|
||||
|
||||
|
||||
def test_gumbel_watermark_rejects_beam_search():
|
||||
with pytest.raises(ValueError, match="Beam search is not supported"):
|
||||
_watermarked_vllm_config()._check_watermarking_unsupported(beam_search=True)
|
||||
def test_gumbel_watermark_disables_beam_search_watermarking(caplog_vllm):
|
||||
enabled = _watermarked_vllm_config()._check_supports_watermarking(
|
||||
BeamSearchParams(beam_width=2, max_tokens=1)
|
||||
)
|
||||
|
||||
assert not enabled
|
||||
assert "beam search requests will run without watermarking" in caplog_vllm.text
|
||||
|
||||
|
||||
def test_gumbel_watermark_allows_unwatermarked_beam_search():
|
||||
_watermarked_vllm_config()._check_supports_watermarking(
|
||||
BeamSearchParams(beam_width=2, max_tokens=1, watermarking=False)
|
||||
)
|
||||
|
||||
|
||||
def test_unwatermarked_beam_does_not_bypass_engine_incompatibilities():
|
||||
config = _watermarked_vllm_config()
|
||||
config.speculative_config = SpeculativeConfig(
|
||||
method="ngram",
|
||||
num_speculative_tokens=1,
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="Speculative decoding with watermarking"):
|
||||
config._check_supports_watermarking(
|
||||
BeamSearchParams(beam_width=2, max_tokens=1, watermarking=False)
|
||||
)
|
||||
|
||||
|
||||
def test_gumbel_watermark_rejects_custom_sampler():
|
||||
with pytest.raises(ValueError, match="custom samplers are not supported"):
|
||||
_watermarked_vllm_config()._check_watermarking_unsupported(custom_sampler=True)
|
||||
_watermarked_vllm_config()._check_supports_watermarking(custom_sampler=True)
|
||||
|
||||
|
||||
def test_watermark_key_must_fit_in_64_bits():
|
||||
|
||||
Reference in New Issue
Block a user