{"record":{"id":"835314b5cec7cfe6","repo":"sgl-project/sglang","slug":"explicit-vision-tp-cannot-be-combined-with-data-pa","errorCode":null,"errorMessage":"Explicit vision TP cannot be combined with data parallel","messagePattern":"Explicit vision TP cannot be combined with data parallel","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/models/qwen3_vl.py","lineNumber":113,"sourceCode":"logger = logging.getLogger(__name__)\n\n_is_cpu_amx_available = cpu_has_amx_support()\n_is_cpu = is_cpu()\n\n# Below this image count the per-image loop beats the vectorized path (which has a\n# fixed setup cost; measured crossover ~6 on H20); both give the same result.\n_VECTORIZED_VL_POS_EMBED_MIN_IMAGES = 6\n\n\ndef _resolve_vision_tp(\n    *,\n    use_data_parallel: bool,\n    tp_size: Optional[int],\n    tp_rank: Optional[int],\n) -> tuple[int, int]:\n    if use_data_parallel:\n        if tp_size is not None or tp_rank is not None:\n            raise ValueError(\"Explicit vision TP cannot be combined with data parallel\")\n        return 1, 0\n    if (tp_size is None) != (tp_rank is None):\n        raise ValueError(\"Vision tp_size and tp_rank must be set together\")\n    if tp_size is None:\n        parallel = get_parallel()\n        return parallel.attn_tp_size, parallel.attn_tp_rank\n    assert tp_rank is not None\n    return tp_size, tp_rank\n\n\nclass Qwen3_VisionMLP(nn.Module):\n\n    def __init__(\n        self,\n        in_features: int,\n        hidden_features: int,\n        bias: bool = True,\n        hidden_act=\"silu\",","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/qwen3_vl.py#L95-L131","documentation":"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.","triggerScenarios":"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).","commonSituations":"Serving Qwen3-VL with --dp-size N while also passing vision TP overrides in server args.","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"],"exampleFix":"# before (dp + explicit vision tp)\nQwen3VLModel(..., use_data_parallel=True, tp_size=2, tp_rank=0)\n# after\nQwen3VLModel(..., use_data_parallel=True)","handlingStrategy":"validation","validationCode":"if use_data_parallel:\n    assert tp_size is None and tp_rank is None, \"drop vision TP args under DP\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose either DP or explicit vision TP, never both","Document which parallelism mode your launcher sets"],"tags":["qwen3-vl","vision","data-parallel","tensor-parallel"],"backgroundTag":"conflicting-parallelism-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}