{"record":{"id":"7081325d6d683b35","repo":"sgl-project/sglang","slug":"pipeline-parallel-with-multiple-modulelist-blocks","errorCode":null,"errorMessage":"Pipeline parallel with multiple ModuleList blocks is not supported.","messagePattern":"Pipeline parallel with multiple ModuleList blocks is not supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/models/transformers.py","lineNumber":861,"sourceCode":"        setattr(parent_module, child_name, module)\n\n    def pipeline_parallel(self):\n        if self.pp_group.world_size <= 1:\n            return\n\n        pp_plan = self._get_model_pp_plan()\n        if not pp_plan:\n            raise ValueError(\n                f\"{type(self.model)} does not support pipeline parallel yet!\"\n            )\n\n        pp_keys = [re.sub(r\"^model\\.\", \"\", name) for name in pp_plan.keys()]\n        module_list_idx = None\n        module_list_name = None\n        for idx, name in enumerate(pp_keys):\n            if isinstance(self._get_submodule_or_none(name), nn.ModuleList):\n                if module_list_idx is not None:\n                    raise ValueError(\n                        \"Pipeline parallel with multiple ModuleList blocks is not supported.\"\n                    )\n                module_list_idx = idx\n                module_list_name = name\n\n        if module_list_idx is None or module_list_name is None:\n            raise ValueError(f\"Could not find ModuleList in {type(self.model)}.\")\n\n        keep_prefix_modules = self.pp_group.is_first_rank or (\n            getattr(self.text_config, \"tie_word_embeddings\", False)\n            and self.pp_group.is_last_rank\n        )\n        for name in pp_keys[:module_list_idx]:\n            if keep_prefix_modules:\n                continue\n            self._set_submodule(name, PPMissingLayer())\n            self._register_missing_prefix(maybe_prefix(\"model\", name))\n","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/transformers.py#L843-L879","documentation":"The Transformers-backend PP splitter can only handle a pp plan with a single ModuleList boundary; two or more ModuleList entries in the plan keys are ambiguous and rejected.","triggerScenarios":"A model whose pp plan keys include multiple nn.ModuleList modules (e.g. separate encoder and decoder stacks).","commonSituations":"Encoder-decoder or MoE models with several stacked lists in the plan.","solutions":["Restrict the pp plan to one ModuleList boundary for this backend","Use TP instead of PP for such models","Use a native sglang implementation supporting multi-block PP"],"exampleFix":"# before\npp_plan = {\"model.encoder.layers\": 1, \"model.decoder.layers\": 1}\n# after (single boundary)\npp_plan = {\"model.decoder.layers\": 1}","handlingStrategy":"validation","validationCode":"ml = [k for k in pp_plan if isinstance(model.get_submodule(k), nn.ModuleList)]\nassert len(ml) <= 1, f'multiple ModuleLists: {ml}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Design pp plans around one layer-stack boundary","Avoid encoder-decoder models on this backend with PP"],"tags":["pipeline-parallel","transformers-backend"],"backgroundTag":"unsupported-pp-topology","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}