{"record":{"id":"da97f4e3eedd253c","repo":"PaddlePaddle/PaddleOCR","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":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ppocr/modeling/backbones/rec_svtrnet.py","lineNumber":254,"sourceCode":"            self.norm1 = eval(norm_layer)(dim, epsilon=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, epsilon=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":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/ppocr/modeling/backbones/rec_svtrnet.py#L236-L272","documentation":"SVTRNet's Block (mixer stage) supports three attention mixers: 'Global' and 'Local' (both routed to the Attention mixer, where Local uses windowed attention when HW is set) and 'Conv' (ConvMixer). Any other mixer string raises TypeError listing the three valid values. Note it is a TypeError raised from __init__ of each Block, so it fires while the SVTR backbone is being assembled.","triggerScenarios":"SVTR config with Mixer=['Global','Local','Convx'] (typo), Mixer=['global'] (case-sensitive), or a name from a newer SVTR variant not implemented in this file (e.g. 'Partial' from SVTRv2-style configs).","commonSituations":"Porting an SVTRv2 / PP-OCRv4+ rec config whose mixer names differ from the classic SVTR implementation; case or spelling drift in hand-written Mixer lists.","solutions":["Use only 'Global', 'Local', or 'Conv' (exact casing) in the Mixer list","If following an SVTRv2-style recipe, use the config/backbone file that implements those mixers instead of rec_svtrnet.py's Block","Verify each Mixer entry against a shipped PP-OCR rec SVTR config before editing"],"exampleFix":"# before\nMixer: ['Conv', 'Conv', 'Globalx']   # typo -> TypeError\n\n# after\nMixer: ['Conv', 'Conv', 'Global']","handlingStrategy":"validation","validationCode":"MIXERS = {'Global', 'Local', 'Conv'}\nassert all(m in MIXERS for m in Mixer), f'Mixer entries must be in {sorted(MIXERS)}, got {Mixer}'","typeGuard":"def valid_mixers(mixer_list) -> bool:\n    s = {'Global', 'Local', 'Conv'}\n    return isinstance(mixer_list, (list, tuple)) and all(m in s for m in mixer_list)","tryCatchPattern":null,"preventionTips":["Mixer names are case-sensitive exact strings","SVTRv2-style mixer names are not implemented in this Block — use the matching model file","Validate the Mixer list in config schema checks before training"],"tags":["config","svtr","recognition","enum-value","backbone"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}