Closed aceyw closed 1 year ago
from ppdiffusers import StableDiffusionControlNetPipeline, ControlNetModel
# 初始化3个controlnet
controlnet1 = ControlNetModel.from_pretrained(
"aaaaa"
)
controlnet2 = ControlNetModel.from_pretrained(
"bbbbb"
)
controlnet3 = ControlNetModel.from_pretrained(
"cccccc"
)
# 初始化pipeline
pipe = StableDiffusionControlNetPipeline.from_pretrained("xxxxxx", controlnet=controlnet1)
# 切换controlnet为第二个
pipe.controlnet = controlnet2
# 切换controlnet为第三个
pipe.controlnet = controlnet2
你可以这样试一下
This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。
This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。
Feature request
使用controlnet插件的文生图的时候, 比如先使用controlnet1+sd模型,这时候需要创建pipe(会加载controlnet1+sd模型文件);然后改变成controlnet2+sd模型,这时候需要创建pipe(会加载controlnet2+sd模型文件)。所以,sd模型被加载了两次,比较慢。 能不能这样,直接把pipe的controlnet插件变更就可以使用? 或者类似stable-diffusion-webui那样,可以提前把controlnet1、controlnet2、sd加载到缓存列表里,然后需要用哪些模型插件就选择缓存里的对应模型,而不需要每次变更的时候都加载sd模型
Motivation
可以提升模型变更时的加载时间
Your contribution
谢谢