opendatalab/MinerU · error · TypeError
The mixer must be one of [Global, Local, Conv]
Error message
The mixer must be one of [Global, Local, Conv]
What it means
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.
Source
Thrown at mineru/model/utils/pytorchocr/modeling/backbones/rec_svtrnet.py:238
self.norm1 = eval(norm_layer)(dim, eps=epsilon)
else:
self.norm1 = norm_layer(dim)
if mixer == "Global" or mixer == "Local":
self.mixer = Attention(
dim,
num_heads=num_heads,
mixer=mixer,
HW=HW,
local_k=local_mixer,
qkv_bias=qkv_bias,
qk_scale=qk_scale,
attn_drop=attn_drop,
proj_drop=drop,
)
elif mixer == "Conv":
self.mixer = ConvMixer(dim, num_heads=num_heads, HW=HW, local_k=local_mixer)
else:
raise TypeError("The mixer must be one of [Global, Local, Conv]")
self.drop_path = DropPath(drop_path) if drop_path > 0.0 else Identity()
if isinstance(norm_layer, str):
self.norm2 = eval(norm_layer)(dim, eps=epsilon)
else:
self.norm2 = norm_layer(dim)
mlp_hidden_dim = int(dim * mlp_ratio)
self.mlp_ratio = mlp_ratio
self.mlp = Mlp(
in_features=dim,
hidden_features=mlp_hidden_dim,
act_layer=act_layer,
drop=drop,
)
self.prenorm = prenorm
def forward(self, x):
if self.prenorm:View on GitHub (pinned to 4fe4bde114)
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.
Example fix
# before mixers: [['Conv','local','Global']] # after mixers: [['Conv','Local','Global']]
Defensive patterns
Strategy: validation
Validate before calling
for stage in mixers:
for m in stage:
assert m in {"Global", "Local", "Conv"}, f"bad mixer: {m!r}" Prevention
- Validate the mixers matrix against the shipped SVTR config
- Mixer names are case-sensitive: use exact capitalization
When it happens
Trigger: 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'.
Common situations: Hand-edited PP-OCRv3/v4 rec YAMLs mixing mixer vocabulary from different model generations; case-sensitive typos.
Related errors
- mode[{model_name}_model] is not implemented!
- mode[{model_name}_model] is not implemented!
- Unsupported activation: {name}
- PPLCNetV4 {mode} model_size must be one of {list(config_dict
- not support limit type, image
AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14).
Data as JSON: /api/errors/aa04e1766a6d4a97.
Report an issue: GitHub.