ComfyUI LLM Node

#6
by nazgut - opened

Hi again,

i created simple node for LLM (I made this for T5 model but it should work with gpt2 type model).

Models should be added to LLM_checkpoints in models folder.

Code:

https://github.com/Big-Idea-Technology/ComfyUI_LLM_Node

Nice! Do you have an example workflow that uses SuperPrompt? I'll add it to the README / blogpost if you have one.

yes but i can't upload json file here so i will post it
Zrzut ekranu z 2024-03-24 17-20-29.png

drag and drop this img:

ComfyUI_00083_.png

{
"last_node_id": 12,
"last_link_id": 14,
"nodes": [
{
"id": 8,
"type": "CLIPTextEncode",
"pos": [
480,
660
],
"size": [
372.9921051025391,
119.87756652832036
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 8
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
7
],
"shape": 3
}
],
"properties": {
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"text, waterlogo, (low quality, worst quality:1.5), blurry"
],
"color": "#322",
"bgcolor": "#533"
},
{
"id": 12,
"type": "String debug print",
"pos": [
874,
288
],
"size": [
315,
82
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "Text",
"type": "STRING",
"link": 13,
"widget": {
"name": "Text"
}
}
],
"properties": {
"Node name for S&R": "String debug print"
},
"widgets_values": [
"",
""
]
},
{
"id": 3,
"type": "CheckpointLoaderSimple",
"pos": [
150,
503
],
"size": {
"0": 315,
"1": 98
},
"flags": {},
"order": 0,
"mode": 0,
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
1
],
"shape": 3
},
{
"name": "CLIP",
"type": "CLIP",
"links": [
8,
9
],
"shape": 3,
"slot_index": 1
},
{
"name": "VAE",
"type": "VAE",
"links": [
3
],
"shape": 3,
"slot_index": 2
}
],
"properties": {
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"sd_xl_base_1.0.safetensors"
]
},
{
"id": 4,
"type": "VAEDecode",
"pos": [
1182,
504
],
"size": {
"0": 210,
"1": 46
},
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 2
},
{
"name": "vae",
"type": "VAE",
"link": 3
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
5
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "VAEDecode"
}
},
{
"id": 6,
"type": "SaveImage",
"pos": [
1402,
504
],
"size": [
471.3921221733078,
359.1111511230464
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 5
}
],
"properties": {},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 7,
"type": "EmptyLatentImage",
"pos": [
531,
822
],
"size": {
"0": 315,
"1": 106
},
"flags": {},
"order": 1,
"mode": 0,
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
6
],
"shape": 3
}
],
"properties": {
"Node name for S&R": "EmptyLatentImage"
},
"widgets_values": [
1024,
1024,
1
]
},
{
"id": 9,
"type": "CLIPTextEncode",
"pos": [
476,
498
],
"size": [
373.4720916748047,
111.75758666992186
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 9
},
{
"name": "text",
"type": "STRING",
"link": 14,
"widget": {
"name": "text"
}
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
11
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"cartoon spider with hat on head"
]
},
{
"id": 2,
"type": "KSampler",
"pos": [
864,
503
],
"size": {
"0": 315,
"1": 262
},
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 1,
"slot_index": 0
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 11
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 7,
"slot_index": 2
},
{
"name": "latent_image",
"type": "LATENT",
"link": 6,
"slot_index": 3
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
2
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "KSampler"
},
"widgets_values": [
777,
"fixed",
20,
7,
"dpmpp_2m_sde",
"karras",
1
]
},
{
"id": 1,
"type": "LLM_Node",
"pos": [
437,
286
],
"size": [
419.67209167480473,
174.8775665283203
],
"flags": {},
"order": 2,
"mode": 0,
"outputs": [
{
"name": "string",
"type": "STRING",
"links": [
13,
14
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "LLM_Node"
},
"widgets_values": [
"Expand the following prompt: cartoon spider with hat on head",
"superprompt-v1",
2000
],
"color": "#232",
"bgcolor": "#353"
}
],
"links": [
[
1,
3,
0,
2,
0,
"MODEL"
],
[
2,
2,
0,
4,
0,
"LATENT"
],
[
3,
3,
2,
4,
1,
"VAE"
],
[
5,
4,
0,
6,
0,
"IMAGE"
],
[
6,
7,
0,
2,
3,
"LATENT"
],
[
7,
8,
0,
2,
2,
"CONDITIONING"
],
[
8,
3,
1,
8,
0,
"CLIP"
],
[
9,
3,
1,
9,
0,
"CLIP"
],
[
11,
9,
0,
2,
1,
"CONDITIONING"
],
[
13,
1,
0,
12,
0,
"STRING"
],
[
14,
1,
0,
9,
1,
"STRING"
]
],
"groups": [],
"config": {},
"extra": {},
"version": 0.4
}

or more advenced one (you will need more custom nodes in comfyui)

Zrzut ekranu z 2024-03-24 17-27-17.png

ComfyUI_temp_iayol_00002_.png

roborovski pinned discussion

Sign up or log in to comment