Useravailablepls commited on
Commit
53e2a8b
·
verified ·
1 Parent(s): a0e3679

Upload 4 files

Browse files
Wan22_I2V_LoRA_newIVIбезчанков.json ADDED
@@ -0,0 +1,1285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "4a86fda8-b6b7-43ae-b1da-2fb1372c90d8",
3
+ "revision": 0,
4
+ "last_node_id": 19,
5
+ "last_link_id": 25,
6
+ "nodes": [
7
+ {
8
+ "id": 1,
9
+ "type": "UNETLoader",
10
+ "pos": [
11
+ 0,
12
+ 0
13
+ ],
14
+ "size": [
15
+ 340,
16
+ 82
17
+ ],
18
+ "flags": {},
19
+ "order": 0,
20
+ "mode": 0,
21
+ "inputs": [],
22
+ "outputs": [
23
+ {
24
+ "name": "MODEL",
25
+ "type": "MODEL",
26
+ "links": [
27
+ 1
28
+ ]
29
+ }
30
+ ],
31
+ "title": "UNet High Noise (i2v)",
32
+ "properties": {
33
+ "cnr_id": "comfy-core",
34
+ "ver": "0.7.0",
35
+ "Node name for S&R": "UNETLoader",
36
+ "ue_properties": {
37
+ "widget_ue_connectable": {},
38
+ "version": "7.5.2",
39
+ "input_ue_unconnectable": {}
40
+ }
41
+ },
42
+ "widgets_values": [
43
+ "wan2.2_i2v_high_noise_14B_fp16.safetensors",
44
+ "default"
45
+ ]
46
+ },
47
+ {
48
+ "id": 2,
49
+ "type": "UNETLoader",
50
+ "pos": [
51
+ 0,
52
+ 130
53
+ ],
54
+ "size": [
55
+ 340,
56
+ 82
57
+ ],
58
+ "flags": {},
59
+ "order": 1,
60
+ "mode": 0,
61
+ "inputs": [],
62
+ "outputs": [
63
+ {
64
+ "name": "MODEL",
65
+ "type": "MODEL",
66
+ "links": [
67
+ 4
68
+ ]
69
+ }
70
+ ],
71
+ "title": "UNet Low Noise (i2v)",
72
+ "properties": {
73
+ "cnr_id": "comfy-core",
74
+ "ver": "0.7.0",
75
+ "Node name for S&R": "UNETLoader",
76
+ "ue_properties": {
77
+ "widget_ue_connectable": {},
78
+ "version": "7.5.2",
79
+ "input_ue_unconnectable": {}
80
+ }
81
+ },
82
+ "widgets_values": [
83
+ "wan2.2_i2v_low_noise_14B_fp16.safetensors",
84
+ "default"
85
+ ]
86
+ },
87
+ {
88
+ "id": 3,
89
+ "type": "VAELoader",
90
+ "pos": [
91
+ 0,
92
+ 260
93
+ ],
94
+ "size": [
95
+ 340,
96
+ 58
97
+ ],
98
+ "flags": {},
99
+ "order": 2,
100
+ "mode": 0,
101
+ "inputs": [],
102
+ "outputs": [
103
+ {
104
+ "name": "VAE",
105
+ "type": "VAE",
106
+ "links": [
107
+ 7,
108
+ 8
109
+ ]
110
+ }
111
+ ],
112
+ "title": "VAE",
113
+ "properties": {
114
+ "cnr_id": "comfy-core",
115
+ "ver": "0.7.0",
116
+ "Node name for S&R": "VAELoader",
117
+ "ue_properties": {
118
+ "widget_ue_connectable": {},
119
+ "version": "7.5.2",
120
+ "input_ue_unconnectable": {}
121
+ }
122
+ },
123
+ "widgets_values": [
124
+ "wan_2.1_vae.safetensors"
125
+ ]
126
+ },
127
+ {
128
+ "id": 4,
129
+ "type": "CLIPLoader",
130
+ "pos": [
131
+ 0,
132
+ 350
133
+ ],
134
+ "size": [
135
+ 340,
136
+ 106
137
+ ],
138
+ "flags": {},
139
+ "order": 3,
140
+ "mode": 0,
141
+ "inputs": [],
142
+ "outputs": [
143
+ {
144
+ "name": "CLIP",
145
+ "type": "CLIP",
146
+ "links": [
147
+ 9,
148
+ 10
149
+ ]
150
+ }
151
+ ],
152
+ "title": "Text Encoder (umT5)",
153
+ "properties": {
154
+ "cnr_id": "comfy-core",
155
+ "ver": "0.7.0",
156
+ "Node name for S&R": "CLIPLoader",
157
+ "ue_properties": {
158
+ "widget_ue_connectable": {},
159
+ "version": "7.5.2",
160
+ "input_ue_unconnectable": {}
161
+ }
162
+ },
163
+ "widgets_values": [
164
+ "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
165
+ "wan",
166
+ "default"
167
+ ]
168
+ },
169
+ {
170
+ "id": 5,
171
+ "type": "CLIPVisionLoader",
172
+ "pos": [
173
+ 0,
174
+ 470
175
+ ],
176
+ "size": [
177
+ 340,
178
+ 58
179
+ ],
180
+ "flags": {},
181
+ "order": 4,
182
+ "mode": 0,
183
+ "inputs": [],
184
+ "outputs": [
185
+ {
186
+ "name": "CLIP_VISION",
187
+ "type": "CLIP_VISION",
188
+ "links": [
189
+ 11
190
+ ]
191
+ }
192
+ ],
193
+ "title": "CLIP Vision",
194
+ "properties": {
195
+ "cnr_id": "comfy-core",
196
+ "ver": "0.7.0",
197
+ "Node name for S&R": "CLIPVisionLoader",
198
+ "ue_properties": {
199
+ "widget_ue_connectable": {},
200
+ "version": "7.5.2",
201
+ "input_ue_unconnectable": {}
202
+ }
203
+ },
204
+ "widgets_values": [
205
+ "clip_vision_h.safetensors"
206
+ ]
207
+ },
208
+ {
209
+ "id": 7,
210
+ "type": "LoraLoaderModelOnly",
211
+ "pos": [
212
+ 380,
213
+ 0
214
+ ],
215
+ "size": [
216
+ 340,
217
+ 82
218
+ ],
219
+ "flags": {},
220
+ "order": 6,
221
+ "mode": 0,
222
+ "inputs": [
223
+ {
224
+ "name": "model",
225
+ "type": "MODEL",
226
+ "link": 1
227
+ }
228
+ ],
229
+ "outputs": [
230
+ {
231
+ "name": "MODEL",
232
+ "type": "MODEL",
233
+ "links": [
234
+ 2
235
+ ]
236
+ }
237
+ ],
238
+ "title": "Speed LoRA (high) — lightx2v",
239
+ "properties": {
240
+ "cnr_id": "comfy-core",
241
+ "ver": "0.7.0",
242
+ "Node name for S&R": "LoraLoaderModelOnly",
243
+ "ue_properties": {
244
+ "widget_ue_connectable": {},
245
+ "version": "7.5.2",
246
+ "input_ue_unconnectable": {}
247
+ }
248
+ },
249
+ "widgets_values": [
250
+ "i2v_lightx2v_high_noise_model.safetensors",
251
+ 1
252
+ ]
253
+ },
254
+ {
255
+ "id": 8,
256
+ "type": "LoraLoaderModelOnly",
257
+ "pos": [
258
+ 380,
259
+ 130
260
+ ],
261
+ "size": [
262
+ 340,
263
+ 82
264
+ ],
265
+ "flags": {},
266
+ "order": 7,
267
+ "mode": 0,
268
+ "inputs": [
269
+ {
270
+ "name": "model",
271
+ "type": "MODEL",
272
+ "link": 4
273
+ }
274
+ ],
275
+ "outputs": [
276
+ {
277
+ "name": "MODEL",
278
+ "type": "MODEL",
279
+ "links": [
280
+ 5
281
+ ]
282
+ }
283
+ ],
284
+ "title": "Speed LoRA (low) — lightx2v",
285
+ "properties": {
286
+ "cnr_id": "comfy-core",
287
+ "ver": "0.7.0",
288
+ "Node name for S&R": "LoraLoaderModelOnly",
289
+ "ue_properties": {
290
+ "widget_ue_connectable": {},
291
+ "version": "7.5.2",
292
+ "input_ue_unconnectable": {}
293
+ }
294
+ },
295
+ "widgets_values": [
296
+ "i2v_lightx2v_low_noise_model.safetensors",
297
+ 1
298
+ ]
299
+ },
300
+ {
301
+ "id": 9,
302
+ "type": "LoraLoaderModelOnly",
303
+ "pos": [
304
+ 760,
305
+ 0
306
+ ],
307
+ "size": [
308
+ 340,
309
+ 82
310
+ ],
311
+ "flags": {},
312
+ "order": 11,
313
+ "mode": 0,
314
+ "inputs": [
315
+ {
316
+ "name": "model",
317
+ "type": "MODEL",
318
+ "link": 2
319
+ }
320
+ ],
321
+ "outputs": [
322
+ {
323
+ "name": "MODEL",
324
+ "type": "MODEL",
325
+ "links": [
326
+ 3
327
+ ]
328
+ }
329
+ ],
330
+ "title": "Character LoRA (high)",
331
+ "properties": {
332
+ "cnr_id": "comfy-core",
333
+ "ver": "0.7.0",
334
+ "Node name for S&R": "LoraLoaderModelOnly",
335
+ "ue_properties": {
336
+ "widget_ue_connectable": {},
337
+ "version": "7.5.2",
338
+ "input_ue_unconnectable": {}
339
+ }
340
+ },
341
+ "widgets_values": [
342
+ "newIVI.safetensors",
343
+ 0.9
344
+ ]
345
+ },
346
+ {
347
+ "id": 10,
348
+ "type": "LoraLoaderModelOnly",
349
+ "pos": [
350
+ 760,
351
+ 130
352
+ ],
353
+ "size": [
354
+ 340,
355
+ 82
356
+ ],
357
+ "flags": {},
358
+ "order": 12,
359
+ "mode": 0,
360
+ "inputs": [
361
+ {
362
+ "name": "model",
363
+ "type": "MODEL",
364
+ "link": 5
365
+ }
366
+ ],
367
+ "outputs": [
368
+ {
369
+ "name": "MODEL",
370
+ "type": "MODEL",
371
+ "links": [
372
+ 6
373
+ ]
374
+ }
375
+ ],
376
+ "title": "Character LoRA (low)",
377
+ "properties": {
378
+ "cnr_id": "comfy-core",
379
+ "ver": "0.7.0",
380
+ "Node name for S&R": "LoraLoaderModelOnly",
381
+ "ue_properties": {
382
+ "widget_ue_connectable": {},
383
+ "version": "7.5.2",
384
+ "input_ue_unconnectable": {}
385
+ }
386
+ },
387
+ "widgets_values": [
388
+ "newIVI.safetensors",
389
+ 0.9
390
+ ]
391
+ },
392
+ {
393
+ "id": 12,
394
+ "type": "CLIPTextEncode",
395
+ "pos": [
396
+ 380,
397
+ 580
398
+ ],
399
+ "size": [
400
+ 400,
401
+ 140
402
+ ],
403
+ "flags": {},
404
+ "order": 8,
405
+ "mode": 0,
406
+ "inputs": [
407
+ {
408
+ "name": "clip",
409
+ "type": "CLIP",
410
+ "link": 9
411
+ }
412
+ ],
413
+ "outputs": [
414
+ {
415
+ "name": "CONDITIONING",
416
+ "type": "CONDITIONING",
417
+ "links": [
418
+ 15
419
+ ]
420
+ }
421
+ ],
422
+ "title": "Positive Prompt (trigger = ivi)",
423
+ "properties": {
424
+ "cnr_id": "comfy-core",
425
+ "ver": "0.7.0",
426
+ "Node name for S&R": "CLIPTextEncode",
427
+ "ue_properties": {
428
+ "widget_ue_connectable": {},
429
+ "version": "7.5.2",
430
+ "input_ue_unconnectable": {}
431
+ }
432
+ },
433
+ "widgets_values": [
434
+ "ivi, young asian woman with straight black bob haircut and pale blue eyes, wearing a black satin bralette crop top and matching black underwear, sunlit bedroom with sheer white curtains and soft morning light, unmade white bed. she lowers her phone from the mirror selfie pose, then gently places the phone on the nightstand in front of the camera, then slowly steps backward into the center of the room, turns her body to face the camera, one hand resting on her hip, other hand lightly touching her hair, subtle body sway, confident calm expression. soft natural skin texture, realistic body proportions, shallow depth of field, warm golden morning light, handheld vertical iphone video aesthetic, photorealistic, 8k"
435
+ ]
436
+ },
437
+ {
438
+ "id": 13,
439
+ "type": "CLIPTextEncode",
440
+ "pos": [
441
+ 380,
442
+ 750
443
+ ],
444
+ "size": [
445
+ 400,
446
+ 140
447
+ ],
448
+ "flags": {},
449
+ "order": 9,
450
+ "mode": 0,
451
+ "inputs": [
452
+ {
453
+ "name": "clip",
454
+ "type": "CLIP",
455
+ "link": 10
456
+ }
457
+ ],
458
+ "outputs": [
459
+ {
460
+ "name": "CONDITIONING",
461
+ "type": "CONDITIONING",
462
+ "links": [
463
+ 16
464
+ ]
465
+ }
466
+ ],
467
+ "title": "Negative Prompt",
468
+ "properties": {
469
+ "cnr_id": "comfy-core",
470
+ "ver": "0.7.0",
471
+ "Node name for S&R": "CLIPTextEncode",
472
+ "ue_properties": {
473
+ "widget_ue_connectable": {},
474
+ "version": "7.5.2",
475
+ "input_ue_unconnectable": {}
476
+ }
477
+ },
478
+ "widgets_values": [
479
+ "worst quality, low quality, jpeg artifacts, blurry, deformed, disfigured, malformed limbs, extra fingers, fused fingers, bad hands, bad face, waxy skin, plastic skin, oversaturated, overexposed, flicker, ghosting, static image, static frozen frame, looping motion, identity drift, face morph, outfit change, clothes change, color shift, extra person, text, watermark, subtitles, logo"
480
+ ]
481
+ },
482
+ {
483
+ "id": 14,
484
+ "type": "WanImageToVideo",
485
+ "pos": [
486
+ 1140,
487
+ 500
488
+ ],
489
+ "size": [
490
+ 330,
491
+ 210
492
+ ],
493
+ "flags": {},
494
+ "order": 13,
495
+ "mode": 0,
496
+ "inputs": [
497
+ {
498
+ "name": "positive",
499
+ "type": "CONDITIONING",
500
+ "link": 15
501
+ },
502
+ {
503
+ "name": "negative",
504
+ "type": "CONDITIONING",
505
+ "link": 16
506
+ },
507
+ {
508
+ "name": "vae",
509
+ "type": "VAE",
510
+ "link": 7
511
+ },
512
+ {
513
+ "name": "clip_vision_output",
514
+ "shape": 7,
515
+ "type": "CLIP_VISION_OUTPUT",
516
+ "link": 14
517
+ },
518
+ {
519
+ "name": "start_image",
520
+ "shape": 7,
521
+ "type": "IMAGE",
522
+ "link": 13
523
+ }
524
+ ],
525
+ "outputs": [
526
+ {
527
+ "name": "positive",
528
+ "type": "CONDITIONING",
529
+ "links": [
530
+ 17,
531
+ 20
532
+ ]
533
+ },
534
+ {
535
+ "name": "negative",
536
+ "type": "CONDITIONING",
537
+ "links": [
538
+ 18,
539
+ 21
540
+ ]
541
+ },
542
+ {
543
+ "name": "latent",
544
+ "type": "LATENT",
545
+ "links": [
546
+ 19
547
+ ]
548
+ }
549
+ ],
550
+ "title": "WanImageToVideo (480x832, 121 frames)",
551
+ "properties": {
552
+ "cnr_id": "comfy-core",
553
+ "ver": "0.7.0",
554
+ "Node name for S&R": "WanImageToVideo",
555
+ "ue_properties": {
556
+ "widget_ue_connectable": {},
557
+ "version": "7.5.2",
558
+ "input_ue_unconnectable": {}
559
+ }
560
+ },
561
+ "widgets_values": [
562
+ 480,
563
+ 832,
564
+ 121,
565
+ 1
566
+ ]
567
+ },
568
+ {
569
+ "id": 15,
570
+ "type": "KSampler",
571
+ "pos": [
572
+ 1500,
573
+ 0
574
+ ],
575
+ "size": [
576
+ 320,
577
+ 262
578
+ ],
579
+ "flags": {},
580
+ "order": 14,
581
+ "mode": 0,
582
+ "inputs": [
583
+ {
584
+ "name": "model",
585
+ "type": "MODEL",
586
+ "link": 3
587
+ },
588
+ {
589
+ "name": "positive",
590
+ "type": "CONDITIONING",
591
+ "link": 17
592
+ },
593
+ {
594
+ "name": "negative",
595
+ "type": "CONDITIONING",
596
+ "link": 18
597
+ },
598
+ {
599
+ "name": "latent_image",
600
+ "type": "LATENT",
601
+ "link": 19
602
+ }
603
+ ],
604
+ "outputs": [
605
+ {
606
+ "name": "LATENT",
607
+ "type": "LATENT",
608
+ "links": [
609
+ 22
610
+ ]
611
+ }
612
+ ],
613
+ "title": "KSampler — High Noise (stage 1)",
614
+ "properties": {
615
+ "cnr_id": "comfy-core",
616
+ "ver": "0.7.0",
617
+ "Node name for S&R": "KSampler",
618
+ "ue_properties": {
619
+ "widget_ue_connectable": {},
620
+ "version": "7.5.2",
621
+ "input_ue_unconnectable": {}
622
+ }
623
+ },
624
+ "widgets_values": [
625
+ 565287251058139,
626
+ "randomize",
627
+ 4,
628
+ 1,
629
+ "euler",
630
+ "simple",
631
+ 1
632
+ ]
633
+ },
634
+ {
635
+ "id": 16,
636
+ "type": "KSampler",
637
+ "pos": [
638
+ 1500,
639
+ 300
640
+ ],
641
+ "size": [
642
+ 320,
643
+ 262
644
+ ],
645
+ "flags": {},
646
+ "order": 15,
647
+ "mode": 0,
648
+ "inputs": [
649
+ {
650
+ "name": "model",
651
+ "type": "MODEL",
652
+ "link": 6
653
+ },
654
+ {
655
+ "name": "positive",
656
+ "type": "CONDITIONING",
657
+ "link": 20
658
+ },
659
+ {
660
+ "name": "negative",
661
+ "type": "CONDITIONING",
662
+ "link": 21
663
+ },
664
+ {
665
+ "name": "latent_image",
666
+ "type": "LATENT",
667
+ "link": 22
668
+ }
669
+ ],
670
+ "outputs": [
671
+ {
672
+ "name": "LATENT",
673
+ "type": "LATENT",
674
+ "links": [
675
+ 23
676
+ ]
677
+ }
678
+ ],
679
+ "title": "KSampler — Low Noise (stage 2 refine)",
680
+ "properties": {
681
+ "cnr_id": "comfy-core",
682
+ "ver": "0.7.0",
683
+ "Node name for S&R": "KSampler",
684
+ "ue_properties": {
685
+ "widget_ue_connectable": {},
686
+ "version": "7.5.2",
687
+ "input_ue_unconnectable": {}
688
+ }
689
+ },
690
+ "widgets_values": [
691
+ 567699387371003,
692
+ "randomize",
693
+ 4,
694
+ 1,
695
+ "euler",
696
+ "simple",
697
+ 1
698
+ ]
699
+ },
700
+ {
701
+ "id": 17,
702
+ "type": "VAEDecode",
703
+ "pos": [
704
+ 1860,
705
+ 0
706
+ ],
707
+ "size": [
708
+ 210,
709
+ 58
710
+ ],
711
+ "flags": {},
712
+ "order": 16,
713
+ "mode": 0,
714
+ "inputs": [
715
+ {
716
+ "name": "samples",
717
+ "type": "LATENT",
718
+ "link": 23
719
+ },
720
+ {
721
+ "name": "vae",
722
+ "type": "VAE",
723
+ "link": 8
724
+ }
725
+ ],
726
+ "outputs": [
727
+ {
728
+ "name": "IMAGE",
729
+ "type": "IMAGE",
730
+ "links": [
731
+ 24
732
+ ]
733
+ }
734
+ ],
735
+ "title": "VAE Decode",
736
+ "properties": {
737
+ "cnr_id": "comfy-core",
738
+ "ver": "0.7.0",
739
+ "Node name for S&R": "VAEDecode",
740
+ "ue_properties": {
741
+ "widget_ue_connectable": {},
742
+ "version": "7.5.2",
743
+ "input_ue_unconnectable": {}
744
+ }
745
+ },
746
+ "widgets_values": []
747
+ },
748
+ {
749
+ "id": 18,
750
+ "type": "RIFE VFI",
751
+ "pos": [
752
+ 1860,
753
+ 100
754
+ ],
755
+ "size": [
756
+ 358.97421875,
757
+ 198
758
+ ],
759
+ "flags": {},
760
+ "order": 17,
761
+ "mode": 0,
762
+ "inputs": [
763
+ {
764
+ "name": "frames",
765
+ "type": "IMAGE",
766
+ "link": 24
767
+ },
768
+ {
769
+ "name": "optional_interpolation_states",
770
+ "shape": 7,
771
+ "type": "INTERPOLATION_STATES",
772
+ "link": null
773
+ }
774
+ ],
775
+ "outputs": [
776
+ {
777
+ "name": "IMAGE",
778
+ "type": "IMAGE",
779
+ "links": [
780
+ 25
781
+ ]
782
+ }
783
+ ],
784
+ "title": "RIFE 16→32 fps (отключи mode=4 если не нужен)",
785
+ "properties": {
786
+ "aux_id": "Fannovel16/ComfyUI-Frame-Interpolation",
787
+ "ver": "a969c01dbccd9e5510641be04eb51fe93f6bfc3d",
788
+ "Node name for S&R": "RIFE VFI",
789
+ "ue_properties": {
790
+ "widget_ue_connectable": {},
791
+ "version": "7.5.2",
792
+ "input_ue_unconnectable": {}
793
+ }
794
+ },
795
+ "widgets_values": [
796
+ "rife49.pth",
797
+ 10,
798
+ 2,
799
+ false,
800
+ true,
801
+ 1
802
+ ]
803
+ },
804
+ {
805
+ "id": 19,
806
+ "type": "VHS_VideoCombine",
807
+ "pos": [
808
+ 2250,
809
+ 0
810
+ ],
811
+ "size": [
812
+ 370,
813
+ 954.6666666666667
814
+ ],
815
+ "flags": {},
816
+ "order": 18,
817
+ "mode": 0,
818
+ "inputs": [
819
+ {
820
+ "name": "images",
821
+ "type": "IMAGE",
822
+ "link": 25
823
+ },
824
+ {
825
+ "name": "audio",
826
+ "shape": 7,
827
+ "type": "AUDIO",
828
+ "link": null
829
+ },
830
+ {
831
+ "name": "meta_batch",
832
+ "shape": 7,
833
+ "type": "VHS_BatchManager",
834
+ "link": null
835
+ },
836
+ {
837
+ "name": "vae",
838
+ "shape": 7,
839
+ "type": "VAE",
840
+ "link": null
841
+ }
842
+ ],
843
+ "outputs": [
844
+ {
845
+ "name": "Filenames",
846
+ "type": "VHS_FILENAMES",
847
+ "links": []
848
+ }
849
+ ],
850
+ "title": "Save Video (32fps)",
851
+ "properties": {
852
+ "aux_id": "Kosinkadink/ComfyUI-VideoHelperSuite",
853
+ "ver": "3234937ff5f3ca19068aaba5042771514de2429d",
854
+ "Node name for S&R": "VHS_VideoCombine",
855
+ "ue_properties": {
856
+ "widget_ue_connectable": {},
857
+ "version": "7.5.2",
858
+ "input_ue_unconnectable": {}
859
+ }
860
+ },
861
+ "widgets_values": {
862
+ "frame_rate": 32,
863
+ "loop_count": 0,
864
+ "filename_prefix": "WanI2V",
865
+ "format": "video/h264-mp4",
866
+ "pix_fmt": "yuv420p",
867
+ "crf": 19,
868
+ "save_metadata": true,
869
+ "trim_to_audio": false,
870
+ "pingpong": false,
871
+ "save_output": true,
872
+ "videopreview": {
873
+ "hidden": false,
874
+ "paused": false,
875
+ "params": {
876
+ "filename": "WanI2V_00009.mp4",
877
+ "subfolder": "",
878
+ "type": "output",
879
+ "format": "video/h264-mp4",
880
+ "frame_rate": 32,
881
+ "workflow": "WanI2V_00009.png",
882
+ "fullpath": "/workspace/ComfyUI/output/WanI2V_00009.mp4"
883
+ }
884
+ }
885
+ }
886
+ },
887
+ {
888
+ "id": 11,
889
+ "type": "CLIPVisionEncode",
890
+ "pos": [
891
+ 502.60891930196067,
892
+ 382.2887994330991
893
+ ],
894
+ "size": [
895
+ 340,
896
+ 78
897
+ ],
898
+ "flags": {},
899
+ "order": 10,
900
+ "mode": 0,
901
+ "inputs": [
902
+ {
903
+ "name": "clip_vision",
904
+ "type": "CLIP_VISION",
905
+ "link": 11
906
+ },
907
+ {
908
+ "name": "image",
909
+ "type": "IMAGE",
910
+ "link": 12
911
+ }
912
+ ],
913
+ "outputs": [
914
+ {
915
+ "name": "CLIP_VISION_OUTPUT",
916
+ "type": "CLIP_VISION_OUTPUT",
917
+ "links": [
918
+ 14
919
+ ]
920
+ }
921
+ ],
922
+ "title": "CLIP Vision Encode",
923
+ "properties": {
924
+ "cnr_id": "comfy-core",
925
+ "ver": "0.7.0",
926
+ "Node name for S&R": "CLIPVisionEncode",
927
+ "ue_properties": {
928
+ "widget_ue_connectable": {},
929
+ "version": "7.5.2",
930
+ "input_ue_unconnectable": {}
931
+ }
932
+ },
933
+ "widgets_values": [
934
+ "center"
935
+ ]
936
+ },
937
+ {
938
+ "id": 6,
939
+ "type": "LoadImage",
940
+ "pos": [
941
+ 0,
942
+ 570
943
+ ],
944
+ "size": [
945
+ 340,
946
+ 314
947
+ ],
948
+ "flags": {},
949
+ "order": 5,
950
+ "mode": 0,
951
+ "inputs": [],
952
+ "outputs": [
953
+ {
954
+ "name": "IMAGE",
955
+ "type": "IMAGE",
956
+ "links": [
957
+ 12,
958
+ 13
959
+ ]
960
+ },
961
+ {
962
+ "name": "MASK",
963
+ "type": "MASK",
964
+ "links": []
965
+ }
966
+ ],
967
+ "title": "Reference image (первый кадр / локация)",
968
+ "properties": {
969
+ "cnr_id": "comfy-core",
970
+ "ver": "0.7.0",
971
+ "Node name for S&R": "LoadImage",
972
+ "ue_properties": {
973
+ "widget_ue_connectable": {},
974
+ "version": "7.5.2",
975
+ "input_ue_unconnectable": {}
976
+ }
977
+ },
978
+ "widgets_values": [
979
+ "66.png",
980
+ "image"
981
+ ]
982
+ }
983
+ ],
984
+ "links": [
985
+ [
986
+ 1,
987
+ 1,
988
+ 0,
989
+ 7,
990
+ 0,
991
+ "MODEL"
992
+ ],
993
+ [
994
+ 2,
995
+ 7,
996
+ 0,
997
+ 9,
998
+ 0,
999
+ "MODEL"
1000
+ ],
1001
+ [
1002
+ 3,
1003
+ 9,
1004
+ 0,
1005
+ 15,
1006
+ 0,
1007
+ "MODEL"
1008
+ ],
1009
+ [
1010
+ 4,
1011
+ 2,
1012
+ 0,
1013
+ 8,
1014
+ 0,
1015
+ "MODEL"
1016
+ ],
1017
+ [
1018
+ 5,
1019
+ 8,
1020
+ 0,
1021
+ 10,
1022
+ 0,
1023
+ "MODEL"
1024
+ ],
1025
+ [
1026
+ 6,
1027
+ 10,
1028
+ 0,
1029
+ 16,
1030
+ 0,
1031
+ "MODEL"
1032
+ ],
1033
+ [
1034
+ 7,
1035
+ 3,
1036
+ 0,
1037
+ 14,
1038
+ 2,
1039
+ "VAE"
1040
+ ],
1041
+ [
1042
+ 8,
1043
+ 3,
1044
+ 0,
1045
+ 17,
1046
+ 1,
1047
+ "VAE"
1048
+ ],
1049
+ [
1050
+ 9,
1051
+ 4,
1052
+ 0,
1053
+ 12,
1054
+ 0,
1055
+ "CLIP"
1056
+ ],
1057
+ [
1058
+ 10,
1059
+ 4,
1060
+ 0,
1061
+ 13,
1062
+ 0,
1063
+ "CLIP"
1064
+ ],
1065
+ [
1066
+ 11,
1067
+ 5,
1068
+ 0,
1069
+ 11,
1070
+ 0,
1071
+ "CLIP_VISION"
1072
+ ],
1073
+ [
1074
+ 12,
1075
+ 6,
1076
+ 0,
1077
+ 11,
1078
+ 1,
1079
+ "IMAGE"
1080
+ ],
1081
+ [
1082
+ 13,
1083
+ 6,
1084
+ 0,
1085
+ 14,
1086
+ 4,
1087
+ "IMAGE"
1088
+ ],
1089
+ [
1090
+ 14,
1091
+ 11,
1092
+ 0,
1093
+ 14,
1094
+ 3,
1095
+ "CLIP_VISION_OUTPUT"
1096
+ ],
1097
+ [
1098
+ 15,
1099
+ 12,
1100
+ 0,
1101
+ 14,
1102
+ 0,
1103
+ "CONDITIONING"
1104
+ ],
1105
+ [
1106
+ 16,
1107
+ 13,
1108
+ 0,
1109
+ 14,
1110
+ 1,
1111
+ "CONDITIONING"
1112
+ ],
1113
+ [
1114
+ 17,
1115
+ 14,
1116
+ 0,
1117
+ 15,
1118
+ 1,
1119
+ "CONDITIONING"
1120
+ ],
1121
+ [
1122
+ 18,
1123
+ 14,
1124
+ 1,
1125
+ 15,
1126
+ 2,
1127
+ "CONDITIONING"
1128
+ ],
1129
+ [
1130
+ 19,
1131
+ 14,
1132
+ 2,
1133
+ 15,
1134
+ 3,
1135
+ "LATENT"
1136
+ ],
1137
+ [
1138
+ 20,
1139
+ 14,
1140
+ 0,
1141
+ 16,
1142
+ 1,
1143
+ "CONDITIONING"
1144
+ ],
1145
+ [
1146
+ 21,
1147
+ 14,
1148
+ 1,
1149
+ 16,
1150
+ 2,
1151
+ "CONDITIONING"
1152
+ ],
1153
+ [
1154
+ 22,
1155
+ 15,
1156
+ 0,
1157
+ 16,
1158
+ 3,
1159
+ "LATENT"
1160
+ ],
1161
+ [
1162
+ 23,
1163
+ 16,
1164
+ 0,
1165
+ 17,
1166
+ 0,
1167
+ "LATENT"
1168
+ ],
1169
+ [
1170
+ 24,
1171
+ 17,
1172
+ 0,
1173
+ 18,
1174
+ 0,
1175
+ "IMAGE"
1176
+ ],
1177
+ [
1178
+ 25,
1179
+ 18,
1180
+ 0,
1181
+ 19,
1182
+ 0,
1183
+ "IMAGE"
1184
+ ]
1185
+ ],
1186
+ "groups": [
1187
+ {
1188
+ "id": 1,
1189
+ "title": "Step 1 - Model Loaders",
1190
+ "bounding": [
1191
+ -10,
1192
+ -10,
1193
+ 360,
1194
+ 330
1195
+ ],
1196
+ "color": "#3f789e",
1197
+ "font_size": 24,
1198
+ "flags": {}
1199
+ },
1200
+ {
1201
+ "id": 2,
1202
+ "title": "Step 2 - Speed + Character LoRAs",
1203
+ "bounding": [
1204
+ 370,
1205
+ -10,
1206
+ 740,
1207
+ 240
1208
+ ],
1209
+ "color": "#8AA",
1210
+ "font_size": 24,
1211
+ "flags": {}
1212
+ },
1213
+ {
1214
+ "id": 3,
1215
+ "title": "Step 3 - Conditioning",
1216
+ "bounding": [
1217
+ 370,
1218
+ 460,
1219
+ 430,
1220
+ 470
1221
+ ],
1222
+ "color": "#A88",
1223
+ "font_size": 24,
1224
+ "flags": {}
1225
+ },
1226
+ {
1227
+ "id": 4,
1228
+ "title": "Step 4 - Wan Image→Video",
1229
+ "bounding": [
1230
+ 1130,
1231
+ 490,
1232
+ 350,
1233
+ 200
1234
+ ],
1235
+ "color": "#A8A",
1236
+ "font_size": 24,
1237
+ "flags": {}
1238
+ },
1239
+ {
1240
+ "id": 5,
1241
+ "title": "Step 5 - Sampling",
1242
+ "bounding": [
1243
+ 1490,
1244
+ -10,
1245
+ 340,
1246
+ 580
1247
+ ],
1248
+ "color": "#AA8",
1249
+ "font_size": 24,
1250
+ "flags": {}
1251
+ },
1252
+ {
1253
+ "id": 6,
1254
+ "title": "Step 6 - Decode + 32fps + Save",
1255
+ "bounding": [
1256
+ 1850,
1257
+ -10,
1258
+ 800,
1259
+ 720
1260
+ ],
1261
+ "color": "#8A8",
1262
+ "font_size": 24,
1263
+ "flags": {}
1264
+ }
1265
+ ],
1266
+ "config": {},
1267
+ "extra": {
1268
+ "workflowRendererVersion": "LG",
1269
+ "ue_links": [],
1270
+ "links_added_by_ue": [],
1271
+ "ds": {
1272
+ "scale": 1.1712800000000003,
1273
+ "offset": [
1274
+ -1092.3755677549368,
1275
+ -95.64397283313947
1276
+ ]
1277
+ },
1278
+ "frontendVersion": "1.35.9",
1279
+ "VHS_latentpreview": true,
1280
+ "VHS_latentpreviewrate": 0,
1281
+ "VHS_MetadataImage": true,
1282
+ "VHS_KeepIntermediate": true
1283
+ },
1284
+ "version": 0.4
1285
+ }
Wan_Animate_God_Mode_V2.5_iviNEWцц.json ADDED
The diff for this file is too large to render. See raw diff
 
newIVIгадмод.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7a15ab91d5ee7990c2980f697b9be14b4e971be5abb8f7c87afaadea2230e40
3
+ size 613516400
wanv2v_iter_control_group.py ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Tuple
2
+ import torch
3
+
4
+ """
5
+ WanV2VIterControlGroup (finalized + masks)
6
+
7
+ MODIFIED: This version implements a sequential, overlapping chunking logic similar to WanVaceToVideoCopy.
8
+ - Iter 1: A simple slice from the start of the control images.
9
+ - Iter > 1: The start of the chunk is built from the TAIL of the prev_output, ensuring temporal consistency.
10
+
11
+ The mask output is aligned with this logic:
12
+ - If `mask_master` is NOT provided (default behavior):
13
+ - Iter 1: All masks are WHITE (1.0 -> editable).
14
+ - Iter > 1: First `overlap_size` masks are BLACK (0.0 -> non-editable), remaining are WHITE (1.0 -> editable).
15
+ - If `mask_master` IS provided:
16
+ - The output mask is sliced from `mask_master` to match the frame logic.
17
+ - Iter 1: A direct slice from `mask_master`.
18
+ - Iter > 1: `overlap_size` black frames are prepended, followed by a sequential slice from `mask_master`.
19
+ """
20
+
21
+ def _sec_to_hms_ms(sec: float) -> str:
22
+ ms = int(round((sec - int(sec)) * 1000.0))
23
+ s_total = int(sec)
24
+ h = s_total // 3600
25
+ m = (s_total % 3600) // 60
26
+ s = s_total % 60
27
+ return f"{h:02d}:{m:02d}:{s:02d}.{ms:03d}"
28
+
29
+ class WanV2VIterControlGroup:
30
+ @classmethod
31
+ def INPUT_TYPES(cls):
32
+ return {
33
+ "required": {
34
+ "controlnet_images": ("IMAGE",), # [T,H,W,C]
35
+ "chunk_size": ("INT", {"default": 81, "min": 1, "max": 4096, "step": 1}),
36
+ "overlap_size": ("INT", {"default": 8, "min": 0, "max": 2048, "step": 1}),
37
+ "iter": ("INT", {"default": 1, "min": 1, "max": 99999, "step": 1}), # 1-based
38
+ "fps": ("FLOAT", {"default": 24.0, "min": 1.0, "max": 240.0, "step": 0.1}),
39
+ },
40
+ "optional": {
41
+ "prev_output": ("IMAGE",), # previous sampler output [*,H,W,C]
42
+ "mask_master": ("MASK",), # <<< NEW: Optional master mask input
43
+ },
44
+ }
45
+
46
+ RETURN_TYPES = ("IMAGE", "STRING", "MASK")
47
+ RETURN_NAMES = ("control_group", "info", "edit_mask_batch")
48
+ FUNCTION = "build"
49
+ CATEGORY = "Wanv2vControlnetManager/WAN"
50
+
51
+ # ---- helpers ----
52
+ def _ensure_batched(self, t: torch.Tensor) -> torch.Tensor:
53
+ assert torch.is_tensor(t), "Expected torch.Tensor"
54
+ assert t.ndim == 4, f"Expected [B,H,W,C], got {tuple(t.shape)}"
55
+ return t
56
+
57
+ def _slice_safe(self, t: torch.Tensor, start: int, end: int) -> torch.Tensor:
58
+ start = max(0, int(start))
59
+ end = max(start, min(int(end), t.shape[0]))
60
+ return t[start:end]
61
+
62
+ def _last_n(self, t: torch.Tensor, n: int) -> torch.Tensor:
63
+ n = max(0, int(n))
64
+ if n == 0:
65
+ return t[:0]
66
+ n = min(n, t.shape[0])
67
+ return t[-n:]
68
+
69
+ def _empty_like(self, ref: torch.Tensor, B: int = 0) -> torch.Tensor:
70
+ _, H, W, C = ref.shape
71
+ return torch.empty((B, H, W, C), dtype=ref.dtype, device=ref.device)
72
+
73
+ def _pad_repeat_last(self, t: torch.Tensor, target_len: int) -> torch.Tensor:
74
+ """Pad batch t by repeating its last frame until target_len."""
75
+ if t.shape[0] == 0:
76
+ return t
77
+ need = target_len - t.shape[0]
78
+ if need <= 0:
79
+ return t[:target_len]
80
+ last = t[-1:].repeat(need, 1, 1, 1)
81
+ return torch.cat([t, last], dim=0)
82
+
83
+ # <<< NEW: Helper for padding 3D mask tensors
84
+ def _pad_repeat_last_mask(self, t: torch.Tensor, target_len: int) -> torch.Tensor:
85
+ """Pad a 3D mask batch t by repeating its last mask until target_len."""
86
+ if t.shape[0] == 0:
87
+ return t
88
+ need = target_len - t.shape[0]
89
+ if need <= 0:
90
+ return t[:target_len]
91
+ last = t[-1:].repeat(need, 1, 1)
92
+ return torch.cat([t, last], dim=0)
93
+
94
+ def _build_masks(self, H: int, W: int, chunk_size: int, locked_frames: int, device, dtype=torch.float32) -> torch.Tensor:
95
+ B = max(1, int(chunk_size))
96
+ x = max(0, int(locked_frames))
97
+ x = min(x, B)
98
+ black = torch.zeros((x, H, W), dtype=dtype, device=device)
99
+ white = torch.ones((B - x, H, W), dtype=dtype, device=device)
100
+ return torch.cat([black, white], dim=0)
101
+
102
+ # ---- core ----
103
+ def build(
104
+ self,
105
+ controlnet_images: torch.Tensor,
106
+ chunk_size: int,
107
+ overlap_size: int,
108
+ iter: int,
109
+ fps: float,
110
+ prev_output: torch.Tensor = None,
111
+ mask_master: torch.Tensor = None, # <<< NEW: Accepting the new parameter
112
+ ) -> Tuple[torch.Tensor, str, torch.Tensor]:
113
+
114
+ frames = self._ensure_batched(controlnet_images)
115
+ T, H, W, C = frames.shape
116
+ device = frames.device
117
+
118
+ # --- Frame calculation logic (This remains unchanged) ---
119
+ step_size = chunk_size - overlap_size
120
+ start_frame = (iter - 1) * step_size
121
+ end_frame = start_frame + chunk_size
122
+
123
+ total_seconds = float(T) / float(fps) if fps > 0 else 0.0
124
+
125
+ if start_frame >= T and (iter > 1 and prev_output is None):
126
+ empty_frames = self._empty_like(frames, 0)
127
+ empty_masks = self._build_masks(H, W, chunk_size, 0, device)
128
+ info = f"iter={iter}: Processing complete. Total frames={T}."
129
+ return empty_frames, info, empty_masks
130
+
131
+ # --- Frame building logic (This remains unchanged) ---
132
+ if iter == 1 or prev_output is None:
133
+ built_chunk = self._slice_safe(frames, start_frame, end_frame)
134
+ built_chunk = self._pad_repeat_last(built_chunk, chunk_size)
135
+ locked_frames = 0
136
+ info = (f"iter={iter} (Start): Built chunk of {built_chunk.shape[0]} frames from master video [{start_frame}:{end_frame}]. "
137
+ f"Locked frames: {locked_frames}.")
138
+ else:
139
+ prev_out = self._ensure_batched(prev_output)
140
+ overlap_frames = self._last_n(prev_out, overlap_size)
141
+ num_new_frames = chunk_size - overlap_frames.shape[0]
142
+ new_frames_start = start_frame + overlap_size
143
+ new_frames_end = new_frames_start + num_new_frames
144
+ new_frames_chunk = self._slice_safe(frames, new_frames_start, new_frames_end)
145
+ built_chunk = torch.cat([overlap_frames, new_frames_chunk], dim=0)
146
+ built_chunk = self._pad_repeat_last(built_chunk, chunk_size)
147
+ locked_frames = overlap_size
148
+ info = (f"iter={iter} (Overlap): Built chunk of {built_chunk.shape[0]} frames. "
149
+ f"Using {overlap_frames.shape[0]} from prev_output and {new_frames_chunk.shape[0]} new frames. "
150
+ f"Locked frames: {locked_frames}.")
151
+
152
+ # --- Generate Mask and Final Return ---
153
+ # <<< NEW: Conditional logic for mask generation
154
+ if mask_master is None:
155
+ # DEFAULT BEHAVIOR: Generate mask procedurally (this is the original, working logic)
156
+ final_masks = self._build_masks(H, W, chunk_size, locked_frames, device)
157
+ else:
158
+ # CUSTOM BEHAVIOR: Splice the mask from the provided mask_master
159
+ if iter == 1:
160
+ # For iter 1, just slice the master mask from the beginning
161
+ final_masks = self._slice_safe(mask_master, start_frame, end_frame)
162
+ final_masks = self._pad_repeat_last_mask(final_masks, chunk_size)
163
+ else:
164
+ # For iter > 1, prepend black masks for the overlap, then slice the rest
165
+ black_prepend = torch.zeros((overlap_size, H, W), dtype=mask_master.dtype, device=device)
166
+
167
+ num_new_masks = chunk_size - overlap_size
168
+ new_masks_start = start_frame + overlap_size
169
+ new_masks_end = new_masks_start + num_new_masks
170
+ new_mask_chunk = self._slice_safe(mask_master, new_masks_start, new_masks_end)
171
+
172
+ final_masks = torch.cat([black_prepend, new_mask_chunk], dim=0)
173
+ final_masks = self._pad_repeat_last_mask(final_masks, chunk_size)
174
+
175
+ final_info = f"{info} Total source frames={T} ({_sec_to_hms_ms(total_seconds)} @ {fps:.2f}fps)."
176
+
177
+ return built_chunk, final_info, final_masks