Nodes/ComfyUI-Allegro/Allegro Encoder
ComfyUI Node

Allegro Encoder

Pushing real frames into Allegro's latent space

By bombax-xiaoice·Created 2 years ago·Updated about a year ago· 5
Allegro Encoder
  • images
  • vae
  • latents
batch1

Most Allegro text-to-video workflows don't actually use this node. The AllegroSampler will happily start from pure noise, and that's what the example workflow does. AllegroEncoder exists for when you don't want to start from scratch - when you have real frames and want to begin the generation from them, or when you're doing something with the latent space itself. It's the least glamorous node in the pack, and also the one that explains the most about why Allegro isn't like your image models.

It takes a normal ComfyUI IMAGE batch, runs it through the Allegro VAE's encoder, and returns latents. Functionally that's the same contract as any VAEEncode node you've used. The difference is the shape of the output, and that shape is the whole story.

How it works

Allegro's VAE is a 3D causal VAE: it compresses time as well as space. Where an SD or SDXL VAE folds an image into a 2D latent with a scale factor of 8, Allegro's encoder compresses the spatial dimensions and the frame dimension together, so a video of T frames becomes a latent video with a different (smaller) frame count. That's why you can't just grab the latents out of this node and hand them to a standard KSampler or EmptyLatentImage node - the latent format is incompatible with anything that expects SD-style spatial-only latents. It's Allegro latents, for Allegro nodes.

Technically it's a lean node: it loads the VAE encoder and quantization conv in bf16, encodes, then offloads again. The batch input (1–16, default 1) controls how many images encode per pass - higher is faster, higher is also more likely to OOM, same trade as the decoder.

The inputs that matter

  • images (IMAGE) - your frames, as a batch. Required.
  • vae (VAE) - the VAE from LoadAllegroModel's second output. Required.
  • batch - keep it at 1 unless encode speed hurts.

It returns latents (LATENT).

Where it actually fits

The README's tip #4 is the key to using the output: if you feed latents into AllegroSampler's optional latents input, the batch size of your latent batch must be a quarter of your frame count (22 for the standard 88). Get that ratio right and the sampler seeds its generation from your encoded frames instead of noise; get it wrong and the shapes won't line up and you'll be back here reading error messages.

If your actual goal is image-to-video, note that Allegro packs a proper I2V path - the TextImage2Video encoder and sampler - and that's the node you want for reference-frame video. This plain encoder is the more manual route: encode frames, drop them into the sampler, let it denoise around your content. Think of it as the "I want to start from something" escape hatch, not the flagship feature.

Install

Same pack, same story:

cd ComfyUI/custom_nodes
git clone https://github.com/bombax-xiaoice/ComfyUI-Allegro
cd ComfyUI-Allegro && pip install -r requirements.txt

Restart ComfyUI and you'll find it under "Allegro".

Common issues

There's no specific failure mode unique to this node - if it errors, it's almost always a VAE or dependency problem shared with the rest of the pack, or a batch value your VRAM can't absorb. On 8GB cards, respect the 1/4-frame rule and keep batch low; the encode is a warm-up, and the sampler after it is where your memory actually gets spent.

CategoryAllegro

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
vaeVAE
batchINT11–16

Outputs (1)

NameTypeDescription
latentsLATENT