{"record":{"id":"482b23ecd94ebe4f","repo":"hiyouga/LlamaFactory","slug":"image-max-pixels-cannot-be-smaller-than-image-m","errorCode":null,"errorMessage":"`image_max_pixels` cannot be smaller than `image_min_pixels`.","messagePattern":"`image_max_pixels` cannot be smaller than `image_min_pixels`\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/hparams/model_args.py","lineNumber":348,"sourceCode":"        default=2.0,\n        metadata={\"help\": \"The frames to sample per second for video inputs.\"},\n    )\n    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(","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/hparams/model_args.py#L330-L366","documentation":"Raised in MultimodalArguments.__post_init__ (model_args.py:348) when image_max_pixels < image_min_pixels. These fields bound the resolution range used when rescaling input images for vision-language models; an empty range is contradictory and would make the resize logic pick undefined behavior, so it fails fast at config-parse time.","triggerScenarios":"Setting image_max_pixels below image_min_pixels in one YAML (e.g. min 336*336 and max 262144); shrinking image_max_pixels to save memory without checking the default min (typically 4*28*28 for ViT-based models); overriding only one bound via CLI while the other stays at a conflicting default.","commonSituations":"Memory-tuning VLM preprocessing by lowering max pixels until it crosses the min; copying per-model examples that assume different defaults; unit confusion (pixels vs. pixels-per-side).","solutions":["Set image_max_pixels >= image_min_pixels (e.g. raise max or lower min)","If memory is the concern, lower BOTH bounds together, keeping max >= min","Remove both overrides to accept defaults"],"exampleFix":"# before\nimage_min_pixels: 112896   # 4*168*168\nimage_max_pixels: 65536\n\n# after\nimage_min_pixels: 3136      # 4*28*28\nimage_max_pixels: 112896","handlingStrategy":"validation","validationCode":"assert cfg.get('image_max_pixels', INF_DEFAULT) >= cfg.get('image_min_pixels', 0), 'image pixel bounds inverted'","typeGuard":"def image_bounds_ok(mn: int, mx: int) -> bool:\n    return mx >= mn","tryCatchPattern":null,"preventionTips":["Always edit min/max pixel pairs together","When memory tuning, scale both bounds down proportionally"],"tags":["hparams","multimodal","vision","config-validation"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}