mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-04-20 22:39:09 +00:00
safe cleanup to avoid potential problems
This commit is contained in:
@@ -2,7 +2,7 @@ import torch
|
||||
from ldm_patched.modules.conds import CONDRegular, CONDCrossAttn
|
||||
from ldm_patched.modules.samplers import sampling_function
|
||||
from ldm_patched.modules import model_management
|
||||
from modules_forge.stream import synchronize_current_stream
|
||||
from ldm_patched.modules.ops import cleanup_cache
|
||||
|
||||
|
||||
def cond_from_a1111_to_patched_ldm(cond):
|
||||
@@ -114,5 +114,5 @@ def sampling_prepare(unet, x):
|
||||
def sampling_cleanup(unet):
|
||||
for cnet in unet.list_controlnets():
|
||||
cnet.cleanup()
|
||||
synchronize_current_stream()
|
||||
cleanup_cache()
|
||||
return
|
||||
|
||||
@@ -40,12 +40,6 @@ def get_new_stream():
|
||||
return None
|
||||
|
||||
|
||||
def synchronize_current_stream():
|
||||
global current_stream
|
||||
if current_stream is not None:
|
||||
current_stream.synchronize()
|
||||
|
||||
|
||||
if shared.opts.use_non_streamlined_lowvram:
|
||||
current_stream = None
|
||||
mover_stream = None
|
||||
|
||||
Reference in New Issue
Block a user