sgl-project/sglang · error · ValueError
Explicit vision TP cannot be combined with data parallel
Error message
Explicit vision TP cannot be combined with data parallel
What it means
Qwen3-VL vision modules can either run data-parallel (vision TP resolved to 1,0) or with an explicit TP size/rank — not both. Passing tp_size/tp_rank while use_data_parallel=True is contradictory and rejected.
Source
Thrown at python/sglang/srt/models/qwen3_vl.py:113
logger = logging.getLogger(__name__)
_is_cpu_amx_available = cpu_has_amx_support()
_is_cpu = is_cpu()
# Below this image count the per-image loop beats the vectorized path (which has a
# fixed setup cost; measured crossover ~6 on H20); both give the same result.
_VECTORIZED_VL_POS_EMBED_MIN_IMAGES = 6
def _resolve_vision_tp(
*,
use_data_parallel: bool,
tp_size: Optional[int],
tp_rank: Optional[int],
) -> tuple[int, int]:
if use_data_parallel:
if tp_size is not None or tp_rank is not None:
raise ValueError("Explicit vision TP cannot be combined with data parallel")
return 1, 0
if (tp_size is None) != (tp_rank is None):
raise ValueError("Vision tp_size and tp_rank must be set together")
if tp_size is None:
parallel = get_parallel()
return parallel.attn_tp_size, parallel.attn_tp_rank
assert tp_rank is not None
return tp_size, tp_rank
class Qwen3_VisionMLP(nn.Module):
def __init__(
self,
in_features: int,
hidden_features: int,
bias: bool = True,
hidden_act="silu",View on GitHub (pinned to 0132848349)
Solutions
- Remove the explicit vision tp_size/tp_rank arguments when using data parallel
- Or drop --dp-size / disable vision data parallel if you need explicit vision TP
Example fix
# before (dp + explicit vision tp) Qwen3VLModel(..., use_data_parallel=True, tp_size=2, tp_rank=0) # after Qwen3VLModel(..., use_data_parallel=True)
Defensive patterns
Strategy: validation
Validate before calling
if use_data_parallel:
assert tp_size is None and tp_rank is None, "drop vision TP args under DP" Prevention
- Choose either DP or explicit vision TP, never both
- Document which parallelism mode your launcher sets
When it happens
Trigger: Constructing the Qwen3-VL visual tower with use_data_parallel=True and a non-None tp_size or tp_rank (e.g. via --dp-size with explicit vision TP args).
Common situations: Serving Qwen3-VL with --dp-size N while also passing vision TP overrides in server args.
Related errors
- Vision tp_size and tp_rank must be set together
- delta payload size mismatch: expected ${expectedSize}, got $
- This browser does not support worker image decoding
- Generate subcommand is not yet supported for model: {model_p
- Error: --model-type requires a non-empty value.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/835314b5cec7cfe6.
Report an issue: GitHub.