persist control units state on restarts

This commit is contained in:
Vladimir Mandic
2024-09-19 20:10:53 -04:00
parent 271b493921
commit 4acf3c00a2
10 changed files with 117 additions and 34 deletions
+4 -1
View File
@@ -78,7 +78,7 @@ class ControlLLLite():
self.model = None
self.model_id = None
def load(self, model_id: str = None) -> str:
def load(self, model_id: str = None, force: bool = True) -> str:
try:
t0 = time.time()
model_id = model_id or self.model_id
@@ -94,6 +94,9 @@ class ControlLLLite():
if model_path is None:
log.error(f'Control {what} model load failed: id="{model_id}" error=unknown model id')
return
if model_id == self.model_id and not force:
log.debug(f'Control {what} model: id="{model_id}" path="{model_path}" already loaded')
return
log.debug(f'Control {what} model loading: id="{model_id}" path="{model_path}" {self.load_config}')
if model_path.endswith('.safetensors'):
self.model = ControlNetLLLite(model_path)