{"record":{"id":"7acb7b259229cf9b","repo":"hiyouga/LlamaFactory","slug":"video-max-pixels-cannot-be-smaller-than-video-m","errorCode":null,"errorMessage":"`video_max_pixels` cannot be smaller than `video_min_pixels`.","messagePattern":"`video_max_pixels` cannot be smaller than `video_min_pixels`\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/hparams/model_args.py","lineNumber":351,"sourceCode":"    video_maxlen: int = field(\n        default=128,\n        metadata={\"help\": \"The maximum number of sampled frames for video inputs.\"},\n    )\n    use_audio_in_video: bool = field(\n        default=False,\n        metadata={\"help\": \"Whether or not to use audio in video inputs.\"},\n    )\n    audio_sampling_rate: int = field(\n        default=16000,\n        metadata={\"help\": \"The sampling rate of audio inputs.\"},\n    )\n\n    def __post_init__(self):\n        if self.image_max_pixels < self.image_min_pixels:\n            raise ValueError(\"`image_max_pixels` cannot be smaller than `image_min_pixels`.\")\n\n        if self.video_max_pixels < self.video_min_pixels:\n            raise ValueError(\"`video_max_pixels` cannot be smaller than `video_min_pixels`.\")\n\n\n@dataclass\nclass ExportArguments:\n    r\"\"\"Arguments pertaining to the model export.\"\"\"\n\n    export_dir: str | None = field(\n        default=None,\n        metadata={\"help\": \"Path to the directory to save the exported model.\"},\n    )\n    export_size: int = field(\n        default=5,\n        metadata={\"help\": \"The file shard size (in GB) of the exported model.\"},\n    )\n    export_device: Literal[\"cpu\", \"auto\"] = field(\n        default=\"cpu\",\n        metadata={\"help\": \"The device used in model export, use `auto` to accelerate exporting.\"},\n    )","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/hparams/model_args.py#L333-L369","documentation":"Raised in MultimodalArguments.__post_init__ (model_args.py:351) when video_max_pixels < video_min_pixels. Same invariant as the image pair but for video frames: the min/max pixel bounds for video preprocessing must form a non-empty range. Validated immediately when the multimodal dataclass is constructed.","triggerScenarios":"Setting video_max_pixels: 16384 with the default/overridden video_min_pixels higher than that; tuning long-video memory by cutting video_max_pixels below the min; overriding one bound in an accelerate launch --*overrides style CLI merge.","commonSituations":"Video-LLM experiments with aggressive frame-resolution caps; configs assembled from multiple includes where mins come from a shared base file; per-model recipes (Qwen-VL vs InternVL) using different default bounds mixed together.","solutions":["Ensure video_max_pixels >= video_min_pixels; adjust the pair together","To cut video memory, also lower video_min_pixels or reduce video_max_frames / fps instead of crossing the bounds","Remove both keys to fall back to defaults"],"exampleFix":"# before\nvideo_min_pixels: 12845056  # 16384*28*28\nvideo_max_pixels: 100352\n\n# after\nvideo_min_pixels: 100352    # 128*28*28\nvideo_max_pixels: 737280     # 960*28*28","handlingStrategy":"validation","validationCode":"assert cfg.get('video_max_pixels', INF_DEFAULT) >= cfg.get('video_min_pixels', 0), 'video pixel bounds inverted'","typeGuard":"def video_bounds_ok(mn: int, mx: int) -> bool:\n    return mx >= mn","tryCatchPattern":null,"preventionTips":["Keep video bound overrides in the same YAML section as video_max_frames","Prefer reducing frame count over crossing the pixel-bounds invariant"],"tags":["hparams","multimodal","video","config-validation"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}