Skip to content

LTX2 import fails with Transformers 5.5.0 due to annotation-only Gemma4Unified dependency #14773

Description

@Imagineer99

Describe the bug

With Diffusers 0.40.0 and Transformers 5.5.0, importing LTX2Pipeline fails because Gemma4UnifiedForConditionalGeneration is unavailable. This blocks Gemma3-based LTX 2.3 use before any checkpoint is loaded. We encountered this in Unsloth Desktop, but the reproduction does not import Unsloth.

The unconditional import is also present on current main. In the five affected pipeline modules in 0.40.0, the missing class is used only in the text_encoder constructor annotation.

Reproduction

In an environment with PyTorch, diffusers==0.40.0, and transformers==5.5.0:

from diffusers import LTX2Pipeline

LTX2ImageToVideoPipeline fails similarly. No model download, GPU generation, or authentication is required to trigger this error.

Logs

RuntimeError: Failed to import diffusers.pipelines.ltx2.pipeline_ltx2 because of the following error (look up to see its traceback):
cannot import name 'Gemma4UnifiedForConditionalGeneration' from 'transformers'

Proposed scope and validation

Would you accept a PR replacing the architecture-specific text_encoder annotation with transformers.PreTrainedModel and removing the unused Gemma imports across these five modules?

  • pipeline_ltx2.py
  • pipeline_ltx2_image2video.py
  • pipeline_ltx2_condition.py
  • pipeline_ltx2_ic_lora.py
  • pipeline_ltx2_hdr_lora.py

An isolated candidate preserves Diffusers 0.40.0 and Transformers 5.5.0, with no changes to generation logic. Validation so far:

  • Original fails with the error above on Windows and WSL; the candidate completes tiny-fixture text-to-video and image-to-video inference, including audio decoding and local save/reload, on both.
  • On a separate Transformers 5.17.0 test stack, original and patched pipelines produce bit-for-bit identical video and audio tensors for those same tiny fixtures. The real Gemma4Unified class remains accepted by the annotation.
  • All five affected pipeline imports/signature checks and MiniMax-H3/Music-3 modular pipeline imports pass.

The runtime checks use the upstream LTX tiny-component fixture and hf-internal-testing/tiny-gemma3. Full LTX 2.3 and MiniMax checkpoint generation have not been tested.

This investigation and candidate were AI-assisted. Following the contribution guidelines, I am opening this issue for maintainer acknowledgment before a PR, and am happy to adjust the approach or add repository-native regression coverage.

System Info

Reproduced on both:

Windows WSL2 Ubuntu
Diffusers 0.40.0 0.40.0
Transformers 5.5.0 5.5.0
Python 3.13.5 3.13.12
PyTorch 2.10.0+cu130 2.11.0+cu130

Additional WSL environment: huggingface_hub 1.30.0, Accelerate 1.14.0, PEFT 0.18.1, safetensors 0.8.0. NVIDIA RTX 5070 Ti is available; the reproduction is import-only and does not use distributed execution.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions