{"record":{"id":"8a2b850b955fb843","repo":"sgl-project/sglang","slug":"action-normalization-stats-not-found-at-stats-pat","errorCode":null,"errorMessage":"Action normalization stats not found at {stats_path}.","messagePattern":"Action normalization stats not found at (.+?)\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3_action.py","lineNumber":170,"sourceCode":"            \"duration\": f\"{int(duration_seconds)}s\",\n            \"fps\": float(fps),\n            \"resolution\": {\"H\": int(height), \"W\": int(width)},\n            \"aspect_ratio\": canonical_aspect_ratio(int(width), int(height)),\n        }\n        prompts.append(json.dumps(prompt))\n\n    if isinstance(description, (list, tuple)):\n        return prompts\n    return prompts[0]\n\n\ndef load_action_stats(\n    stats_path: str, stats_key: str = \"global\"\n) -> dict[str, torch.Tensor]:\n    \"\"\"Load per-channel action normalization stats from a JSON file.\"\"\"\n    path = Path(stats_path)\n    if not path.exists():\n        raise FileNotFoundError(\n            f\"Action normalization stats not found at {stats_path}.\"\n        )\n    raw = json.loads(path.read_text())\n    if stats_key in raw:\n        raw = raw[stats_key]\n    return {\n        k: torch.as_tensor(np.array(v, dtype=np.float32))\n        for k, v in raw.items()\n        if k in _STAT_KEYS\n    }\n\n\ndef normalize_action(\n    action: torch.Tensor, method: str, stats: dict[str, torch.Tensor]\n) -> torch.Tensor:\n    if method == \"quantile\":\n        q01, q99 = stats[\"q01\"].to(action), stats[\"q99\"].to(action)\n        return (2.0 * (action - q01) / (q99 - q01).clamp(min=1e-8) - 1.0).clamp(","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3_action.py#L152-L188","documentation":"load_action_stats reads a JSON file of per-channel action normalization statistics (mean/std/min/max/q01/q99) required to normalize/denormalize actions. If the path does not exist it raises FileNotFoundError — the stats artifact was not shipped, mounted, or its path misconfigured.","triggerScenarios":"Any action-conditioned Cosmos3 request: _prepare_action_latents/forward calls load_action_stats(stats_path) with a path (from pipeline config / server args) that doesn't exist on the scheduler's filesystem.","commonSituations":"Stats JSON not downloaded with the model checkpoint; wrong path after moving the model directory; container missing a volume mount that hosts the stats file; typo in the config key.","solutions":["Verify the stats JSON exists at the configured path (ls the exact path from the error)","Point the config/server arg at the correct location of the model's action stats file","If the file was never generated, create it from your training data (per-channel mean/std/min/max/q01/q99) or export it from the model release","In containers, ensure the volume containing the stats file is mounted"],"exampleFix":"# before\n--action-stats-path /models/cosmos3/stats.json  # missing\n# after\n--action-stats-path /models/cosmos3/action_stats.json  # actual filename in checkpoint","handlingStrategy":"validation","validationCode":"from pathlib import Path\nassert Path(stats_path).is_file(), f\"action stats file missing: {stats_path}\"","typeGuard":"def action_stats_available(stats_path: str) -> bool:\n    return Path(stats_path).is_file()","tryCatchPattern":"try:\n    stats = load_action_stats(stats_path)\nexcept FileNotFoundError:\n    raise RuntimeError(f\"deploy blocked: mount or download action stats at {stats_path}\") from None","preventionTips":["Ship stats JSON alongside the checkpoint and verify presence in deployment smoke tests","Mount the stats file explicitly in container specs","Hash-pin the stats file version to the checkpoint to avoid mismatches"],"tags":["cosmos3","file-not-found","normalization-stats","checkpoint"],"backgroundTag":"missing-model-artifact-file","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}