From 2dd285052d4da3a86af3fc275e0aaeecce6cda92 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Fri, 26 Apr 2024 18:03:03 -0500 Subject: [PATCH] Fixed lowvram I accidentally broke during cleanup --- animatediff/model_injection.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/animatediff/model_injection.py b/animatediff/model_injection.py index 4d36f11..ccc75e3 100644 --- a/animatediff/model_injection.py +++ b/animatediff/model_injection.py @@ -292,10 +292,10 @@ class ModelPatcherAndInjector(ModelPatcher): if key not in self.hooked_backup: self.hooked_backup[key] = (weight.to(device=target_device, copy=inplace_update), weight.device) - if device_to is not None: - temp_weight = comfy.model_management.cast_to_device(weight, device_to, torch.float32, copy=True) - else: - temp_weight = weight.to(torch.float32, copy=True) + # if device_to is not None: + temp_weight = comfy.model_management.cast_to_device(weight, weight.device, torch.float32, copy=True) + # else: + # temp_weight = weight.to(torch.float32, copy=True) out_weight = self.calculate_weight(combined_patches[key], temp_weight, key).to(weight.dtype) if self.lora_hook_mode == LoraHookMode.MAX_SPEED: self.cached_hooked_patches.setdefault(lora_hooks, {})