From a13466cb6baa30cb26b8cc2a0fb89152a842ebf0 Mon Sep 17 00:00:00 2001 From: Karan Shelar Date: Mon, 31 Aug 2026 11:54:14 +0530 Subject: [PATCH] config: raise ValueError instead of assert for DBO all2all backend validation Signed-off-by: Karan Shelar --- tests/test_config.py | 25 +++++++++++++++++++++++++ vllm/config/vllm.py | 19 ++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 4c27a6fe699c..6a3977c84ec6 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -2408,3 +2408,28 @@ def test_revision_resolved_when_weights_match_model(mock_resolve): assert isinstance(config.revision, ResolvedRevision) assert config.revision.resolved == REVISION mock_resolve.assert_any_call(model, None, config.hf_token) + + +@pytest.mark.skip_global_cleanup +@patch("vllm.config.model.get_config") +@patch("vllm.config.model.resolve_revision", return_value=ResolvedRevision(REVISION)) +def test_microbatching_all2all_backend_validation(mock_resolve, mock_get_config): + from transformers import PretrainedConfig + hf_config = PretrainedConfig( + model_type="qwen3", + num_hidden_layers=1, + architectures=["Qwen3ForCausalLM"], + ) + mock_get_config.return_value = hf_config + + # Microbatching requires specific all2all backends. + # By default, use_ubatching is True when enable_dbo is True, + # but all2all_backend defaults to allgather_reducescatter. + # This must raise a ValueError. + from vllm.config import DeviceConfig + with pytest.raises(ValueError, match="Microbatching currently only supports"): + VllmConfig( + model_config=ModelConfig("Qwen/Qwen3-0.6B"), + parallel_config=ParallelConfig(enable_dbo=True), + device_config=DeviceConfig(device="cpu"), + ) diff --git a/vllm/config/vllm.py b/vllm/config/vllm.py index 37304ec188d6..356be86e615b 100644 --- a/vllm/config/vllm.py +++ b/vllm/config/vllm.py @@ -1730,18 +1730,19 @@ def has_blocked_weights(): if self.parallel_config.use_ubatching: a2a_backend = self.parallel_config.all2all_backend - assert a2a_backend in [ + if a2a_backend not in [ "deepep_low_latency", "deepep_high_throughput", "nixl_ep", - ], ( - "Microbatching currently only supports the deepep_low_latency, " - "deepep_high_throughput, and nixl_ep all2all backends. " - f"{a2a_backend} is not supported. To fix use " - "--all2all-backend=deepep_low_latency, " - "--all2all-backend=deepep_high_throughput, or " - "--all2all-backend=nixl_ep and install the matching kernels." - ) + ]: + raise ValueError( + "Microbatching currently only supports the deepep_low_latency, " + "deepep_high_throughput, and nixl_ep all2all backends. " + f"{a2a_backend} is not supported. To fix use " + "--all2all-backend=deepep_low_latency, " + "--all2all-backend=deepep_high_throughput, or " + "--all2all-backend=nixl_ep and install the matching kernels." + ) if not self.model_config.disable_cascade_attn: self.model_config.disable_cascade_attn = True