You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.7 KiB
60 lines
1.7 KiB
import comfy_extras.nodes_model_merging |
|
|
|
class ModelMergeSD1(comfy_extras.nodes_model_merging.ModelMergeBlocks): |
|
CATEGORY = "advanced/model_merging/model_specific" |
|
@classmethod |
|
def INPUT_TYPES(s): |
|
arg_dict = { "model1": ("MODEL",), |
|
"model2": ("MODEL",)} |
|
|
|
argument = ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}) |
|
|
|
arg_dict["time_embed."] = argument |
|
arg_dict["label_emb."] = argument |
|
|
|
for i in range(12): |
|
arg_dict["input_blocks.{}.".format(i)] = argument |
|
|
|
for i in range(3): |
|
arg_dict["middle_block.{}.".format(i)] = argument |
|
|
|
for i in range(12): |
|
arg_dict["output_blocks.{}.".format(i)] = argument |
|
|
|
arg_dict["out."] = argument |
|
|
|
return {"required": arg_dict} |
|
|
|
|
|
class ModelMergeSDXL(comfy_extras.nodes_model_merging.ModelMergeBlocks): |
|
CATEGORY = "advanced/model_merging/model_specific" |
|
|
|
@classmethod |
|
def INPUT_TYPES(s): |
|
arg_dict = { "model1": ("MODEL",), |
|
"model2": ("MODEL",)} |
|
|
|
argument = ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}) |
|
|
|
arg_dict["time_embed."] = argument |
|
arg_dict["label_emb."] = argument |
|
|
|
for i in range(9): |
|
arg_dict["input_blocks.{}".format(i)] = argument |
|
|
|
for i in range(3): |
|
arg_dict["middle_block.{}".format(i)] = argument |
|
|
|
for i in range(9): |
|
arg_dict["output_blocks.{}".format(i)] = argument |
|
|
|
arg_dict["out."] = argument |
|
|
|
return {"required": arg_dict} |
|
|
|
|
|
NODE_CLASS_MAPPINGS = { |
|
"ModelMergeSD1": ModelMergeSD1, |
|
"ModelMergeSD2": ModelMergeSD1, #SD1 and SD2 have the same blocks |
|
"ModelMergeSDXL": ModelMergeSDXL, |
|
}
|
|
|