huggingface / huggingface/diffusers

PixArtAlphaPipeline does not handle negative_prompt list correctly

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

Beschreibung

### Describe the bug

Passing negative_prompt as list to PixArtAlphaPipeline will eventually cause a "list object has no attribute lower" error.

The encode_prompt function documentation shows that it can be a list as well:
https://github.com/huggingface/diffusers/blob/7404f1e9dcdac286caf6ca3cfa43b294f61583bf/src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py#L308

However the function type hints restrict it to a str instead:
https://github.com/huggingface/diffusers/blob/7404f1e9dcdac286caf6ca3cfa43b294f61583bf/src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py#L291

These restrictions are completely arbitrary, since
a) prompt is correctly handled for the same case,
b) negative_prompt is only used in one place and there it just gets converted to a list anyway:

https://github.com/huggingface/diffusers/blob/7404f1e9dcdac286caf6ca3cfa43b294f61583bf/src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py#L392

### Reproduction

Call Pixart-Sigma with negative_prompt as list instead of a single string.

### Logs
(sorry for images)

![image](https://github.com/huggingface/diffusers/assets/1809172/b7916b50-09f1-4b1d-96e5-5b3841dff53b)
![image](https://github.com/huggingface/diffusers/assets/1809172/0b4e85bd-4fc3-4fdb-afd1-c16c79f41a6a)

### System Info

Windows 11
PyTorch 2.2.2 with CUDA support
Diffusers 0.28.0.dev0 @ https://github.com/huggingface/diffusers/commit/7404f1e9dcdac286caf6ca3cfa43b294f61583bf

### Who can help?

@DN6 @sayakpaul @lawrence-cj

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start in src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py, at encode_prompt and the negative_prompt handling around line 392. Reproduce PixArt-Sigma with negative_prompt as a list, then verify that the pipeline accepts the list without the reported lower error and handles it consistently with prompt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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