tidy(mm): rename ckpt "last_modified" -> "converted_at"

Clarify what this timestamp means
This commit is contained in:
psychedelicious 2024-03-01 15:27:41 +11:00
parent 9b40c28144
commit bd4fd9693d
5 changed files with 7 additions and 9 deletions

View File

@ -74,7 +74,7 @@ example_model_config = {
"current_hash": "string",
"description": "string",
"source": "string",
"last_modified": 0,
"converted_at": 0,
"variant": "normal",
"prediction_type": "epsilon",
"repo_variant": "fp16",

View File

@ -138,9 +138,7 @@ class ModelConfigBase(BaseModel):
@staticmethod
def json_schema_extra(schema: dict[str, Any], model_class: Type[BaseModel]) -> None:
schema["required"].extend(
["key", "base", "type", "format", "original_hash", "current_hash", "source", "last_modified"]
)
schema["required"].extend(["key", "base", "type", "format", "original_hash", "current_hash", "source"])
model_config = ConfigDict(
use_enum_values=False,
@ -159,7 +157,7 @@ class CheckpointConfigBase(ModelConfigBase):
format: Literal[ModelFormat.Checkpoint] = ModelFormat.Checkpoint
config_path: str = Field(description="path to the checkpoint model config file")
last_modified: Optional[float] = Field(
converted_at: Optional[float] = Field(
description="When this model was last converted to diffusers", default_factory=time.time
)
@ -380,5 +378,5 @@ class ModelConfigFactory(object):
if key:
model.key = key
if isinstance(model, CheckpointConfigBase) and timestamp is not None:
model.last_modified = timestamp
model.converted_at = timestamp
return model # type: ignore

View File

@ -29,7 +29,7 @@ class ControlNetLoader(GenericDiffusersLoader):
return False
elif (
dest_path.exists()
and (dest_path / "config.json").stat().st_mtime >= (config.last_modified or 0.0)
and (dest_path / "config.json").stat().st_mtime >= (config.converted_at or 0.0)
and (dest_path / "config.json").stat().st_mtime >= model_path.stat().st_mtime
):
return False

View File

@ -59,7 +59,7 @@ class StableDiffusionDiffusersModel(GenericDiffusersLoader):
return False
elif (
dest_path.exists()
and (dest_path / "model_index.json").stat().st_mtime >= (config.last_modified or 0.0)
and (dest_path / "model_index.json").stat().st_mtime >= (config.converted_at or 0.0)
and (dest_path / "model_index.json").stat().st_mtime >= model_path.stat().st_mtime
):
return False

View File

@ -31,7 +31,7 @@ class VaeLoader(GenericDiffusersLoader):
return False
elif (
dest_path.exists()
and (dest_path / "config.json").stat().st_mtime >= (config.last_modified or 0.0)
and (dest_path / "config.json").stat().st_mtime >= (config.converted_at or 0.0)
and (dest_path / "config.json").stat().st_mtime >= model_path.stat().st_mtime
):
return False