sgl-project/sglang · error · ValueError

unsupported audio interleave mode: {ai_k_mode!r}

Error message

unsupported audio interleave mode: {ai_k_mode!r}

What it means

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.

Source

Thrown at python/sglang/srt/multimodal/processors/dots_note_omni_video_core/video_qa_flattener.py:54

    return [key for _, key in sorted(pairs)]


class VideoQAFlattener:
    """Apply the frame and audio sampling policy used during training."""

    def __init__(
        self,
        time_format: str = "random",
        seconds_decimals: int = 1,
        audio_interleave: bool = False,
        ai_seg_min_sec: float = 1.0,
        ai_k_mode: str = "eval30",
        rng: random.Random | None = None,
    ):
        if time_format not in ("hms", "seconds", "random"):
            raise ValueError(f"unsupported time format: {time_format!r}")
        if ai_k_mode not in ("logk", "eval30", "eval_ek", "whole"):
            raise ValueError(f"unsupported audio interleave mode: {ai_k_mode!r}")

        self.time_format = time_format
        self.seconds_decimals = max(0, int(seconds_decimals))
        self.audio_interleave = bool(audio_interleave)
        self.ai_seg_min_sec = max(1e-6, float(ai_seg_min_sec))
        self.ai_k_mode = ai_k_mode
        self.rng = rng or random.Random()

    def _subsample_one_video(self, video_dict: dict):
        """Return ordered frames, timestamps, and optional WAV data."""
        original_fps = float(video_dict.get("fps", 1.0)) or 1.0
        image_keys = _sorted_image_keys(video_dict)
        frames = [video_dict[key] for key in image_keys]
        timestamps = [round(i / original_fps, 3) for i in range(len(image_keys))]
        return frames, timestamps, video_dict.get("audio_0") or None

    @staticmethod
    def _decode_wav_b64(audio_b64: str):

View on GitHub (pinned to 0132848349)

Solutions

  1. Set ai_k_mode to one of 'logk', 'eval30', 'eval_ek', 'whole'
  2. Check for positional-argument misordering in the constructor call — a shifted time_format value often lands here
  3. Update configs written for an older mode vocabulary

Example fix

# before
fl = VideoQAFlattener('hms', 2, True, 1.0, 'eval')
# after
fl = VideoQAFlattener(time_format='hms', audio_interleave=True, ai_k_mode='eval30')
Defensive patterns

Strategy: validation

Validate before calling

VALID_K = {'logk','eval30','eval_ek','whole'}
assert cfg.get('ai_k_mode','eval30') in VALID_K, cfg.get('ai_k_mode')

Type guard

def is_valid_ai_k_mode(v: str) -> bool:
    return v in ('logk','eval30','eval_ek','whole')

Prevention

When it happens

Trigger: Constructing the flattener with ai_k_mode='eval' (missing the 30), 'random', or an accidentally passed other parameter due to positional-argument misordering.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/7b4f9b869109ef5b. Report an issue: GitHub.