-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwan_lora_sequencer.py
More file actions
48 lines (39 loc) · 1.96 KB
/
wan_lora_sequencer.py
File metadata and controls
48 lines (39 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ====================================================================================================
# Logging Utility
# ====================================================================================================
def _log(msg: str):
"""Simple print logger for the console."""
try:
print(f"[WanVideoLooper:Sequencer] {msg}", flush=True)
except Exception:
pass
# ====================================================================================================
# WanVideo Lora Sequencer Node
# ====================================================================================================
class WanVideoLoraSequencer:
@classmethod
def INPUT_TYPES(s):
inputs = {"optional": {}}
for i in range(1, 11):
inputs["optional"][f"model_high_{i}"] = ("MODEL", {"tooltip": f"Patched HIGH model for segment {i}."})
for i in range(1, 11):
inputs["optional"][f"model_low_{i}"] = ("MODEL", {"tooltip": f"Patched LOW model for segment {i}."})
for i in range(1, 11):
inputs["optional"][f"clip_{i}"] = ("CLIP", {"tooltip": f"Patched CLIP model for segment {i}."})
return inputs
RETURN_TYPES = ("ANY",)
RETURN_NAMES = ("model_clip_sequence",)
FUNCTION = "sequence_models_clips"
CATEGORY = "WanVideoLooper"
def sequence_models_clips(self, **kwargs):
"""Creates a list of tuples, each containing models/clip for a segment."""
model_clip_sequence = []
for i in range(1, 11):
model_high = kwargs.get(f"model_high_{i}", None)
model_low = kwargs.get(f"model_low_{i}", None)
clip = kwargs.get(f"clip_{i}", None)
segment_data = (model_high, model_low, clip)
model_clip_sequence.append(segment_data)
if any(segment_data):
_log(f"Found patched models/clip for segment {i}")
return (model_clip_sequence, )