Skip to content

Commit

Permalink
Prevent PuLID preprocessor unload. Temp Fix VRAM leak.
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed May 11, 2024
1 parent b30f0ac commit f7715d3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/supported_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,21 @@ def tag_to_filters(cls, tag: str) -> Set[str]:

@classmethod
def unload_unused(cls, active_processors: Set["Preprocessor"]):
# Prevent unloading for following preprocessors.
# https://github.com/Mikubill/sd-webui-controlnet/issues/2862
# TODO: Investigate proper way to unload PuLID.
# Current unloading method will cause VRAM leak. It is suspected
# the current unload method causes new model to load each time
# preprocessor is called.
prevent_unload = [
"EVA02-CLIP-L-14-336",
"facexlib",
"ip-adapter_pulid",
]
for p in cls.all_processors.values():
if p.label in prevent_unload:
continue

if p not in active_processors:
success = p.unload()
if success:
Expand Down

0 comments on commit f7715d3

Please sign in to comment.