{"record":{"id":"75f56a911d096b3f","repo":"hiyouga/LlamaFactory","slug":"this-model-does-not-support-image-input-please-ch","errorCode":null,"errorMessage":"This model does not support image input. Please check whether the correct `template` is used.","messagePattern":"This model does not support image input\\. Please check whether the correct `template` is used\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/data/mm_plugin.py","lineNumber":163,"sourceCode":"    expand_mm_tokens: bool = True\n\n    def _validate_input(\n        self,\n        processor: Optional[\"MMProcessor\"],\n        images: list[\"ImageInput\"],\n        videos: list[\"VideoInput\"],\n        audios: list[\"AudioInput\"],\n    ) -> None:\n        r\"\"\"Validate if this model accepts the input modalities.\"\"\"\n        image_processor: BaseImageProcessor = getattr(processor, \"image_processor\", None)\n        video_processor: BaseImageProcessor = getattr(\n            processor, \"video_processor\", getattr(processor, \"image_processor\", None)\n        )\n        feature_extractor: SequenceFeatureExtractor = getattr(processor, \"feature_extractor\", None) or getattr(\n            processor, \"audio_processor\", None\n        )\n        if len(images) != 0 and self.image_token is None:\n            raise ValueError(\n                \"This model does not support image input. Please check whether the correct `template` is used.\"\n            )\n\n        if len(videos) != 0 and self.video_token is None:\n            raise ValueError(\n                \"This model does not support video input. Please check whether the correct `template` is used.\"\n            )\n\n        if len(audios) != 0 and self.audio_token is None:\n            raise ValueError(\n                \"This model does not support audio input. Please check whether the correct `template` is used.\"\n            )\n\n        if self.image_token is not None and processor is None:\n            raise ValueError(\"Processor was not found, please check and update your model file.\")\n\n        if self.image_token is not None and image_processor is None:\n            raise ValueError(\"Image processor was not found, please check and update your model file.\")","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/data/mm_plugin.py#L145-L181","documentation":"ValueError from BasePlugin._validate_inputs during multimodal preprocessing: the sample contains images, but the active mm_plugin/template defines no image_token (e.g. the plugin's IMAGE_TOKEN is None), meaning this model/template combination has no image input support. It is a template-vs-modality mismatch, detected before any processor call.","triggerScenarios":"Using a multimodal dataset (images column or <image> placeholders) with a text-only template (e.g. default llama template) or a template whose registration maps to a plugin without image support; setting a vision model's template string incorrectly so the wrong plugin is selected.","commonSituations":"Fine-tuning a VLM (Qwen-VL, Llava, etc.) while leaving template: default or a chat template from the base LLM; forgetting to switch the template after changing model_name_or_path to a multimodal checkpoint.","solutions":["Set template in the YAML to the model's official multimodal template (e.g. qwen, llava, mllama) so an image-capable plugin is selected.","Confirm model_name_or_path points to the full multimodal checkpoint, not the language-model-only backbone.","If training text-only, remove images/`<image>` placeholders from the dataset.","Check data/template.py to verify the chosen template registers an mm_plugin with an image token."],"exampleFix":"# before (train.yaml for Qwen2-VL)\ntemplate: llama3\n\n# after\ntemplate: qwen","handlingStrategy":"validation","validationCode":"# before training: confirm the chosen plugin supports images\nfrom llamafactory.data.template import get_template_and_fix_tokenizer\n# plugin check happens at preprocessing; cheap proxy:\ndef template_supports_image(template_name: str, mm_plugins: dict) -> bool:\n    return mm_plugins.get(template_name, {}).get(\"image_token\") is not None","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set template to the model's official multimodal template name from data/template.py.","Change template whenever you change model_name_or_path to a different modality family.","Strip images/<image> tags for text-only runs."],"tags":["multimodal","image","template","config"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}