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

Fix int8 lora #431

Merged
merged 5 commits into from
Dec 20, 2023
Merged

Fix int8 lora #431

merged 5 commits into from
Dec 20, 2023

Conversation

doombeaker
Copy link
Contributor

@doombeaker doombeaker commented Dec 17, 2023

  • 社区版 LoRA 修复、跑通
  • 商业版 int8 修复
  • CI 中加入社区版 LoRA 测试

.to(weight.device)
)
weight = weight.to(torch.float32) * org_weight_scale
# if is_rewrite_qkv and is_quant:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

出图效果和原来不一致了,应该是这里 is_rewrite_qkv 恒为 False 导致的

Copy link
Contributor

Choose a reason for hiding this comment

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

这里 is_rewrite_qkv 恒为 False 是应为:CrossAttentionPytorch 最新的Comfyui名字 CrossAttention
https://github.com/Oneflow-Inc/onediff/blob/516ea1f95293c1d9e3a4e77488eaa4da90c3cb68/onediff_comfy_nodes/utils/diffusers_quant_utils.py#L239-L241

Copy link
Contributor

Choose a reason for hiding this comment

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

出图效果和原来不一致了,应该是这里 is_rewrite_qkv 恒为 False 导致的
看了这里添加量化权重的逻辑应该是没有问题 和以前一样,我单独量化 conv 出图效果一致,但是加上 linear 量化效果不一致。具体还待确认

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ccssu 我记得用量化插件量化 sdxl turbo 时,是 disable conv,保留 linear,效果就比较一致。
这个没什么特别的原因,就是新的量化是不做筛选的,有些模型层类别 conv(或者 linear)对量化比较敏感,量化后效果就差了。

我觉得这里满足:

  1. 能提速
  2. 出图效果比较一致

就可以了。

Copy link
Contributor

@ccssu ccssu Dec 19, 2023

Choose a reason for hiding this comment

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

商业版 int8 修复测试 我测的效果差不多。 LoRA的ci测试我这边那个比较节点直接连接遇到些问题。这个 pr 商业版 int8 修复没问题的话, 我后面单独pr加个 lora ci测试。
image

@doombeaker doombeaker marked this pull request as ready for review December 19, 2023 08:12
@ccssu
Copy link
Contributor

ccssu commented Dec 19, 2023

fp16 的 oneflow 和 pytorch 混合跑会出问题,如下图所示。
workflow (20)

@doombeaker
Copy link
Contributor Author

fp16 的 oneflow 和 pytorch 混合跑会出问题,如下图所示。

这个问题在之前就存在,怀疑是 ComfyUI 机制导致的问题。加载 2 个 load checkpoint 可以绕过

@@ -0,0 +1,581 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

workflow (21)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lora 的 CI 挂了,而且我本地暂时复现不出来,我先把这个 PR 里你加入的 LoRA CI revert 了。之后再慢慢加 LoRA 的效果比较的 CI 吧。

Copy link
Contributor

Choose a reason for hiding this comment

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

收到👌

@ccssu ccssu merged commit 2c10ef0 into main Dec 20, 2023
8 checks passed
@ccssu ccssu deleted the fix_int8_lora branch December 20, 2023 01:24
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.

2 participants