{"record":{"id":"12812221abe7d8ae","repo":"invoke-ai/InvokeAI","slug":"there-are-no-submodels-in-a-ti-model","errorCode":null,"errorMessage":"There are no submodels in a TI model.","messagePattern":"There are no submodels in a TI model\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/textual_inversion.py","lineNumber":33,"sourceCode":"    SubModelType,\n)\nfrom invokeai.backend.textual_inversion import TextualInversionModelRaw\n\n\n@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.TextualInversion, format=ModelFormat.EmbeddingFile)\n@ModelLoaderRegistry.register(\n    base=BaseModelType.Any, type=ModelType.TextualInversion, format=ModelFormat.EmbeddingFolder\n)\nclass TextualInversionLoader(ModelLoader):\n    \"\"\"Class to load TI models.\"\"\"\n\n    def _load_model(\n        self,\n        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        if submodel_type is not None:\n            raise ValueError(\"There are no submodels in a TI model.\")\n        model = TextualInversionModelRaw.from_checkpoint(\n            file_path=config.path,\n            dtype=self._torch_dtype,\n        )\n        return model\n\n    # override\n    def _get_model_path(self, config: AnyModelConfig) -> Path:\n        model_path = self._app_config.models_path / config.path\n\n        if config.format == ModelFormat.EmbeddingFolder:\n            path = model_path / \"learned_embeds.bin\"\n        else:\n            path = model_path\n\n        if not path.exists():\n            raise OSError(f\"The embedding file at {path} was not found\")\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/textual_inversion.py#L15-L51","documentation":"A textual inversion (TI/embedding) model is a single artifact with no submodels, so the loader raises this ValueError whenever a submodel_type is provided. The message emphasizes that submodel requests are meaningless for TI embeddings.","triggerScenarios":"Calling load_model on a textual inversion config with submodel_type set (e.g. trying to fetch its 'text encoder' component) instead of None.","commonSituations":"Code iterating submodels of a main model that also touches TI embeddings; mistaking an embedding entry for a pipeline entry; automation that always requests a TextEncoder submodel.","solutions":["Pass submodel_type=None when loading TI embeddings.","Apply TI embeddings at pipeline level (prompt/concept loading), not via submodel requests.","Filter TI models out of any submodel-loading loops in your code."],"exampleFix":"// before\nmodel = loader.load_model(ti_config, submodel_type=SubModelType.TextEncoder)\n// after\nmodel = loader.load_model(ti_config, submodel_type=None)","handlingStrategy":"validation","validationCode":"if model_type is ModelType.TextualInversion and submodel_type is not None:\n    submodel_type = None  # TI embeddings have no submodels","typeGuard":"def is_embedding(model_type: ModelType) -> bool:\n    return model_type is ModelType.TextualInversion","tryCatchPattern":"try:\n    model = loader.load_model(ti_config, submodel_type=None)\nexcept ValueError as e:\n    logger.error(\"TI load failed: %s\", e)\n    raise","preventionTips":["Exclude TextualInversion models from submodel iteration loops.","Pass submodel_type=None for all embedding loads.","Separate embedding application logic from component-loading logic."],"tags":["valueerror","submodel","textual-inversion","embeddings"],"backgroundTag":"unsupported-submodel-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}