Skip to content

LTX-2 VAE encoder reads RGB out_channels instead of latent_channels from diffusers config #35

Description

@andyelka-creator

Summary

Loading the unified LTX-2 VAE config from Hugging Face builds VideoEncoder with out_channels=3 because the diffusers AutoencoderKLLTX2Video config uses out_channels for RGB decoder output channels and latent_channels=128 for the VAE latent channel count.

VideoEncoderModelConfig.from_dict() currently filters fields directly into the encoder config, so the encoder treats the RGB out_channels as its latent channel count.

Reproduction

Load Lightricks/LTX-2 vae/encoder with VideoEncoder.from_pretrained(), then encode a 512x512 input image with prepare_image_for_encoding().

Actual result

ValueError: Cannot reshape array of size 2097152 into shape (1,6,2,1,64,64)

The failing block is the first space-to-depth downsample. It is built with channel counts derived from out_channels=3, not the expected LTX-2 latent width.

Expected result

For unified diffusers VAE configs, the encoder should use latent_channels as its latent/output channel count and keep RGB out_channels for decoder output only.

Impact

Image-to-video generation with Lightricks/LTX-2 fails before denoising because the input image cannot be encoded into latents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions