{"record":{"id":"d407dd69f8fe6f68","repo":"sgl-project/sglang","slug":"unknown-pi05-gemma-variant-variant","errorCode":null,"errorMessage":"Unknown Pi05 Gemma variant: {variant}","messagePattern":"Unknown Pi05 Gemma variant: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/vlas/pi05_core.py","lineNumber":823,"sourceCode":"    if variant == \"gemma_300m\":\n        return GemmaVariantConfig(\n            width=1024,\n            depth=18,\n            mlp_dim=4096,\n            num_heads=8,\n            num_kv_heads=1,\n            head_dim=256,\n        )\n    if variant == \"gemma_2b\":\n        return GemmaVariantConfig(\n            width=2048,\n            depth=18,\n            mlp_dim=16_384,\n            num_heads=8,\n            num_kv_heads=1,\n            head_dim=256,\n        )\n    raise ValueError(f\"Unknown Pi05 Gemma variant: {variant}\")\n\n\ndef create_sinusoidal_pos_embedding(\n    time: torch.Tensor,\n    dimension: int,\n    min_period: float,\n    max_period: float,\n) -> Tensor:\n    if dimension % 2 != 0:\n        raise ValueError(f\"dimension ({dimension}) must be divisible by 2\")\n    if time.ndim != 1:\n        raise ValueError(\"time must have shape [batch]\")\n    fraction = torch.linspace(\n        0.0,\n        1.0,\n        dimension // 2,\n        dtype=torch.float64,\n        device=time.device,","sourceCodeStart":805,"sourceCodeEnd":841,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/vlas/pi05_core.py#L805-L841","documentation":"The Pi05 (pi05_core.py) model factory maps a Gemma variant name string to a hardcoded transformer config (depth, mlp_dim, num_heads, num_kv_heads, head_dim). If the supplied variant string matches none of the known keys, construction fails with 'Unknown Pi05 Gemma variant'. This is a config-name validation error raised during model __init__, before any weights load.","triggerScenarios":"Calling the Pi05 model constructor (directly or via a config object) with a variant key not in the supported set, e.g. a typo like 'gemma_3' instead of 'gemma3', or a new/renamed variant string from a checkpoint config that this code version does not know.","commonSituations":"Upgrading/downgrading sglang versions where variant names changed; hand-editing a model config JSON; loading a community-finetuned Pi05 checkpoint that names its language model variant differently.","solutions":["Check the error message for the exact variant string and compare it against the keys accepted in get_gemma_variant_config (pi05_core.py around line 790-823)","Fix the typo/rename in your config to a supported variant name","If the variant is legitimately new, add a config entry to the mapping in get_gemma_variant_config and rebuild","Upgrade sglang to a version that supports the variant"],"exampleFix":"// before\nmodel = Pi05Model(config=Pi05Config(gemma_variant=\"gemma_3\"))\n\n// after\nmodel = Pi05Model(config=Pi05Config(gemma_variant=\"gemma3\"))","handlingStrategy":"validation","validationCode":"import inspect\nfrom sglang.multimodal_gen.runtime.models.vlas import pi05_core\n\nsrc = inspect.getsource(pi05_core.get_gemma_variant_config)\n# fast structural check: any string literal compared to `variant`\nimport re\nsupported = set(re.findall(r\"variant\\s*==\\s*[\\\"']([\\w-]+)[\\\"']\", src))\nassert my_config.gemma_variant in supported, f\"use one of {supported}\"","typeGuard":"def is_supported_gemma_variant(v: str) -> bool:\n    import re, inspect\n    from sglang.multimodal_gen.runtime.models.vlas import pi05_core\n    src = inspect.getsource(pi05_core.get_gemma_variant_config)\n    return v in set(re.findall(r'variant\\s*==\\s*[\"\\']([\\w-]+)[\"\\']', src))","tryCatchPattern":"try:\n    model = Pi05Model(cfg)\nexcept ValueError as e:\n    if \"Unknown Pi05 Gemma variant\" in str(e):\n        raise SystemExit(f\"Bad gemma_variant in config: {cfg.gemma_variant}. Check supported variants.\") from e\n    raise","preventionTips":["Pin your sglang version and record which gemma variants it supports next to your config","Never hand-edit variant strings in checkpoint configs; copy them verbatim from the upstream repo","Add a config lint step that validates all enum-like strings before launching long training/serving jobs"],"tags":["pi05","gemma","config","invalid-variant"],"backgroundTag":"invalid-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}