[Bugfix] Reject mismatched float16/bfloat16 KV cache dtype (#60885)
Signed-off-by: cipheraxat <cipheraxat@users.noreply.github.com> Co-authored-by: cipheraxat <cipheraxat@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
cipheraxat
Claude Opus 5.5
parent
fc8e08a2a6
commit
48f17b77bb
@@ -290,6 +290,28 @@ def test_mamba_cache_mode_all_is_rejected():
|
||||
CacheConfig(mamba_cache_mode="all")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("cache_dtype", "model_dtype", "should_raise"),
|
||||
[
|
||||
("float16", torch.bfloat16, True),
|
||||
("bfloat16", torch.float16, True),
|
||||
("float16", torch.float32, True),
|
||||
("float16", torch.float16, False),
|
||||
("auto", torch.bfloat16, False),
|
||||
("fp8", torch.bfloat16, False),
|
||||
],
|
||||
)
|
||||
def test_mismatched_float_kv_cache_is_rejected(cache_dtype, model_dtype, should_raise):
|
||||
config = VllmConfig(cache_config=CacheConfig(cache_dtype=cache_dtype))
|
||||
config.model_config = SimpleNamespace(dtype=model_dtype)
|
||||
|
||||
if should_raise:
|
||||
with pytest.raises(ValueError, match="kv_cache_dtype"):
|
||||
config._reject_mismatched_float_kv_cache()
|
||||
else:
|
||||
config._reject_mismatched_float_kv_cache()
|
||||
|
||||
|
||||
def test_per_request_spec_decode_metrics_requires_spec_decode():
|
||||
# The flag only makes sense with speculative decoding configured; enabling
|
||||
# it without --speculative-config should fail fast rather than silently
|
||||
|
||||
Reference in New Issue
Block a user