mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
add offload mode to controlnets and framepack
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user