ComfyUI Node

ToonCrafter Decode

The special decoder that keeps the lines clean

By kijai·Created 2 years ago·Updated about a year ago· 681
ToonCrafter Decode
  • model
  • latent
  • images
vae_dtypeauto
prune_last_framefalse

If you've built a ToonCrafter interpolation graph and you're staring at a LATENT output wondering how to turn it into actual frames - this is the node. ToonCrafterInterpolation deliberately stops at latents, and ToonCrafterDecode is what converts them to images. And no, you can't just use a normal VAE Decode here. That's the entire reason this node exists.

It's part of kijai's ComfyUI-DynamiCrafterWrapper, the ComfyUI port of the CUHK / Tencent AI Lab ToonCrafter model.

How it works

ToonCrafter ships a custom, dual-reference VAE decoder. Instead of decoding each latent frame in isolation like a standard VAE, it looks back at the two input keyframes and injects their detail into the decode, which is what keeps line art crisp and consistent across the generated inbetweens rather than smearing. That reference-aware decode is baked into this node - hand it the same DCMODEL you sampled with (it carries the decoder) and the latent, and it gives you frames. Per Kijai's README, this decode is also the single most memory-hungry step in the whole pipeline, peaking around 17GB at 512x320, and it wants xformers for full-quality results.

The inputs and outputs that matter

Three inputs, one of them optional:

  • model - the ToonCrafter DCMODEL, the same one you fed the interpolation node. The decoder rides along with it.
  • latent - the samples output from ToonCrafterInterpolation.
  • vae_dtype - fp32/fp16/bf16/auto. auto is fine to start; if decode OOMs, a lower-precision setting can help you squeak under the ceiling.
  • prune_last_frame (optional) - set true to drop the final frame. Handy when you're stitching clips or building a loop and don't want a duplicate frame at the seam.

Output is images (IMAGE) - the finished frame sequence, ready for a Video Combine / Save node.

Installing it

Comes with the pack; there's no separate install. ComfyUI Manager → search ComfyUI-DynamiCrafterWrapper, or cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-DynamiCrafterWrapper, then pip install -r requirements.txt and restart. The one thing to actually do for this node: install xformers (pip install xformers --no-deps). Kijai's README calls it out specifically - decode "currently REQUIRES xformers for full quality results." Without it you can still decode, but at reduced quality.

Common issues

  • This is where you OOM. Sampling fits but decode blows up? That's expected - decode is the peak. Lower the resolution, try a lighter vae_dtype, and make sure xformers is installed. If you're still stuck, Kijai notes you can fall back to ComfyUI's standard VAE Decode for a bit less quality and far less memory - you lose the dual-reference benefit but you get frames.
  • Lines look mushy or inconsistent. Two usual causes: you decoded with a plain VAE Decode instead of this node (so you lost the reference-aware decode), or xformers isn't active so decode ran in reduced-quality mode.
  • Duplicate frame at a loop seam. That's what prune_last_frame is for - turn it on when chaining or looping.
CategoryDynamiCrafterWrapper

Inputs (4)

NameTypeDefaultDescription
modelDCMODEL
latentLATENT
vae_dtypeCOMBOauto4 options: fp32, fp16, bf16, auto
prune_last_frameoptBOOLEANfalse

Outputs (1)

NameTypeDescription
imagesIMAGE