{"record":{"id":"a0a2185fcb34aff7","repo":"huggingface/transformers","slug":"can-t-load-image-processor-for-pretrained-model","errorCode":null,"errorMessage":"Can't load image processor for '{pretrained_model_name_or_path}'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory containing a {image_processor_filename} file","messagePattern":"Can't load image processor for '(.+?)'\\. If you were trying to load it from 'https://huggingface\\.co/models', make sure you don't have a local directory with the same name\\. Otherwise, make sure '(.+?)' is the correct path to a directory containing a (.+?) file","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"src/transformers/image_processing_base.py","lineNumber":314,"sourceCode":"                    pretrained_model_name_or_path,\n                    filename=image_processor_file,\n                    cache_dir=cache_dir,\n                    force_download=force_download,\n                    proxies=proxies,\n                    local_files_only=local_files_only,\n                    token=token,\n                    user_agent=user_agent,\n                    revision=revision,\n                    subfolder=subfolder,\n                    _raise_exceptions_for_missing_entries=False,\n                )\n            except OSError:\n                # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted to\n                # the original exception.\n                raise\n            except Exception:\n                # For any other exception, we throw a generic error.\n                raise OSError(\n                    f\"Can't load image processor for '{pretrained_model_name_or_path}'. If you were trying to load\"\n                    \" it from 'https://huggingface.co/models', make sure you don't have a local directory with the\"\n                    f\" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a\"\n                    f\" directory containing a {image_processor_filename} file\"\n                )\n\n        # Load image_processor dict. Priority goes as (nested config if found -> image processor config)\n        # We are downloading both configs because almost all models have a `processor_config.json` but\n        # not all of these are nested. We need to check if it was saved recently as nested or if it is legacy style\n        image_processor_dict = None\n        if resolved_processor_file is not None:\n            processor_dict = safe_load_json_file(resolved_processor_file)\n            if \"image_processor\" in processor_dict:\n                image_processor_dict = processor_dict[\"image_processor\"]\n\n        if resolved_image_processor_file is not None and image_processor_dict is None:\n            image_processor_dict = safe_load_json_file(resolved_image_processor_file)\n","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/image_processing_base.py#L296-L332","documentation":"Error \"Can't load image processor for '{pretrained_model_name_or_path}'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory containing a {image_processor_filename} file\" thrown in huggingface/transformers.","triggerScenarios":"Raised in ImageProcessingMixin.from_pretrained when no image processor config file can be resolved locally or from the Hub.","commonSituations":"Wrong repo id/path, a local directory shadowing a Hub model name, or a checkpoint missing preprocessor_config.json.","solutions":["Verify the path points to a directory containing a preprocessor_config.json file.","If loading from the Hub, pass the repo id and ensure no local directory shadows it."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}