huggingface / huggingface/diffusers

Please reconsider `transformers>=5.0.0`

Offen
#13,935 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### Describe the bug

Can you please reconsider requiring `transformers>=5.0.0` on the module-level solely for the optional prompt-enhancer (`pe`) component?

This is a significant burden for downstream projects that pin `transformers` 4.x for unrelated reasons. As one data point, migrating to `transformers` v5 in our project (OneTrainer) turned out to be a substantial breaking change well beyond Ernie itself (e.g. https://github.com/Nerogar/OneTrainer/pull/1506)

We will eventually upgrade transformers, but I'd appreciate it if it isn't forced by upgrading diffusers.

Details:
```python
if is_transformers_version("<", "5.0.0"):
raise ImportError("`ErnieImagePipeline` requires `transformers>=5.0.0` for `Ministral3ForCausalLM`.")

from transformers import Ministral3ForCausalLM # noqa: E402
```

`Ministral3ForCausalLM` is only used as the type of the **optional** `pe`/`pe_tokenizer` ("prompt enhancer") components (`_optional_components = ["pe", "pe_tokenizer"]`), which the pipeline runs perfectly well without

The actually-required components — `text_encoder: Mistral3Model`, the transformer, VAE and scheduler — work fine on transformers 4.x (`Mistral3Model` already exists there).

Because the guard is unconditional and at module scope, **any code that imports `ErnieImagePipeline` at all** — even without ever touching `pe` — is now forced onto `transformers>=5.0.0`, even though the core model doesn't need it.

### Reproduction

```
import transformers
print(transformers.__version__) # e.g. 4.57.6

from diffusers import ErnieImagePipeline

```

### Logs

```
4.57.6
Traceback (most recent call last):
...
ImportError: `ErnieImagePipeline` requires `transformers>=5.0.0` for `Ministral3ForCausalLM`.

```

### System Info

not needed

### Who can help?

Other: @yiyixuxu @DN6

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne beim Modul ErnieImagePipeline und untersuche die auf Modulebene geltende transformers-Versionsprüfung, die optionalen Komponenten pe und pe_tokenizer sowie den Import von Ministral3ForCausalLM. Reproduziere den gemeldeten Import mit transformers 4.57.6 und verifiziere anschließend, dass der Import der Pipeline ohne Prompt Enhancement mit transformers 4.x funktioniert, während die optionale Komponente weiterhin ihr erforderliches Versionsverhalten beibehält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
machine-learning
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
50/100

Neue Issues direkt in Ihr Postfach

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