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

How about using lora to do video style changes?please enlighten me #39

Closed
tbxmh opened this issue Sep 22, 2023 · 17 comments
Closed

How about using lora to do video style changes?please enlighten me #39

tbxmh opened this issue Sep 22, 2023 · 17 comments

Comments

@tbxmh
Copy link

tbxmh commented Sep 22, 2023

No description provided.

@tbxmh tbxmh changed the title How to use lora?please enlighten me How about using lora to do video style changes?please enlighten me Sep 22, 2023
@williamyang1991
Copy link
Owner

Our method is based on the original SD model.
You may need to merge LoRA into Diffuser models.
And then, you may need to convert Diffuser models to the original one.

Then our method can load this new model.
You can just modify sd_model_cfg.py to add paths to the saved merged SD models to load it.

@tbxmh
Copy link
Author

tbxmh commented Sep 22, 2023

Thank you for your reply. May I ask if you have used xformer to speed up reasoning? I have noticed that the speed of this excellent work seems to be a bit slow. Or do you have any other ways to speed up reasoning?

@williamyang1991
Copy link
Owner

We didn't tested our code with xformer to speed up.
But some users have successfully use it in #23 (comment)

@williamyang1991
Copy link
Owner

And we are implementing our method in Diffusers, which might be more efficient.

@tbxmh
Copy link
Author

tbxmh commented Sep 22, 2023

Thank you for your reply.Looking forward to your further work!

@zhanghongyong123456
Copy link

Our method is based on the original SD model. You may need to merge LoRA into Diffuser models. And then, you may need to convert Diffuser models to the original one.

Then our method can load this new model. You can just modify sd_model_cfg.py to add paths to the saved merged SD models to load it.

大佬,请问如何基于 embedding 进行风格化呢,有相关的融合示例吗

@williamyang1991
Copy link
Owner

是text embedding吗?
你在
https://civitai.com/models
上找embedding的模型,然后prompt里用对应的Trigger Words

我没用过,所以具体细节我也不清楚。

@zhanghongyong123456
Copy link

zhanghongyong123456 commented Sep 26, 2023

是text embedding吗? 你在 https://civitai.com/models 上找embedding的模型,然后prompt里用对应的Trigger Words

我没用过,所以具体细节我也不清楚。

https://civitai.com/models/9416?modelVersionId=11173 我看到这个风格很强,所以想测试一下 ,他不可以像Lora 一样融合到模型里吗,我下载的embedding **.pt 应该放到哪里,如何才能加载到代码里

@williamyang1991
Copy link
Owner

这种看上去是用的直接把text embedding用到base model (base model可以加上其他LoRA)上了。
具体还需要你自己研究一下

@zhanghongyong123456
Copy link

这种看上去是用的直接把text embedding用到base model (base model可以加上其他LoRA)上了。 具体还需要你自己研究一下
我看了原始论文代码,加载.pt采用DDPM 中 LatentDiffusion 类,但我找不到我们基础模型采用什么加载的?
QQ图片20230926153845
QQ图片20230926153832

@williamyang1991
Copy link
Owner

基础模型就是原版的stable diffusion 1.5模型+controlnet(models/control_sd15_canny.pth),
也应该可以加LoRA

这部分具体代码是controlnet里的,其中对应LatentDiffusion 类的应该是,具体需要你研究一下controlnet的代码
diffusion_model = self.model.diffusion_model

https://github.com/lllyasviel/ControlNet/blob/d3284fcd0972c510635a4f5abe2eeb71dc0de524/cldm/cldm.py#L330

@zhanghongyong123456
Copy link

基础模型就是原版的stable diffusion 1.5模型+controlnet(models/control_sd15_canny.pth), 也应该可以加LoRA

这部分具体代码是controlnet里的,其中对应LatentDiffusion 类的应该是,具体需要你研究一下controlnet的代码 diffusion_model = self.model.diffusion_model

https://github.com/lllyasviel/ControlNet/blob/d3284fcd0972c510635a4f5abe2eeb71dc0de524/cldm/cldm.py#L330

当我增加embedding 模型加载,出现没有属性error,我对比 embedding 源码 和 controlnet 代码里面的ddpm,发现少一部分 embedding 相关代码,我不确定是 diffusion 版本问题还是 embedding 源码特有的

4
01

1
3

@williamyang1991
Copy link
Owner

self.control_model 是 controlnet,是stable diffusion的旁路

self.model.diffusion_model 才是 stable diffusion 本体,才是LatentDiffusion model

@zhanghongyong123456
Copy link

self.control_model 是 controlnet,是stable diffusion的旁路

self.model.diffusion_model 才是 stable diffusion 本体,才是LatentDiffusion model

我尝试了在 self.model.diffusion_model 添加 embedding,但是 出现另一个类的错误,我看到他的父类 和LatentDiffusion model 没一点关系,才换的这个位置添加
image

image

@williamyang1991
Copy link
Owner

我看了一下,你的是texture inversion的代码,是基于LDM修改的代码,
ControlNet的代码也是基于LDM修改的代码,
LDM是没有你说的embedding相关的函数的,所以这部分是texture inversion自己修改的代码。
那你需要做的是把texture inversion修改的部分看懂并迁移到ControlNet的代码中,

但这已经超出了我这个项目的范围,所以后面我就不再继续解答相关问题,这个issue也已经讨论和lora无关的问题很久了。

@zhanghongyong123456
Copy link

我看了一下,你的是texture inversion的代码,是基于LDM修改的代码, ControlNet的代码也是基于LDM修改的代码, LDM是没有你说的embedding相关的函数的,所以这部分是texture inversion自己修改的代码。 那你需要做的是把texture inversion修改的部分看懂并迁移到ControlNet的代码中,

但这已经超出了我这个项目的范围,所以后面我就不再继续解答相关问题,这个issue也已经讨论和lora无关的问题很久了。

好的,我在查一下其他相关实现代码,看看有没有解决办法,谢谢您的解答

@justinjohn0306
Copy link

@zhanghongyong123456 had any luck with it?

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

No branches or pull requests

4 participants