diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

PixArtAlphaPipeline does not handle negative_prompt list correctly

Open Trojaner opened this issue 1 year ago • 6 comments

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 image

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

Trojaner avatar Apr 24 '24 00:04 Trojaner

Feel free to drop a PR to fix it :)

sayakpaul avatar Apr 24 '24 01:04 sayakpaul

Feel free to drop a PR to fix it :)

No.

What's the point of bug reports if we must fix it ourselves? Then just remove the option to report bugs and only accept PRs at this point.

I already contributed here by pinpointing the issue to the point where fixing it is trivial.

Trojaner avatar Apr 24 '24 02:04 Trojaner

I already contributed here by pinpointing the issue to the point where fixing it is trivial.

That is exactly why I asked you to submit a PR. Since you already have a thorough understanding of what's going on and know how to fix the issue. That way, your contributions stay within the repository, and that is very much appreciated.

If you don't prefer that, sure, I am just happy to open a PR on behalf of yourself. What is your commit email id so that I can add your as a co-author of the commit?

sayakpaul avatar Apr 24 '24 03:04 sayakpaul

That is exactly why I asked you to submit a PR.

Sadly your initial post is very open to misunderstandings. If you had included more explanation on why you want me to do it, it would have shown me that it wasn't a toxic comment. I will submit a PR in the next days.

Trojaner avatar Apr 24 '24 06:04 Trojaner

Sorry for not being clear. Appreciate your understanding.

sayakpaul avatar Apr 24 '24 06:04 sayakpaul

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Sep 14 '24 15:09 github-actions[bot]