chore(backend): rename ModelInfo -> LoadedModelInfo

We have two different classes named `ModelInfo` which might need to be used by API consumers. We need to export both but have to deal with this naming collision.

The `ModelInfo` I've renamed here is the one that is returned when a model is loaded. It's the object least likely to be used by API consumers.
This commit is contained in:
psychedelicious
2024-02-11 09:27:57 +11:00
parent 2005411f7e
commit 083a4f3faa
9 changed files with 38 additions and 30 deletions

View File

@ -3,7 +3,7 @@
Initialization file for invokeai.backend.model_management
"""
# This import must be first
from .model_manager import AddModelResult, ModelInfo, ModelManager, SchedulerPredictionType
from .model_manager import AddModelResult, LoadedModelInfo, ModelManager, SchedulerPredictionType
from .lora import ModelPatcher, ONNXModelPatcher
from .model_cache import ModelCache

View File

@ -271,7 +271,7 @@ CONFIG_FILE_VERSION = "3.0.0"
@dataclass
class ModelInfo:
class LoadedModelInfo:
context: ModelLocker
name: str
base_model: BaseModelType
@ -450,7 +450,7 @@ class ModelManager(object):
base_model: BaseModelType,
model_type: ModelType,
submodel_type: Optional[SubModelType] = None,
) -> ModelInfo:
) -> LoadedModelInfo:
"""Given a model named identified in models.yaml, return
an ModelInfo object describing it.
:param model_name: symbolic name of the model in models.yaml
@ -508,7 +508,7 @@ class ModelManager(object):
model_hash = "<NO_HASH>" # TODO:
return ModelInfo(
return LoadedModelInfo(
context=model_context,
name=model_name,
base_model=base_model,