{"record":{"id":"7b4f9b869109ef5b","repo":"sgl-project/sglang","slug":"unsupported-audio-interleave-mode-ai-k-mode-r","errorCode":null,"errorMessage":"unsupported audio interleave mode: {ai_k_mode!r}","messagePattern":"unsupported audio interleave mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/dots_note_omni_video_core/video_qa_flattener.py","lineNumber":54,"sourceCode":"    return [key for _, key in sorted(pairs)]\n\n\nclass VideoQAFlattener:\n    \"\"\"Apply the frame and audio sampling policy used during training.\"\"\"\n\n    def __init__(\n        self,\n        time_format: str = \"random\",\n        seconds_decimals: int = 1,\n        audio_interleave: bool = False,\n        ai_seg_min_sec: float = 1.0,\n        ai_k_mode: str = \"eval30\",\n        rng: random.Random | None = None,\n    ):\n        if time_format not in (\"hms\", \"seconds\", \"random\"):\n            raise ValueError(f\"unsupported time format: {time_format!r}\")\n        if ai_k_mode not in (\"logk\", \"eval30\", \"eval_ek\", \"whole\"):\n            raise ValueError(f\"unsupported audio interleave mode: {ai_k_mode!r}\")\n\n        self.time_format = time_format\n        self.seconds_decimals = max(0, int(seconds_decimals))\n        self.audio_interleave = bool(audio_interleave)\n        self.ai_seg_min_sec = max(1e-6, float(ai_seg_min_sec))\n        self.ai_k_mode = ai_k_mode\n        self.rng = rng or random.Random()\n\n    def _subsample_one_video(self, video_dict: dict):\n        \"\"\"Return ordered frames, timestamps, and optional WAV data.\"\"\"\n        original_fps = float(video_dict.get(\"fps\", 1.0)) or 1.0\n        image_keys = _sorted_image_keys(video_dict)\n        frames = [video_dict[key] for key in image_keys]\n        timestamps = [round(i / original_fps, 3) for i in range(len(image_keys))]\n        return frames, timestamps, video_dict.get(\"audio_0\") or None\n\n    @staticmethod\n    def _decode_wav_b64(audio_b64: str):","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/dots_note_omni_video_core/video_qa_flattener.py#L36-L72","documentation":"Raised by the DotsNote Omni video QA flattener constructor when ai_k_mode (audio interleave segment selection mode) is not one of 'logk', 'eval30', 'eval_ek', 'whole'. The mode controls how many audio segments are interleaved into the flattened QA transcript. Note the constructor only validates the mode string even when audio_interleave=False, so an invalid value always fails.","triggerScenarios":"Constructing the flattener with ai_k_mode='eval' (missing the 30), 'random', or an accidentally passed other parameter due to positional-argument misordering.","commonSituations":"Positional args shifted after adding new parameters (rng, ai_seg_min_sec) so a time_format string lands in ai_k_mode; stale config from an older version using a renamed mode.","solutions":["Set ai_k_mode to one of 'logk', 'eval30', 'eval_ek', 'whole'","Check for positional-argument misordering in the constructor call — a shifted time_format value often lands here","Update configs written for an older mode vocabulary"],"exampleFix":"# before\nfl = VideoQAFlattener('hms', 2, True, 1.0, 'eval')\n# after\nfl = VideoQAFlattener(time_format='hms', audio_interleave=True, ai_k_mode='eval30')","handlingStrategy":"validation","validationCode":"VALID_K = {'logk','eval30','eval_ek','whole'}\nassert cfg.get('ai_k_mode','eval30') in VALID_K, cfg.get('ai_k_mode')","typeGuard":"def is_valid_ai_k_mode(v: str) -> bool:\n    return v in ('logk','eval30','eval_ek','whole')","tryCatchPattern":null,"preventionTips":["Always pass flattener options by keyword to avoid positional shifts","Centralize accepted enum sets in constants shared with your config schema"],"tags":["multimodal","config-validation","audio-interleave","dots-note-omni"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}