MiniMax H3 fixes faces with a latent upscale partway through the run, which
means splitting the generation: some steps, the upscaler, then the rest. The
sampler could only ever run a schedule end to end, so getting the upscaler in
meant dropping shader noise out of the workflow entirely.
Four inputs, the same ones KSampler (Advanced) has: add_noise, start_at_step,
end_at_step and return_with_leftover_noise. They land at the tail of the
optional block, because ComfyUI maps saved widget values by position.
The machinery was already there. The pipeline builds one sigma schedule and
samples it in segments, slicing sigmas[start:end + 1] for each; a window is
that same slicing applied once more at the outer edges. Indices stay absolute,
so the per-segment seed still comes out as seed + start -- which means a split
run draws the same ancestral and SDE noise as the unsplit one it came from.
Decisions worth naming:
- Stages spread across the steps the node actually samples, not the whole
schedule. Two stages over a three-step window are two stages in those three
steps; spread over the schedule, one would land outside the window and never
fire. merge_boundaries takes the window's own edges for this, and its first
parameter is renamed end_step to say so -- measuring the tail against the
schedule length instead would leave a 1-step tail inside a long window.
- stage_progression keeps measuring position in the whole trajectory, so a node
running the last three steps of seven gets the fine end of coarse_to_fine
rather than a fresh coarse-to-fine sweep of its own.
- With add_noise off the opening boundary is not painted. The latent already
carries its noise from whatever ran before, and the shader on a zero tensor
would add back exactly what was turned off. Later boundaries still paint,
since their noise is recovered from the latent rather than made here. The
refusal for an unpaintable latent weighs only the stages that will actually
be painted, so it no longer rejects a latent on behalf of noise nobody makes.
Two things fixed on the way:
- force_full_denoise was dead. KSampler.sample only reads it alongside
last_step, and this code passes sigmas= with last_step unset, so it was
discarded on every call. The window's zeroed sigma tail is what does that job
now. The golden fixtures recorded the flag, so they are re-captured; every
sigma, noise tensor, seed and output across all thirteen is unchanged, which
was checked before blessing them.
- The progress bar counted the schedule rather than the steps being run.
ProgressBar takes its total from the callback, so a windowed run would have
started part-filled and stopped short of the end. At the defaults the numbers
are identical to before.
A schedule with fewer than two sigmas now returns the latent instead of being
handed to the sampler, which is what denoise 0.0 builds.
Verified against comfy.samplers.KSampler itself across seven start/end/leftover
combinations, requiring the sigmas to match bit for bit -- the parity that lets
this node sit on one side of a split and a stock KSampler (Advanced) on the
other. Two golden fixtures cover the two halves. Also run for real on H3:
4 steps, latent upscale, 3 steps, 896x896x124 with audio, in the new
example_workflows/MiniMaxH3_Split_Upscale_SNK_Direct.json.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>