feat: Added D2 Model and CLIP Merge SDXL
This commit is contained in:
+2
-1
@@ -12,9 +12,10 @@ from .nodes.d2_nodes import NODE_CLASS_MAPPINGS as D2_CLASS_MAPPIGS
|
||||
from .nodes.d2_size_nodes import NODE_CLASS_MAPPINGS as D2_SIZE_CLASS_MAPPIGS
|
||||
from .nodes.d2_xy_nodes import NODE_CLASS_MAPPINGS as D2_XY_CLASS_MAPPIGS
|
||||
from .nodes.d2_refiner_nodes import NODE_CLASS_MAPPINGS as D2_REFINER_CLASS_MAPPIGS
|
||||
from .nodes.d2_merge_nodes import NODE_CLASS_MAPPINGS as D2_MERGE_CLASS_MAPPIGS
|
||||
|
||||
WEB_DIRECTORY = "./web"
|
||||
NODE_CLASS_MAPPINGS = {**D2_CLASS_MAPPIGS, **D2_SIZE_CLASS_MAPPIGS, **D2_XY_CLASS_MAPPIGS, **D2_REFINER_CLASS_MAPPIGS}
|
||||
NODE_CLASS_MAPPINGS = {**D2_CLASS_MAPPIGS, **D2_SIZE_CLASS_MAPPIGS, **D2_XY_CLASS_MAPPIGS, **D2_REFINER_CLASS_MAPPIGS, **D2_MERGE_CLASS_MAPPIGS}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = []
|
||||
|
||||
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
|
||||
|
||||
@@ -130,6 +130,11 @@ If you have installed any of the following custom nodes previously, please remov
|
||||
- <a href="node.md#D2-Refiner-Steps-Tester">`D2 Refiner Steps Tester`</a>
|
||||
- Node for checking steps
|
||||
|
||||
### Merge Node
|
||||
|
||||
- <a href="node.md#D2-Model-and-CLIP-Merge-SDXL">`D2 Model and CLIP Merge SDXL`</a>
|
||||
- A node that combines ModelMergeSDXL and CLIPMergeSimple
|
||||
|
||||
### Float Palet
|
||||
|
||||
- <a href="node.md#D2-Queue-Button">`D2 Queue Button`</a>
|
||||
@@ -142,6 +147,10 @@ If you have installed any of the following custom nodes previously, please remov
|
||||
|
||||
## :blossom: Changelog
|
||||
|
||||
**2025.02.23**
|
||||
|
||||
- `D2 Model and CLIP Merge SDXL`: Added checkpoint merge nodes
|
||||
|
||||
**2025.01.20**
|
||||
|
||||
- `D2 XY Seed2`: Added new node
|
||||
|
||||
@@ -842,6 +842,25 @@ Output text
|
||||
|
||||
- Node for checking steps
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
## :tomato: Merge Node
|
||||
|
||||
|
||||
### D2 Model and CLIP Merge SDXL
|
||||
|
||||
<figure>
|
||||
<img src="../img/merge_sdxl.png">
|
||||
</figure>
|
||||
|
||||
- A node that combines ModelMergeSDXL and CLIPMergeSimple
|
||||
- Allows comma-separated weight specifications for easier use with XYPlot
|
||||
- In this figure, `0.85,0.85,1,1,0.4,0.4,1,0.4,0.4,0.4,1,0.4,0.4,0.4,0,0.55,0.85,0.85,0.85,0.85,0.85,0.85,1,1,0.65` is specified
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## :tomato: Float Palet
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
@@ -133,6 +133,12 @@ D2 Nodes ComfyUI
|
||||
- <a href="node.md#D2-Refiner-Steps-Tester">`D2 Refiner Steps Tester`</a>
|
||||
- steps を確認するためのノード
|
||||
|
||||
### Merge Node
|
||||
|
||||
- <a href="node.md#D2-Model-and-CLIP-Merge-SDXL">`D2 Model and CLIP Merge SDXL`</a>
|
||||
- ModelMergeSDXL と CLIPMergeSimple を合体させたノード
|
||||
|
||||
|
||||
### Float Palet
|
||||
|
||||
- <a href="node.md#D2-Queue-Button">`D2 Queue Button`</a>
|
||||
@@ -145,6 +151,10 @@ D2 Nodes ComfyUI
|
||||
|
||||
## :blossom: Changelog
|
||||
|
||||
**2025.02.23**
|
||||
|
||||
- `D2 Model and CLIP Merge SDXL`: checkpointのマージノードを追加
|
||||
|
||||
**2025.01.20**
|
||||
|
||||
- `D2 XY Seed2`: 新規追加
|
||||
|
||||
@@ -935,6 +935,23 @@ Output text
|
||||
---
|
||||
|
||||
|
||||
## :tomato: Merge Node
|
||||
|
||||
|
||||
### D2 Model and CLIP Merge SDXL
|
||||
|
||||
<figure>
|
||||
<img src="../img/merge_sdxl.png">
|
||||
</figure>
|
||||
|
||||
- ModelMergeSDXL と CLIPMergeSimple を合体させたノード
|
||||
- XYPlot で使いやすいように、各 weight をカンマ区切りで指定可能にした
|
||||
- この図では `0.85,0.85,1,1,0.4,0.4,1,0.4,0.4,0.4,1,0.4,0.4,0.4,0,0.55,0.85,0.85,0.85,0.85,0.85,0.85,1,1,0.65` を指定している
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
## :tomato: Float Palet
|
||||
|
||||
|
||||
|
||||
@@ -131,6 +131,13 @@
|
||||
- <a href="node.md#D2-Refiner-Steps-Tester">`D2 Refiner Steps Tester`</a>
|
||||
- 用於確認步數的節點
|
||||
|
||||
### Merge Node
|
||||
|
||||
- <a href="node.md#D2-Model-and-CLIP-Merge-SDXL">`D2 Model and CLIP Merge SDXL`</a>
|
||||
- 將 ModelMergeSDXL 和 CLIPMergeSimple 結合的節點
|
||||
|
||||
|
||||
|
||||
### 浮動面板
|
||||
|
||||
- <a href="node.md#D2-Queue-Button">`D2 Queue Button`</a>
|
||||
@@ -141,6 +148,10 @@
|
||||
|
||||
## :blossom: 更新日誌
|
||||
|
||||
**2025.02.23**
|
||||
|
||||
- `D2 Model and CLIP Merge SDXL`: 新增 checkpoint 合併節點
|
||||
|
||||
**2025.01.20**
|
||||
|
||||
- `D2 XY Seed2`: 新增節點
|
||||
|
||||
@@ -876,6 +876,24 @@ Output text
|
||||
|
||||
- 用於確認步數的節點
|
||||
|
||||
---
|
||||
|
||||
## :tomato: Merge Node
|
||||
|
||||
|
||||
### D2 Model and CLIP Merge SDXL
|
||||
|
||||
<figure>
|
||||
<img src="../img/merge_sdxl.png">
|
||||
</figure>
|
||||
|
||||
- 將 ModelMergeSDXL 和 CLIPMergeSimple 結合的節點
|
||||
- 為了便於在 XYPlot 中使用,可以用逗號分隔指定各個權重
|
||||
- 在此圖中指定了 `0.85,0.85,1,1,0.4,0.4,1,0.4,0.4,0.4,1,0.4,0.4,0.4,0,0.55,0.85,0.85,0.85,0.85,0.85,0.85,1,1,0.65`
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## :tomato: Float Palet
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
from typing import Optional
|
||||
from comfy_extras.nodes_model_merging import ModelMergeBlocks, CLIPMergeSimple
|
||||
|
||||
class D2_ModelAndCLIPMergeSDXL():
|
||||
CATEGORY = "advanced/model_merging/model_specific"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"model1": ("MODEL",),
|
||||
"model2": ("MODEL",),
|
||||
"clip1": ("CLIP",),
|
||||
"clip2": ("CLIP",),
|
||||
"weights": ("STRING",),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("MODEL", "CLIP",)
|
||||
FUNCTION = "merge"
|
||||
CATEGORY = "D2/Merge"
|
||||
|
||||
def merge(self, model1, model2, clip1, clip2, weights):
|
||||
# Parse weights string into dictionary
|
||||
weight_parts = [w.strip() for w in weights.split(",")]
|
||||
weights_dict = {}
|
||||
|
||||
# SDXL model structure components
|
||||
components = [
|
||||
"time_embed.",
|
||||
"label_emb.",
|
||||
"input_blocks.0", "input_blocks.1", "input_blocks.2", "input_blocks.3",
|
||||
"input_blocks.4", "input_blocks.5", "input_blocks.6", "input_blocks.7", "input_blocks.8",
|
||||
"middle_block.0", "middle_block.1", "middle_block.2",
|
||||
"output_blocks.0", "output_blocks.1", "output_blocks.2", "output_blocks.3",
|
||||
"output_blocks.4", "output_blocks.5", "output_blocks.6", "output_blocks.7", "output_blocks.8",
|
||||
"out"
|
||||
]
|
||||
|
||||
# Map weights to components
|
||||
for i, weight in enumerate(weight_parts):
|
||||
if i < len(components):
|
||||
try:
|
||||
weight_float = float(weight)
|
||||
weights_dict[components[i]] = weight_float
|
||||
except ValueError:
|
||||
weights_dict[components[i]] = 0.5 # Default to 0.5 if invalid weight
|
||||
|
||||
# Fill remaining components with default weight
|
||||
for comp in components:
|
||||
if comp not in weights_dict:
|
||||
weights_dict[comp] = 0.5
|
||||
|
||||
# Calculate CLIP merge ratio (last weight if provided, otherwise 0.5)
|
||||
clip_ratio = float(weight_parts[-1]) if len(weight_parts) > len(components) else 0.5
|
||||
|
||||
# Merge models using ModelMergeBlocks
|
||||
model_merger = ModelMergeBlocks()
|
||||
merged_model = model_merger.merge(model1, model2, **weights_dict)[0]
|
||||
|
||||
# Merge CLIP models
|
||||
clip_merger = CLIPMergeSimple()
|
||||
merged_clip = clip_merger.merge(clip1, clip2, clip_ratio)[0]
|
||||
|
||||
return (merged_model, merged_clip,)
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"D2 Model and CLIP Merge SDXL": D2_ModelAndCLIPMergeSDXL,
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "d2-nodes-comfyui"
|
||||
description = "This is a collection of custom nodes that make ComfyUI slightly more convenient."
|
||||
version = "10.0.0"
|
||||
version = "11.0.0"
|
||||
license = { file = "LICENSE" }
|
||||
|
||||
[project.urls]
|
||||
|
||||
Reference in New Issue
Block a user