3 Commits
Author SHA1 Message Date
Searge 8e71c26c44 Added logo 2024-08-26 14:33:47 +02:00
Searge 89c49f889a Added experimental workflows 2024-08-26 14:09:45 +02:00
Searge e0342fb280 Minor tweaks based on feedback from beta testing 2024-08-26 13:30:39 +02:00
6 changed files with 2881 additions and 95 deletions
+2
View File
@@ -3,6 +3,8 @@
A prompt-generator or prompt-improvement node for ComfyUI, utilizing the power of a language model to turn a provided
text-to-image prompt into a more detailed and improved prompt.
![Custom node Searge-LLM for ComfyUI](img/SeargeLLM-Flux.jpg "Searge-LLM for ComfyUI Logo")
## Install the language model
- Create a new folder called `llm_gguf` in the `ComfyUI/models` directory.
- Download the file `Mistral-7B-Instruct-v0.3.Q4_K_M.gguf` **(4.37 GB)**.
+4 -4
View File
@@ -49,8 +49,8 @@ class Searge_LLM_Node:
CATEGORY = "Searge-LLM"
FUNCTION = "main"
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("string",)
RETURN_TYPES = ("STRING", "STRING",)
RETURN_NAMES = ("generated", "original",)
def main(self, text, random_seed, model, max_tokens, apply_instructions, instructions, adv_options_config=None):
model_path = os.path.join(GLOBAL_MODELS_DIR, model)
@@ -175,9 +175,9 @@ class Searge_LLM_Node:
llm_result = model_to_use.create_chat_completion(messages, **generate_kwargs)
return (llm_result['choices'][0]['message']['content'].strip(),)
return (llm_result['choices'][0]['message']['content'].strip(), text)
else:
return ("NOT A GGUF MODEL",)
return ("NOT A GGUF MODEL", text)
class Searge_Output_Node:
+892
View File
@@ -0,0 +1,892 @@
{
"last_node_id": 37,
"last_link_id": 74,
"nodes": [
{
"id": 3,
"type": "KSampler",
"pos": [
850,
190
],
"size": {
"0": 315,
"1": 262
},
"flags": {
"pinned": true
},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 28
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 74
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 41
},
{
"name": "latent_image",
"type": "LATENT",
"link": 2
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
7
],
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "KSampler"
},
"widgets_values": [
740147218195907,
"fixed",
20,
1,
"ddim",
"ddim_uniform",
1
],
"color": "#233",
"bgcolor": "#355"
},
{
"id": 5,
"type": "EmptyLatentImage",
"pos": [
480,
680
],
"size": {
"0": 320,
"1": 110
},
"flags": {
"pinned": true
},
"order": 0,
"mode": 0,
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
2
],
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "EmptyLatentImage"
},
"widgets_values": [
1216,
832,
1
],
"color": "#323",
"bgcolor": "#535"
},
{
"id": 8,
"type": "VAEDecode",
"pos": [
1210,
190
],
"size": {
"0": 210,
"1": 46
},
"flags": {
"pinned": true
},
"order": 14,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 7
},
{
"name": "vae",
"type": "VAE",
"link": 12
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
9
],
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "VAEDecode"
},
"color": "#223",
"bgcolor": "#335"
},
{
"id": 9,
"type": "SaveImage",
"pos": [
1210,
500
],
"size": {
"0": 450,
"1": 360
},
"flags": {
"pinned": true
},
"order": 15,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 9
}
],
"properties": {},
"widgets_values": [
"Flux/Image"
],
"color": "#222",
"bgcolor": "#000"
},
{
"id": 10,
"type": "VAELoader",
"pos": [
850,
510
],
"size": {
"0": 315,
"1": 58
},
"flags": {
"pinned": true
},
"order": 1,
"mode": 0,
"outputs": [
{
"name": "VAE",
"type": "VAE",
"links": [
12
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "VAELoader"
},
"widgets_values": [
"flux-vae.safetensors"
],
"color": "#322",
"bgcolor": "#533"
},
{
"id": 19,
"type": "ModelSamplingFlux",
"pos": [
480,
40
],
"size": {
"0": 320,
"1": 130
},
"flags": {
"pinned": true
},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 36
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
28
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "ModelSamplingFlux"
},
"widgets_values": [
1.15,
0.5,
1216,
832
],
"color": "#2a363b",
"bgcolor": "#3f5159"
},
{
"id": 22,
"type": "Searge_Output_Node",
"pos": [
370,
360
],
"size": {
"0": 430,
"1": 270
},
"flags": {
"pinned": true
},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "text",
"type": "*",
"link": 51
}
],
"properties": {
"Node name for S&R": "Searge_Output_Node"
},
"widgets_values": [
""
]
},
{
"id": 26,
"type": "DualCLIPLoader",
"pos": [
10,
210
],
"size": {
"0": 340,
"1": 110
},
"flags": {
"pinned": true
},
"order": 2,
"mode": 0,
"outputs": [
{
"name": "CLIP",
"type": "CLIP",
"links": [
37,
52
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "DualCLIPLoader"
},
"widgets_values": [
"t5xxl_fp8_e4m3fn.safetensors",
"clip_l.safetensors",
"flux"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 27,
"type": "UNETLoader",
"pos": [
10,
40
],
"size": {
"0": 340,
"1": 90
},
"flags": {
"pinned": true
},
"order": 3,
"mode": 0,
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
36
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "UNETLoader"
},
"widgets_values": [
"flux1-dev-fp8.safetensors",
"fp8_e4m3fn"
],
"color": "#2a363b",
"bgcolor": "#3f5159"
},
{
"id": 28,
"type": "CLIPTextEncodeFlux",
"pos": [
370,
210
],
"size": {
"0": 430,
"1": 110
},
"flags": {
"pinned": true
},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 37
},
{
"name": "clip_l",
"type": "STRING",
"link": 56,
"widget": {
"name": "clip_l"
}
},
{
"name": "t5xxl",
"type": "STRING",
"link": 57,
"widget": {
"name": "t5xxl"
}
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
41,
64
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "CLIPTextEncodeFlux"
},
"widgets_values": [
"",
"",
3.5
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 31,
"type": "PrimitiveNode",
"pos": [
850,
680
],
"size": {
"0": 319.20001220703125,
"1": 82
},
"flags": {
"pinned": true
},
"order": 4,
"mode": 0,
"outputs": [
{
"name": "INT",
"type": "INT",
"links": [
43
],
"widget": {
"name": "random_seed"
}
}
],
"title": "Seed for the Searge LLM prompting node",
"properties": {
"Run widget replace on values": false
},
"widgets_values": [
290300454036196,
"fixed"
],
"color": "#332922",
"bgcolor": "#593930"
},
{
"id": 32,
"type": "Searge_LLM_Node",
"pos": [
10,
360
],
"size": {
"0": 340,
"1": 510
},
"flags": {
"pinned": true
},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "adv_options_config",
"type": "SRGADVOPTIONSCONFIG",
"link": null
},
{
"name": "random_seed",
"type": "INT",
"link": 43,
"widget": {
"name": "random_seed"
}
}
],
"outputs": [
{
"name": "generated",
"type": "STRING",
"links": [
51,
56,
57
],
"slot_index": 0,
"shape": 3
},
{
"name": "original",
"type": "STRING",
"links": [
58
],
"slot_index": 1,
"shape": 3
}
],
"properties": {
"Node name for S&R": "Searge_LLM_Node"
},
"widgets_values": [
"A psychedelic animal frozen in a jar on a wooden table, sci-fi, wide angle",
290300454036196,
"Mistral-7B-Instruct-v0.3.Q4_K_M.gguf",
4096,
true,
"Generate a prompt from \"{prompt}\""
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 33,
"type": "Reroute",
"pos": [
450,
-70
],
"size": [
75,
26
],
"flags": {
"pinned": true
},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "",
"type": "*",
"link": 58,
"widget": {
"name": "value"
}
}
],
"outputs": [
{
"name": "",
"type": "STRING",
"links": [
60,
61
],
"slot_index": 0
}
],
"properties": {
"showOutputText": false,
"horizontal": false
},
"color": "#232",
"bgcolor": "#353"
},
{
"id": 34,
"type": "Reroute",
"pos": [
450,
-110
],
"size": [
75,
26
],
"flags": {
"pinned": true
},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "",
"type": "*",
"link": 52
}
],
"outputs": [
{
"name": "",
"type": "CLIP",
"links": [
59
],
"slot_index": 0
}
],
"properties": {
"showOutputText": false,
"horizontal": false
},
"color": "#432",
"bgcolor": "#653"
},
{
"id": 36,
"type": "ConditioningCombine",
"pos": [
850,
-60
],
"size": {
"0": 228.39999389648438,
"1": 46
},
"flags": {
"pinned": true
},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "conditioning_1",
"type": "CONDITIONING",
"link": 63
},
{
"name": "conditioning_2",
"type": "CONDITIONING",
"link": 64
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
74
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "ConditioningCombine"
},
"color": "#432",
"bgcolor": "#653"
},
{
"id": 37,
"type": "CLIPTextEncodeFlux",
"pos": [
590,
-110
],
"size": {
"0": 210,
"1": 98
},
"flags": {
"pinned": true
},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 59
},
{
"name": "clip_l",
"type": "STRING",
"link": 60,
"widget": {
"name": "clip_l"
}
},
{
"name": "t5xxl",
"type": "STRING",
"link": 61,
"widget": {
"name": "t5xxl"
}
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
63
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "CLIPTextEncodeFlux"
},
"widgets_values": [
"",
"",
3.5
],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[
2,
5,
0,
3,
3,
"LATENT"
],
[
7,
3,
0,
8,
0,
"LATENT"
],
[
9,
8,
0,
9,
0,
"IMAGE"
],
[
12,
10,
0,
8,
1,
"VAE"
],
[
28,
19,
0,
3,
0,
"MODEL"
],
[
36,
27,
0,
19,
0,
"MODEL"
],
[
37,
26,
0,
28,
0,
"CLIP"
],
[
41,
28,
0,
3,
2,
"CONDITIONING"
],
[
43,
31,
0,
32,
1,
"INT"
],
[
51,
32,
0,
22,
0,
"*"
],
[
52,
26,
0,
34,
0,
"*"
],
[
56,
32,
0,
28,
1,
"STRING"
],
[
57,
32,
0,
28,
2,
"STRING"
],
[
58,
32,
1,
33,
0,
"*"
],
[
59,
34,
0,
37,
0,
"CLIP"
],
[
60,
33,
0,
37,
1,
"STRING"
],
[
61,
33,
0,
37,
2,
"STRING"
],
[
63,
37,
0,
36,
0,
"CONDITIONING"
],
[
64,
28,
0,
36,
1,
"CONDITIONING"
],
[
74,
36,
0,
3,
1,
"CONDITIONING"
]
],
"groups": [],
"config": {},
"extra": {},
"version": 0.4
}
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

+152 -91
View File
@@ -1,6 +1,6 @@
{
"last_node_id": 28,
"last_link_id": 41,
"last_node_id": 32,
"last_link_id": 46,
"nodes": [
{
"id": 3,
@@ -16,7 +16,7 @@
"flags": {
"pinned": true
},
"order": 8,
"order": 9,
"mode": 0,
"inputs": [
{
@@ -116,7 +116,7 @@
"flags": {
"pinned": true
},
"order": 9,
"order": 10,
"mode": 0,
"inputs": [
{
@@ -160,7 +160,7 @@
"flags": {
"pinned": true
},
"order": 10,
"order": 11,
"mode": 0,
"inputs": [
{
@@ -272,13 +272,13 @@
"flags": {
"pinned": true
},
"order": 6,
"order": 7,
"mode": 0,
"inputs": [
{
"name": "text",
"type": "*",
"link": 33
"link": 44
}
],
"properties": {
@@ -288,56 +288,6 @@
""
]
},
{
"id": 25,
"type": "Searge_LLM_Node",
"pos": [
10,
360
],
"size": {
"0": 340,
"1": 510
},
"flags": {
"pinned": true
},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "adv_options_config",
"type": "SRGADVOPTIONSCONFIG",
"link": null
}
],
"outputs": [
{
"name": "string",
"type": "STRING",
"links": [
33,
38,
39
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "Searge_LLM_Node"
},
"widgets_values": [
"A psychedelic animal frozen in a frosted jar on a wooden table, sci-fi, wide angle",
1337,
"Mistral-7B-Instruct-v0.3.Q4_K_M.gguf",
4096,
true,
"Generate a prompt from \"{prompt}\""
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 26,
"type": "DualCLIPLoader",
@@ -384,7 +334,7 @@
40
],
"size": {
"0": 315,
"0": 340,
"1": 82
},
"flags": {
@@ -420,14 +370,14 @@
370,
210
],
"size": [
430,
110
],
"size": {
"0": 430,
"1": 110
},
"flags": {
"pinned": true
},
"order": 7,
"order": 8,
"mode": 0,
"inputs": [
{
@@ -438,7 +388,7 @@
{
"name": "clip_l",
"type": "STRING",
"link": 38,
"link": 45,
"widget": {
"name": "clip_l"
}
@@ -446,7 +396,7 @@
{
"name": "t5xxl",
"type": "STRING",
"link": 39,
"link": 46,
"widget": {
"name": "t5xxl"
}
@@ -460,8 +410,8 @@
40,
41
],
"shape": 3,
"slot_index": 0
"slot_index": 0,
"shape": 3
}
],
"properties": {
@@ -474,6 +424,109 @@
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 31,
"type": "PrimitiveNode",
"pos": [
850,
680
],
"size": {
"0": 319.20001220703125,
"1": 82
},
"flags": {
"pinned": true
},
"order": 4,
"mode": 0,
"outputs": [
{
"name": "INT",
"type": "INT",
"links": [
43
],
"widget": {
"name": "random_seed"
}
}
],
"title": "Seed for the Searge LLM prompting node",
"properties": {
"Run widget replace on values": false
},
"widgets_values": [
1337,
"fixed"
],
"color": "#332922",
"bgcolor": "#593930"
},
{
"id": 32,
"type": "Searge_LLM_Node",
"pos": [
10,
360
],
"size": {
"0": 340,
"1": 510
},
"flags": {
"pinned": true
},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "adv_options_config",
"type": "SRGADVOPTIONSCONFIG",
"link": null
},
{
"name": "random_seed",
"type": "INT",
"link": 43,
"widget": {
"name": "random_seed"
}
}
],
"outputs": [
{
"name": "generated",
"type": "STRING",
"links": [
44,
45,
46
],
"slot_index": 0,
"shape": 3
},
{
"name": "original",
"type": "STRING",
"links": null,
"shape": 3
}
],
"properties": {
"Node name for S&R": "Searge_LLM_Node"
},
"widgets_values": [
"A psychedelic animal frozen in a jar on a wooden table, sci-fi, wide angle",
1337,
"Mistral-7B-Instruct-v0.3.Q4_K_M.gguf",
4096,
true,
"Generate a prompt from \"{prompt}\""
],
"color": "#232",
"bgcolor": "#353"
}
],
"links": [
@@ -517,14 +570,6 @@
0,
"MODEL"
],
[
33,
25,
0,
22,
0,
"*"
],
[
36,
27,
@@ -541,22 +586,6 @@
0,
"CLIP"
],
[
38,
25,
0,
28,
1,
"STRING"
],
[
39,
25,
0,
28,
2,
"STRING"
],
[
40,
28,
@@ -572,6 +601,38 @@
3,
2,
"CONDITIONING"
],
[
43,
31,
0,
32,
1,
"INT"
],
[
44,
32,
0,
22,
0,
"*"
],
[
45,
32,
0,
28,
1,
"STRING"
],
[
46,
32,
0,
28,
2,
"STRING"
]
],
"groups": [],