Nodes/H3MD Director (H3MD 导演台)/H3MD Loop Sampler (legacy)
ComfyUI Node

H3MD Loop Sampler (legacy)

Runs all segments of an H3MD plan: Encode -> Continue (final latent only; skipped for hard cuts) -> H3MD Sampler -> VRAM release, then joins them. Outputs: only 'long video' -> H3MD Save Video Interp is designed to stay within bounded VRAM/RAM (it streams chunk by chunk from the disk cache). 'latent' (the joined audio-video latent) and 'audio' (the joined audio) can also be connected to other nodes for upscaling / custom processing, e.g. Separate AV Latent -> Hyper-VAE or a VAE decoder -> VHS Video Combine. 'images' is only a 64x64 placeholder (merge_images was removed): to get frames, decode 'latent' externally. WARNING: for large / long videos the latent / decoded-image / audio paths do NOT guarantee against VRAM/RAM blowups - decoding the full latent externally holds the whole clip in memory. 输出说明:只有 'long video' → H3MD Save Video Interp 是按有限显存/内存设计的(从磁盘缓存一段一段流式处理)。'latent'(拼好的音视频 latent)和 'audio'(拼好的音频)也可以接到别的节点做放大或自定义处理,例如 Separate AV Latent → Hyper-VAE 或 VAE 解码器 → VHS Video Combine。'images' 只是 64x64 占位图(merge_images 已删除):要拿到画面帧,请在外部解码 'latent'。警告:大/长视频走 latent / 解码图片 / audio 这些路径不保证显存/内存不爆——在外部解码整段 latent 会把整段视频放进内存。

By 1113800942·Created 4 days ago·Updated about 7 hours ago· 11
H3MD Loop Sampler (legacy)
  • plan
  • clip
  • vae
  • audio_vae
  • low_res_model
  • sampler
  • sigmas
  • high_res_model
  • semantic_bridge
  • depth_control
  • latent
  • images
  • audio
  • frame_count
  • summary
  • long video
◄rerun_segments►
◄stop_after0►
◄rerun_new_seedtrue►
◄seed0►
◄cfg1.0►
◄transition_step6►
◄lowres_scale0.50►
◄rho0.00►
◄w_min0.50►
◄w_max1.00►
◄upscaler_modelnone►
◄ref_image_sizematch►
◄continue_audiotrue►
◄drift_strength0.60►
◄drift_lock_tokens2►
◄seed_modeincrement►
◄decode_outputtrue►
◄audio_crossfade_ms0►
◄release_vram_between_segmentstrue►
◄highres_tilingtrue►
◄tiling_axisauto►
◄tiling_overlap8►
◄ff_chunk_rows0►
◄release_upscalertrue►
◄unload_idle_modelstrue►
◄cache_modedisk►
◄cache_dtypefp16►
◄cache_dir►
◄delete_cachetrue►
◄resume_from_cachefalse►
◄unload_models_before_mergetrue►
◄continue_lowres_prefixnative_lowres_carry►
◄merge_overlap_sourcenext►
◄seam_tone_matchoff►
◄seam_tone_strength1.00►
◄seam_tone_global0.00►
◄seam_decode_context0►
◄vram_releasedeep►
◄slow_step_guardstop►
◄lowres_anchor0.00►
CategoryMiniMax H3/H3MD

Inputs (50)

