{"record":{"id":"eff78c22ae0a498e","repo":"opendatalab/MinerU","slug":"name-is-not-supported-in-multihead-yet","errorCode":null,"errorMessage":"{name} is not supported in MultiHead yet","messagePattern":"(.+?) is not supported in MultiHead yet","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"mineru/model/utils/pytorchocr/modeling/heads/rec_multi_head.py","lineNumber":64,"sourceCode":"                    self.head = nn.Linear(self.encoder.out_channels, out_channels_list[\"CTCLabelDecode\"], bias=True)\n                    self.out_channels = out_channels_list[\"CTCLabelDecode\"]\n                    self.use_light_svtr_head = True\n                else:\n                    self.ctc_encoder = SequenceEncoder(\n                        in_channels=in_channels, encoder_type=encoder_type, **neck_args\n                    )\n                    # ctc head\n                    head_args = self.head_list[idx][name].get(\"Head\", {})\n                    if head_args is None:\n                        head_args = {}\n\n                    self.ctc_head = CTCHead(\n                        in_channels=self.ctc_encoder.out_channels,\n                        out_channels=out_channels_list[\"CTCLabelDecode\"],\n                        **head_args,\n                    )\n            else:\n                raise NotImplementedError(f\"{name} is not supported in MultiHead yet\")\n\n    def forward(self, x, data=None):\n        \"\"\"根据配置执行 v6 LightSVTR 或历史 CTC 分支。\"\"\"\n        if self.use_light_svtr_head:\n            ctc_encoder = self.encoder(x)\n            ctc_encoder = ctc_encoder.squeeze(dim=2).permute(0, 2, 1)\n            predicts = self.head(ctc_encoder)\n            if not self.training:\n                # 推理阶段保留 raw logits，交给 CTC 解码端按需计算 max 概率，避免整块 softmax 矩阵搬运。\n                return {\"ctc_logits\": predicts, \"ctc_use_raw_logits\": True}\n            return predicts\n        ctc_encoder = self.ctc_encoder(x)\n        return self.ctc_head(ctc_encoder)\n","sourceCodeStart":46,"sourceCodeEnd":78,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/model/utils/pytorchocr/modeling/heads/rec_multi_head.py#L46-L78","documentation":"Raised by MultiHead (rec_multi_head.py) when iterating head_list and encountering a head name other than the recognized ones (CTC/SAR/NRTR branches; the v6 LightSVTR path bypasses this loop). The multi-head rec model only knows how to build those specific heads from the out_channels_list.","triggerScenarios":"A rec config with Head.name=MultiHead and head_list containing an entry like {'NRTRHead': ...} variants or a custom head name not handled by the constructor.","commonSituations":"Porting newer PaddleOCR rec configs whose head_list includes heads this port hasn't implemented; typos in head names inside YAML.","solutions":["Restrict head_list entries to the supported head names (CTCLabelDecode/SARLabelDecode/NRTRLabelDecode families) — compare with the bundled MultiHead config.","If you only need CTC, drop the extra head entries and keep just the CTC head.","For PP-OCRv6 models, prefer the built-in LightSVTR head path (use_light_svtr_head) instead of hand-built head_list."],"exampleFix":"# before\nhead_list:\n  - CTCHead: {}\n  - MyCustomHead: {}   # unsupported\n\n# after\nhead_list:\n  - CTCHead: {}","handlingStrategy":"validation","validationCode":"SUPPORTED_HEADS = {\"CTCLabelDecode\", \"SARLabelDecode\", \"NRTRLabelDecode\"}\nfor entry in head_list:\n    for name in entry:\n        assert name in SUPPORTED_HEADS, f\"MultiHead does not support {name!r}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep head_list minimal (CTC-only) unless you need multi-head training","Prefer the built-in v6 LightSVTR head for PP-OCRv6 models"],"tags":["ocr","recognition","multi-head","config","not-implemented"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}