huggingface / huggingface/diffusers

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

Aperta
#14,773 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug needs-env-info pipelines
Lingua principale
Python
Stelle
34.5k
Fork
7.3k
Merge medio
3g 3h
PR unite (30g)
91

Descrizione

### 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](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx2/pipeline_ltx2.py). 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`:

```python
from diffusers import LTX2Pipeline
```

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

### Logs

```text
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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the imports and text_encoder annotations in pipeline_ltx2.py, pipeline_ltx2_image2video.py, pipeline_ltx2_condition.py, pipeline_ltx2_ic_lora.py, and pipeline_ltx2_hdr_lora.py. Reproduce the LTX2Pipeline import with Diffusers 0.40.0 and Transformers 5.5.0, then run the affected pipeline import/signature checks and tiny-fixture inference. Done means imports succeed without the unavailable class and generation behavior remains unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python, pytorch
Ambito
machine-learning
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
76/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.