"""MiniMax language models: Text-01, VL-01, M1, M2, M2.1, M2.5, M2.7, M3, M3.1-Flash. Facts these rules rely on (checked 2026-11-20 against the official config.json files): - Four layouts. Text-01 and M1 share one (model_type minimax_text_01 / minimax_m1, both `minimax` in the transformers port; hidden 6144, 80 layers, 32 experts); VL-01 wraps it (minimax_vl_01). M2, M2.1, M2.5 and M2.7 share minimax_m2 (hidden 3072, 62 layers, 256 experts). M3 and M3.1-Flash share minimax_m3_vl (hidden 6144, 60 layers, 128 experts). GGUF headers call them minimax-m2 / minimax-m3. - So the layout says which line a repo is built on, not which release: within a line it is the declared base_model, the GGUF header (general.name / base_model), the repo name, the card and the creation date (a repo cannot be built on a release that came out after it). - Pruning experts (REAP) keeps the hidden size, so it stays a derivative; toy test models reuse the architecture at a different hidden size and are left out, as are models distilled from our outputs into another architecture (their config names that one). - The Hub tags every repo with its model_type, so the architecture tags find derivatives whatever they are called. """ import re from ..family import Arch, Family, Member ORG = "MiniMaxAI/" END = r"(?![._]?\d)" # "M2" is not "M2.5" or "M25" # lineage, official repos, how the release is written in names (after "MiniMax" in cards) RELEASES = [ ("Text-01", ["MiniMax-Text-01", "MiniMax-Text-01-hf"], r"text[-_ ]?0?1|0?1[-_ ]?text"), ("VL-01", ["MiniMax-VL-01"], r"vl[-_ ]?0?1"), ("M1", ["MiniMax-M1-80k", "MiniMax-M1-40k", "MiniMax-M1-80k-hf", "MiniMax-M1-40k-hf"], r"m1"), ("M2", ["MiniMax-M2"], r"m2(?!-[157](?!\d))"), # "M2-5" is M2.5 ("M2.1", ["MiniMax-M2.1"], r"m2[-._]1"), ("M2.5", ["MiniMax-M2.5"], r"m2[-._]5"), ("M2.7", ["MiniMax-M2.7"], r"m2[-._]7"), ("M3", ["MiniMax-M3", "MiniMax-M3-MXFP8"], r"m3(?![-_ ]?flash|-1(?!\d))"), ("M3.1-Flash", ["MiniMax-M3.1-Flash"], r"m3(?:[-._]1)?[-_ ]?flash|m3[-._]1"), ] def in_name(tok): """The release on its own in a repo name, also glued to the family ("MiniMaxM2").""" return re.compile(rf"(?:(?