-
Notifications
You must be signed in to change notification settings - Fork 146
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
base: develop
Are you sure you want to change the base?
PaddleMIX ppdiffusers Stable Diffusion 3 inference optimize #681
Conversation
Thanks for your contribution! |
ppdiffusers/deploy/sd3/README.md
Outdated
|
||
高性能推理指令: | ||
```shell | ||
#step1: 生成FP32的TRT模型 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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/ | ||
|
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里需要加上,如果不是self.inference_optimize,那么需要直接return
No description provided.