Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stable Diffusion XL Long Weighted Prompt Pipeline #461

Merged
merged 4 commits into from
Mar 22, 2024

Conversation

co63oc
Copy link
Contributor

@co63oc co63oc commented Mar 12, 2024

#413

paddle
image

torch
torch_out

paddle, torch生成图一致

torch 代码

from diffusers import DiffusionPipeline
import torch

pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0"
    , torch_dtype       = torch.float16
    , use_safetensors   = True
    , variant           = "fp16"
    , custom_pipeline   = "lpw_stable_diffusion_xl",
)

prompt = "photo of a cute (white) cat running on the grass"*20
prompt2 = "chasing (birds:1.5)"*20
prompt = f"{prompt},{prompt2}"
neg_prompt = "blur, low quality, carton, animate"

pipe.to("cuda")
images = pipe(
    prompt                  = prompt
    , negative_prompt       = neg_prompt
    , generator=torch.Generator("cuda").manual_seed(452)
).images[0]
images.save("torch_out.png")

Copy link

paddle-bot bot commented Mar 12, 2024

Thanks for your contribution!

@JunnYu JunnYu requested a review from westfish March 12, 2024 07:56
@JunnYu JunnYu assigned westfish and unassigned JunnYu Mar 12, 2024
@westfish
Copy link
Contributor

抱歉忘了强调版本了,需要参考diffusers 0.24.0的相关代码来实现,当前develop与diffusers 0.24.0对齐

@co63oc
Copy link
Contributor Author

co63oc commented Mar 13, 2024

抱歉忘了强调版本了,需要参考diffusers 0.24.0的相关代码来实现,当前develop与diffusers 0.24.0对齐

使用的是对齐diffusers 0.24.0的develop版本

@westfish
Copy link
Contributor

diffusers 0.24.0貌似不需要用到StableDiffusionMixin

@co63oc
Copy link
Contributor Author

co63oc commented Mar 14, 2024

diffusers 0.24.0貌似不需要用到StableDiffusionMixin

已修改取消 StableDiffusionMixin

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Mar 14, 2024
@luotao1 luotao1 self-assigned this Mar 14, 2024
Copy link
Contributor

@westfish westfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@co63oc
Copy link
Contributor Author

co63oc commented Mar 19, 2024

@westfish CI已完成

@co63oc
Copy link
Contributor Author

co63oc commented Mar 22, 2024

image
@westfish 这里怎么不是像Paddle那样,Paddle不用更新分支

@westfish westfish merged commit b39153e into PaddlePaddle:develop Mar 22, 2024
3 checks passed
westfish pushed a commit to westfish/PaddleMIX that referenced this pull request Sep 25, 2024
PaddlePaddle#413

paddle 

![image](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/938e44c1-a0c1-4a34-8496-f63bc1592673)

torch

![torch_out](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/de1be876-c3bb-4614-bca0-46a150f7d7fa)

paddle, torch生成图一致

torch 代码
```
from diffusers import DiffusionPipeline
import torch

pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0"
    , torch_dtype       = torch.float16
    , use_safetensors   = True
    , variant           = "fp16"
    , custom_pipeline   = "lpw_stable_diffusion_xl",
)

prompt = "photo of a cute (white) cat running on the grass"*20
prompt2 = "chasing (birds:1.5)"*20
prompt = f"{prompt},{prompt2}"
neg_prompt = "blur, low quality, carton, animate"

pipe.to("cuda")
images = pipe(
    prompt                  = prompt
    , negative_prompt       = neg_prompt
    , generator=torch.Generator("cuda").manual_seed(452)
).images[0]
images.save("torch_out.png")
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants