support diffusers controlnets

This commit is contained in:
Artiprocher
2024-04-25 16:22:37 +08:00
parent 3e8ba78652
commit cc37860438
2 changed files with 5 additions and 1 deletions

View File

@@ -45,7 +45,8 @@ class ModelManager:
def is_controlnet(self, state_dict):
param_name = "control_model.time_embed.0.weight"
return param_name in state_dict
param_name_2 = "mid_block.resnets.1.time_emb_proj.weight" # For controlnets in diffusers format
return param_name in state_dict or param_name_2 in state_dict
def is_animatediff(self, state_dict):
param_name = "mid_block.motion_modules.0.temporal_transformer.proj_out.weight"

View File

@@ -232,6 +232,9 @@ class SDControlNetStateDictConverter:
return state_dict_
def from_civitai(self, state_dict):
if "mid_block.resnets.1.time_emb_proj.weight" in state_dict:
# For controlnets in diffusers format
return self.from_diffusers(state_dict)
rename_dict = {
"control_model.time_embed.0.weight": "time_embedding.0.weight",
"control_model.time_embed.0.bias": "time_embedding.0.bias",