NameTypeDefaultDescription
rerun_segmentsSTRINGRe-render only these segments (1-based, as in the log): e.g. 3 or 4-6 or 8-10, 13-14. Empty = normal run. Needs resume_from_cache on and every other segment in the cache. Each selected block starts from the end of the segment before it and its last overlap frames are locked to the start of the cached segment after it, so nothing else is re-rendered. Old files go to _replaced_<time>. 只重跑这些段(从 1 数,和日志一致):如 3、4-6、8-10, 13-14。留空 = 正常跑。需要打开 resume_from_cache,其余段都要在缓存里。每块开头接上一段结尾,结尾锁到下一段的旧开头,其余段不重跑;旧文件挪到 _replaced_<时间> 留底。
stop_afterINT00–255Run segments 1..N only (0 = all). Short test: 1 = only the first segment; set it back to 0 later and the cached segments are reused. 只跑到第 N 段为止(0 = 全部)。短测试填 1 = 只跑第 1 段;之后改回 0,已跑的段从缓存取。
rerun_new_seedBOOLEANtrueRe-rendered segments get a new random seed (logged and stored in the cache), so a rerun differs even with the same prompt and refs. Off: the original seed. 重跑的段用新的随机种子(记进日志和缓存),提示词和参考图不变也能抽到不同结果。关:用原种子。
planH3MD_PLAN—
clipCLIP—
vaeVAEVideo VAE (pixel route of the lift when rho > 0).
audio_vaeVAE—
low_res_modelMODELModel for the low-res pass (and the high-res pass when high_res_model is not connected).
samplerSAMPLER—
sigmasSIGMASOne schedule for both passes; split at transition_step.
seedINT00–18446744073709550000—
cfgFLOAT1.00–100—
transition_stepINT61–10000Steps of the schedule run at low resolution; the rest run at full resolution.
lowres_scaleFLOAT0.500.25–1Size of the low-res pass (0.5 = half width and height).
rhoFLOAT0.000–1Share of the most inconsistent positions corrected toward the pixel-VAE route. 0 = learned upscaler only (no VAE round trip).
w_minFLOAT0.500–1—
w_maxFLOAT1.000–1—
upscaler_modelCOMBOnoneLearned H3 3D latent upscaler for the lift (models/latent_upscale_models or upscale_models). none = nearest.
ref_image_sizeCOMBOmatch2 options: match, max
continue_audioBOOLEANtrue—
drift_strengthFLOAT0.600–1Drift: peak re-noise weight for the overlap prefix token farthest from the seam (the prefix is restored exactly at the end). 0 = prefix kept unchanged during sampling too (the former static_lock).
drift_lock_tokensINT20–64Prefix tokens nearest the seam that stay locked (1 token = 3.4 frames).
seed_modeCOMBOincrementincrement (default): segment k uses seed + k, so equal-length segments do not get identical noise; same: every segment uses the seed. With resume_from_cache on, the seed of the run being resumed is reused.
decode_outputBOOLEANtrueDecode every segment (video + audio VAE) after sampling and join the frames like H3MD Segment Join. Off: only the joined latent is produced.
audio_crossfade_msINT00–2000—
release_vram_between_segmentsBOOLEANtrueUnload idle models (text encoder, VAEs, upscaler leftovers) + soft_empty_cache between segments. The shared base UNet stays.
high_res_modeloptMODELModel for the high-res pass (default: low_res_model).
highres_tilingoptBOOLEANtrueHigh-res pass: measure the free VRAM and use the fewest strips that fit (full frame when it fits - no cost on large cards). Off = always full frame.
tiling_axisoptCOMBOautoHigh-res tiling: split direction. auto = the longer side; width = left/right strips; height = top/bottom strips. Audio and time are never split.
tiling_overlapoptINT82–32High-res tiling: overlap between neighbouring strips in latent pixels (x16 image pixels); the strip predictions are feather-blended over it.
ff_chunk_rowsoptINT00–262144Low VRAM: run the DiT feed-forward on this many sequence rows at a time (both passes). Same result, lower peak memory, a little slower. 0 = off (the high-res tiling still switches it on by itself after an out-of-memory retry at the most strips).
release_upscaleroptBOOLEANtrueDrop the learned upscaler from RAM right after the lift.
unload_idle_modelsoptBOOLEANtrueBetween the passes: unload text encoder / VAEs / other idle models + empty the cache. The diffusion models stay loaded.
cache_modeoptCOMBOdiskdisk: decode each segment right after sampling and write it to a disk cache (RAM holds one segment); merge at the end. ram: original in-RAM decode/join.
cache_dtypeoptCOMBOfp16Cached frame format. fp16 ~= lossless (2 B/value); uint8 = half the disk, 8-bit like the saved video.
cache_diroptSTRINGEmpty = auto: <drive>/H3MD_cache on the local fixed drive with the most free space (an existing H3MD_cache holding resume_* runs is reused first, so resume survives restarts). Falls back to ComfyUI temp/h3md_cache with a warning if nothing is writable.
delete_cacheoptBOOLEANtrueHidden / no effect since 2026-10-18: the Loop never deletes its cache before the video is saved. Use H3MD Save Video Interp -> delete_cache_after_save.
resume_from_cacheoptBOOLEANfalseReuse cached segments with identical plan segment, refs, seed and settings (models/LoRAs are NOT checked). The base seed of the run being resumed is reused, so a randomized seed widget does not break the resume.
unload_models_before_mergeoptBOOLEANtrueAfter the last segment: unload all models (incl. the base UNet) + empty cache before the merge and downstream RIFE/Save.
continue_lowres_prefixoptCOMBOnative_lowres_carryContinued segments, low-res pass: pixel_reencode (Alpha) = the overlap frames are downscaled in pixel space and VAE-encoded (fixes the hazy/ghosted continuation); latent_resize = the engine's latent-space resize; native_lowres_carry (default) = the previous segment's own low-res stage latent tail (unresized) pins the low-res prefix, the high-res final latent pins the high-res prefix; falls back to pixel_reencode when no matching carry exists.
merge_overlap_sourceoptCOMBOnextContinuation joins: which decoded copy of the overlap frames is kept. next = the new segment's copy (decoded WITH following frames as VAE context; the previous segment's last frames are decoded without it); prev = old behaviour. Hard cuts, frame count, audio and the joined latent are unchanged.
seam_tone_matchoptCOMBOoffContinuation joins, after decode: measure the low-frequency brightness (luma) or colour (color) difference of the two overlap copies near the seam and add a small, clamped offset to the new segment that eases out over ~18 frames. off = unchanged.
seam_tone_strengthoptFLOAT1.000–1Fraction of the measured seam delta corrected (clamped to +-0.04).
seam_tone_globaloptFLOAT0.000–1Optional whole-segment luma offset = this * measured luma delta (clamped to +-0.015); the seam offset eases to it instead of to 0.
semantic_bridgeoptH3MD_SEMANTIC_BRIDGEOptional H3MD Semantic Bridge chain. Not connected = off.
seam_decode_contextoptINT00–2Continued segments: decode with this many 17-frame clips of the previous segment's final latent in front (VAE context), then drop them, so the new segment does not start the VAE cold at the seam. 0 = off (old behaviour).
depth_controloptH3MD_DEPTHH3MD Depth Control (optional, appended LAST): depth ControlNet on the low-res stage for plan videos with 'depth' ticked. Not connected = off.
vram_releaseoptCOMBOdeepBetween segments. deep: unload idle models, reset ComfyUI's cast/staging buffers, empty the CUDA cache and log memory before/after; if PyTorch still keeps > 2 GB idle or the GPU is nearly full, unload ALL models (the base UNet reloads, ~0.5-1 min). basic: the old idle-model unload only.
slow_step_guardoptCOMBOstopWatches the sampler's step times. A step >= 4x the usual time of that stage (and >= 120 s) means VRAM ran out (weights streamed every step). stop: interrupt the run (disk cache kept; restart ComfyUI and queue again with resume_from_cache on). warn: log only. off: no watch.
lowres_anchoroptFLOAT0.000–1ONE continuous scene only (motion copy, a long take). After each continued segment's low-res pass, pull the new frames' 24 latent channels (mean and spread) back to the first segment of the shot, before the upscale; the low-res carry is corrected too, so colour / contrast drift cannot pile up segment after segment. 0 = off, 1 = full. Needs continue_lowres_prefix = native_lowres_carry. Do not use for a story whose colours should change. 只用于单一场景的长视频(动作复刻、长镜头):每个续接段低清跑完、放大前,把新画面 24 个通道的均值和幅度拉回本镜头第一段,低清接续数据也一起校正,颜色不会一段段越漂越深。0 = 关,1 = 全量。需要 continue_lowres_prefix = native_lowres_carry。场景本该变色的叙事视频不要开。

