@melite/models-h3 0.1.5-pre-alpha → 0.2.2-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/LICENSE +561 -457
- package/README.md +11 -16
- package/lib/actions.d.ts +100 -17
- package/lib/actions.js +1505 -257
- package/lib/chainEdit.d.ts +196 -0
- package/lib/chainEdit.js +334 -0
- package/lib/chainUpscale.d.ts +25 -0
- package/lib/chainUpscale.js +134 -0
- package/lib/extend.d.ts +25 -0
- package/lib/extend.js +221 -0
- package/lib/filmMix.d.ts +28 -12
- package/lib/filmMix.js +47 -16
- package/lib/finalize.js +6 -1
- package/lib/index.d.ts +12 -0
- package/lib/index.js +269 -65
- package/lib/mods/loras.d.ts +18 -95
- package/lib/mods/loras.js +35 -10
- package/lib/refine.d.ts +170 -0
- package/lib/refine.js +775 -0
- package/lib/repair.d.ts +15 -0
- package/lib/repair.js +164 -0
- package/lib/reshoot.d.ts +201 -0
- package/lib/reshoot.js +399 -0
- package/lib/schema.d.ts +70 -13
- package/lib/schema.js +342 -60
- package/lib/swap.d.ts +14 -0
- package/lib/swap.js +95 -0
- package/lib/timelineContract.d.ts +170 -0
- package/lib/timelineContract.js +238 -2
- package/lib/windowSpec.d.ts +23 -0
- package/lib/windowSpec.js +49 -0
- package/package.json +23 -12
package/lib/reshoot.js
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/** The pack's clip-normalization node (the official chain's first
|
|
2
|
+
* stage — resamples to 24 fps, snaps the frame count to H3's 17k+5
|
|
3
|
+
* grid, centre-crops to the requested aspect at the pixel budget).
|
|
4
|
+
* The F13d grid-match burn this node kills at the source: the old
|
|
5
|
+
* chain resized VDA depth onto full-size frames by hand. */
|
|
6
|
+
export const CROSSVIEW_PREPARE_NODE = 'CrossViewPrepareClip';
|
|
7
|
+
/** The pack's reprojection node (the one class the pack always
|
|
8
|
+
* carried; the official graph wires moge_geometry, the metric
|
|
9
|
+
* input — never the legacy brightness-depth seat). */
|
|
10
|
+
export const CROSSVIEW_WARP_NODE = 'CrossViewWarp';
|
|
11
|
+
/** Core MoGe nodes (engine comfy_extras/nodes_moge.py — v0.37+,
|
|
12
|
+
* no pack provision rides them). */
|
|
13
|
+
export const MOGE_LOAD_NODE = 'LoadMoGeModel';
|
|
14
|
+
export const MOGE_INFER_NODE = 'MoGeInference';
|
|
15
|
+
/** The prepare node's own clock (it resamples every clip to 24 fps
|
|
16
|
+
* before the warp sees it) — the unit the guide duration is stated
|
|
17
|
+
* in. */
|
|
18
|
+
export const CROSSVIEW_PREP_FPS = 24;
|
|
19
|
+
/** The shortest window a re-shoot will guide: one second of prepared
|
|
20
|
+
* motion. Below this the warp carries no usable parallax and the
|
|
21
|
+
* guide outlives the window it is pinned into. */
|
|
22
|
+
export const CROSSVIEW_MIN_GUIDE_FRAMES = CROSSVIEW_PREP_FPS;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export function crossviewGuideSeconds(windowFrames) {
|
|
40
|
+
if (!Number.isFinite(windowFrames) || windowFrames <= 0) {
|
|
41
|
+
throw new Error('h3 re-shoot: the guide needs the window length in frames — a re-shoot window of ' + String(windowFrames) + ' frames cannot carry the camera guide');
|
|
42
|
+
}
|
|
43
|
+
if (windowFrames < CROSSVIEW_MIN_GUIDE_FRAMES) {
|
|
44
|
+
throw new Error('h3 re-shoot: window too short for the camera guide — ' + String(Math.round(windowFrames)) + ' frames is below the ' + String(CROSSVIEW_MIN_GUIDE_FRAMES) + '-frame floor (one second at ' + String(CROSSVIEW_PREP_FPS) + ' fps); author the re-shoot call on a longer span');
|
|
45
|
+
}
|
|
46
|
+
return windowFrames / CROSSVIEW_PREP_FPS;
|
|
47
|
+
}
|
|
48
|
+
/** MoGe-2 ViTL normal fp16 — the official workflow's one geometry
|
|
49
|
+
* checkpoint (Comfy-Org/MoGe on HF), already on the engine's
|
|
50
|
+
* geometry_estimation shelf. */
|
|
51
|
+
export const MOGE_MODEL = 'moge_2_vitl_normal_fp16.safetensors';
|
|
52
|
+
/** The CrossView LoRA (Cseti/MiniMax-H3_Ref2VA-LoRA-CrossView-Warp_v1
|
|
53
|
+
* on HF, the _3500 step file comfy-reshoot pins): trained against
|
|
54
|
+
* the warp guide, it is what makes H3 FOLLOW the moved camera.
|
|
55
|
+
* Arm-functional, not a Modifiers row — the Fun ControlNet patch
|
|
56
|
+
* precedent (a per-arm model file provisioned by the family, never
|
|
57
|
+
* a user-picked distill seat; the catalog is for adapters a user
|
|
58
|
+
* stacks freely, and this one is meaningless outside a reshoot). */
|
|
59
|
+
export const CROSSVIEW_LORA = 'h3/MiniMax-H3_Ref2VA-LoRA-CrossView-Warp_v1_3500.safetensors';
|
|
60
|
+
/** The LoRA's trigger word (the pack's own docs + the official
|
|
61
|
+
* graph's prompt is exactly `crossview.`) — rides the r2v prompt
|
|
62
|
+
* when the arm is armed, or the LoRA does not fire. */
|
|
63
|
+
export const CROSSVIEW_TRIGGER = 'crossview';
|
|
64
|
+
const num = (e, key, fallback) => {
|
|
65
|
+
const v = e[key];
|
|
66
|
+
return typeof v === 'number' && Number.isFinite(v) ? v : fallback;
|
|
67
|
+
};
|
|
68
|
+
/** The dial bands — MIRRORED from the card's RESHOOT_MOD field rows
|
|
69
|
+
* (the UI's own bounds; the wall judges the two homes in 1:1
|
|
70
|
+
* agreement). A bag entry rides the compose door as a loose dict,
|
|
71
|
+
* so the READER owns the refusal — out-of-domain dials refuse LOUD
|
|
72
|
+
* here, ahead of the engine, never as a ComfyUI widget 400. */
|
|
73
|
+
/** The app's default camera move (see {@link readReshootKnobs}). */
|
|
74
|
+
export const RESHOOT_DEFAULT_POSE = {
|
|
75
|
+
orbit: -30,
|
|
76
|
+
tilt: 20,
|
|
77
|
+
};
|
|
78
|
+
/** The smallest pose the CrossView LoRA accepts as a camera MOVE. The
|
|
79
|
+
* pack's README: "Avoid near-zero angles — the LoRA misbehaves when
|
|
80
|
+
* the warp is almost identical to the source." Below this both-angle
|
|
81
|
+
* floor the warp is the input clip plus hole noise, and the guide
|
|
82
|
+
* prior contradicts the source prior instead of extending it. */
|
|
83
|
+
export const RESHOOT_MIN_POSE_DEGREES = 5;
|
|
84
|
+
export const RESHOOT_DIAL_BOUNDS = {
|
|
85
|
+
orbit: [-180, 180],
|
|
86
|
+
tilt: [-90, 90],
|
|
87
|
+
dolly: [0.1, 3],
|
|
88
|
+
zoom: [20, 120],
|
|
89
|
+
pan: [-1, 1],
|
|
90
|
+
|
|
91
|
+
// floor — under 0.8 the warp is followed less and the model's prior
|
|
92
|
+
// rebuilds the frame (the F33 anime drift); the old 0.5 floor left the
|
|
93
|
+
// drift reachable from [0.5, 0.8).)
|
|
94
|
+
strength: [0.8, 1],
|
|
95
|
+
depth_ratio: [1.5, 1000],
|
|
96
|
+
};
|
|
97
|
+
/** The dial defaults (the OFFICIAL app's own slider posture — the
|
|
98
|
+
* identity camera is not a re-shoot, so absent dials never fall to
|
|
99
|
+
* zero). */
|
|
100
|
+
const DIAL_DEFAULTS = {
|
|
101
|
+
orbit: RESHOOT_DEFAULT_POSE.orbit,
|
|
102
|
+
tilt: RESHOOT_DEFAULT_POSE.tilt,
|
|
103
|
+
dolly: 1.0,
|
|
104
|
+
zoom: 50,
|
|
105
|
+
pan: 0,
|
|
106
|
+
strength: 0.8,
|
|
107
|
+
depth_ratio: 6,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
const DIAL_UNITS = {
|
|
115
|
+
orbit: 'degrees of orbit (negative orbits left, positive right; ±45 tested)',
|
|
116
|
+
tilt: 'degrees of elevation (positive looks down; below −20 is the weak direction)',
|
|
117
|
+
dolly: 'camera distance where 1.0 keeps the source distance (below 1 dollies in)',
|
|
118
|
+
zoom: 'lens field of view in degrees (50 = a normal lens; NOT a multiplier)',
|
|
119
|
+
pan: 'vertical framing shift as a fraction of frame height (the camera does not move)',
|
|
120
|
+
strength: 'CrossView LoRA strength (the official tested band; under 0.8 the prior rebuilds the frame)',
|
|
121
|
+
depth_ratio: 'scene depth as a far/near ratio (2.5–4 close-ups, 4–8 mid, 8–16 wide)',
|
|
122
|
+
};
|
|
123
|
+
/** THE ALL-DIALS REFUSAL (the F13 cure): the compose iterates every
|
|
124
|
+
* dial anyway — the refusal reports them the same way, each with its
|
|
125
|
+
* band AND its unit, so ONE round trip states the whole camera. The
|
|
126
|
+
* old per-dial throw burned five presses on one bag entry (zoom,
|
|
127
|
+
* dolly, pan, strength, depth_ratio — each refusal naming exactly
|
|
128
|
+
* one dial and nothing else).
|
|
129
|
+
* @param e the bag's entry (the dial seat values, loose)
|
|
130
|
+
* @returns every dial's in-band value, keyed by wire name */
|
|
131
|
+
const bandedAll = (e) => {
|
|
132
|
+
const bad = [];
|
|
133
|
+
const dials = {};
|
|
134
|
+
for (const key of Object.keys(RESHOOT_DIAL_BOUNDS)) {
|
|
135
|
+
const v = num(e, key, DIAL_DEFAULTS[key]);
|
|
136
|
+
dials[key] = v;
|
|
137
|
+
const [lo, hi] = RESHOOT_DIAL_BOUNDS[key];
|
|
138
|
+
if (v < lo || v > hi) {
|
|
139
|
+
bad.push(`${key} ${v} is outside the camera band [${lo}, ${hi}] — ${DIAL_UNITS[key]}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (bad.length > 0) {
|
|
143
|
+
throw new Error(`h3 re-shoot: the bag's camera dials are out of band — ${bad.join('; ')} (the card's Reshoot rows state the same bounds; refused ahead of the engine, never a widget 400 — every offender named in one pass)`);
|
|
144
|
+
}
|
|
145
|
+
return dials;
|
|
146
|
+
};
|
|
147
|
+
/** The bag's first (and only — max_stack 1) entry, typed loose. */
|
|
148
|
+
const bagEntry = (p) => {
|
|
149
|
+
const bag = p.reshoot;
|
|
150
|
+
if (!Array.isArray(bag) || bag.length === 0)
|
|
151
|
+
return undefined;
|
|
152
|
+
const e = bag[0];
|
|
153
|
+
return typeof e === 'object' && e !== null && !Array.isArray(e)
|
|
154
|
+
? e
|
|
155
|
+
: undefined;
|
|
156
|
+
};
|
|
157
|
+
/** THE OFFICIAL APP'S POSE (Comfy-Org/comfy-reshoot,
|
|
158
|
+
* workflows/generate.api.json node 5: azimuth -30, elevation 20, the
|
|
159
|
+
* app's own slider defaults) — never the identity camera. The pack's
|
|
160
|
+
* README names the failure mode verbatim: "Avoid near-zero angles —
|
|
161
|
+
* the LoRA misbehaves when the warp is almost identical to the
|
|
162
|
+
* source." The identity default shipped a warp indistinguishable from
|
|
163
|
+
* the input, fed it to a camera LoRA as the geometric prior, and
|
|
164
|
+
* round 5 measured the result (a second subject at a second scale).
|
|
165
|
+
* The neutral pose is therefore the app's DEFAULT camera move: orbit
|
|
166
|
+
* -30°, tilt +20° (inside the green training zone), the source
|
|
167
|
+
* distance, a normal 50° lens, no framing shift. The
|
|
168
|
+
* strength default is the official 0.8 (the LoRA's own tested
|
|
169
|
+
* band is 0.5–1, served default 0.8). */
|
|
170
|
+
export function readReshootKnobs(p) {
|
|
171
|
+
const e = bagEntry(p) ?? {};
|
|
172
|
+
const dials = bandedAll(e);
|
|
173
|
+
return {
|
|
174
|
+
orbit: dials.orbit,
|
|
175
|
+
tilt: dials.tilt,
|
|
176
|
+
dolly: dials.dolly,
|
|
177
|
+
zoom: dials.zoom,
|
|
178
|
+
pan: dials.pan,
|
|
179
|
+
strength: dials.strength,
|
|
180
|
+
depthRatio: dials.depth_ratio,
|
|
181
|
+
smoothDepth: e.smooth_depth === true,
|
|
182
|
+
invertDepth: e.invert_depth === true,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/** The arm predicate: BAG PRESENCE — the same law as the replace/
|
|
186
|
+
* repair/extend arms (the fourth-mod-bag unification: a commission
|
|
187
|
+
* is armed when its bag is a NON-EMPTY ARRAY, whatever its entry's
|
|
188
|
+
* shape). A non-object entry and a bag whose entry names no source
|
|
189
|
+
* clip both stay ARMED and refuse loud at the chain build (the
|
|
190
|
+
* compose's missing-required law) — neither quietly disarms the
|
|
191
|
+
* film. Absent or empty bag = the compose never sees the chain
|
|
192
|
+
* (byte-stable graphs). */
|
|
193
|
+
export function reshootArmed(p) {
|
|
194
|
+
const bag = p.reshoot;
|
|
195
|
+
return Array.isArray(bag) && bag.length > 0;
|
|
196
|
+
}
|
|
197
|
+
/** The r2v prompt seat under the arm: the trigger word leads (the
|
|
198
|
+
* official graph's prompt is exactly `crossview.` — the LoRA fires
|
|
199
|
+
* on the word's presence, the estate's own motion prose follows). */
|
|
200
|
+
export function reshootPrompt(prompt) {
|
|
201
|
+
return `${CROSSVIEW_TRIGGER}. ${prompt}`.trim();
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Build the re-shoot chain on the run's graph (once per compose).
|
|
205
|
+
*
|
|
206
|
+
* @param p the gated compose doc (the reshoot bag's entry carries
|
|
207
|
+
* source_clip + the camera knobs; reshootArmed gates the build)
|
|
208
|
+
* @param g the run's graph builder
|
|
209
|
+
* @param windowFrames the SHORTEST window this run renders (the guide
|
|
210
|
+
* is pinned into every window, so its duration derives from this —
|
|
211
|
+
* F28)
|
|
212
|
+
* @param runId the run's own id — scopes the two preview saves under
|
|
213
|
+
* the run's output folder so the artifact harvest lists them with
|
|
214
|
+
* the film (§8.7)
|
|
215
|
+
* @returns the shared handles for the per-window seats
|
|
216
|
+
*/
|
|
217
|
+
export function buildH3Reshoot(p, g, windowFrames, runId) {
|
|
218
|
+
const entry = bagEntry(p);
|
|
219
|
+
const clip = (entry?.source_clip ?? '').trim();
|
|
220
|
+
if (clip === '') {
|
|
221
|
+
throw new Error('h3 re-shoot: the reshoot bag carries an entry but names no source clip — a re-shoot needs the video whose scene the new camera views');
|
|
222
|
+
}
|
|
223
|
+
const knobs = readReshootKnobs(p);
|
|
224
|
+
// THE IDENTITY CAMERA IS NOT A RE-SHOOT (the pack README's warning as
|
|
225
|
+
// a compose-door refusal): a pose with no orbit and no tilt builds a
|
|
226
|
+
// warp almost identical to the source, which is the one condition the
|
|
227
|
+
// CrossView LoRA documents as misbehaving.
|
|
228
|
+
if (Math.abs(knobs.orbit) < RESHOOT_MIN_POSE_DEGREES &&
|
|
229
|
+
Math.abs(knobs.tilt) < RESHOOT_MIN_POSE_DEGREES) {
|
|
230
|
+
throw new Error(`h3 re-shoot: the camera pose is ${knobs.orbit}° orbit / ${knobs.tilt}° tilt — both under the ${RESHOOT_MIN_POSE_DEGREES}° floor, so the warp is almost identical to the source; the CrossView pack documents that pose as the one the LoRA misbehaves on ("avoid near-zero angles"). Set orbit or tilt to a real move (the app's default is -30° / +20°)`);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// one node that emits the VIDEO type CrossViewPrepareClip demands.
|
|
234
|
+
// The sibling arms' VHS seat stays theirs — VHS serves force-rate
|
|
235
|
+
// frames + audio for chains that consume frames; this chain hands
|
|
236
|
+
// the WHOLE video to the prepare node, which owns the resample
|
|
237
|
+
// (24 fps), the frame-grid snap and the crop — the staged leaf
|
|
238
|
+
// binds by name on the same input directory both loaders read.
|
|
239
|
+
const video = g.node('LoadVideo', { file: clip }).out(0);
|
|
240
|
+
// stage 1 — normalize: every downstream grid fact (width, height,
|
|
241
|
+
// length) comes from THIS node's outputs, never the raw clip
|
|
242
|
+
|
|
243
|
+
// TARGET's, never the pack's 0.5 MP default. The round-4 researh
|
|
244
|
+
// measured the cost of the default: a 0.97 MP plate squeezed to
|
|
245
|
+
// ~942×530 fed BOTH ref_video_0 and the guide for a 1344×768
|
|
246
|
+
// render — 48 % of the plate discarded, then reconstructed at
|
|
247
|
+
// 2.06×, which is the soft render the operator saw. The budget
|
|
248
|
+
// therefore tracks the window shape the doc states.
|
|
249
|
+
const targetW = p.width;
|
|
250
|
+
const targetH = p.height;
|
|
251
|
+
if (!Number.isFinite(targetW) || !Number.isFinite(targetH)) {
|
|
252
|
+
throw new Error('h3 re-shoot: the plate budget reads the render target — the doc carries no finite width/height (' + String(targetW) + '×' + String(targetH) + '); re-shoot documents walk the schema first (1344×768 are the declared defaults)');
|
|
253
|
+
}
|
|
254
|
+
const targetMp = (targetW * targetH) / 1_000_000;
|
|
255
|
+
const prep = g.node(CROSSVIEW_PREPARE_NODE, {
|
|
256
|
+
video,
|
|
257
|
+
duration: crossviewGuideSeconds(windowFrames),
|
|
258
|
+
aspect_ratio: 'source',
|
|
259
|
+
megapixels: Number(targetMp.toFixed(3)),
|
|
260
|
+
multiple: 32,
|
|
261
|
+
});
|
|
262
|
+
// metric geometry — MoGe-2 with forced projection and mask refine
|
|
263
|
+
// (the official literals; brightness depth died with the old chain)
|
|
264
|
+
const moge = g.node(MOGE_LOAD_NODE, { model_name: MOGE_MODEL }).out(0);
|
|
265
|
+
const geometry = g.node(MOGE_INFER_NODE, {
|
|
266
|
+
moge_model: moge,
|
|
267
|
+
image: prep.out(0),
|
|
268
|
+
resolution_level: 2,
|
|
269
|
+
fov_x_degrees: 0,
|
|
270
|
+
batch_size: 4,
|
|
271
|
+
force_projection: true,
|
|
272
|
+
apply_mask: true,
|
|
273
|
+
refine_steps: 3,
|
|
274
|
+
}).out(0);
|
|
275
|
+
// the warp — every literal below is the official graph's own
|
|
276
|
+
// (pose dials from the bag, the rest the verified posture)
|
|
277
|
+
const warpNode = g.node(CROSSVIEW_WARP_NODE, {
|
|
278
|
+
frames: prep.out(0),
|
|
279
|
+
moge_geometry: geometry,
|
|
280
|
+
azimuth: knobs.orbit,
|
|
281
|
+
elevation: knobs.tilt,
|
|
282
|
+
distance: knobs.dolly,
|
|
283
|
+
hfov: knobs.zoom,
|
|
284
|
+
vertical_shift: knobs.pan,
|
|
285
|
+
depth_ratio: knobs.depthRatio,
|
|
286
|
+
smooth_depth: knobs.smoothDepth,
|
|
287
|
+
invert_depth: knobs.invertDepth,
|
|
288
|
+
roll_lock: false,
|
|
289
|
+
pivot_override: false,
|
|
290
|
+
pivot_x: 0.0,
|
|
291
|
+
pivot_y: 0.0,
|
|
292
|
+
pivot_z: 1.05,
|
|
293
|
+
use_keyframes: false,
|
|
294
|
+
frame_count: 0,
|
|
295
|
+
keyframes: '',
|
|
296
|
+
interp_motion: 'linear',
|
|
297
|
+
interpolation: 'linear',
|
|
298
|
+
keep_source_aim: true,
|
|
299
|
+
preview_size: 384,
|
|
300
|
+
frame_index: 1,
|
|
301
|
+
});
|
|
302
|
+
// THE TWO SEATS ARE THE OFFICIAL APP'S OWN (Comfy-Org/comfy-reshoot,
|
|
303
|
+
|
|
304
|
+
// ref_videos.ref_video_0 <- CrossViewPrepareClip.out(0)
|
|
305
|
+
// (node 20 inputs; the SOURCE clip —
|
|
306
|
+
// appearance + identity)
|
|
307
|
+
// MiniMaxH3AddGuide.image <- CrossViewWarp.out(0)
|
|
308
|
+
// (node 21 inputs; the warp WITH its
|
|
309
|
+
// magenta disocclusions — the training
|
|
310
|
+
// signal, never a fill)
|
|
311
|
+
// This builder had collapsed both seats onto a filled warp (the
|
|
312
|
+
// F30 hole fill, which round 5 measured as a second full-size
|
|
313
|
+
// subject). The official app runs NO mask, NO grow, NO composite
|
|
314
|
+
// and NO blur: the CrossView LoRA was trained on the holed warp
|
|
315
|
+
// and reconstructs what the camera never saw, while the clean
|
|
316
|
+
// source clip carries identity. Those are the two priors, and the
|
|
317
|
+
// collapse is what starved the render.
|
|
318
|
+
const warp = warpNode.out(0);
|
|
319
|
+
const source = prep.out(0);
|
|
320
|
+
// THE TWO WITNESSES (§8.7): the plate the guide PINS and the pack's
|
|
321
|
+
// `orbit_view` gizmo (output 1: the camera dome with its
|
|
322
|
+
// az/el/dist overlay). Both save under the run's folder — zero
|
|
323
|
+
// extra compute (the tensors already exist), and the harvest lists
|
|
324
|
+
// them beside the film.
|
|
325
|
+
//
|
|
326
|
+
// ONE plate, never the warp clip: CrossViewWarp emits every warped
|
|
327
|
+
// frame, so saving `warp` raw wrote N PNGs per re-shoot (the
|
|
328
|
+
// operator's 90-file harvest of one still, report §13.1). The guide
|
|
329
|
+
// reads frame 0 (`MiniMaxH3AddGuide.frame_idx 0`), so the witness
|
|
330
|
+
// selects exactly that frame — the same take the guide pinned,
|
|
331
|
+
// holes and all, which is what makes the witness evidence.
|
|
332
|
+
const plate = g.node('ImageFromBatch', {
|
|
333
|
+
image: warp,
|
|
334
|
+
batch_index: 0,
|
|
335
|
+
length: 1,
|
|
336
|
+
}).out(0);
|
|
337
|
+
const plateSave = g.node('SaveImage', {
|
|
338
|
+
images: plate,
|
|
339
|
+
filename_prefix: `${runId}/reshoot_warp`,
|
|
340
|
+
}).out(0);
|
|
341
|
+
const orbitSave = g.node('SaveImage', {
|
|
342
|
+
images: warpNode.out(1),
|
|
343
|
+
filename_prefix: `${runId}/reshoot_orbit`,
|
|
344
|
+
}).out(0);
|
|
345
|
+
return {
|
|
346
|
+
refFrames: source,
|
|
347
|
+
warp,
|
|
348
|
+
plateSave,
|
|
349
|
+
orbitSave,
|
|
350
|
+
prepWidth: prep.out(1),
|
|
351
|
+
prepHeight: prep.out(2),
|
|
352
|
+
prepLength: prep.out(3),
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* The per-window MODEL seat: the CrossView LoRA on the window's
|
|
357
|
+
* model, post sigma shift (the official order — the distill lora
|
|
358
|
+
* loads first, the shift + attention ride over it, the CrossView
|
|
359
|
+
* LoRA applies LAST so the camera-trained adapters win). Mounted
|
|
360
|
+
* ahead of the file-based picks chain — the camera spine; picks
|
|
361
|
+
* refine on top.
|
|
362
|
+
*
|
|
363
|
+
* @param g the window's (scoped) builder
|
|
364
|
+
* @param model the window's model so far (post sigma shift)
|
|
365
|
+
* @param p the gated doc (the strength dial rides, band 0.5–1)
|
|
366
|
+
* @returns the LoRA-loaded model handle for the scheduler chain
|
|
367
|
+
*/
|
|
368
|
+
export function applyH3ReshootModel(g, model, p) {
|
|
369
|
+
return g.node('LoraLoaderModelOnly', {
|
|
370
|
+
model,
|
|
371
|
+
lora_name: CROSSVIEW_LORA,
|
|
372
|
+
strength_model: readReshootKnobs(p).strength,
|
|
373
|
+
}).out();
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* The per-window CONDITIONING seat: the warp pinned into the
|
|
377
|
+
* window's own AV latent at row 0 through MiniMaxH3AddGuide — the
|
|
378
|
+
* H3-native guide lane (the same node the estate's keyframe pins
|
|
379
|
+
* ride), the official chain's image seat verbatim. Mounts AFTER the
|
|
380
|
+
* arm's own guide pins (audio first, keyframes next, the camera
|
|
381
|
+
* spine last — the strongest structural prior closes the chain).
|
|
382
|
+
*
|
|
383
|
+
* @param g the window's (scoped) builder
|
|
384
|
+
* @param cond the window's positive conditioning so far
|
|
385
|
+
* @param latent the window's latent (the guide pins into it)
|
|
386
|
+
* @param vae the window's video VAE (the guide image encodes through it)
|
|
387
|
+
* @param chain the shared run-level handles
|
|
388
|
+
* @returns the guide-wrapped conditioning for the guider
|
|
389
|
+
*/
|
|
390
|
+
export function applyH3ReshootCond(g, cond, latent, vae, chain) {
|
|
391
|
+
return g.node('MiniMaxH3AddGuide', {
|
|
392
|
+
positive: cond,
|
|
393
|
+
latent,
|
|
394
|
+
vae,
|
|
395
|
+
image: chain.warp,
|
|
396
|
+
frame_idx: 0,
|
|
397
|
+
}).out(0);
|
|
398
|
+
}
|
|
399
|
+
//# sourceMappingURL=reshoot.js.map
|
package/lib/schema.d.ts
CHANGED
|
@@ -4,9 +4,18 @@ export declare const FAMILIES: readonly ["t4r", "t4_open", "t4_chain"];
|
|
|
4
4
|
export type Family = (typeof FAMILIES)[number];
|
|
5
5
|
export declare const wireList: typeof normalizeDeclaredRefs;
|
|
6
6
|
export declare const H3_RECOMMENDED_SAMPLERS: readonly ["euler", "euler_cfg_pp", "euler_ancestral", "dpmpp_2m", "dpmpp_2m_sde", "heun", "res_multistep", "res_multistep_cfg_pp", "er_sde", "seeds_2", "seeds_3"];
|
|
7
|
-
export declare const JSON_ARRAY_PARAMS: readonly ["calls", "audio_clips"];
|
|
7
|
+
export declare const JSON_ARRAY_PARAMS: readonly ["calls", "audio_clips", "keyframes"];
|
|
8
|
+
/** The fps rail's own bounds, one home: the row declares them and the
|
|
9
|
+
* internal seconds rail derives its own bounds from them (see
|
|
10
|
+
* fps_seconds) — a second rail must never invent a rival bound. */
|
|
11
|
+
export declare const FPS_RAIL_MIN = 1;
|
|
12
|
+
export declare const FPS_RAIL_MAX = 120;
|
|
13
|
+
/** The refinement window's DECLARED default — one home for the seat,
|
|
14
|
+
* the schema walk, and every wall/receipt that judges the unstated
|
|
15
|
+
* rider (the SOTA plan's researched 0.30–0.35 band; 1.0 is the
|
|
16
|
+
* taomate full-denoise mechanic, opt-in). */
|
|
17
|
+
export declare const REFINE_DENOISE_DEFAULT = 0.35;
|
|
8
18
|
export declare const paramSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
9
|
-
prompt: z<string, string, "plain">;
|
|
10
19
|
image: z<string, string, "plain">;
|
|
11
20
|
last_frame: z<string, string, "plain">;
|
|
12
21
|
ref_images: z<string[], string[], "plain">;
|
|
@@ -20,11 +29,16 @@ export declare const paramSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
|
20
29
|
}>>[], "plain">;
|
|
21
30
|
ref_audios: z<string[], string[], "plain">;
|
|
22
31
|
ref_mods: z<string[], string[], "plain">;
|
|
32
|
+
refmod_mode: z<string, string, "defined">;
|
|
33
|
+
refmod_pool: z<number, number, "defined">;
|
|
34
|
+
refmod_identity: z<number, number, "defined">;
|
|
35
|
+
refmod_save: z<boolean, boolean, "defined">;
|
|
23
36
|
duck_depth_db: z<number, number, "defined">;
|
|
24
37
|
seed: z<number, number, "defined">;
|
|
25
38
|
width: z<number, number, "defined">;
|
|
26
39
|
height: z<number, number, "defined">;
|
|
27
40
|
length: z<number, number, "defined">;
|
|
41
|
+
fps: z<number, number, "defined">;
|
|
28
42
|
steps: z<number, number, "defined">;
|
|
29
43
|
second_pass_enabled: z<boolean, boolean, "defined">;
|
|
30
44
|
sharpen_enabled: z<boolean, boolean, "defined">;
|
|
@@ -36,6 +50,9 @@ export declare const paramSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
|
36
50
|
refine_lora: z<string, string, "defined">;
|
|
37
51
|
refine_strength: z<number, number, "plain">;
|
|
38
52
|
refine_steps: z<number, number, "plain">;
|
|
53
|
+
refine_denoise: z<number, number, "defined">;
|
|
54
|
+
upscale_route: z<string, string, "defined">;
|
|
55
|
+
upscale_model: z<string, string, "defined">;
|
|
39
56
|
attention_backend: z<string, string, "defined">;
|
|
40
57
|
interp_model: z<string, string, "defined">;
|
|
41
58
|
interp_multiplier: z<number, number, "defined">;
|
|
@@ -56,19 +73,18 @@ export declare const paramSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
|
56
73
|
sla_protect_audio: z<boolean, boolean, "defined">;
|
|
57
74
|
sla_stabilize_motion: z<boolean, boolean, "plain">;
|
|
58
75
|
sla_disable_fp16_accum: z<boolean, boolean, "defined">;
|
|
59
|
-
sharpen_method: z<string, string, "
|
|
76
|
+
sharpen_method: z<string, string, "defined">;
|
|
60
77
|
sharpen_radius: z<number, number, "plain">;
|
|
61
78
|
sharpen_threshold: z<number, number, "plain">;
|
|
62
79
|
sharpen_iterations: z<number, number, "plain">;
|
|
63
80
|
k: z<number, number, "plain">;
|
|
64
81
|
noise_seed: z<number, number, "plain">;
|
|
65
|
-
fps_seconds: z<number, number, "
|
|
82
|
+
fps_seconds: z<number, number, "plain">;
|
|
66
83
|
interp_switch: z<boolean, boolean, "plain">;
|
|
67
84
|
sharpen_switch: z<boolean, boolean, "plain">;
|
|
68
85
|
sla_switch: z<boolean, boolean, "plain">;
|
|
69
86
|
image_name: z<string, string, "plain">;
|
|
70
87
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
71
|
-
prompt: z<string, string, "plain">;
|
|
72
88
|
image: z<string, string, "plain">;
|
|
73
89
|
last_frame: z<string, string, "plain">;
|
|
74
90
|
ref_images: z<string[], string[], "plain">;
|
|
@@ -82,11 +98,16 @@ export declare const paramSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
|
82
98
|
}>>[], "plain">;
|
|
83
99
|
ref_audios: z<string[], string[], "plain">;
|
|
84
100
|
ref_mods: z<string[], string[], "plain">;
|
|
101
|
+
refmod_mode: z<string, string, "defined">;
|
|
102
|
+
refmod_pool: z<number, number, "defined">;
|
|
103
|
+
refmod_identity: z<number, number, "defined">;
|
|
104
|
+
refmod_save: z<boolean, boolean, "defined">;
|
|
85
105
|
duck_depth_db: z<number, number, "defined">;
|
|
86
106
|
seed: z<number, number, "defined">;
|
|
87
107
|
width: z<number, number, "defined">;
|
|
88
108
|
height: z<number, number, "defined">;
|
|
89
109
|
length: z<number, number, "defined">;
|
|
110
|
+
fps: z<number, number, "defined">;
|
|
90
111
|
steps: z<number, number, "defined">;
|
|
91
112
|
second_pass_enabled: z<boolean, boolean, "defined">;
|
|
92
113
|
sharpen_enabled: z<boolean, boolean, "defined">;
|
|
@@ -98,6 +119,9 @@ export declare const paramSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
|
98
119
|
refine_lora: z<string, string, "defined">;
|
|
99
120
|
refine_strength: z<number, number, "plain">;
|
|
100
121
|
refine_steps: z<number, number, "plain">;
|
|
122
|
+
refine_denoise: z<number, number, "defined">;
|
|
123
|
+
upscale_route: z<string, string, "defined">;
|
|
124
|
+
upscale_model: z<string, string, "defined">;
|
|
101
125
|
attention_backend: z<string, string, "defined">;
|
|
102
126
|
interp_model: z<string, string, "defined">;
|
|
103
127
|
interp_multiplier: z<number, number, "defined">;
|
|
@@ -118,13 +142,13 @@ export declare const paramSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
|
118
142
|
sla_protect_audio: z<boolean, boolean, "defined">;
|
|
119
143
|
sla_stabilize_motion: z<boolean, boolean, "plain">;
|
|
120
144
|
sla_disable_fp16_accum: z<boolean, boolean, "defined">;
|
|
121
|
-
sharpen_method: z<string, string, "
|
|
145
|
+
sharpen_method: z<string, string, "defined">;
|
|
122
146
|
sharpen_radius: z<number, number, "plain">;
|
|
123
147
|
sharpen_threshold: z<number, number, "plain">;
|
|
124
148
|
sharpen_iterations: z<number, number, "plain">;
|
|
125
149
|
k: z<number, number, "plain">;
|
|
126
150
|
noise_seed: z<number, number, "plain">;
|
|
127
|
-
fps_seconds: z<number, number, "
|
|
151
|
+
fps_seconds: z<number, number, "plain">;
|
|
128
152
|
interp_switch: z<boolean, boolean, "plain">;
|
|
129
153
|
sharpen_switch: z<boolean, boolean, "plain">;
|
|
130
154
|
sla_switch: z<boolean, boolean, "plain">;
|
|
@@ -139,10 +163,28 @@ export declare const paramSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
|
139
163
|
* declared knobs — old drafts keep working because the schema admits
|
|
140
164
|
* them and the compose door overlays explicit params last (the
|
|
141
165
|
* img-to-mesh filename_prefix precedent). */
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
export declare const REFINE_PLANE_KEYS: readonly ["sched_name", "shift_video", "shift_audio", "sla_enabled", "sla_sparsity", "sla_block_size", "sla_min_seq_len", "sla_dense_last_steps", "sla_protect_audio", "sla_dense_steps", "sla_dense_backend", "sla_disable_fp16_accum", "sla_stabilize_motion", "sla_reference_protection"];
|
|
173
|
+
export declare const refinePlaneSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
174
|
+
[k: string]: z;
|
|
175
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
176
|
+
[k: string]: z;
|
|
177
|
+
}>>, "plain">;
|
|
142
178
|
export declare const coerceWireBoolean: (raw: Record<string, unknown>) => Record<string, unknown>;
|
|
179
|
+
/** THE PIN ROW SHAPE (one law, two seats): the doc walk and the compose
|
|
180
|
+
* gate both run this BEFORE any placement math — a row must carry a
|
|
181
|
+
* whole film-absolute frame and a non-empty image ref. Exported so the
|
|
182
|
+
* walk's refusal and the build door's are the same literal (the
|
|
183
|
+
* gate-and-walk wall pins them); placement and media existence stay
|
|
184
|
+
* the compose gate's, which owns the doc's calls/windows. */
|
|
185
|
+
export declare function assertKeyframeRowShape(rows: readonly unknown[]): void;
|
|
143
186
|
export declare function schema(v: unknown): Record<string, unknown>;
|
|
144
187
|
export declare const carrier: z<Schemastery.ObjectS<NoInfer<{
|
|
145
|
-
prompt: z<string, string, "plain">;
|
|
146
188
|
image: z<string, string, "plain">;
|
|
147
189
|
last_frame: z<string, string, "plain">;
|
|
148
190
|
ref_images: z<string[], string[], "plain">;
|
|
@@ -156,11 +198,16 @@ export declare const carrier: z<Schemastery.ObjectS<NoInfer<{
|
|
|
156
198
|
}>>[], "plain">;
|
|
157
199
|
ref_audios: z<string[], string[], "plain">;
|
|
158
200
|
ref_mods: z<string[], string[], "plain">;
|
|
201
|
+
refmod_mode: z<string, string, "defined">;
|
|
202
|
+
refmod_pool: z<number, number, "defined">;
|
|
203
|
+
refmod_identity: z<number, number, "defined">;
|
|
204
|
+
refmod_save: z<boolean, boolean, "defined">;
|
|
159
205
|
duck_depth_db: z<number, number, "defined">;
|
|
160
206
|
seed: z<number, number, "defined">;
|
|
161
207
|
width: z<number, number, "defined">;
|
|
162
208
|
height: z<number, number, "defined">;
|
|
163
209
|
length: z<number, number, "defined">;
|
|
210
|
+
fps: z<number, number, "defined">;
|
|
164
211
|
steps: z<number, number, "defined">;
|
|
165
212
|
second_pass_enabled: z<boolean, boolean, "defined">;
|
|
166
213
|
sharpen_enabled: z<boolean, boolean, "defined">;
|
|
@@ -172,6 +219,9 @@ export declare const carrier: z<Schemastery.ObjectS<NoInfer<{
|
|
|
172
219
|
refine_lora: z<string, string, "defined">;
|
|
173
220
|
refine_strength: z<number, number, "plain">;
|
|
174
221
|
refine_steps: z<number, number, "plain">;
|
|
222
|
+
refine_denoise: z<number, number, "defined">;
|
|
223
|
+
upscale_route: z<string, string, "defined">;
|
|
224
|
+
upscale_model: z<string, string, "defined">;
|
|
175
225
|
attention_backend: z<string, string, "defined">;
|
|
176
226
|
interp_model: z<string, string, "defined">;
|
|
177
227
|
interp_multiplier: z<number, number, "defined">;
|
|
@@ -192,19 +242,18 @@ export declare const carrier: z<Schemastery.ObjectS<NoInfer<{
|
|
|
192
242
|
sla_protect_audio: z<boolean, boolean, "defined">;
|
|
193
243
|
sla_stabilize_motion: z<boolean, boolean, "plain">;
|
|
194
244
|
sla_disable_fp16_accum: z<boolean, boolean, "defined">;
|
|
195
|
-
sharpen_method: z<string, string, "
|
|
245
|
+
sharpen_method: z<string, string, "defined">;
|
|
196
246
|
sharpen_radius: z<number, number, "plain">;
|
|
197
247
|
sharpen_threshold: z<number, number, "plain">;
|
|
198
248
|
sharpen_iterations: z<number, number, "plain">;
|
|
199
249
|
k: z<number, number, "plain">;
|
|
200
250
|
noise_seed: z<number, number, "plain">;
|
|
201
|
-
fps_seconds: z<number, number, "
|
|
251
|
+
fps_seconds: z<number, number, "plain">;
|
|
202
252
|
interp_switch: z<boolean, boolean, "plain">;
|
|
203
253
|
sharpen_switch: z<boolean, boolean, "plain">;
|
|
204
254
|
sla_switch: z<boolean, boolean, "plain">;
|
|
205
255
|
image_name: z<string, string, "plain">;
|
|
206
256
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
207
|
-
prompt: z<string, string, "plain">;
|
|
208
257
|
image: z<string, string, "plain">;
|
|
209
258
|
last_frame: z<string, string, "plain">;
|
|
210
259
|
ref_images: z<string[], string[], "plain">;
|
|
@@ -218,11 +267,16 @@ export declare const carrier: z<Schemastery.ObjectS<NoInfer<{
|
|
|
218
267
|
}>>[], "plain">;
|
|
219
268
|
ref_audios: z<string[], string[], "plain">;
|
|
220
269
|
ref_mods: z<string[], string[], "plain">;
|
|
270
|
+
refmod_mode: z<string, string, "defined">;
|
|
271
|
+
refmod_pool: z<number, number, "defined">;
|
|
272
|
+
refmod_identity: z<number, number, "defined">;
|
|
273
|
+
refmod_save: z<boolean, boolean, "defined">;
|
|
221
274
|
duck_depth_db: z<number, number, "defined">;
|
|
222
275
|
seed: z<number, number, "defined">;
|
|
223
276
|
width: z<number, number, "defined">;
|
|
224
277
|
height: z<number, number, "defined">;
|
|
225
278
|
length: z<number, number, "defined">;
|
|
279
|
+
fps: z<number, number, "defined">;
|
|
226
280
|
steps: z<number, number, "defined">;
|
|
227
281
|
second_pass_enabled: z<boolean, boolean, "defined">;
|
|
228
282
|
sharpen_enabled: z<boolean, boolean, "defined">;
|
|
@@ -234,6 +288,9 @@ export declare const carrier: z<Schemastery.ObjectS<NoInfer<{
|
|
|
234
288
|
refine_lora: z<string, string, "defined">;
|
|
235
289
|
refine_strength: z<number, number, "plain">;
|
|
236
290
|
refine_steps: z<number, number, "plain">;
|
|
291
|
+
refine_denoise: z<number, number, "defined">;
|
|
292
|
+
upscale_route: z<string, string, "defined">;
|
|
293
|
+
upscale_model: z<string, string, "defined">;
|
|
237
294
|
attention_backend: z<string, string, "defined">;
|
|
238
295
|
interp_model: z<string, string, "defined">;
|
|
239
296
|
interp_multiplier: z<number, number, "defined">;
|
|
@@ -254,13 +311,13 @@ export declare const carrier: z<Schemastery.ObjectS<NoInfer<{
|
|
|
254
311
|
sla_protect_audio: z<boolean, boolean, "defined">;
|
|
255
312
|
sla_stabilize_motion: z<boolean, boolean, "plain">;
|
|
256
313
|
sla_disable_fp16_accum: z<boolean, boolean, "defined">;
|
|
257
|
-
sharpen_method: z<string, string, "
|
|
314
|
+
sharpen_method: z<string, string, "defined">;
|
|
258
315
|
sharpen_radius: z<number, number, "plain">;
|
|
259
316
|
sharpen_threshold: z<number, number, "plain">;
|
|
260
317
|
sharpen_iterations: z<number, number, "plain">;
|
|
261
318
|
k: z<number, number, "plain">;
|
|
262
319
|
noise_seed: z<number, number, "plain">;
|
|
263
|
-
fps_seconds: z<number, number, "
|
|
320
|
+
fps_seconds: z<number, number, "plain">;
|
|
264
321
|
interp_switch: z<boolean, boolean, "plain">;
|
|
265
322
|
sharpen_switch: z<boolean, boolean, "plain">;
|
|
266
323
|
sla_switch: z<boolean, boolean, "plain">;
|