add offload mode to controlnets and framepack

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-10-22 15:40:52 -04:00
parent 3b89094ac1
commit 87fc6c7913
3 changed files with 29 additions and 6 deletions
+8
View File
@@ -172,6 +172,7 @@ class Processor():
return f' Processor(id={self.processor_id} model={self.model.__class__.__name__})' if self.processor_id and self.model else ''
def reset(self, processor_id: str = None):
from modules.shared import opts
if self.model is not None:
debug(f'Control Processor unloaded: id="{self.processor_id}"')
self.model = None
@@ -180,6 +181,13 @@ class Processor():
# self.override = None
# devices.torch_gc()
self.load_config = { 'cache_dir': cache_dir }
if opts.offline_mode:
self.load_config["local_files_only"] = True
os.environ['HF_HUB_OFFLINE'] = '1'
else:
os.environ.pop('HF_HUB_OFFLINE', None)
os.unsetenv('HF_HUB_OFFLINE')
def config(self, processor_id = None):
if processor_id is not None:
+6
View File
@@ -205,6 +205,12 @@ class ControlNet():
self.load_config = { 'cache_dir': cache_dir }
if load_config is not None:
self.load_config.update(load_config)
if opts.offline_mode:
self.load_config["local_files_only"] = True
os.environ['HF_HUB_OFFLINE'] = '1'
else:
os.environ.pop('HF_HUB_OFFLINE', None)
os.unsetenv('HF_HUB_OFFLINE')
if model_id is not None:
self.load()