Phr00t commited on
Commit
9e7a67a
·
verified ·
1 Parent(s): 226cad3

Update Custom-Advanced-VACE-Node/nodes_utility.py

Browse files
Custom-Advanced-VACE-Node/nodes_utility.py CHANGED
@@ -121,21 +121,23 @@ class WanVideoVACEStartToEndFrame:
121
  device = start_image.device if start_image is not None else end_image.device
122
  B, H, W, C = start_image.shape if start_image is not None else end_image.shape
123
 
124
- if control_strength < 1.0 and control_images is not None:
125
- # strength happens at much smaller number
126
- control_strength *= 2.0
127
- control_strength = control_strength * control_strength / 8.0
128
- control_images = torch.lerp(torch.ones((control_images.shape[0], control_images.shape[1], control_images.shape[2], control_images.shape[3])) * empty_frame_level, control_images, control_strength)
129
-
130
- # ease in control stuff?
131
- if num_frames > control_ease and control_ease > 0:
132
- empty_frame = torch.ones((1, control_images.shape[1], control_images.shape[2], control_images.shape[3])) * empty_frame_level
133
- if start_image is not None:
134
- for i in range(1, control_ease + 1):
135
- control_images[i] = torch.lerp(control_images[i], empty_frame, (control_ease - i) / (1 + control_ease))
136
- else:
137
- for i in range(num_frames - control_ease - 1, num_frames - 1):
138
- control_images[i] = torch.lerp(control_images[i], empty_frame, i / (1 + control_ease))
 
 
139
 
140
  if start_image is None and end_image is None and control_images is not None:
141
  if control_images.shape[0] >= num_frames:
 
121
  device = start_image.device if start_image is not None else end_image.device
122
  B, H, W, C = start_image.shape if start_image is not None else end_image.shape
123
 
124
+ if control_images is not None:
125
+ # weaken the control images?
126
+ if control_strength < 1.0:
127
+ # strength happens at much smaller number
128
+ control_strength *= 2.0
129
+ control_strength = control_strength * control_strength / 8.0
130
+ control_images = torch.lerp(torch.ones((control_images.shape[0], control_images.shape[1], control_images.shape[2], control_images.shape[3])) * empty_frame_level, control_images, control_strength)
131
+
132
+ # ease in control stuff?
133
+ if num_frames > control_ease and control_ease > 0:
134
+ empty_frame = torch.ones((1, control_images.shape[1], control_images.shape[2], control_images.shape[3])) * empty_frame_level
135
+ if start_image is not None:
136
+ for i in range(1, control_ease + 1):
137
+ control_images[i] = torch.lerp(control_images[i], empty_frame, (control_ease - i) / (1 + control_ease))
138
+ else:
139
+ for i in range(num_frames - control_ease - 1, num_frames - 1):
140
+ control_images[i] = torch.lerp(control_images[i], empty_frame, i / (1 + control_ease))
141
 
142
  if start_image is None and end_image is None and control_images is not None:
143
  if control_images.shape[0] >= num_frames: