@melite/models-h3 0.2.2-alpha → 0.3.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/lib/actions.js +116 -178
- package/lib/chainEdit.d.ts +94 -0
- package/lib/chainEdit.js +184 -13
- package/lib/chainUpscale.js +4 -1
- package/lib/edit.d.ts +103 -0
- package/lib/edit.js +645 -0
- package/lib/extend.d.ts +1 -8
- package/lib/extend.js +111 -32
- package/lib/filmMix.d.ts +25 -0
- package/lib/filmMix.js +76 -21
- package/lib/index.d.ts +2 -1
- package/lib/index.js +25 -6
- package/lib/refine.d.ts +99 -8
- package/lib/refine.js +75 -54
- package/lib/refmodBake.d.ts +29 -0
- package/lib/refmodBake.js +176 -0
- package/lib/repair.js +84 -77
- package/lib/reshoot.js +7 -2
- package/lib/schema.d.ts +34 -0
- package/lib/schema.js +75 -3
- package/lib/secondPass.d.ts +31 -0
- package/lib/secondPass.js +59 -0
- package/lib/swap.js +63 -34
- package/lib/timelineContract.d.ts +271 -2
- package/lib/timelineContract.js +365 -2
- package/package.json +9 -5
package/lib/refine.js
CHANGED
|
@@ -1,23 +1,53 @@
|
|
|
1
1
|
import { chainSaveBoundaries, concatSavedFilms, filmJoinAudio } from './actions.js';
|
|
2
|
-
import { h3MaskedEditPlane, loadVideo } from './chainEdit.js';
|
|
2
|
+
import { contexMaskedTarget, h3MaskedEditPlane, loadVideo } from './chainEdit.js';
|
|
3
|
+
import { FULL_NOISE_REASON, fullNoiseClause } from './secondPass.js';
|
|
3
4
|
import { DOC_FPS_DEFAULT, MAX_COMPOSED_WINDOWS, SEAM_OVERLAP_FRAMES } from './timelineContract.js';
|
|
4
5
|
/** The learned 3D-conv upscale weights (the schema's upscale_model
|
|
5
6
|
* seat carries this same single option — one file, one spelling, no
|
|
6
7
|
* hand-spelled alternatives). */
|
|
7
8
|
export const REFINE_UPSCALE_MODEL = 'minimax_h3_latent_upscaler_3d_bf16.safetensors';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
15
19
|
export const REFINE_2X_OOM_FRAMES = 141;
|
|
16
20
|
|
|
17
21
|
|
|
18
22
|
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export const REFINE_DEFAULT_CLIP_SECONDS = 2.33;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export const REGION_REPAIR_GREEN_FRAMES = 362;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
export const REFINE_WORKAROUND_WIDE_FRAMES = 90;
|
|
21
51
|
/** The refine auto-tile's default carried overlap, in frames at the
|
|
22
52
|
* film clock — the film's own seam (SEAM_OVERLAP_FRAMES), which is
|
|
23
53
|
* also token-exact (5, 22, 39 …), so the default auto-tile takes the
|
|
@@ -51,8 +81,10 @@ export function refineArmed(p) {
|
|
|
51
81
|
* or above 1: a second pass is a refine, never a re-render) */
|
|
52
82
|
const refineDials = (entry) => {
|
|
53
83
|
const denoise = num(entry, 'denoise', 0.32);
|
|
84
|
+
// THE SHARED FULL-NOISE LAW (secondPass.ts): the clause and the
|
|
85
|
+
// reason are the seat's own — this door names its window.
|
|
54
86
|
if (denoise >= 1) {
|
|
55
|
-
throw new Error(`h3-timeline refine: denoise ${denoise} >= 1 —
|
|
87
|
+
throw new Error(`h3-timeline refine: denoise ${denoise} >= 1 — ${fullNoiseClause('refine')} (the partial-denoise window is 0.05–0.50; ${FULL_NOISE_REASON} and the vendored node throws — that is a reshoot, and the reshoot door exists)`);
|
|
56
88
|
}
|
|
57
89
|
return {
|
|
58
90
|
denoise,
|
|
@@ -86,18 +118,19 @@ const judgeRefineWindow = (cap, dials) => {
|
|
|
86
118
|
const sameSize = dials.upMode === 'scale by multiplier' && dials.upScale < 2;
|
|
87
119
|
if (!sameSize && cap > REFINE_2X_OOM_FRAMES) {
|
|
88
120
|
const named = dials.upMode === 'scale by multiplier' ? `${dials.upScale}x` : dials.upMode;
|
|
89
|
-
throw new Error(`h3-timeline refine: a ${cap} f window at ${named} — the 2x pass was measured OOM at ${REFINE_2X_OOM_FRAMES} f
|
|
121
|
+
throw new Error(`h3-timeline refine: a ${cap} f window at ${named} is TOO LONG — the 2x pass was measured OOM at ${REFINE_2X_OOM_FRAMES} f (2688×1536, 48 kHz; H3 memory grows with the window, and that is the whole story: there is no OOM mystery and no ceiling to press, whichever sizing mode upsizes, a window that dies is just a window too long). The design is the ~2 s window (${REFINE_DEFAULT_CLIP_SECONDS} s = ${Math.round(REFINE_DEFAULT_CLIP_SECONDS * 24)} f, the 2 s class's rung of the 22+17k token grid) tiled window by window and joined by the context carry — the carry is what makes a short window seamless (the carry is served, ROADMAP F3-14 cured), so no film ever needs a wider window. Cut clip_seconds to ${REFINE_DEFAULT_CLIP_SECONDS} s or less and let the carry tile the rest, or lower scale to 1 for a same-size pass`);
|
|
90
122
|
}
|
|
91
123
|
};
|
|
92
124
|
/** THE JOINT AV TARGET — the estate's one source→nested-AV
|
|
93
|
-
* constructor
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
125
|
+
* constructor rider: the SolidMask (all-white, sized from the
|
|
126
|
+
* loader's frames via GetImageSizeAndCount — never a hand-typed
|
|
127
|
+
* resolution) feeds the shared `contexMaskedTarget` seat every
|
|
128
|
+
* masked-edit chain rides (chainEdit.ts, the timeline rework's
|
|
129
|
+
* stage-1 seam). White means "every frame is editable" (nothing
|
|
130
|
+
* is held; a refine re-renders the window at its own denoise) and
|
|
131
|
+
* `keep_audio` carries the window's soundtrack into the joint
|
|
132
|
+
* latent, so the audio stream every downstream node reads is the
|
|
133
|
+
* source's own.
|
|
101
134
|
* @param g the run's graph builder
|
|
102
135
|
* @param plane the plane's two VAE seats
|
|
103
136
|
* @param frames the window's loaded frames
|
|
@@ -108,17 +141,9 @@ const refineJointTarget = (g, plane, frames, audio) => {
|
|
|
108
141
|
const whiteMask = g.node('SolidMask', {
|
|
109
142
|
value: 1, width: size.out(1), height: size.out(2),
|
|
110
143
|
}).out(0);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
audio_vae: plane.vaeAudio, audio,
|
|
115
|
-
}).out(0);
|
|
116
|
-
return g.node('MiniMaxH3ContexMaskedTarget', {
|
|
117
|
-
mask_meaning: 'white = generate',
|
|
118
|
-
audio_mode: 'preserve source audio',
|
|
119
|
-
mask_conversion: 'H3 exact (causal/token max)',
|
|
120
|
-
target_latent: edit, mask: whiteMask,
|
|
121
|
-
}).out(0);
|
|
144
|
+
return contexMaskedTarget(g, plane, {
|
|
145
|
+
frames, audio, mask: whiteMask, keepAudio: true,
|
|
146
|
+
});
|
|
122
147
|
};
|
|
123
148
|
/** THE WINDOW BODY — one refine window, whichever door composed it:
|
|
124
149
|
* joint AV target → (carry) → the 2x handoff → decode → (head-trim).
|
|
@@ -231,7 +256,7 @@ const composeRefineWindow = (g, entry, p, plane, seat, iteration, previousLatent
|
|
|
231
256
|
|
|
232
257
|
export function renderH3RefineWindow(entry, p, facts, g, seat) {
|
|
233
258
|
if (!Number.isInteger(seat.cap) || seat.cap < 1) {
|
|
234
|
-
throw new Error(`h3-timeline refine: a ${seat.cap} f window — a refine window needs frames (the loop's cap is the loader's frame_load_cap at 24 fps; the
|
|
259
|
+
throw new Error(`h3-timeline refine: a ${seat.cap} f window — a refine window needs frames (the loop's cap is the loader's frame_load_cap at 24 fps; the design window is ${REFINE_DEFAULT_CLIP_SECONDS} s = ${Math.round(REFINE_DEFAULT_CLIP_SECONDS * 24)} f, the 2 s class's rung — the carry-joined window, not the widest-green workaround)`);
|
|
235
260
|
}
|
|
236
261
|
if (!Number.isInteger(seat.skip) || seat.skip < 0) {
|
|
237
262
|
throw new Error(`h3-timeline refine: a window starting at frame ${seat.skip} — a window starts at or after the clip's first frame (the loop's skip is the loader's skip_first_frames)`);
|
|
@@ -249,7 +274,7 @@ function refineWindowOrigin(entry) {
|
|
|
249
274
|
const clipSeconds = num(entry, 'clip_seconds', REFINE_DEFAULT_CLIP_SECONDS);
|
|
250
275
|
const startSeconds = num(entry, 'start_seconds', 0);
|
|
251
276
|
if (!(clipSeconds > 0)) {
|
|
252
|
-
throw new Error(`h3-timeline refine: clip_seconds ${clipSeconds} — a refine window needs frames (the seat is the loader's frame_load_cap: seconds × 24 at the film clock; the
|
|
277
|
+
throw new Error(`h3-timeline refine: clip_seconds ${clipSeconds} — a refine window needs frames (the seat is the loader's frame_load_cap: seconds × 24 at the film clock; the design window is ${REFINE_DEFAULT_CLIP_SECONDS} s = ${Math.round(REFINE_DEFAULT_CLIP_SECONDS * 24)} f, the 2 s class's rung — the carry-joined window, not the widest-green workaround)`);
|
|
253
278
|
}
|
|
254
279
|
if (!(startSeconds >= 0)) {
|
|
255
280
|
throw new Error(`h3-timeline refine: start_seconds ${startSeconds} — a window starts at or after the clip's first frame (the seat is the loader's skip_first_frames); advance it window by window to cover a long film`);
|
|
@@ -342,13 +367,6 @@ export function renderH3Refine(entry, p, facts, g, runId) {
|
|
|
342
367
|
|
|
343
368
|
|
|
344
369
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
function refineCarryStanddown(what) {
|
|
350
|
-
return `h3-timeline refine: ${what} would carry the film's own continuation between windows — and that carry is DEAD in the engine today (F3-14, operator burn 2026-11-05): the carried window dies at its handoff with "ValueError: Drift-Control AV packed mask does not match its audio stream" (the Drift-Control mask state splits the packed mask by the install-time stream shapes, drift_control_av.py:159, and a continuation-carried latent's audio prefix no longer lands; the node is MinimaxH3LatentUpscaler3DRefineHandoff). Window 0 renders and bills BEFORE that failure, so the door refuses the carry shape instead of billing a partial. The hard cut serves today: state overlap_frames 0 (the auto-tile) or start the next window at the previous window's end (the bag) — the plain concat of independent windows, no continuation. The carried refine is owed the engine cure (ROADMAP F3-14).`;
|
|
351
|
-
}
|
|
352
370
|
|
|
353
371
|
|
|
354
372
|
|
|
@@ -626,16 +644,18 @@ export function renderH3RefineBag(bag, p, facts, g, runId) {
|
|
|
626
644
|
? `This window is too short for any carried join — state zero carry (abut the windows) or one entry with windows above 1.`
|
|
627
645
|
: `State window ${offGrid + 1} at frame ${lawful} (${(lawful / clockFps).toFixed(3)} s) for a 22 f carry — the film's own seam — (the nearest rung above the measured span is ${rung} f), or make the join zero-carry (start window ${offGrid + 1} at frame ${prev.skip + prev.cap}, the hard cut).`}`);
|
|
628
646
|
}
|
|
629
|
-
|
|
630
|
-
//
|
|
631
|
-
//
|
|
632
|
-
//
|
|
633
|
-
//
|
|
647
|
+
|
|
648
|
+
// operator order "the app cannot ever go all green while this is
|
|
649
|
+
// still broken"): the refinement pass now strips the foreign
|
|
650
|
+
// dynamic denoise-mask patch at the handoff that burned (the
|
|
651
|
+
// vendored MinimaxH3LatentUpscaler3DRefineHandoff clone-strips
|
|
652
|
+
// the Drift-Control AV function before its guider samples — the
|
|
653
|
+
// estate python wall tests/test_h3_refine_handoff_strip.py judges
|
|
654
|
+
// the cure live and pins the burn's verbatim ValueError). The
|
|
655
|
+
// shape judges above stay law; the carried bag rides the round-27
|
|
656
|
+
// carry walk (the "ZERO DIFFERENCE" seat).
|
|
634
657
|
assertRefineCarryLawful(bag, origins, originsCarries);
|
|
635
|
-
|
|
636
|
-
.map((carry, k) => `window ${k}→${k + 1} carries ${carry} f`)
|
|
637
|
-
.join(', ');
|
|
638
|
-
throw new Error(refineCarryStanddown(`the carried join${originsCarries.length === 1 ? '' : 's'} (${spans})`));
|
|
658
|
+
return renderH3RefineCarry(bag, p, facts, g, origins, originsCarries, runId);
|
|
639
659
|
}
|
|
640
660
|
const prefixes = [];
|
|
641
661
|
const saves = [];
|
|
@@ -691,7 +711,7 @@ export function renderH3RefineWindows(entry, p, facts, g, runId, loop) {
|
|
|
691
711
|
}
|
|
692
712
|
const clipSeconds = num(entry, 'clip_seconds', REFINE_DEFAULT_CLIP_SECONDS);
|
|
693
713
|
if (!(clipSeconds > 0)) {
|
|
694
|
-
throw new Error(`h3-timeline refine: clip_seconds ${clipSeconds} — a refine window needs frames (the seat is the loader's frame_load_cap: seconds × 24 at the film clock; the
|
|
714
|
+
throw new Error(`h3-timeline refine: clip_seconds ${clipSeconds} — a refine window needs frames (the seat is the loader's frame_load_cap: seconds × 24 at the film clock; the design window is ${REFINE_DEFAULT_CLIP_SECONDS} s = ${Math.round(REFINE_DEFAULT_CLIP_SECONDS * 24)} f, the 2 s class's rung — the carry-joined window, not the widest-green workaround)`);
|
|
695
715
|
}
|
|
696
716
|
const startFrames = Math.round(num(entry, 'start_seconds', 0) * 24);
|
|
697
717
|
const cap = Math.max(1, Math.round(clipSeconds * 24));
|
|
@@ -724,12 +744,13 @@ export function renderH3RefineWindows(entry, p, facts, g, runId, loop) {
|
|
|
724
744
|
}));
|
|
725
745
|
const carries = new Array(loop.windows - 1).fill(loop.overlapFrames);
|
|
726
746
|
const entries = new Array(loop.windows).fill(entry);
|
|
727
|
-
|
|
728
|
-
//
|
|
729
|
-
//
|
|
747
|
+
|
|
748
|
+
// the handoff strips the foreign Drift-Control patch before its
|
|
749
|
+
// second pass (tests/test_h3_refine_handoff_strip.py judges the
|
|
750
|
+
// cure live); the loop's carried joins ride the same round-27
|
|
751
|
+
// carry walk as the bag's.
|
|
730
752
|
assertRefineCarryLawful(entries, windows, carries);
|
|
731
|
-
|
|
732
|
-
throw new Error(refineCarryStanddown(`a ${loop.windows}-window loop at a ${loop.overlapFrames} f overlap (${joins} carried join${joins === 1 ? '' : 's'})`));
|
|
753
|
+
return renderH3RefineCarry(entries, p, facts, g, windows, carries, runId);
|
|
733
754
|
}
|
|
734
755
|
for (let k = 0; k < loop.windows; k += 1) {
|
|
735
756
|
const prefix = `${runId}/refine_w${k}`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GraphBuilder, OutputHandle } from '@melite/comfyui-card-kit/graph';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export declare function mountRefModBake(g: GraphBuilder, opts: {
|
|
23
|
+
p: Record<string, unknown>;
|
|
24
|
+
bagMods?: readonly string[];
|
|
25
|
+
cond: OutputHandle;
|
|
26
|
+
vaeVideo: OutputHandle;
|
|
27
|
+
vaeAudio: OutputHandle;
|
|
28
|
+
}): OutputHandle;
|
|
29
|
+
//# sourceMappingURL=refmodBake.d.ts.map
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { mediaKindOf } from '@melite/contracts/mediaKinds';
|
|
2
|
+
import { wireList } from './schema.js';
|
|
3
|
+
import { REF_CAPS } from './timelineContract.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export function mountRefModBake(g, opts) {
|
|
25
|
+
const { p, cond: inCond, vaeVideo, vaeAudio } = opts;
|
|
26
|
+
let cond = inCond;
|
|
27
|
+
const bagMods = opts.bagMods ?? [];
|
|
28
|
+
const declaredMods = wireList(p.ref_mods);
|
|
29
|
+
const seenMods = new Set(declaredMods.map((m) => m.trim()));
|
|
30
|
+
const refModsAll = [...declaredMods, ...bagMods.filter((m) => !seenMods.has(m.trim()))];
|
|
31
|
+
if (refModsAll.length === 0)
|
|
32
|
+
return cond;
|
|
33
|
+
if (refModsAll.length > REF_CAPS.refmods) {
|
|
34
|
+
throw new Error(`[h3-timeline] ref_mods exceeds the loader's ${String(REF_CAPS.refmods)} slots (saw ${String(refModsAll.length)})`);
|
|
35
|
+
}
|
|
36
|
+
const modStems = [];
|
|
37
|
+
const modImages = [];
|
|
38
|
+
const modVideos = [];
|
|
39
|
+
const modAudios = [];
|
|
40
|
+
for (const src of refModsAll) {
|
|
41
|
+
// Trim, then query-strip (the estate precedent:
|
|
42
|
+
// timelineContract's _kindOfFile splits '?' first), then split
|
|
43
|
+
// on BOTH separators — a backslash-prefixed or padded entry
|
|
44
|
+
// would otherwise pass the suffix check with junk baked into
|
|
45
|
+
// the stem and die server-side as a combo miss. The two `as`
|
|
46
|
+
// casts are total (split always yields a non-empty array), so
|
|
47
|
+
// this adds no defensive branches to the coverage face.
|
|
48
|
+
// A data: URL rides VERBATIM past the split (the studio's
|
|
49
|
+
// upload chips commit data URLs; the run's staging walk
|
|
50
|
+
// uploads them into the engine's input tree and rewrites the
|
|
51
|
+
// load nodes' slots — the family reads off the MIME here).
|
|
52
|
+
const raw = src.trim();
|
|
53
|
+
const query = raw.split('?')[0];
|
|
54
|
+
const base = query.split(/[\\/]/).pop();
|
|
55
|
+
if (raw.startsWith('data:')) {
|
|
56
|
+
const mime = /^data:([^;,]+)[;,]/.exec(raw)?.[1] ?? '';
|
|
57
|
+
if (mime.startsWith('image/'))
|
|
58
|
+
modImages.push(raw);
|
|
59
|
+
else if (mime.startsWith('video/'))
|
|
60
|
+
modVideos.push(raw);
|
|
61
|
+
else if (mime.startsWith('audio/'))
|
|
62
|
+
modAudios.push(raw);
|
|
63
|
+
else {
|
|
64
|
+
throw new Error(`[h3-timeline] ref_mods entries are ANY media (image/video/audio — the system bakes the pack) or pre-baked .safetensors stems under models/refmods/ (saw '${src.slice(0, 60)}')`);
|
|
65
|
+
}
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (base.endsWith('.safetensors')) {
|
|
69
|
+
modStems.push(base.slice(0, -'.safetensors'.length));
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
// ANY media boards (mediaKindOf — the contracts SSOT): image →
|
|
73
|
+
// the creator's refs_image.ref_image_N, video →
|
|
74
|
+
// refs_video.ref_video_N via the component split, audio → the
|
|
75
|
+
// audio extractor. Anything the estate does not recognize as
|
|
76
|
+
// media refuses HERE, loud, instead of dying server-side (the
|
|
77
|
+
// I2V census-alignment law).
|
|
78
|
+
const kind = mediaKindOf(base);
|
|
79
|
+
if (kind === 'image')
|
|
80
|
+
modImages.push(query);
|
|
81
|
+
else if (kind === 'video')
|
|
82
|
+
modVideos.push(query);
|
|
83
|
+
else if (kind === 'audio')
|
|
84
|
+
modAudios.push(query);
|
|
85
|
+
else {
|
|
86
|
+
throw new Error(`[h3-timeline] ref_mods entries are ANY media (image/video/audio — the system bakes the pack) or pre-baked .safetensors stems under models/refmods/ (saw '${src}')`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// The chain's law: each mods source appends through its own
|
|
90
|
+
// Apply (Apply passes conditioning through, one mods input), in
|
|
91
|
+
// fixed order — pre-baked stems, the baked visual pack, then
|
|
92
|
+
// each baked audio pack.
|
|
93
|
+
const applyMods = (mods) => {
|
|
94
|
+
cond = g.node('MiniMaxH3RefModApply', {
|
|
95
|
+
conditioning: cond, mods, override: false, retention: 1,
|
|
96
|
+
curve_direction: 'constant', scramble_seed: -1,
|
|
97
|
+
curve_shape: 'linear', curve_value: 1,
|
|
98
|
+
}).out(0);
|
|
99
|
+
};
|
|
100
|
+
if (modStems.length > 0) {
|
|
101
|
+
const loaderInputs = { show_info: false };
|
|
102
|
+
for (let i = 0; i < REF_CAPS.refmods; i++) {
|
|
103
|
+
const stem = modStems[i];
|
|
104
|
+
loaderInputs[`mod_${i + 1}`] = stem === undefined ? '(none)' : stem;
|
|
105
|
+
loaderInputs[`strength_${i + 1}`] = 1;
|
|
106
|
+
loaderInputs[`copies_${i + 1}`] = 1;
|
|
107
|
+
}
|
|
108
|
+
applyMods(g.node('MiniMaxH3RefModsLoader', loaderInputs).out(0));
|
|
109
|
+
}
|
|
110
|
+
if (modImages.length > 0 || modVideos.length > 0) {
|
|
111
|
+
// One creator node stacks every visual ref of the seat into a
|
|
112
|
+
// single video-kind mod (the node's own grammar: stills into
|
|
113
|
+
// the refs_image autogrow container's grown slots, frame
|
|
114
|
+
// batches into refs_video's — DOTTED container.slot addressing,
|
|
115
|
+
// the r2v ref_images.ref_image_0 receipt; a BARE ref_image_1
|
|
116
|
+
// key is an undeclared input and phase 1 refuses it, the
|
|
117
|
+
|
|
118
|
+
// ref's basename, sanitized node-side — a data: upload chip
|
|
119
|
+
// has no basename, so a data-only seat names the generic
|
|
120
|
+
// 'mod'. save rides the node default (true) so the baked pack
|
|
121
|
+
// lands in the loader's dropdown for later reuse.
|
|
122
|
+
const firstVisual = (modImages[0] ?? modVideos[0]);
|
|
123
|
+
const nameBase = firstVisual.startsWith('data:') ? 'mod' : firstVisual.split(/[\\/]/).pop()?.replace(/\.[^.]+$/, '') ?? 'mod';
|
|
124
|
+
// THE STATED BAKE (study §5/§7.2; value-arms ARMs 13/14): the
|
|
125
|
+
// fidelity dials are DECLARED params (schema.ts, the refmod
|
|
126
|
+
// group) and ride the node verbatim. The fallbacks are the
|
|
127
|
+
// declared defaults verbatim — one owner, the schema.
|
|
128
|
+
const bakeMode = typeof p.refmod_mode === 'string' ? p.refmod_mode : 'Compressed Reference';
|
|
129
|
+
const bakePool = typeof p.refmod_pool === 'number' && Number.isFinite(p.refmod_pool) ? p.refmod_pool : 16;
|
|
130
|
+
const bakeIdentity = typeof p.refmod_identity === 'number' && Number.isFinite(p.refmod_identity) ? p.refmod_identity : 500;
|
|
131
|
+
const extractInputs = {
|
|
132
|
+
name: nameBase,
|
|
133
|
+
mode: bakeMode, concept_type: 'generic',
|
|
134
|
+
save: p.refmod_save !== false,
|
|
135
|
+
pool_h: bakePool, pool_w: bakePool, identity: bakeIdentity,
|
|
136
|
+
|
|
137
|
+
// (MiniMax-H3 VAE loader) or a standard VAE' — the engine
|
|
138
|
+
// refuses the extract at run time without one; both inputs
|
|
139
|
+
// are schema-optional, so no phase-1 judge can catch it).
|
|
140
|
+
// The family's own optimized H3 VAE rides (the int8-convrot
|
|
141
|
+
// video VAE, the same handle the film lane loads); no
|
|
142
|
+
// MINIMAX_H3_AV_ENCODER loader node exists in this engine's
|
|
143
|
+
// /object_info, so the standard-VAE input is THE wire.
|
|
144
|
+
vae: vaeVideo,
|
|
145
|
+
};
|
|
146
|
+
modImages.forEach((img, i) => {
|
|
147
|
+
extractInputs[`refs_image.ref_image_${i}`] = g.node('LoadImage', { image: img, upload: 'image' }).out(0);
|
|
148
|
+
});
|
|
149
|
+
modVideos.forEach((vid, i) => {
|
|
150
|
+
extractInputs[`refs_video.ref_video_${i}`] = g.node('GetVideoComponents', {
|
|
151
|
+
video: g.node('LoadVideo', { file: vid }).out(),
|
|
152
|
+
}).out(0);
|
|
153
|
+
});
|
|
154
|
+
applyMods(g.node('MiniMaxH3RefModExtract', extractInputs).out(0));
|
|
155
|
+
}
|
|
156
|
+
for (const src of modAudios) {
|
|
157
|
+
// Audio mods are their own extractor (AUDIO in, one mod out);
|
|
158
|
+
// one node per entry, voice-grade defaults, saved for reuse
|
|
159
|
+
// (a data: upload chip names the generic 'audio_mod').
|
|
160
|
+
// budget_policy + concept_type are REQUIRED bare combos in the
|
|
161
|
+
// engine's /object_info — no declared default, so no primed
|
|
162
|
+
// builder autofills them (the B7 wall refuses at compose) — the
|
|
163
|
+
// graph states the pack's own signature defaults
|
|
164
|
+
// (vendor/ComfyUI-MiniMaxH3Mod/nodes.py:2143: budget_policy
|
|
165
|
+
// 'error', concept_type 'voice').
|
|
166
|
+
applyMods(g.node('MiniMaxH3RefModAudioExtract', {
|
|
167
|
+
audio: g.node('LoadAudio', { audio: src }).out(),
|
|
168
|
+
audio_vae: vaeAudio,
|
|
169
|
+
name: src.startsWith('data:') ? 'audio_mod' : src.split(/[\\/]/).pop()?.replace(/\.[^.]+$/, '') ?? 'audio_mod',
|
|
170
|
+
budget_policy: 'error', concept_type: 'voice',
|
|
171
|
+
save: true,
|
|
172
|
+
}).out(0));
|
|
173
|
+
}
|
|
174
|
+
return cond;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=refmodBake.js.map
|