[Core] Add update_config RPC method (#20095)
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from vllm.compilation.backends import VllmBackend
|
||||
from vllm.config import (LoadConfig, ModelConfig, PoolerConfig, VllmConfig,
|
||||
get_field)
|
||||
get_field, update_config)
|
||||
from vllm.model_executor.layers.pooler import PoolingType
|
||||
from vllm.platforms import current_platform
|
||||
|
||||
@@ -46,6 +46,34 @@ def test_get_field():
|
||||
assert c.default_factory is MISSING
|
||||
|
||||
|
||||
@dataclass
|
||||
class _TestNestedConfig:
|
||||
a: _TestConfigFields = field(
|
||||
default_factory=lambda: _TestConfigFields(a=0))
|
||||
|
||||
|
||||
def test_update_config():
|
||||
# Simple update
|
||||
config1 = _TestConfigFields(a=0)
|
||||
new_config1 = update_config(config1, {"a": 42})
|
||||
assert new_config1.a == 42
|
||||
# Nonexistent field
|
||||
with pytest.raises(AssertionError):
|
||||
new_config1 = update_config(config1, {"nonexistent": 1})
|
||||
# Nested update with dataclass
|
||||
config2 = _TestNestedConfig()
|
||||
new_inner_config = _TestConfigFields(a=1, c="new_value")
|
||||
new_config2 = update_config(config2, {"a": new_inner_config})
|
||||
assert new_config2.a == new_inner_config
|
||||
# Nested update with dict
|
||||
config3 = _TestNestedConfig()
|
||||
new_config3 = update_config(config3, {"a": {"c": "new_value"}})
|
||||
assert new_config3.a.c == "new_value"
|
||||
# Nested update with invalid type
|
||||
with pytest.raises(AssertionError):
|
||||
new_config3 = update_config(config3, {"a": "new_value"})
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("model_id", "expected_runner_type", "expected_task"),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user