huggingface / huggingface/diffusers

Please reconsider `transformers>=5.0.0`

Aperta
#13,935 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Python
Stelle
34.5k
Fork
7.3k
Merge medio
3g 3h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal modulo ErnieImagePipeline e ispeziona il controllo della versione di transformers a livello di modulo, i componenti opzionali pe e pe_tokenizer e l’importazione di Ministral3ForCausalLM. Riproduci l’importazione segnalata con transformers 4.57.6, quindi verifica che l’importazione della pipeline senza prompt enhancement funzioni con transformers 4.x, mentre il componente opzionale mantenga il comportamento di versione richiesto.

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

Valutazione

Stack tecnologico
python
Ambito
machine-learning
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
50/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.