diff --git a/invokeai/app/api/routers/model_manager.py b/invokeai/app/api/routers/model_manager.py index 2a6d35b92f..36f5c22ac5 100644 --- a/invokeai/app/api/routers/model_manager.py +++ b/invokeai/app/api/routers/model_manager.py @@ -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", diff --git a/invokeai/backend/model_manager/config.py b/invokeai/backend/model_manager/config.py index c70f8faffd..76f1388623 100644 --- a/invokeai/backend/model_manager/config.py +++ b/invokeai/backend/model_manager/config.py @@ -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 diff --git a/invokeai/backend/model_manager/load/model_loaders/controlnet.py b/invokeai/backend/model_manager/load/model_loaders/controlnet.py index 6ef3f80eb5..ce9ed8f82a 100644 --- a/invokeai/backend/model_manager/load/model_loaders/controlnet.py +++ b/invokeai/backend/model_manager/load/model_loaders/controlnet.py @@ -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 diff --git a/invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py b/invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py index d8a8732b27..8c12f6ec94 100644 --- a/invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py +++ b/invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py @@ -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 diff --git a/invokeai/backend/model_manager/load/model_loaders/vae.py b/invokeai/backend/model_manager/load/model_loaders/vae.py index 67a8dee039..e4fc811346 100644 --- a/invokeai/backend/model_manager/load/model_loaders/vae.py +++ b/invokeai/backend/model_manager/load/model_loaders/vae.py @@ -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