A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 3, 06:45 UTC
[bug] fix WeightTransferConfig.backend to allow for all strings (#43121)
Signed-off-by: ahao-anyscale <ahao@anyscale.com>
Aaron Hao committed
May 19, 2026 at 18:01 UTC
73dd2f33b7a5a8a237fe7296039cec246e4c68bd
2 files changed
+5
-18
tests/distributed/test_weight_transfer.py
+1
-14
@@ -173,20 +173,7 @@ class TestEngineRegistry:
173
174
def test_create_engine_invalid_backend(self):
175
"""Test factory raises for invalid backend."""
176
- # Pydantic validates Literal types at construction, so we can't create
177
- # a config with an invalid backend. Instead, we test by directly
178
- # accessing the registry or using model_construct to bypass validation.
179
- from pydantic import ValidationError
180
-
181
- # Test that Pydantic prevents invalid backend at construction
182
- with pytest.raises(ValidationError):
183
- WeightTransferConfig(backend="invalid")
184
-
185
- # Test factory error by creating a config with valid backend but
186
- # then manually modifying the backend attribute (bypassing validation)
187
- config = WeightTransferConfig(backend="nccl")
188
- # Use object.__setattr__ to bypass Pydantic validation
189
- object.__setattr__(config, "backend", "invalid")
176
+ config = WeightTransferConfig(backend="invalid")
177
parallel_config = create_mock_parallel_config()
178
with pytest.raises(ValueError, match="Invalid weight transfer backend"):
179
WeightTransferEngineFactory.create_engine(config, parallel_config)
vllm/config/weight_transfer.py
+4
-4
@@ -1,7 +1,5 @@
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
-from typing import Literal
4
-
3
from vllm.config.utils import config
4
5
@@ -9,5 +7,7 @@ from vllm.config.utils import config
7
class WeightTransferConfig:
8
"""Configuration for weight transfer during RL training."""
9
12
- backend: Literal["nccl", "ipc"] = "nccl"
13
- """The backend to use for weight transfer."""
10
+ backend: str = "nccl"
11
+ """The backend to use for weight transfer. Validated against the
12
+ `WeightTransferEngineFactory` registry at engine creation time.
13
+ """