tidy(mm): only main models get the main default settings

This commit is contained in:
psychedelicious 2024-03-08 15:32:02 +11:00 committed by Brandon
parent 33ded359e6
commit 6fc3e86061
2 changed files with 6 additions and 6 deletions

View File

@ -18,7 +18,7 @@ from invokeai.backend.model_manager import (
ModelFormat, ModelFormat,
ModelType, ModelType,
) )
from invokeai.backend.model_manager.config import ModelDefaultSettings, ModelVariantType, SchedulerPredictionType from invokeai.backend.model_manager.config import MainModelDefaultSettings, ModelVariantType, SchedulerPredictionType
class DuplicateModelException(Exception): class DuplicateModelException(Exception):
@ -68,7 +68,7 @@ class ModelRecordChanges(BaseModelExcludeNull):
description: Optional[str] = Field(description="Model description", default=None) description: Optional[str] = Field(description="Model description", default=None)
base: Optional[BaseModelType] = Field(description="The base model.", default=None) base: Optional[BaseModelType] = Field(description="The base model.", default=None)
trigger_phrases: Optional[set[str]] = Field(description="Set of trigger phrases for this model", default=None) trigger_phrases: Optional[set[str]] = Field(description="Set of trigger phrases for this model", default=None)
default_settings: Optional[ModelDefaultSettings] = Field( default_settings: Optional[MainModelDefaultSettings] = Field(
description="Default settings for this model", default=None description="Default settings for this model", default=None
) )

View File

@ -131,7 +131,7 @@ class ModelSourceType(str, Enum):
HFRepoID = "hf_repo_id" HFRepoID = "hf_repo_id"
class ModelDefaultSettings(BaseModel): class MainModelDefaultSettings(BaseModel):
vae: str | None vae: str | None
vae_precision: str | None vae_precision: str | None
scheduler: SCHEDULER_NAME_VALUES | None scheduler: SCHEDULER_NAME_VALUES | None
@ -156,9 +156,6 @@ class ModelConfigBase(BaseModel):
source_api_response: Optional[str] = Field( source_api_response: Optional[str] = Field(
description="The original API response from the source, as stringified JSON.", default=None description="The original API response from the source, as stringified JSON.", default=None
) )
default_settings: Optional[ModelDefaultSettings] = Field(
description="Default settings for this model", default=None
)
cover_image: Optional[str] = Field(description="Url for image to preview model", default=None) cover_image: Optional[str] = Field(description="Url for image to preview model", default=None)
@staticmethod @staticmethod
@ -279,6 +276,9 @@ class TextualInversionFolderConfig(ModelConfigBase):
class MainConfigBase(ModelConfigBase): class MainConfigBase(ModelConfigBase):
type: Literal[ModelType.Main] = ModelType.Main type: Literal[ModelType.Main] = ModelType.Main
trigger_phrases: Optional[set[str]] = Field(description="Set of trigger phrases for this model", default=None) trigger_phrases: Optional[set[str]] = Field(description="Set of trigger phrases for this model", default=None)
default_settings: Optional[MainModelDefaultSettings] = Field(
description="Default settings for this model", default=None
)
class MainCheckpointConfig(CheckpointConfigBase, MainConfigBase): class MainCheckpointConfig(CheckpointConfigBase, MainConfigBase):