diff --git a/animatediff/model_injection.py b/animatediff/model_injection.py index 27c7da8..3a8e0a7 100644 --- a/animatediff/model_injection.py +++ b/animatediff/model_injection.py @@ -66,6 +66,12 @@ def __init__(self, m: ModelPatcher): self.motion_injection_params: InjectionParams = InjectionParams() self.sample_settings: SampleSettings = SampleSettings() self.motion_models: MotionModelGroup = None + # backwards-compatible calculate_weight + if hasattr(comfy.lora, "calculate_weight"): + self.do_calculate_weight = comfy.lora.calculate_weight + else: + self.do_calculate_weight = self.calculate_weight + def clone(self, hooks_only=False): cloned = ModelPatcherAndInjector(self) @@ -379,7 +385,7 @@ def patch_hooked_weight_to_device(self, lora_hooks: LoraHookGroup, combined_patc # TODO: handle model_params_lowvram stuff if necessary temp_weight = comfy.model_management.cast_to_device(weight, weight.device, torch.float32, copy=True) - out_weight = self.calculate_weight(combined_patches[key], temp_weight, key).to(weight.dtype) + out_weight = self.do_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, {}) self.cached_hooked_patches[lora_hooks][key] = out_weight diff --git a/pyproject.toml b/pyproject.toml index 5816d62..beb3ba3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-animatediff-evolved" description = "Improved AnimateDiff integration for ComfyUI." -version = "1.2.0" +version = "1.2.1" license = { file = "LICENSE" } dependencies = []