tidy(mm): remove update method from ModelConfigBase

It's only used in the soon-to-be-removed model merge logic
This commit is contained in:
psychedelicious 2024-03-01 16:34:21 +11:00
parent a8cd3dfc99
commit 61b737bb9f
2 changed files with 3 additions and 13 deletions

View File

@ -129,7 +129,6 @@ class ModelConfigBase(BaseModel):
key: str = Field(description="unique key for model", default="<NOKEY>")
hash: Optional[str] = Field(description="original fasthash of model contents", default=None)
description: Optional[str] = Field(description="human readable description of the model", default=None)
source: Optional[str] = Field(description="model original source (path, URL or repo_id)", default=None)
@staticmethod
def json_schema_extra(schema: dict[str, Any], model_class: Type[BaseModel]) -> None:
@ -141,11 +140,6 @@ class ModelConfigBase(BaseModel):
json_schema_extra=json_schema_extra,
)
def update(self, attributes: Dict[str, Any]) -> None:
"""Update the object with fields in dict."""
for key, value in attributes.items():
setattr(self, key, value) # may raise a validation error
class CheckpointConfigBase(ModelConfigBase):
"""Model config for checkpoint-style models."""

View File

@ -163,12 +163,8 @@ class ModelMerger(object):
# update model's config
model_config = self._installer.record_store.get_model(key)
model_config.update(
{
"name": merged_model_name,
"description": f"Merge of models {', '.join(model_names)}",
"vae": vae,
}
)
model_config.name = merged_model_name
model_config.description = f"Merge of models {', '.join(model_names)}"
self._installer.record_store.update_model(key, model_config)
return model_config