{"record":{"id":"aa04e1766a6d4a97","repo":"opendatalab/MinerU","slug":"the-mixer-must-be-one-of-global-local-conv","errorCode":null,"errorMessage":"The mixer must be one of [Global, Local, Conv]","messagePattern":"The mixer must be one of \\[Global, Local, Conv\\]","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"mineru/model/utils/pytorchocr/modeling/backbones/rec_svtrnet.py","lineNumber":238,"sourceCode":"            self.norm1 = eval(norm_layer)(dim, eps=epsilon)\n        else:\n            self.norm1 = norm_layer(dim)\n        if mixer == \"Global\" or mixer == \"Local\":\n            self.mixer = Attention(\n                dim,\n                num_heads=num_heads,\n                mixer=mixer,\n                HW=HW,\n                local_k=local_mixer,\n                qkv_bias=qkv_bias,\n                qk_scale=qk_scale,\n                attn_drop=attn_drop,\n                proj_drop=drop,\n            )\n        elif mixer == \"Conv\":\n            self.mixer = ConvMixer(dim, num_heads=num_heads, HW=HW, local_k=local_mixer)\n        else:\n            raise TypeError(\"The mixer must be one of [Global, Local, Conv]\")\n\n        self.drop_path = DropPath(drop_path) if drop_path > 0.0 else Identity()\n        if isinstance(norm_layer, str):\n            self.norm2 = eval(norm_layer)(dim, eps=epsilon)\n        else:\n            self.norm2 = norm_layer(dim)\n        mlp_hidden_dim = int(dim * mlp_ratio)\n        self.mlp_ratio = mlp_ratio\n        self.mlp = Mlp(\n            in_features=dim,\n            hidden_features=mlp_hidden_dim,\n            act_layer=act_layer,\n            drop=drop,\n        )\n        self.prenorm = prenorm\n\n    def forward(self, x):\n        if self.prenorm:","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/model/utils/pytorchocr/modeling/backbones/rec_svtrnet.py#L220-L256","documentation":"Raised in SVTR recognition blocks (Block/BlockAttn construction) when the mixer string for a stage is not 'Global', 'Local', or 'Conv'. Each block instantiates a GlobalAttention/LocalAttention or ConvMixer depending on this config value; the else branch raises TypeError.","triggerScenarios":"A rec SVTR config where Backbone.mixers (list like [['Conv','Local','Global'],...]) contains a misspelled entry ('global', 'local_mixer', 'GA'); building rec_svtrnet directly with mixer='Attention'.","commonSituations":"Hand-edited PP-OCRv3/v4 rec YAMLs mixing mixer vocabulary from different model generations; case-sensitive typos.","solutions":["Set each stage's mixer to exactly 'Global', 'Local', or 'Conv' in the backbone config.","Check the mixers matrix shape and values against the shipped SVTR config for your model version.","Verify capitalization — matching is case-sensitive."],"exampleFix":"# before\nmixers: [['Conv','local','Global']]\n\n# after\nmixers: [['Conv','Local','Global']]","handlingStrategy":"validation","validationCode":"for stage in mixers:\n    for m in stage:\n        assert m in {\"Global\", \"Local\", \"Conv\"}, f\"bad mixer: {m!r}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the mixers matrix against the shipped SVTR config","Mixer names are case-sensitive: use exact capitalization"],"tags":["ocr","backbone","svtr","config","typeerror"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}