2024-04-09 08:25:45 +00:00
|
|
|
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}
|
|
|
|
|
2024-06-21 12:41:31 +00:00
|
|
|
class ModelMergeSD3_2B(comfy_extras.nodes_model_merging.ModelMergeBlocks):
|
2024-06-20 01:46:37 +00:00
|
|
|
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["pos_embed."] = argument
|
|
|
|
arg_dict["x_embedder."] = argument
|
|
|
|
arg_dict["context_embedder."] = argument
|
|
|
|
arg_dict["y_embedder."] = argument
|
|
|
|
arg_dict["t_embedder."] = argument
|
|
|
|
|
2024-06-21 12:41:31 +00:00
|
|
|
for i in range(24):
|
2024-06-20 01:46:37 +00:00
|
|
|
arg_dict["joint_blocks.{}.".format(i)] = argument
|
|
|
|
|
|
|
|
arg_dict["final_layer."] = argument
|
|
|
|
|
|
|
|
return {"required": arg_dict}
|
2024-04-09 08:25:45 +00:00
|
|
|
|
2024-08-03 03:20:30 +00:00
|
|
|
class ModelMergeFlux1(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["img_in."] = argument
|
|
|
|
arg_dict["time_in."] = argument
|
|
|
|
arg_dict["guidance_in"] = argument
|
|
|
|
arg_dict["vector_in."] = argument
|
|
|
|
arg_dict["txt_in."] = argument
|
|
|
|
|
|
|
|
for i in range(19):
|
|
|
|
arg_dict["double_blocks.{}.".format(i)] = argument
|
|
|
|
|
|
|
|
for i in range(38):
|
|
|
|
arg_dict["single_blocks.{}.".format(i)] = argument
|
|
|
|
|
|
|
|
arg_dict["final_layer."] = argument
|
|
|
|
|
|
|
|
return {"required": arg_dict}
|
|
|
|
|
2024-10-24 20:45:46 +00:00
|
|
|
class ModelMergeSD35_Large(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["pos_embed."] = argument
|
|
|
|
arg_dict["x_embedder."] = argument
|
|
|
|
arg_dict["context_embedder."] = argument
|
|
|
|
arg_dict["y_embedder."] = argument
|
|
|
|
arg_dict["t_embedder."] = argument
|
|
|
|
|
|
|
|
for i in range(38):
|
|
|
|
arg_dict["joint_blocks.{}.".format(i)] = argument
|
|
|
|
|
|
|
|
arg_dict["final_layer."] = argument
|
|
|
|
|
|
|
|
return {"required": arg_dict}
|
|
|
|
|
2024-11-14 12:51:20 +00:00
|
|
|
class ModelMergeMochiPreview(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["pos_frequencies."] = argument
|
|
|
|
arg_dict["t_embedder."] = argument
|
|
|
|
arg_dict["t5_y_embedder."] = argument
|
|
|
|
arg_dict["t5_yproj."] = argument
|
|
|
|
|
|
|
|
for i in range(48):
|
|
|
|
arg_dict["blocks.{}.".format(i)] = argument
|
|
|
|
|
|
|
|
arg_dict["final_layer."] = argument
|
|
|
|
|
|
|
|
return {"required": arg_dict}
|
|
|
|
|
2024-04-09 08:25:45 +00:00
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
|
|
"ModelMergeSD1": ModelMergeSD1,
|
|
|
|
"ModelMergeSD2": ModelMergeSD1, #SD1 and SD2 have the same blocks
|
|
|
|
"ModelMergeSDXL": ModelMergeSDXL,
|
2024-06-21 12:41:31 +00:00
|
|
|
"ModelMergeSD3_2B": ModelMergeSD3_2B,
|
2024-08-03 03:20:30 +00:00
|
|
|
"ModelMergeFlux1": ModelMergeFlux1,
|
2024-10-24 20:45:46 +00:00
|
|
|
"ModelMergeSD35_Large": ModelMergeSD35_Large,
|
2024-11-14 12:51:20 +00:00
|
|
|
"ModelMergeMochiPreview": ModelMergeMochiPreview,
|
2024-04-09 08:25:45 +00:00
|
|
|
}
|