sgl-project/sglang · error · ValueError

Video sampling strategy not specified

Error message

Video sampling strategy not specified

What it means

Raised by prepare_video_kwargs in MiMo-V2 when default_video_processor_kwargs is falsy (None or empty) so no fps/max_frames/min_frames can be derived. Without a sampling strategy the video processor cannot decide which frames to sample, so it refuses rather than guessing.

Source

Thrown at python/sglang/srt/multimodal/processors/mimo_v2.py:673

                kwargs[k] = self.default_video_processor_kwargs[k]
        if video.num_frames is not None:
            kwargs["num_frames"] = video.num_frames
        elif video.fps is not None:
            kwargs["fps"] = video.fps
            if video.max_frames is not None:
                kwargs["max_frames"] = video.max_frames
            if video.min_frames is not None:
                kwargs["min_frames"] = video.min_frames
        elif self.default_video_processor_kwargs["num_frames"] is not None:
            kwargs["num_frames"] = self.default_video_processor_kwargs["num_frames"]
        elif self.default_video_processor_kwargs["fps"] is not None:
            kwargs["fps"] = self.default_video_processor_kwargs["fps"]
            if self.default_video_processor_kwargs["max_frames"] is not None:
                kwargs["max_frames"] = self.default_video_processor_kwargs["max_frames"]
            if self.default_video_processor_kwargs["min_frames"] is not None:
                kwargs["min_frames"] = self.default_video_processor_kwargs["min_frames"]
        else:
            raise ValueError("Video sampling strategy not specified")
        return kwargs

    def process_image(self, image: ImageInput):
        kwargs = self.prepare_image_kwargs(image)
        image = image.image
        if isinstance(image, (str, bytes)):
            image = self.fetch_image(image)
        image_transformed_tensor, _, _ = self.get_visual_transform(
            image,
            factor=self.patch_size * self.merge_size,
            min_pixels=kwargs["min_pixels"],
            max_pixels=kwargs["max_pixels"],
            device=self.device,
        )
        return image_transformed_tensor

    def process_video(
        self, video_input: VideoInput | VideoAudioInput, temporal_padding_factor=None

View on GitHub (pinned to 0132848349)

Solutions

  1. Populate default_video_processor_kwargs with at least {'fps': ...} when constructing MiMoProcessor
  2. Check the model's preprocessor_config.json for the video sampling section and pass it through
  3. If building the processor manually for tests, supply explicit fps/min_frames/max_frames values

Example fix

# before
proc = MiMoProcessor(hf_config, server_args, _processor)  # no video kwargs
# after
proc = MiMoProcessor(hf_config, server_args, _processor,
                     default_video_processor_kwargs={'fps': 2.0, 'max_frames': 16, 'min_frames': 4})
Defensive patterns

Strategy: validation

Validate before calling

kwargs = proc.default_video_processor_kwargs or {}
assert kwargs.get('fps') is not None, 'default_video_processor_kwargs must define fps before process_video'

Try / catch

try:
    out = proc.process_video(video_input)
except ValueError as e:
    if 'Video sampling strategy not specified' in str(e):
        proc.default_video_processor_kwargs = {'fps': 2.0, 'max_frames': 16, 'min_frames': 4}
        out = proc.process_video(video_input)
    else:
        raise

Prevention

When it happens

Trigger: Instantiating MiMoProcessor without default_video_processor_kwargs (or with an empty dict) and then calling process_video / prepare_video_kwargs on a video input that doesn't itself carry fps settings.

Common situations: A checkpoint's preprocessor_config lacks video sampling fields (fps, max_frames, min_frames); constructing the processor programmatically in tests without full config; config migrations that drop the video section.

Related errors


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