{"record":{"id":"16dffa6b8cc2e8fb","repo":"sgl-project/sglang","slug":"unsupported-pi05-dtype-dtype-name","errorCode":null,"errorMessage":"Unsupported Pi05 dtype: {dtype_name}","messagePattern":"Unsupported Pi05 dtype: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/vlas/pi05_policy.py","lineNumber":454,"sourceCode":"        )\n        return cls(\n            config,\n            model_path=local_path,\n            device=device,\n            dtype=dtype,\n            manifest=manifest,\n        )\n\n    @staticmethod\n    def _dtype_from_config(dtype_name: str) -> torch.dtype:\n        name = (dtype_name or \"bf16\").lower()\n        if name in (\"bf16\", \"bfloat16\"):\n            return torch.bfloat16\n        if name in (\"fp16\", \"float16\", \"half\"):\n            return torch.float16\n        if name in (\"fp32\", \"float32\"):\n            return torch.float32\n        raise ValueError(f\"Unsupported Pi05 dtype: {dtype_name}\")\n\n    @staticmethod\n    def _apply_checkpoint_config(\n        model_path: str,\n        config: Pi05PipelineConfig,\n    ) -> None:\n        config_path = Path(model_path) / \"config.json\"\n        if not config_path.exists():\n            return\n        with open(config_path, encoding=\"utf-8\") as f:\n            payload = json.load(f)\n\n        config.paligemma_variant = payload.get(\n            \"paligemma_variant\", config.paligemma_variant\n        )\n        config.action_expert_variant = payload.get(\n            \"action_expert_variant\", config.action_expert_variant\n        )","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/vlas/pi05_policy.py#L436-L472","documentation":"_dtype_from_config in pi05_policy.py parses the dtype string from a checkpoint's config into a torch dtype, recognizing only bf16/bfloat16, fp16/float16/half, and fp32/float32. Any other string (or a config where the dtype key is None or a novel quantization name) raises 'Unsupported Pi05 dtype'. Called during from_pretrained.","triggerScenarios":"Loading a Pi05 checkpoint whose config declares a dtype like 'fp8', 'bfloat8', 'auto', 'float64', or an empty/None dtype_name; also case-sensitive variants like 'BF16' will miss if not handled upstream.","commonSituations":"Loading a community checkpoint saved with a newer/quantized dtype; hand-edited config.json; checkpoint exported from another framework that writes torch.str or 'torch.bfloat16'-style strings.","solutions":["Check the exception for the exact dtype_name, then edit the checkpoint config to one of: bf16, bfloat16, fp16, float16, half, fp32, float32","If the checkpoint is genuinely quantized (fp8), dequantize/convert it to bf16 before loading","Normalize strings like 'torch.bfloat16' or 'auto' to 'bfloat16' in your loader before from_pretrained","Upgrade sglang in case newer dtype aliases were added"],"exampleFix":"# before\n# config.json: {\"dtype\": \"fp8\"}\npolicy = Pi05Policy.from_pretrained(\"./ckpt\")\n\n# after\n# config.json: {\"dtype\": \"bfloat16\"}\npolicy = Pi05Policy.from_pretrained(\"./ckpt\")","handlingStrategy":"validation","validationCode":"import json\n_ALIASES = {\"bf16\": \"bfloat16\", \"bfloat16\": \"bfloat16\", \"fp16\": \"fp16\",\n           \"float16\": \"fp16\", \"half\": \"fp16\", \"fp32\": \"fp32\", \"float32\": \"fp32\"}\nname = json.load(open(f\"{model_path}/config.json\")).get(\"dtype\")\nname = str(name).replace(\"torch.\", \"\").lower() if name else \"bfloat16\"\nassert name in _ALIASES, f\"unsupported checkpoint dtype {name!r}\"","typeGuard":"def is_supported_pi05_dtype(name: object) -> bool:\n    return isinstance(name, str) and name.replace(\"torch.\", \"\").lower() in {\n        \"bf16\", \"bfloat16\", \"fp16\", \"float16\", \"half\", \"fp32\", \"float32\"}","tryCatchPattern":"try:\n    policy = Pi05Policy.from_pretrained(path)\nexcept ValueError as e:\n    if \"Unsupported Pi05 dtype\" in str(e):\n        cfgp = f\"{path}/config.json\"\n        cfg = json.load(open(cfgp)); cfg[\"dtype\"] = \"bfloat16\"\n        json.dump(cfg, open(cfgp, \"w\"))\n        policy = Pi05Policy.from_pretrained(path)\n    else:\n        raise","preventionTips":["Validate checkpoint dtype strings in your model-registry loader before calling from_pretrained","Convert exotic quantized checkpoints to bf16/fp32 safetensors with an offline script rather than at load time"],"tags":["pi05","dtype","checkpoint","config"],"backgroundTag":"unsupported-dtype","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}