Nodes/ComfyUI-FlashPortrait/FlashPortrait Sampler
ComfyUI Node

FlashPortrait Sampler

Where FlashPortrait's 6× Speedup Actually Happens

By okdalto·Created 8 months ago·Updated 8 months ago· 25
FlashPortrait Sampler
  • pipe
  • head_emo_features
  • image
  • IMAGE
promptThe man is singing
negative_prompt色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走
seed42
steps30
cfg_scale1.00
guidance_scale4.00
text_cfg_scale1.00
emo_cfg_scale4.00
max_size720
shift5.00
context_size51
context_overlap30

The Loader hands you the models, the Feature Extractor hands you the face script, and this node performs it. The Sampler is where everything in the pack's name happens: it takes your reference image, reads the head-and-emotion features frame by frame, and denoises an actual video of your portrait doing the things the driving video did - at up to 6× the speed of a naive Wan portrait pipeline. If you're here, this is the node you've been looking for. Set the other two up, and this one is where the magic either lands or refuses to.

How the "6× faster, infinite" trick works

Two mechanisms, both from the FlashPortrait paper, both visible in the source. First, adaptive latent prediction: instead of stepping through all denoising timesteps, the model watches the latent variation rate and the derivative magnitude ratio between diffusion layers, then uses higher-order latent derivatives at the current timestep to jump ahead and predict future latents directly, skipping whole denoising steps. Second, a dynamic sliding window: long videos get processed in overlapping chunks with weighted blending in the overlap zones, so the animation can run essentially forever without visible seams. The context_size / context_overlap inputs you see are the control surface for that second mechanism - the stride is context_size − context_overlap, exactly like the extractor's.

The node builds the generation from your reference image as the first frame, masks everything after it so the model fills in the future, and drives each frame with the matching head_emo feature. Guidance is a three-way blend straight out of the code:

noise_pred = unconditional
           + text_cfg_scale * (text direction)
           + emo_cfg_scale  * (emotion direction)

Inputs that matter

  • pipe and head_emo_features - the Loader's pipe and the Extractor's feature stack. No surprises.
  • image - your reference/identity image. Only the first frame is used, so don't feed it a video; feed it one clean, well-lit face.
  • prompt - default is "The man is singing", and the default negative_prompt is a Chinese-language quality list that roughly translates to "static, oversaturated, low quality, bad hands, extra fingers." You can and should replace the negative with whatever you're used to. For the positive, remember this is an I2V prompt: describe motion ("she turns to the camera and smiles slowly"), not what's in the still - that's the community rule of thumb for Wan and it applies here.
  • guidance_scale (4), text_cfg_scale (1), emo_cfg_scale (4) - the three knobs that actually drive output. emo_cfg_scale is the one that makes the animation follow the driving face, and it's the first thing to raise if your portrait ignores the source video. guidance_scale > 1 switches on classifier-free guidance at all.
  • steps (30), seed (42) - steps is the ceiling, not the count; adaptive prediction skips some anyway.
  • max_size (720) - output height; width scales to match and both round to multiples of 16. shift (5) - noise-schedule shift; the repo's own config comments say use 3.0 for 480p and 5.0 for 720p.
  • context_size / context_overlap - match them to the Feature Extractor. Mismatched windows are the classic source of weird output.

One honest gotcha: the node lists a cfg_scale input (default 1.0), and it's a trap. In this build it's plumbed into the UI but never forwarded to the pipeline - only guidance_scale, text_cfg_scale, and emo_cfg_scale actually reach the sampler internals. Ignore cfg_scale and use the three-way knobs.

Output and where it goes

The output is a single IMAGE batch - your generated frames (the first frame is stripped off, so it's a clean animation). Wire it into a Save Video / VHS node, and set that node's fps from the extractor's fps output so the clip plays at the right speed.

Troubleshooting

If you're out of memory, the fix isn't here - it's back in the Loader's GPU_memory_mode (sequential CPU offload or fp8). At full bf16 the README quotes ~40GB VRAM, and the honest community line from release is "if you can run Wan 14B, you can run this." Output length is tied to your driving video's length (subject to the VAE's (N-1)%4 frame rule), so a short drive gives a short animation. And if the face ignores the driving video, bump emo_cfg_scale before you touch anything else - it's the emotion-guidance dial, and it's the one people forget exists. Install is the shared pack story: Manager search "FlashPortrait" or clone https://github.com/okdalto/ComfyUI-FlashPortrait, install requirements, restart. Then generate something, because watching a portrait finally hold its face through a 30-second performance is the part that makes the 40GB worth it.

CategoryFlashPortrait

Inputs (15)

NameTypeDefaultDescription
pipeFLASH_PORTRAIT_PIPE
head_emo_featuresHEAD_EMO_FEAT
imageIMAGE
promptSTRINGThe man is singing
negative_promptSTRING色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走
seedINT420–18446744073709550000
stepsINT30
cfg_scaleFLOAT1.000–20
guidance_scaleFLOAT4.00
text_cfg_scaleFLOAT1.00
emo_cfg_scaleFLOAT4.00
max_sizeINT720
shiftFLOAT5.00
context_sizeINT51
context_overlapINT30

Outputs (1)

NameTypeDescription
IMAGEIMAGE