huggingface / huggingface/diffusers

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

Offen
#14,773 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug needs-env-info pipelines
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit den Imports und den text_encoder-Annotationen in pipeline_ltx2.py, pipeline_ltx2_image2video.py, pipeline_ltx2_condition.py, pipeline_ltx2_ic_lora.py und pipeline_ltx2_hdr_lora.py. Reproduziere den LTX2Pipeline-Import mit Diffusers 0.40.0 und Transformers 5.5.0 und führe anschließend die betroffenen Pipeline-Import-/Signaturprüfungen sowie die Inferenz mit einem kleinen Fixture aus. Als abgeschlossen gilt die Aufgabe, wenn die Imports ohne die nicht verfügbare Klasse erfolgreich sind und das Generierungsverhalten unverändert bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, pytorch
Bereich
machine-learning
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
76/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.