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

PaddleMIX ppdiffusers Stable Diffusion 3 inference optimize #681

Open
wants to merge 58 commits into
base: develop
Choose a base branch
from

Conversation

chang-wenbin
Copy link
Contributor

No description provided.

Copy link

paddle-bot bot commented Aug 19, 2024

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Aug 19, 2024

CLA assistant check
All committers have signed the CLA.


高性能推理指令:
```shell
#step1: 生成FP32的TRT模型
Copy link
Contributor

@zhoutianzi666 zhoutianzi666 Sep 18, 2024

Choose a reason for hiding this comment

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

生成FP32的paddle模型,同时根据Paddle模型生成FP16的TensorRT engine。

@@ -99,6 +109,29 @@ def __init__(
for i in range(self.config.num_layers)
]
)
if self.inference_optimize:
Copy link
Contributor

Choose a reason for hiding this comment

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

这里加一句 del self.transformer_blocks

)
return encoder_hidden_states, hidden_states

@paddle.incubate.jit.inference(
Copy link
Contributor

Choose a reason for hiding this comment

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

把这个装饰器移动到demo中吧

@@ -88,6 +89,7 @@ def __init__(
use_quant_conv: bool = True,
use_post_quant_conv: bool = True,
):
os.environ["USE_PPXFORMERS"] = "False"
Copy link
Contributor

Choose a reason for hiding this comment

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

这里解释下为什么我们需要将其设置为False吧

)
)
state_dict[f"simplified_sd3.eqkv.{i}.bias"] = paddle.assign(
Copy link
Contributor

Choose a reason for hiding this comment

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

paddle.assign(没必要存在,删了吧


# 安装develop版本的paddle
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu123/

Copy link
Contributor

Choose a reason for hiding this comment

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

这里加一句,请使用2024年9月6日之后的PaddleNLP,因为在该天,我们修复了一个针对PaddleNLP的bug。
https://github.com/PaddlePaddle/PaddleNLP/pull/9016/files


@classmethod
def custom_modify_weight(cls, state_dict):
Copy link
Contributor

Choose a reason for hiding this comment

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

这里需要加上,如果不是self.inference_optimize,那么需要直接return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants