什么是模型合并?
准备新的检查点模型的方法,粗略分为下面 3 个。
- 从 0 学习
- 追加学习既有模型(微调 / LoRA 等)
- 混合既有模型彼此 (合并)
上 2 个专业知识和数据集的准备很麻烦,但第 3 个“合并”,可以在 ComfyUI 上简单地进行。
以 50:50 混合检查点
首先单纯地将 2 个模型混合一半吧。

{
"id": "32871326-b934-4cc4-887d-9d5f84bf23dc",
"revision": 0,
"last_node_id": 35,
"last_link_id": 37,
"nodes": [
{
"id": 6,
"type": "CLIPTextEncode",
"pos": [
385,
180
],
"size": [
422.84503173828125,
164.31304931640625
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 18
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
4
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"beautifull woman,portrait,wearing yellow sweater,looking at viewer, simple white background"
]
},
{
"id": 14,
"type": "CheckpointLoaderSimple",
"pos": [
-321.07180000000005,
230.32569999999998
],
"size": [
315,
98
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
10
]
},
{
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": []
},
{
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"📷-v1.x\\epicphotogasm_z.safetensors"
],
"color": "#323",
"bgcolor": "#535"
},
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [
386,
399
],
"size": [
423.39306640625,
139.30099487304688
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 17
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
6
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"text, watermark, worstquality, NSFW"
]
},
{
"id": 5,
"type": "EmptyLatentImage",
"pos": [
493,
614
],
"size": [
315,
106
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
2
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "EmptyLatentImage"
},
"widgets_values": [
512,
512,
1
]
},
{
"id": 15,
"type": "CheckpointLoaderSimple",
"pos": [
-321.07180000000005,
400.3257000000004
],
"size": [
315,
98
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
12
]
},
{
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": [
20
]
},
{
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": [
36
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"😎-v1.x\\meinamix_meinaV11.safetensors"
],
"color": "#323",
"bgcolor": "#535"
},
{
"id": 18,
"type": "Reroute",
"pos": [
221.9282,
420.3257000000004
],
"size": [
75,
26
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "",
"type": "*",
"link": 20
}
],
"outputs": [
{
"name": "",
"type": "CLIP",
"slot_index": 0,
"links": [
17,
18,
35
]
}
],
"properties": {
"showOutputText": false,
"horizontal": false
}
},
{
"id": 16,
"type": "VAELoader",
"pos": [
919.3486100676182,
66.26146418591145
],
"size": [
258.6513899323818,
58
],
"flags": {
"collapsed": false
},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "VAE",
"type": "VAE",
"links": [
14
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAELoader"
},
"widgets_values": [
"vae-ft-mse-840000-ema-pruned.safetensors"
]
},
{
"id": 8,
"type": "VAEDecode",
"pos": [
1210.605919854539,
186
],
"size": [
176.94214876033038,
46
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 7
},
{
"name": "vae",
"type": "VAE",
"link": 14
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"slot_index": 0,
"links": [
37
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAEDecode"
},
"widgets_values": []
},
{
"id": 32,
"type": "SaveImage",
"pos": [
1420.1539884694082,
186
],
"size": [
436.27,
503.5300000000001
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 37
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 3,
"type": "KSampler",
"pos": [
863,
186
],
"size": [
315,
262
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 13
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 4
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 6
},
{
"name": "latent_image",
"type": "LATENT",
"link": 2
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
7
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "KSampler"
},
"widgets_values": [
12345,
"fixed",
20,
8,
"euler",
"normal",
1
]
},
{
"id": 10,
"type": "ModelMergeSimple",
"pos": [
43.928200000000004,
315.3257000000004
],
"size": [
257.3212268066404,
78
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "model1",
"type": "MODEL",
"link": 10
},
{
"name": "model2",
"type": "MODEL",
"link": 12
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
13,
34
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ModelMergeSimple"
},
"widgets_values": [
0.5
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 31,
"type": "CheckpointSave",
"pos": [
403.19000776666985,
787.3953004833538
],
"size": [
315,
98
],
"flags": {},
"order": 8,
"mode": 4,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 34
},
{
"name": "clip",
"type": "CLIP",
"link": 35
},
{
"name": "vae",
"type": "VAE",
"link": 36
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CheckpointSave"
},
"widgets_values": [
"checkpoints/ComfyUI"
],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[
2,
5,
0,
3,
3,
"LATENT"
],
[
4,
6,
0,
3,
1,
"CONDITIONING"
],
[
6,
7,
0,
3,
2,
"CONDITIONING"
],
[
7,
3,
0,
8,
0,
"LATENT"
],
[
10,
14,
0,
10,
0,
"MODEL"
],
[
12,
15,
0,
10,
1,
"MODEL"
],
[
13,
10,
0,
3,
0,
"MODEL"
],
[
14,
16,
0,
8,
1,
"VAE"
],
[
17,
18,
0,
7,
0,
"CLIP"
],
[
18,
18,
0,
6,
0,
"CLIP"
],
[
20,
15,
1,
18,
0,
"*"
],
[
34,
10,
0,
31,
0,
"MODEL"
],
[
35,
18,
0,
31,
1,
"CLIP"
],
[
36,
15,
2,
31,
2,
"VAE"
],
[
37,
8,
0,
32,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {
"0246.VERSION": [
0,
0,
4
],
"ds": {
"scale": 0.8264462809917362,
"offset": [
421.07180000000005,
33.73853581408855
]
},
"frontendVersion": "1.35.0",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
在这个工作流中,使用 ModelMergeSimple 节点将 2 个检查点以 1:1 合并。
- 🟩
ModelMergeSimple接收 2 个MODEL输入,输出以指定的比率线性插补了权重的新模型。ratio=0.5时,可以认为是“将模型 A 和模型 B 各混了一半的东西”。
- 如果将输出的
MODEL原样连接到KSampler,就能简单地尝试中间模型。- 虽然只是杂乱地混合了动漫系和真实系,但能做到像 2.5 次元那样的表现令人吃惊呢。

- 如果中意合并结果,连接到
CheckpointSave节点作为检查点保存。(在上面的工作流旁路着。)- 保存目的地默认为
ComfyUI/output/checkpoints/(Windows 便携版的标准设定)。
- 保存目的地默认为
模型合并的弱点
即使混合 2 个模型,参数的数量本身仍是“一个模型份”。 在加上什么新的力量的一方,也可以认为那分量的原来的拿手领域的表现力被削减了。
混合各一半擅长画角色的模型和擅长画风景的模型的话,角色和背景都变成不上不下的模型。
这样似乎不太有用呢… 没有什么好方法吗?
阶层合并
Stable Diffusion 的“从噪声复原图像的本体”是名为 U 字形的网络“U-Net”的东西。 这是阶梯状的,从几个研究知道每层似乎作用不同。(cf. P+)
- 浅层 … 靠拢纹理・颜色・细微的图案
- 深层 … 靠拢形状・构图・布局
也就是说,在只想要模型 B 的色调时,好像只要只将浅层向模型 B 靠拢合并就好。 这就是阶层合并的机制。

{
"id": "32871326-b934-4cc4-887d-9d5f84bf23dc",
"revision": 0,
"last_node_id": 36,
"last_link_id": 41,
"nodes": [
{
"id": 6,
"type": "CLIPTextEncode",
"pos": [
385,
180
],
"size": [
422.84503173828125,
164.31304931640625
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 18
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
4
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"beautifull woman,portrait,wearing yellow sweater,looking at viewer, simple white background"
]
},
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [
386,
399
],
"size": [
423.39306640625,
139.30099487304688
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 17
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
6
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"text, watermark, worstquality, NSFW"
]
},
{
"id": 5,
"type": "EmptyLatentImage",
"pos": [
493,
614
],
"size": [
315,
106
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
2
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "EmptyLatentImage"
},
"widgets_values": [
512,
512,
1
]
},
{
"id": 18,
"type": "Reroute",
"pos": [
221.9282,
420.3257000000004
],
"size": [
75,
26
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "",
"type": "*",
"link": 20
}
],
"outputs": [
{
"name": "",
"type": "CLIP",
"slot_index": 0,
"links": [
17,
18,
35
]
}
],
"properties": {
"showOutputText": false,
"horizontal": false
}
},
{
"id": 16,
"type": "VAELoader",
"pos": [
919.3486100676182,
66.26146418591145
],
"size": [
258.6513899323818,
58
],
"flags": {
"collapsed": false
},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "VAE",
"type": "VAE",
"links": [
14
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAELoader"
},
"widgets_values": [
"vae-ft-mse-840000-ema-pruned.safetensors"
]
},
{
"id": 8,
"type": "VAEDecode",
"pos": [
1210.605919854539,
186
],
"size": [
176.94214876033038,
46
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 7
},
{
"name": "vae",
"type": "VAE",
"link": 14
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"slot_index": 0,
"links": [
37
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAEDecode"
},
"widgets_values": []
},
{
"id": 32,
"type": "SaveImage",
"pos": [
1420.1539884694082,
186
],
"size": [
436.27,
503.5300000000001
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 37
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 3,
"type": "KSampler",
"pos": [
863,
186
],
"size": [
315,
262
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 40
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 4
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 6
},
{
"name": "latent_image",
"type": "LATENT",
"link": 2
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
7
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "KSampler"
},
"widgets_values": [
12345,
"fixed",
20,
8,
"euler",
"normal",
1
]
},
{
"id": 31,
"type": "CheckpointSave",
"pos": [
403.19000776666985,
787.3953004833538
],
"size": [
315,
98
],
"flags": {},
"order": 8,
"mode": 4,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 41
},
{
"name": "clip",
"type": "CLIP",
"link": 35
},
{
"name": "vae",
"type": "VAE",
"link": 36
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CheckpointSave"
},
"widgets_values": [
"checkpoints/ComfyUI"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 14,
"type": "CheckpointLoaderSimple",
"pos": [
-321.07180000000005,
230.32569999999998
],
"size": [
315,
98
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
38
]
},
{
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": []
},
{
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"📷-v1.x\\epicphotogasm_z.safetensors"
],
"color": "#323",
"bgcolor": "#535"
},
{
"id": 15,
"type": "CheckpointLoaderSimple",
"pos": [
-321.07180000000005,
400.3257000000004
],
"size": [
315,
98
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
39
]
},
{
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": [
20
]
},
{
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": [
36
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"😎-v1.x\\meinamix_meinaV11.safetensors"
],
"color": "#323",
"bgcolor": "#535"
},
{
"id": 36,
"type": "ModelMergeBlocks",
"pos": [
40.11001818181825,
261.92937964045683
],
"size": [
256.81818181818176,
126
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "model1",
"type": "MODEL",
"link": 38
},
{
"name": "model2",
"type": "MODEL",
"link": 39
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
40,
41
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ModelMergeBlocks"
},
"widgets_values": [
1,
1,
0.5
],
"color": "#232",
"bgcolor": "#353"
}
],
"links": [
[
2,
5,
0,
3,
3,
"LATENT"
],
[
4,
6,
0,
3,
1,
"CONDITIONING"
],
[
6,
7,
0,
3,
2,
"CONDITIONING"
],
[
7,
3,
0,
8,
0,
"LATENT"
],
[
14,
16,
0,
8,
1,
"VAE"
],
[
17,
18,
0,
7,
0,
"CLIP"
],
[
18,
18,
0,
6,
0,
"CLIP"
],
[
20,
15,
1,
18,
0,
"*"
],
[
35,
18,
0,
31,
1,
"CLIP"
],
[
36,
15,
2,
31,
2,
"VAE"
],
[
37,
8,
0,
32,
0,
"IMAGE"
],
[
38,
14,
0,
36,
0,
"MODEL"
],
[
39,
15,
0,
36,
1,
"MODEL"
],
[
40,
36,
0,
3,
0,
"MODEL"
],
[
41,
36,
0,
31,
0,
"MODEL"
]
],
"groups": [],
"config": {},
"extra": {
"0246.VERSION": [
0,
0,
4
],
"ds": {
"scale": 1,
"offset": [
421.07180000000005,
33.73853581408855
]
},
"frontendVersion": "1.35.0",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
ComfyUI 的标准节点 ModelMergeBlocks,可以将 U-Net 整体粗略分为 IN / MID / OUT 的 3 块 指定比率。
IN… 输入侧的块(比较浅的层)MID… 中间的瓶颈附近OUT… 输出侧的块(比较深的层)
实际上 UNet 有几十层,通过社区的研究,哪层似乎对什么有影响,大体已经知道了。
在 ComfyUI,也有 ModelMergeSD1/ModelMergeSDXL 这样,虽然能一层层调整比率的节点。但,能运用自如这个是工匠技艺吧……
LoRA 的合并
LoRA 因为是像“能对原来的模型后加的差分补丁”那样的东西,所以与检查点彼此一样,LoRA 彼此也能相加合并。
在那以前,即使只读取 1 个 LoRA,背面也变成了“向基础的检查点加进 LoRA 的差分,当场制作合成模型”那样的举动。
也就是说,在向 checkpoint 适用 LoRA 的时间点,我们已经一直在做广义上的“像合并的事”了呢 (*゚∀゚)
差分 LoRA
到此为止的话题是“混合模型彼此制作新检查点”的方向,反过来也有 从检查点将“只差分”作为 LoRA 抽出 这样的构思。
- 基础模型
Base(例:v1-5-pruned) - 自定义检查点
Base+X(例:学习结束特定角色或画风的模型)
这时,Base+X 可以粗略视为“基础 + 追加风格 X”。
从这里取出“只 X 的部分”做成 LoRA,就是 差分 LoRA。
-
Base+X - Base = X (← 做成 LoRA 的差分)
-
- 将那个差分压缩为 LoRA 格式
工作流

{
"id": "5e4243dd-542f-476b-af93-165a65887050",
"revision": 0,
"last_node_id": 7,
"last_link_id": 12,
"nodes": [
{
"id": 1,
"type": "CheckpointLoaderSimple",
"pos": [
348.72229872501026,
621.8931414126628
],
"size": [
315,
98
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
10
]
},
{
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": [
8
]
},
{
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"😎-v1.x\\meinamix_meinaV11.safetensors"
],
"color": "#323",
"bgcolor": "#535"
},
{
"id": 3,
"type": "ModelMergeSubtract",
"pos": [
734.7117876431089,
621.8931414126628
],
"size": [
210,
78
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "model1",
"type": "MODEL",
"link": 10
},
{
"name": "model2",
"type": "MODEL",
"link": 11
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
4
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ModelMergeSubtract"
},
"widgets_values": [
1
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 2,
"type": "CheckpointLoaderSimple",
"pos": [
348.72229872501026,
781.0283805094396
],
"size": [
319.03827585779754,
98
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
11
]
},
{
"name": "CLIP",
"type": "CLIP",
"links": [
9
]
},
{
"name": "VAE",
"type": "VAE",
"links": null
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"v1-5-pruned-emaonly-fp16.safetensors"
],
"color": "#323",
"bgcolor": "#535"
},
{
"id": 5,
"type": "LoraSave",
"pos": [
997.1539034546028,
685.3256206111878
],
"size": [
210,
150
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "model_diff",
"shape": 7,
"type": "MODEL",
"link": 4
},
{
"name": "text_encoder_diff",
"shape": 7,
"type": "CLIP",
"link": 12
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76"
},
"widgets_values": [
"loras/meinamix-SD1.5",
32,
"standard",
true
]
},
{
"id": 7,
"type": "CLIPMergeSubtract",
"pos": [
735.1937942440574,
781.0283805094396
],
"size": [
210,
78
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "clip1",
"type": "CLIP",
"link": 8
},
{
"name": "clip2",
"type": "CLIP",
"link": 9
}
],
"outputs": [
{
"name": "CLIP",
"type": "CLIP",
"links": [
12
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "CLIPMergeSubtract"
},
"widgets_values": [
1
],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[
4,
3,
0,
5,
0,
"MODEL"
],
[
8,
1,
1,
7,
0,
"CLIP"
],
[
9,
2,
1,
7,
1,
"CLIP"
],
[
10,
1,
0,
3,
0,
"MODEL"
],
[
11,
2,
0,
3,
1,
"MODEL"
],
[
12,
7,
0,
5,
1,
"CLIP"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 1.0755189070090265,
"offset": [
-33.012469276095786,
-259.6941245825167
]
},
"frontendVersion": "1.35.0",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
- 🟩 输入想取
ModelMergeSubtract节点的差分的模型。- 是
model1 - model2。
- 是
- 🟨 虽然上面没使用,但也有取文本编码器的差分的
CLIPMergeSubtract节点。- 因为文本编码器相当严峻所以也有可能恶化。
- 在
Extract and Save Lora节点作为 LoRA 保存。rank越大越能忠实地保存差分,但那分量模型尺寸变大。- 作为标准,如果是风格差分是 8〜32 左右,想从相当不同的模型大块取差分时是 64 以上,印象中大多这样区分使用。
- 被抽出的 LoRA 模型,被保存在
\ComfyUI\output\loras。
差分 LoRA 的测试

{
"id": "8b9f7796-0873-4025-be3c-0f997f67f866",
"revision": 0,
"last_node_id": 11,
"last_link_id": 19,
"nodes": [
{
"id": 8,
"type": "VAEDecode",
"pos": [
1209,
188
],
"size": [
210,
46
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 7
},
{
"name": "vae",
"type": "VAE",
"link": 10
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"slot_index": 0,
"links": [
9
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "VAEDecode"
},
"widgets_values": []
},
{
"id": 9,
"type": "SaveImage",
"pos": [
1451,
189
],
"size": [
354.2876035004722,
433.23967321788405
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 9
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 5,
"type": "EmptyLatentImage",
"pos": [
582.1350317382813,
606.5799999999999
],
"size": [
244.81999999999994,
106
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
2
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "EmptyLatentImage"
},
"widgets_values": [
512,
512,
1
]
},
{
"id": 6,
"type": "CLIPTextEncode",
"pos": [
415,
186
],
"size": [
411.95503173828126,
151.0030493164063
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 18
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
4
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"beautifull woman,portrait,wearing yellow sweater,looking at viewer, simple white background"
]
},
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [
416.1970166015625,
392.37848510742185
],
"size": [
410.75801513671877,
158.82607910156253
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 19
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
6
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"text, watermark, worstquality, NSFW"
]
},
{
"id": 4,
"type": "CheckpointLoaderSimple",
"pos": [
-236.34725770097657,
296.0522226002962
],
"size": [
315,
98
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
11
]
},
{
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": [
12
]
},
{
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"v1-5-pruned-emaonly-fp16.safetensors"
]
},
{
"id": 11,
"type": "LoraLoader",
"pos": [
103.33290758827951,
296.0522226002962
],
"size": [
247.56574004507888,
126
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 11
},
{
"name": "clip",
"type": "CLIP",
"link": 12
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
15
]
},
{
"name": "CLIP",
"type": "CLIP",
"links": [
18,
19
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoraLoader"
},
"widgets_values": [
"meinamix-SD1.5_00002_.safetensors",
1,
1
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 3,
"type": "KSampler",
"pos": [
863,
186
],
"size": [
315,
262
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 15
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 4
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 6
},
{
"name": "latent_image",
"type": "LATENT",
"link": 2
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
7
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "KSampler"
},
"widgets_values": [
1234,
"fixed",
20,
8,
"euler",
"normal",
1
]
},
{
"id": 10,
"type": "VAELoader",
"pos": [
896.9256198347109,
69.4815990090115
],
"size": [
281.0743801652891,
58
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "VAE",
"type": "VAE",
"links": [
10
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAELoader"
},
"widgets_values": [
"vae-ft-mse-840000-ema-pruned.safetensors"
]
}
],
"links": [
[
2,
5,
0,
3,
3,
"LATENT"
],
[
4,
6,
0,
3,
1,
"CONDITIONING"
],
[
6,
7,
0,
3,
2,
"CONDITIONING"
],
[
7,
3,
0,
8,
0,
"LATENT"
],
[
9,
8,
0,
9,
0,
"IMAGE"
],
[
10,
10,
0,
8,
1,
"VAE"
],
[
11,
4,
0,
11,
0,
"MODEL"
],
[
12,
4,
1,
11,
1,
"CLIP"
],
[
15,
11,
0,
3,
0,
"MODEL"
],
[
18,
11,
1,
6,
0,
"CLIP"
],
[
19,
11,
1,
7,
0,
"CLIP"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.9090909090909092,
"offset": [
335.24725770097655,
30.518400990988496
]
},
"frontendVersion": "1.35.0",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
- 这次因为差分大,虽然并不是仅适用 LoRA 就能完美再现,但虽是 SD1.5,变得能生成像那样的图像了呢。