1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 23:14:49 +08:00

Low vram mode for controlnets.

This commit is contained in:
comfyanonymous
2023-02-17 15:45:29 -05:00
parent 220a72d36b
commit d66415c021
2 changed files with 21 additions and 0 deletions

View File

@@ -349,7 +349,9 @@ class ControlNet:
precision_scope = contextlib.nullcontext
with precision_scope(self.device):
self.control_model = model_management.load_if_low_vram(self.control_model)
control = self.control_model(x=x_noisy, hint=self.cond_hint, timesteps=t, context=cond_txt)
self.control_model = model_management.unload_if_low_vram(self.control_model)
out = []
autocast_enabled = torch.is_autocast_enabled()
for x in control: