diff --git a/examples/efficiency-nodes.json b/examples/efficiency-nodes.json new file mode 100644 index 0000000..67e1ee1 --- /dev/null +++ b/examples/efficiency-nodes.json @@ -0,0 +1,721 @@ +{ + "last_node_id": 10, + "last_link_id": 16, + "nodes": [ + { + "id": 1, + "type": "Efficient Loader", + "pos": [ + 136, + 89 + ], + "size": { + "0": 400, + "1": 462 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "lora_stack", + "type": "LORA_STACK", + "link": null + }, + { + "name": "cnet_stack", + "type": "CONTROL_NET_STACK", + "link": null + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 1, + 9 + ], + "shape": 3 + }, + { + "name": "CONDITIONING+", + "type": "CONDITIONING", + "links": [ + 2, + 10 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "CONDITIONING-", + "type": "CONDITIONING", + "links": [ + 3, + 11 + ], + "shape": 3 + }, + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 4, + 12 + ], + "shape": 3, + "slot_index": 3 + }, + { + "name": "VAE", + "type": "VAE", + "links": [ + 5, + 13 + ], + "shape": 3, + "slot_index": 4 + }, + { + "name": "CLIP", + "type": "CLIP", + "links": null, + "shape": 3 + }, + { + "name": "DEPENDENCIES", + "type": "DEPENDENCIES", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "Efficient Loader" + }, + "widgets_values": [ + "animagine-xl-3.0.safetensors", + "Baked VAE", + -1, + "None", + 1, + 1, + "1girl, hatsune miku, upper body, smile, looking at viewer, masterpiece, best quality", + "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name", + "none", + "comfy", + 1024, + 1024, + 1 + ], + "bgcolor": "#335533", + "shape": 1 + }, + { + "id": 9, + "type": "SaveImageWithMetaData", + "pos": [ + 1464, + 366 + ], + "size": { + "0": 315, + "1": 318 + }, + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 15, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "SaveImageWithMetaData" + }, + "widgets_values": [ + "eff_adv", + "Farthest", + 0 + ] + }, + { + "id": 4, + "type": "Eff. Loader SDXL", + "pos": [ + 141, + 628 + ], + "size": { + "0": 400, + "1": 402.0000305175781 + }, + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [ + { + "name": "lora_stack", + "type": "LORA_STACK", + "link": null + }, + { + "name": "cnet_stack", + "type": "CONTROL_NET_STACK", + "link": null + } + ], + "outputs": [ + { + "name": "SDXL_TUPLE", + "type": "SDXL_TUPLE", + "links": [ + 6 + ], + "shape": 3 + }, + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 7 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "VAE", + "type": "VAE", + "links": [ + 8 + ], + "shape": 3 + }, + { + "name": "DEPENDENCIES", + "type": "DEPENDENCIES", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "Eff. Loader SDXL" + }, + "widgets_values": [ + "animagine-xl-3.0.safetensors", + -2, + "None", + -2, + 6, + 2, + "Baked VAE", + "1girl, hatsune miku, upper body, smile, looking at viewer, masterpiece, best quality", + "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name", + "none", + "comfy", + 832, + 1216, + 1 + ], + "bgcolor": "#335555", + "shape": 1 + }, + { + "id": 8, + "type": "SaveImageWithMetaData", + "pos": [ + 1468, + -21 + ], + "size": { + "0": 315, + "1": 318 + }, + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 14, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "SaveImageWithMetaData" + }, + "widgets_values": [ + "eff", + "Farthest", + 0 + ] + }, + { + "id": 10, + "type": "SaveImageWithMetaData", + "pos": [ + 1472, + 772 + ], + "size": { + "0": 315, + "1": 318 + }, + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 16, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "SaveImageWithMetaData" + }, + "widgets_values": [ + "eff_xl", + "Farthest", + 0 + ] + }, + { + "id": 6, + "type": "KSampler Adv. (Efficient)", + "pos": [ + 1050, + 266 + ], + "size": [ + 323.57684936523447, + 422 + ], + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 9, + "slot_index": 0 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 10 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 11, + "slot_index": 2 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 12 + }, + { + "name": "optional_vae", + "type": "VAE", + "link": 13, + "slot_index": 4 + }, + { + "name": "script", + "type": "SCRIPT", + "link": null + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": null, + "shape": 3 + }, + { + "name": "CONDITIONING+", + "type": "CONDITIONING", + "links": null, + "shape": 3 + }, + { + "name": "CONDITIONING-", + "type": "CONDITIONING", + "links": null, + "shape": 3 + }, + { + "name": "LATENT", + "type": "LATENT", + "links": null, + "shape": 3 + }, + { + "name": "VAE", + "type": "VAE", + "links": null, + "shape": 3 + }, + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 15 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "KSampler Adv. (Efficient)" + }, + "widgets_values": [ + "enable", + 456, + null, + 25, + 7, + "euler_ancestral", + "normal", + 0, + 10000, + "disable", + "none", + "true" + ], + "bgcolor": "#665533", + "shape": 1 + }, + { + "id": 3, + "type": "KSampler (Efficient)", + "pos": [ + 603, + 89 + ], + "size": [ + 339.13239746093757, + 350 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 1, + "slot_index": 0 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 2 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 3, + "slot_index": 2 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 4 + }, + { + "name": "optional_vae", + "type": "VAE", + "link": 5 + }, + { + "name": "script", + "type": "SCRIPT", + "link": null + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": null, + "shape": 3 + }, + { + "name": "CONDITIONING+", + "type": "CONDITIONING", + "links": null, + "shape": 3 + }, + { + "name": "CONDITIONING-", + "type": "CONDITIONING", + "links": null, + "shape": 3 + }, + { + "name": "LATENT", + "type": "LATENT", + "links": null, + "shape": 3 + }, + { + "name": "VAE", + "type": "VAE", + "links": null, + "shape": 3 + }, + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 14 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "KSampler (Efficient)" + }, + "widgets_values": [ + 123, + null, + 20, + 7, + "euler_ancestral", + "normal", + 1, + "none", + "true" + ], + "bgcolor": "#553333", + "shape": 1 + }, + { + "id": 5, + "type": "KSampler SDXL (Eff.)", + "pos": [ + 603, + 720 + ], + "size": [ + 312.24350280761723, + 334 + ], + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [ + { + "name": "sdxl_tuple", + "type": "SDXL_TUPLE", + "link": 6, + "slot_index": 0 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 7 + }, + { + "name": "optional_vae", + "type": "VAE", + "link": 8, + "slot_index": 2 + }, + { + "name": "script", + "type": "SCRIPT", + "link": null + } + ], + "outputs": [ + { + "name": "SDXL_TUPLE", + "type": "SDXL_TUPLE", + "links": null, + "shape": 3 + }, + { + "name": "LATENT", + "type": "LATENT", + "links": null, + "shape": 3 + }, + { + "name": "VAE", + "type": "VAE", + "links": null, + "shape": 3 + }, + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 16 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "KSampler SDXL (Eff.)" + }, + "widgets_values": [ + 789, + null, + 20, + 7, + "euler_ancestral", + "normal", + 0, + -1, + "none", + "true" + ], + "bgcolor": "#553355", + "shape": 1 + } + ], + "links": [ + [ + 1, + 1, + 0, + 3, + 0, + "MODEL" + ], + [ + 2, + 1, + 1, + 3, + 1, + "CONDITIONING" + ], + [ + 3, + 1, + 2, + 3, + 2, + "CONDITIONING" + ], + [ + 4, + 1, + 3, + 3, + 3, + "LATENT" + ], + [ + 5, + 1, + 4, + 3, + 4, + "VAE" + ], + [ + 6, + 4, + 0, + 5, + 0, + "SDXL_TUPLE" + ], + [ + 7, + 4, + 1, + 5, + 1, + "LATENT" + ], + [ + 8, + 4, + 2, + 5, + 2, + "VAE" + ], + [ + 9, + 1, + 0, + 6, + 0, + "MODEL" + ], + [ + 10, + 1, + 1, + 6, + 1, + "CONDITIONING" + ], + [ + 11, + 1, + 2, + 6, + 2, + "CONDITIONING" + ], + [ + 12, + 1, + 3, + 6, + 3, + "LATENT" + ], + [ + 13, + 1, + 4, + 6, + 4, + "VAE" + ], + [ + 14, + 3, + 5, + 8, + 0, + "IMAGE" + ], + [ + 15, + 6, + 5, + 9, + 0, + "IMAGE" + ], + [ + 16, + 5, + 3, + 10, + 0, + "IMAGE" + ] + ], + "groups": [], + "config": {}, + "extra": {}, + "version": 0.4 +} \ No newline at end of file diff --git a/examples/efficiency-nodes.png b/examples/efficiency-nodes.png new file mode 100644 index 0000000..c5fc696 Binary files /dev/null and b/examples/efficiency-nodes.png differ diff --git a/py/defs/ext/efficiency_nodes.py b/py/defs/ext/efficiency_nodes.py new file mode 100644 index 0000000..6de3302 --- /dev/null +++ b/py/defs/ext/efficiency_nodes.py @@ -0,0 +1,61 @@ +# https://github.com/jags111/efficiency-nodes-comfyui +from ..meta import MetaField +from ..formatters import calc_model_hash + +SAMPLERS = { + "KSampler (Efficient)": { + "positive": "positive", + "negative": "negative", + }, + "KSampler Adv. (Efficient)": { + "positive": "positive", + "negative": "negative", + }, + "KSampler SDXL (Eff.)": { + "positive": "positive", + "negative": "negative", + }, +} + +CAPTURE_FIELD_LIST = { + "Efficient Loader": { + MetaField.MODEL_NAME: {"field_name": "ckpt_name"}, + MetaField.MODEL_HASH: {"field_name": "ckpt_name", "format": calc_model_hash}, + MetaField.POSITIVE_PROMPT: {"field_name": "positive"}, + MetaField.NEGATIVE_PROMPT: {"field_name": "negative"}, + MetaField.IMAGE_WIDTH: {"field_name": "empty_latent_width"}, + MetaField.IMAGE_HEIGHT: {"field_name": "empty_latent_height"}, + }, + "Eff. Loader SDXL": { + MetaField.MODEL_NAME: {"field_name": "base_ckpt_name"}, + MetaField.MODEL_HASH: { + "field_name": "base_ckpt_name", + "format": calc_model_hash, + }, + MetaField.POSITIVE_PROMPT: {"field_name": "positive"}, + MetaField.NEGATIVE_PROMPT: {"field_name": "negative"}, + MetaField.IMAGE_WIDTH: {"field_name": "empty_latent_width"}, + MetaField.IMAGE_HEIGHT: {"field_name": "empty_latent_height"}, + }, + "KSampler (Efficient)": { + MetaField.SEED: {"field_name": "seed"}, + MetaField.STEPS: {"field_name": "steps"}, + MetaField.CFG: {"field_name": "cfg"}, + MetaField.SAMPLER_NAME: {"field_name": "sampler_name"}, + MetaField.SCHEDULER: {"field_name": "scheduler"}, + }, + "KSampler Adv. (Efficient)": { + MetaField.SEED: {"field_name": "noise_seed"}, + MetaField.STEPS: {"field_name": "steps"}, + MetaField.CFG: {"field_name": "cfg"}, + MetaField.SAMPLER_NAME: {"field_name": "sampler_name"}, + MetaField.SCHEDULER: {"field_name": "scheduler"}, + }, + "KSampler SDXL (Eff.)": { + MetaField.SEED: {"field_name": "noise_seed"}, + MetaField.STEPS: {"field_name": "steps"}, + MetaField.CFG: {"field_name": "cfg"}, + MetaField.SAMPLER_NAME: {"field_name": "sampler_name"}, + MetaField.SCHEDULER: {"field_name": "scheduler"}, + }, +}