mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 08:44:33 +02:00
Disable load lora gpu with medvram too
This commit is contained in:
@@ -413,11 +413,11 @@ def apply_balanced_offload(sd_model):
|
||||
if checkpoint_name is None:
|
||||
checkpoint_name = pipe.__class__.__name__
|
||||
offload_dir = os.path.join(shared.opts.accelerate_offload_path, checkpoint_name, module_name)
|
||||
network_layer_name = getattr(module, "network_layer_name", None)
|
||||
module = remove_hook_from_module(module, recurse=True)
|
||||
try:
|
||||
module = module.to("cpu")
|
||||
module.offload_dir = offload_dir
|
||||
network_layer_name = getattr(module, "network_layer_name", None)
|
||||
module = add_hook_to_module(module, dispatch_from_cpu_hook(), append=True)
|
||||
module._hf_hook.execution_device = torch.device(devices.device) # pylint: disable=protected-access
|
||||
if network_layer_name:
|
||||
@@ -1455,7 +1455,10 @@ def disable_offload(sd_model):
|
||||
for module_name in keys: # pylint: disable=protected-access
|
||||
module = getattr(sd_model, module_name, None)
|
||||
if isinstance(module, torch.nn.Module):
|
||||
network_layer_name = getattr(module, "network_layer_name", None)
|
||||
module = remove_hook_from_module(module, recurse=True)
|
||||
if network_layer_name:
|
||||
module.network_layer_name = network_layer_name
|
||||
sd_model.has_accelerate = False
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -910,7 +910,7 @@ options_templates.update(options_section(('extra_networks', "Networks"), {
|
||||
"lora_apply_tags": OptionInfo(0, "LoRA auto-apply tags", gr.Slider, {"minimum": -1, "maximum": 32, "step": 1}),
|
||||
"lora_in_memory_limit": OptionInfo(0, "LoRA memory cache", gr.Slider, {"minimum": 0, "maximum": 24, "step": 1}),
|
||||
"lora_quant": OptionInfo("NF4","LoRA precision in quantized models", gr.Radio, {"choices": ["NF4", "FP4"]}),
|
||||
"lora_load_gpu": OptionInfo(True if not cmd_opts.lowvram else False, "Load LoRA directly to GPU"),
|
||||
"lora_load_gpu": OptionInfo(True if not (cmd_opts.lowvram or cmd_opts.medvram) else False, "Load LoRA directly to GPU"),
|
||||
"lora_offload_backup": OptionInfo(True, "Offload LoRA Backup Weights"),
|
||||
}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user