Skip to content

Commit 675241c

Browse files
authored
Merge pull request #463 from Kosinkadink/calculate_weight_change
calculate_weight ComfyUI update
2 parents c5c2780 + 12a5dd5 commit 675241c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

animatediff/model_injection.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ def __init__(self, m: ModelPatcher):
6666
self.motion_injection_params: InjectionParams = InjectionParams()
6767
self.sample_settings: SampleSettings = SampleSettings()
6868
self.motion_models: MotionModelGroup = None
69+
# backwards-compatible calculate_weight
70+
if hasattr(comfy.lora, "calculate_weight"):
71+
self.do_calculate_weight = comfy.lora.calculate_weight
72+
else:
73+
self.do_calculate_weight = self.calculate_weight
74+
6975

7076
def clone(self, hooks_only=False):
7177
cloned = ModelPatcherAndInjector(self)
@@ -379,7 +385,7 @@ def patch_hooked_weight_to_device(self, lora_hooks: LoraHookGroup, combined_patc
379385

380386
# TODO: handle model_params_lowvram stuff if necessary
381387
temp_weight = comfy.model_management.cast_to_device(weight, weight.device, torch.float32, copy=True)
382-
out_weight = self.calculate_weight(combined_patches[key], temp_weight, key).to(weight.dtype)
388+
out_weight = self.do_calculate_weight(combined_patches[key], temp_weight, key).to(weight.dtype)
383389
if self.lora_hook_mode == LoraHookMode.MAX_SPEED:
384390
self.cached_hooked_patches.setdefault(lora_hooks, {})
385391
self.cached_hooked_patches[lora_hooks][key] = out_weight

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-animatediff-evolved"
33
description = "Improved AnimateDiff integration for ComfyUI."
4-
version = "1.2.0"
4+
version = "1.2.1"
55
license = { file = "LICENSE" }
66
dependencies = []
77

0 commit comments

Comments
 (0)