[Bugfix] Validate extension integers before engine serialization (#55606)
Signed-off-by: khluu <khluu000@gmail.com> Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -49,3 +49,25 @@ def test_diffusion_accepts_top_k_top_p():
|
||||
def test_non_diffusion_models_unaffected():
|
||||
params = SamplingParams(temperature=0.7, top_k=10, seed=42)
|
||||
params.verify(MockModelConfig(), None, None, None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", [-(2**63) - 1, 2**64])
|
||||
def test_extra_args_rejects_nested_integer_overflow(value):
|
||||
"""Reject extension values before they reach the engine transport."""
|
||||
with pytest.raises(VLLMValidationError, match="extra_args integers"):
|
||||
SamplingParams(extra_args={"ec_transfer_params": {"nested": [{"x": value}]}})
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", [-(2**63), 2**63 - 1, 2**63, 2**64 - 1, True])
|
||||
def test_extra_args_accepts_messagepack_integer_boundaries(value):
|
||||
extra_args = {"kv_transfer_params": {"nested": [{"x": value}]}}
|
||||
assert SamplingParams(extra_args=extra_args).extra_args == extra_args
|
||||
|
||||
|
||||
def test_extra_args_preserves_custom_objects_and_shared_containers():
|
||||
custom = object()
|
||||
shared = [custom, (None, "value", 1.5)]
|
||||
extra_args = {"first": shared, "second": shared}
|
||||
params = SamplingParams(extra_args=extra_args)
|
||||
assert params.extra_args["first"][0] is custom
|
||||
assert params.extra_args["first"] is params.extra_args["second"]
|
||||
|
||||
Reference in New Issue
Block a user