{"record":{"id":"e6cc5ef72f591bfc","repo":"invoke-ai/InvokeAI","slug":"there-are-no-submodels-in-models-of-type-model-cl","errorCode":null,"errorMessage":"There are no submodels in models of type {model_class}","messagePattern":"There are no submodels in models of type (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py","lineNumber":36,"sourceCode":"    ModelFormat,\n    ModelType,\n    SubModelType,\n)\n\n\n@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.T2IAdapter, format=ModelFormat.Diffusers)\nclass GenericDiffusersLoader(ModelLoader):\n    \"\"\"Class to load simple diffusers models.\"\"\"\n\n    def _load_model(\n        self,\n        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        model_path = Path(config.path)\n        model_class = self.get_hf_load_class(model_path)\n        if submodel_type is not None:\n            raise Exception(f\"There are no submodels in models of type {model_class}\")\n        repo_variant = config.repo_variant if isinstance(config, Diffusers_Config_Base) else None\n        variant = repo_variant.value if repo_variant else None\n        try:\n            result: AnyModel = model_class.from_pretrained(\n                model_path, torch_dtype=self._torch_dtype, variant=variant, local_files_only=True\n            )\n        except OSError as e:\n            if variant and \"no file named\" in str(\n                e\n            ):  # try without the variant, just in case user's preferences changed\n                result = model_class.from_pretrained(model_path, torch_dtype=self._torch_dtype, local_files_only=True)\n            else:\n                raise e\n        result = self._apply_fp8_layerwise_casting(result, config, submodel_type)\n        return result\n\n    # TO DO: Add exception handling\n    def get_hf_load_class(self, model_path: Path, submodel_type: Optional[SubModelType] = None) -> ModelMixin:","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py#L18-L54","documentation":"GenericDiffusersLoader serves whole diffusers models, which have no submodels; if a caller passes a non-None submodel_type it raises this Exception. get_hf_load_class resolves a single model class from the repo's config.","triggerScenarios":"Calling _load_model with submodel_type=Tokenizer/TextEncoder/etc. on a standard diffusers checkpoint routed to the generic loader; pipeline code that generically requests submodels without checking model type.","commonSituations":"Single-file diffusers checkpoints (.safetensors/.ckpt) or whole-pipeline dirs whose format routes them here; refactored loaders passing submodel_type through unconditionally; tests probing the loader contract.","solutions":["Call _load_model with submodel_type=None for generic diffusers models","Route submodel requests to the appropriate submodel loader instead of the generic one","Fix calling code that passes submodel_type for models registered under the generic diffusers format"],"exampleFix":"# before\nmodel = loader._load_model(config, submodel_type=SubModelType.TextEncoder)\n# after\nmodel = loader._load_model(config, submodel_type=None)","handlingStrategy":"validation","validationCode":"def generic_diffusers_requires_whole_model(submodel_type):\n    if submodel_type is not None:\n        raise ValueError(\"Generic diffusers models must be loaded with submodel_type=None\")","typeGuard":"def is_whole_model_request(st: SubModelType | None) -> bool:\n    return st is None","tryCatchPattern":"try:\n    model = loader._load_model(config, submodel_type)\nexcept Exception as e:\n    if \"no submodels in models of type\" in str(e):\n        model = loader._load_model(config, submodel_type=None)\n    else:\n        raise","preventionTips":["Pass submodel_type=None when loading generic diffusers models","Check the model's format/type before requesting submodels","Load submodels from dedicated submodel-capable loaders/models"],"tags":["diffusers","model-loader","submodel-type"],"backgroundTag":"unsupported-submodel-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}