Add dedicated edit LoRA node

This commit is contained in:
GenorTG
2026-11-10 11:48:14 +01:00
parent b75e1cb50e
commit e5ebbf1260
3 changed files with 43 additions and 1 deletions
+6
View File
@@ -203,6 +203,12 @@ Loads an image from the input folder through a thumbnail browser (search, folder
### PromptForge Text Encode (`PROMPTFORGE_TextEncode`)
The positive prompt and the negative prompt in one node: `text` becomes POSITIVE and `negative` becomes NEGATIVE on the same CLIP, so a graph needs one encode instead of two. The negative is always encoded; the model patch's `use_nag` decides whether it is used.
### PromptForge Edit LoRA (`PROMPTFORGE_EditLora`)
The edit LoRA of a family, fixed by name: `Krea 2/tool/krea2_identity_edit_v2` or
`MOSS Image/tool/moss_image_edit_lora_rank_64_bf16`. Pick the family, adjust `strength`, or switch `enabled` off.
Nothing else can be cleared, so the identity/edit path cannot be broken by an empty LoRA list.
### PromptForge Krea NAG / Krea Edit Model Patch (`PROMPTFORGE_KreaNAG`, `PROMPTFORGE_KreaEditModelPatch`)
Model patches for Krea 2. `PromptForge Krea NAG` is the text-to-image NAG path; `PromptForge Krea Edit Model Patch`
+36
View File
@@ -1,4 +1,6 @@
"""PromptForge wrappers for the core nodes the image workflows need."""
import json
import nodes as comfy_nodes
import node_helpers
from comfy_extras.nodes_slg import SkipLayerGuidanceDiTSimple
@@ -93,6 +95,38 @@ class PROMPTFORGE_KreaEditEncode:
return positive, negative_out
EDIT_LORAS = {
"Krea 2": "Krea 2/tool/krea2_identity_edit_v2.safetensors",
"MOSS Image": "MOSS Image/tool/moss_image_edit_lora_rank_64_bf16.safetensors",
}
class PROMPTFORGE_EditLora:
"""The one edit LoRA of a family, fixed by name; only strength and an off switch can change."""
CATEGORY = "🔮 PromptForge/Prompts"
RETURN_TYPES = ("MODEL",)
FUNCTION = "apply"
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"model": ("MODEL",),
"family": (list(EDIT_LORAS), {"default": "Krea 2", "tooltip": "Picks the edit LoRA for this family. The path is fixed."}),
"strength": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.05}),
"enabled": ("BOOLEAN", {"default": True}),
}
}
def apply(self, model, family, strength, enabled):
if not enabled or strength == 0:
return (model,)
item = {"name": EDIT_LORAS[family], "on": True, "model": strength, "clip": None, "random": False,
"min": 0.6, "max": 1, "group": ""}
return (comfy_nodes.NODE_CLASS_MAPPINGS["PROMPTFORGE_LoraLoader"]().load(
model, json.dumps({"filter": "", "items": [item]}, separators=(",", ":")), 0, True)[0],)
class PROMPTFORGE_KreaNAG:
"""Krea2 text-to-image NAG as a model patch, with an off switch."""
CATEGORY = "🔮 PromptForge/Sampling"
@@ -236,6 +270,7 @@ NODE_CLASS_MAPPINGS = {
"PROMPTFORGE_TextEncode": PROMPTFORGE_TextEncode,
"PROMPTFORGE_MossEditEncode": PROMPTFORGE_MossEditEncode,
"PROMPTFORGE_KreaEditEncode": PROMPTFORGE_KreaEditEncode,
"PROMPTFORGE_EditLora": PROMPTFORGE_EditLora,
"PROMPTFORGE_KreaNAG": PROMPTFORGE_KreaNAG,
"PROMPTFORGE_KreaEditModelPatch": PROMPTFORGE_KreaEditModelPatch,
"PROMPTFORGE_SkipLayerGuidance": PROMPTFORGE_SkipLayerGuidance,
@@ -247,6 +282,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"PROMPTFORGE_TextEncode": "PromptForge Text Encode",
"PROMPTFORGE_MossEditEncode": "PromptForge MOSS Edit Encode",
"PROMPTFORGE_KreaEditEncode": "PromptForge Krea Edit Encode",
"PROMPTFORGE_EditLora": "PromptForge Edit LoRA",
"PROMPTFORGE_KreaNAG": "PromptForge Krea NAG",
"PROMPTFORGE_KreaEditModelPatch": "PromptForge Krea Edit Model Patch",
"PROMPTFORGE_SkipLayerGuidance": "PromptForge Skip Layer Guidance",
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "ComfyUI-PromptForge"
description = "ComfyUI prompt enhancement suite: model/config node with GPU-aware auto settings, prompt enhancer with a preset catalog, and a standalone config finder."
version = "1.28.20"
version = "1.28.21"
license = { file = "LICENSE" }
dependencies = [
"transformers",