Skip to content

Commit 156f249

Browse files
authored
Merge pull request #505 from Kosinkadink/develop
Fix Gen1 Nodes scale/effect/per_block, deprecate LoRA Hook Keyframes Interp. node
2 parents 406155c + 071d6fc commit 156f249

File tree

4 files changed

+27
-26
lines changed

4 files changed

+27
-26
lines changed

animatediff/nodes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .nodes_pia import (ApplyAnimateDiffPIAModel, LoadAnimateDiffAndInjectPIANode, InputPIA_MultivalNode, InputPIA_PaperPresetsNode, PIA_ADKeyframeNode)
1212
from .nodes_fancyvideo import (ApplyAnimateDiffFancyVideo,)
1313
from .nodes_multival import MultivalDynamicNode, MultivalScaledMaskNode, MultivalDynamicFloatInputNode, MultivalDynamicFloatsNode, MultivalConvertToMaskNode
14-
from .nodes_conditioning import (CreateLoraHookKeyframeInterpolation,
14+
from .nodes_conditioning import (CreateLoraHookKeyframeInterpolationDEPR,
1515
MaskableLoraLoaderDEPR, MaskableLoraLoaderModelOnlyDEPR, MaskableSDModelLoaderDEPR, MaskableSDModelLoaderModelOnlyDEPR,
1616
SetModelLoraHookDEPR, SetClipLoraHookDEPR,
1717
CombineLoraHooksDEPR, CombineLoraHookFourOptionalDEPR, CombineLoraHookEightOptionalDEPR,
@@ -98,7 +98,6 @@
9898
"ADE_IterationOptsDefault": IterationOptionsNode,
9999
"ADE_IterationOptsFreeInit": FreeInitOptionsNode,
100100
# Conditioning
101-
"ADE_LoraHookKeyframeInterpolation": CreateLoraHookKeyframeInterpolation,
102101
# Conditioning (DEPRECATED)
103102
"ADE_RegisterLoraHook": MaskableLoraLoaderDEPR,
104103
"ADE_RegisterLoraHookModelOnly": MaskableLoraLoaderModelOnlyDEPR,
@@ -110,6 +109,7 @@
110109
"ADE_SetLoraHookKeyframe": SetLoraHookKeyframesDEPR,
111110
"ADE_AttachLoraHookToCLIP": SetClipLoraHookDEPR,
112111
"ADE_LoraHookKeyframe": CreateLoraHookKeyframeDEPR,
112+
"ADE_LoraHookKeyframeInterpolation": CreateLoraHookKeyframeInterpolationDEPR,
113113
"ADE_LoraHookKeyframeFromStrengthList": CreateLoraHookKeyframeFromStrengthListDEPR,
114114
"ADE_AttachLoraHookToConditioning": SetModelLoraHookDEPR,
115115
"ADE_PairedConditioningSetMask": PairedConditioningSetMaskHookedDEPR,
@@ -269,7 +269,6 @@
269269
"ADE_IterationOptsDefault": "Default Iteration Options 🎭🅐🅓",
270270
"ADE_IterationOptsFreeInit": "FreeInit Iteration Options 🎭🅐🅓",
271271
# Conditioning
272-
"ADE_LoraHookKeyframeInterpolation": "LoRA Hook Keyframes Interp. 🎭🅐🅓",
273272
# Conditioning (DEPRECATED)
274273
"ADE_RegisterLoraHook": "Register LoRA Hook 🎭🅐🅓",
275274
"ADE_RegisterLoraHookModelOnly": "Register LoRA Hook (Model Only) 🎭🅐🅓",
@@ -281,6 +280,7 @@
281280
"ADE_SetLoraHookKeyframe": "Set LoRA Hook Keyframes 🎭🅐🅓",
282281
"ADE_AttachLoraHookToCLIP": "Set CLIP LoRA Hook 🎭🅐🅓",
283282
"ADE_LoraHookKeyframe": "LoRA Hook Keyframe 🎭🅐🅓",
283+
"ADE_LoraHookKeyframeInterpolation": "LoRA Hook Keyframes Interp. 🎭🅐🅓",
284284
"ADE_LoraHookKeyframeFromStrengthList": "LoRA Hook Keyframes From List 🎭🅐🅓",
285285
"ADE_AttachLoraHookToConditioning": "Set Model LoRA Hook 🎭🅐🅓",
286286
"ADE_PairedConditioningSetMask": "Set Props on Conds 🎭🅐🅓",

animatediff/nodes_conditioning.py

+11-13
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@
1717
from .logger import logger
1818

1919

20-
class CreateLoraHookKeyframeInterpolation:
20+
###################################################################
21+
# EVERYTHING BELOW HERE IS DEPRECATED;
22+
# Can be replaced with vanilla ComfyUI nodes
23+
#------------------------------------------------------------------
24+
#------------------------------------------------------------------
25+
#------------------------------------------------------------------
26+
#------------------------------------------------------------------
27+
#------------------------------------------------------------------
28+
class CreateLoraHookKeyframeInterpolationDEPR:
2129
@classmethod
2230
def INPUT_TYPES(s):
2331
return {
@@ -32,12 +40,14 @@ def INPUT_TYPES(s):
3240
},
3341
"optional": {
3442
"prev_hook_kf": ("HOOK_KEYFRAMES",),
43+
"deprecation_warning": ("ADEWARN", {"text": "Deprecated - use native ComfyUI nodes instead."}),
3544
},
3645
"hidden": {
3746
"autosize": ("ADEAUTOSIZE", {"padding": 0}),
3847
}
3948
}
4049

50+
DEPRECATED = True
4151
RETURN_TYPES = ("HOOK_KEYFRAMES",)
4252
RETURN_NAMES = ("HOOK_KF",)
4353
CATEGORY = "Animate Diff 🎭🅐🅓/conditioning/schedule lora hooks"
@@ -66,18 +76,6 @@ def create_hook_keyframes(self,
6676
return (prev_hook_kf,)
6777

6878

69-
70-
###################################################################
71-
# EVERYTHING BELOW HERE IS DEPRECATED;
72-
# Can be replaced with vanilla ComfyUI nodes
73-
#------------------------------------------------------------------
74-
#------------------------------------------------------------------
75-
#------------------------------------------------------------------
76-
#------------------------------------------------------------------
77-
#------------------------------------------------------------------
78-
79-
80-
8179
###############################################
8280
### Mask, Combine, and Hook Conditioning
8381
###############################################

animatediff/nodes_gen1.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .utils_motion import ADKeyframeGroup, get_combined_multival
1212
from .motion_lora import MotionLoraInfo, MotionLoraList
1313
from .motion_module_ad import AllPerBlocks
14-
from .model_injection import (ModelPatcherHelper, InjectionParams, MotionModelGroup,
14+
from .model_injection import (ModelPatcherHelper, InjectionParams, MotionModelGroup, get_mm_attachment,
1515
load_motion_lora_as_patches, load_motion_module_gen1, load_motion_module_gen2, validate_model_compatibility_gen2,
1616
validate_per_block_compatibility)
1717
from .sample_settings import SampleSettings, SeedNoiseGeneration
@@ -59,12 +59,13 @@ def load_mm_and_inject_params(self,
5959
if motion_lora is not None:
6060
for lora in motion_lora.loras:
6161
load_motion_lora_as_patches(motion_model, lora)
62-
motion_model.scale_multival = scale_multival
63-
motion_model.effect_multival = effect_multival
62+
attachment = get_mm_attachment(motion_model)
63+
attachment.scale_multival = scale_multival
64+
attachment.effect_multival = effect_multival
6465
if per_block is not None:
6566
validate_per_block_compatibility(motion_model=motion_model, all_per_blocks=per_block)
66-
motion_model.per_block_list = per_block.per_block_list
67-
motion_model.keyframes = ad_keyframes.clone() if ad_keyframes else ADKeyframeGroup()
67+
attachment.per_block_list = per_block.per_block_list
68+
attachment.keyframes = ad_keyframes.clone() if ad_keyframes else ADKeyframeGroup()
6869

6970
# create injection params
7071
params = InjectionParams(unlimited_area_hack=False)
@@ -80,7 +81,7 @@ def load_mm_and_inject_params(self,
8081

8182
# backwards compatibility to support old way of masking scale
8283
if params.motion_model_settings.mask_attn_scale is not None:
83-
motion_model.scale_multival = get_combined_multival(scale_multival, (params.motion_model_settings.mask_attn_scale * params.motion_model_settings.attn_scale))
84+
attachment.scale_multival = get_combined_multival(scale_multival, (params.motion_model_settings.mask_attn_scale * params.motion_model_settings.attn_scale))
8485

8586
# need to use a ModelPatcher that supports injection of motion modules into unet
8687
model = model.clone()
@@ -134,6 +135,7 @@ def INPUT_TYPES(s):
134135
}
135136
}
136137

138+
DEPRECATED = True
137139
RETURN_TYPES = ("MODEL",)
138140
CATEGORY = "Animate Diff 🎭🅐🅓/① Gen1 nodes ①"
139141
FUNCTION = "load_mm_and_inject_params"
@@ -161,12 +163,13 @@ def load_mm_and_inject_params(self,
161163
motion_model_settings.attn_scale = motion_scale
162164
params.set_motion_model_settings(motion_model_settings)
163165

166+
attachment = get_mm_attachment(motion_model)
164167
if params.motion_model_settings.mask_attn_scale is not None:
165-
motion_model.scale_multival = params.motion_model_settings.mask_attn_scale * params.motion_model_settings.attn_scale
168+
attachment.scale_multival = params.motion_model_settings.mask_attn_scale * params.motion_model_settings.attn_scale
166169
else:
167-
motion_model.scale_multival = params.motion_model_settings.attn_scale
170+
attachment.scale_multival = params.motion_model_settings.attn_scale
168171

169-
motion_model.keyframes = ad_keyframes.clone() if ad_keyframes else ADKeyframeGroup()
172+
attachment.keyframes = ad_keyframes.clone() if ad_keyframes else ADKeyframeGroup()
170173

171174
# need to use a ModelPatcher that supports injection of motion modules into unet
172175
model = model.clone()

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.3.2"
4+
version = "1.3.3"
55
license = { file = "LICENSE" }
66
dependencies = []
77

0 commit comments

Comments
 (0)