mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-02-27 18:23:57 +00:00
Maintain patching related
1. fix several problems related to layerdiffuse not unloaded 2. fix several problems related to Fooocus inpaint 3. Slightly speed up on-the-fly LoRAs by precomputing them to computation dtype
This commit is contained in:
@@ -376,16 +376,16 @@ def sampling_prepare(unet, x):
|
||||
additional_inference_memory += unet.controlnet_linked_list.inference_memory_requirements(unet.model_dtype())
|
||||
additional_model_patchers += unet.controlnet_linked_list.get_models()
|
||||
|
||||
if unet.lora_loader.online_mode:
|
||||
lora_memory = utils.nested_compute_size(unet.lora_loader.patches)
|
||||
if unet.has_online_lora():
|
||||
lora_memory = utils.nested_compute_size(unet.lora_patches, element_size=utils.dtype_to_element_size(unet.model.computation_dtype))
|
||||
additional_inference_memory += lora_memory
|
||||
|
||||
memory_management.load_models_gpu(
|
||||
models=[unet] + additional_model_patchers,
|
||||
memory_required=unet_inference_memory + additional_inference_memory)
|
||||
|
||||
if unet.lora_loader.online_mode:
|
||||
utils.nested_move_to_device(unet.lora_loader.patches, device=unet.current_device)
|
||||
if unet.has_online_lora():
|
||||
utils.nested_move_to_device(unet.lora_patches, device=unet.current_device, dtype=unet.model.computation_dtype)
|
||||
|
||||
real_model = unet.model
|
||||
|
||||
@@ -398,8 +398,8 @@ def sampling_prepare(unet, x):
|
||||
|
||||
|
||||
def sampling_cleanup(unet):
|
||||
if unet.lora_loader.online_mode:
|
||||
utils.nested_move_to_device(unet.lora_loader.patches, device=unet.offload_device)
|
||||
if unet.has_online_lora():
|
||||
utils.nested_move_to_device(unet.lora_patches, device=unet.offload_device)
|
||||
for cnet in unet.list_controlnets():
|
||||
cnet.cleanup()
|
||||
cleanup_cache()
|
||||
|
||||
Reference in New Issue
Block a user