Outputs (6)

NameTypeDescription
latentLATENTJoined audio-video latent of all segments (seam overlaps removed). Can be connected externally (e.g. Separate AV Latent -> Hyper-VAE / VAE Decode -> VHS Video Combine) for upscaling or custom processing. NOT bounded: decoding the whole latent holds the whole clip in VRAM/RAM on long videos. Bounded path: 'long video' -> H3MD Save Video Interp. 拼好的音视频 latent,可接外部节点(如 Hyper-VAE / VAE 解码 → VHS Video Combine)放大或自定义处理;长视频整段解码可能爆显存/内存。
imagesIMAGEPlaceholder only (64x64; merge_images was removed) - NOT the video. For frames, decode 'latent' externally, or save with 'long video' -> H3MD Save Video Interp. (cache_mode=ram: still the whole clip in RAM.) 只是占位图,不是视频;要画面帧请在外部解码 'latent',或用 'long video' → H3MD Save Video Interp 出片。
audioAUDIOJoined audio of the whole clip (the same audio H3MD Save Video Interp writes). Can be connected externally for custom processing; not a bounded-memory path on large / long videos. 整段拼好的音频,可接外部节点自定义处理;大/长视频不保证不爆内存。
frame_countINTNumber of video frames of the joined clip (24 fps).
summarySTRINGJSON report of every segment.
long videoH3MD_SEGMENTSCache folder + merge plan for H3MD Save Video Interp - the only output designed to stay within bounded VRAM/RAM (streamed chunk by chunk from the disk cache). None with cache_mode=ram. 接 H3MD Save Video Interp:唯一按有限显存/内存设计的出片路径。