invoke-ai/InvokeAI · error · Exception

There are no submodels in models of type {model_class}

Error message

There are no submodels in models of type {model_class}

What it means

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.

Source

Thrown at invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py:36

    ModelFormat,
    ModelType,
    SubModelType,
)


@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.T2IAdapter, format=ModelFormat.Diffusers)
class GenericDiffusersLoader(ModelLoader):
    """Class to load simple diffusers models."""

    def _load_model(
        self,
        config: AnyModelConfig,
        submodel_type: Optional[SubModelType] = None,
    ) -> AnyModel:
        model_path = Path(config.path)
        model_class = self.get_hf_load_class(model_path)
        if submodel_type is not None:
            raise Exception(f"There are no submodels in models of type {model_class}")
        repo_variant = config.repo_variant if isinstance(config, Diffusers_Config_Base) else None
        variant = repo_variant.value if repo_variant else None
        try:
            result: AnyModel = model_class.from_pretrained(
                model_path, torch_dtype=self._torch_dtype, variant=variant, local_files_only=True
            )
        except OSError as e:
            if variant and "no file named" in str(
                e
            ):  # try without the variant, just in case user's preferences changed
                result = model_class.from_pretrained(model_path, torch_dtype=self._torch_dtype, local_files_only=True)
            else:
                raise e
        result = self._apply_fp8_layerwise_casting(result, config, submodel_type)
        return result

    # TO DO: Add exception handling
    def get_hf_load_class(self, model_path: Path, submodel_type: Optional[SubModelType] = None) -> ModelMixin:

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Call _load_model with submodel_type=None for generic diffusers models
  2. Route submodel requests to the appropriate submodel loader instead of the generic one
  3. Fix calling code that passes submodel_type for models registered under the generic diffusers format

Example fix

# before
model = loader._load_model(config, submodel_type=SubModelType.TextEncoder)
# after
model = loader._load_model(config, submodel_type=None)
Defensive patterns

Strategy: validation

Validate before calling

def generic_diffusers_requires_whole_model(submodel_type):
    if submodel_type is not None:
        raise ValueError("Generic diffusers models must be loaded with submodel_type=None")

Type guard

def is_whole_model_request(st: SubModelType | None) -> bool:
    return st is None

Try / catch

try:
    model = loader._load_model(config, submodel_type)
except Exception as e:
    if "no submodels in models of type" in str(e):
        model = loader._load_model(config, submodel_type=None)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/e6cc5ef72f591bfc. Report an issue: GitHub.