{"record":{"id":"dfa8a48b5f91ea82","repo":"huggingface/transformers","slug":"can-t-load-feature-extractor-for-pretrained-mode-dfa8a4","errorCode":null,"errorMessage":"Can't load feature extractor 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 {feature_extractor_file} file","messagePattern":"Can't load feature extractor 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/feature_extraction_utils.py","lineNumber":529,"sourceCode":"                    \" 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 {FEATURE_EXTRACTOR_NAME} file\"\n                )\n\n        # Load feature_extractor 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        feature_extractor_dict = None\n        if resolved_processor_file is not None:\n            processor_dict = safe_load_json_file(resolved_processor_file)\n            if \"feature_extractor\" in processor_dict or \"audio_processor\" in processor_dict:\n                feature_extractor_dict = processor_dict.get(\"feature_extractor\", processor_dict.get(\"audio_processor\"))\n\n        if resolved_feature_extractor_file is not None and feature_extractor_dict is None:\n            feature_extractor_dict = safe_load_json_file(resolved_feature_extractor_file)\n\n        if feature_extractor_dict is None:\n            raise OSError(\n                f\"Can't load feature extractor 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 {feature_extractor_file} file\"\n            )\n\n        if is_local:\n            logger.info(f\"loading configuration file {resolved_feature_extractor_file}\")\n        else:\n            logger.info(\n                f\"loading configuration file {feature_extractor_file} from cache at {resolved_feature_extractor_file}\"\n            )\n\n        return feature_extractor_dict, kwargs\n\n    @classmethod\n    def from_dict(\n        cls, feature_extractor_dict: dict[str, Any], **kwargs","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/feature_extraction_utils.py#L511-L547","documentation":"Raised after the config files were successfully located but neither the processor config nor the feature extractor file yielded a usable dict: the resolved processor file has no 'feature_extractor'/'audio_processor' key (legacy nested style absent) and no standalone feature extractor file was resolved. It means the checkpoint simply does not ship a feature extractor configuration.","triggerScenarios":"AutoFeatureExtractor.from_pretrained('<model>') where the repo has a processor_config.json without a nested 'feature_extractor'/'audio_processor' section and no preprocessor_config.json / feature_extractor_config.json at all; or a local directory missing those files.","commonSituations":"Loading a text-only or vision model through AutoFeatureExtractor, using a community upload that never included the preprocessor config, or pointing at a directory that contains only weights (pytorch_model.bin/safetensors) and config.json.","solutions":["Confirm the repo actually contains preprocessor_config.json or feature_extractor_config.json (check the Files tab on the Hub)","Use the correct Auto class for the modality (AutoProcessor / AutoTokenizer / AutoImageProcessor) instead of AutoFeatureExtractor","If the files exist locally, ensure they sit in the directory root (or pass subfolder=) so they get resolved","Instantiate manually and save once: Wav2Vec2FeatureExtractor(...).save_pretrained(dir), then load from that directory"],"exampleFix":"# before\nfe = AutoFeatureExtractor.from_pretrained(\"gpt2\")  # no feature extractor shipped\n# after\ntok = AutoTokenizer.from_pretrained(\"gpt2\")  # correct class for this checkpoint","handlingStrategy":"validation","validationCode":"def has_feature_extractor_config(model_id: str) -> bool:\n    import os, json\n    if os.path.isdir(model_id):\n        names = {\"preprocessor_config.json\", \"feature_extractor_config.json\"}\n        if any(os.path.exists(os.path.join(model_id, n)) for n in names):\n            return True\n        p = os.path.join(model_id, \"processor_config.json\")\n        if os.path.exists(p):\n            return any(k in json.load(open(p)) for k in (\"feature_extractor\", \"audio_processor\"))\n        return False\n    return None  # needs a Hub check; see list_repo_files","typeGuard":null,"tryCatchPattern":"try:\n    fe = AutoFeatureExtractor.from_pretrained(model_id)\nexcept OSError:\n    fe = None  # fall back to a manually constructed extractor or different Auto class","preventionTips":["Check the Hub Files tab for preprocessor_config.json before using AutoFeatureExtractor","Use the Auto class matching the modality (Tokenizer/Processor/ImageProcessor)","Save feature extractors once with save_pretrained so future loads are self-contained"],"tags":["python","transformers","feature-extractor","missing-config","auto-class"],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}