File size: 11,152 Bytes
b5eff20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
---
tags:
- gguf
- comfyui
- workflow-generation
- qwen
- text-generation
- sentence-transformers
library_name: gguf
base_model: Qwen/Qwen2.5-14B
license: gpl-3.0
language:
- en
pipeline_tag: text-generation
---

# ComfyUI-WorkflowGenerator Models

This repository contains the quantized GGUF models required for [ComfyUI-WorkflowGenerator](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator), a custom node implementation that generates ComfyUI workflows from natural language descriptions.

## Models Included

### 1. Workflow Generator Model (Required)

- **File**: `workflow-generator-q8_0.gguf`
- **Tokenizer**: `workflow-generator/` directory
- **Purpose**: Generates workflow diagrams from natural language instructions
- **Base Model**: Qwen2.5-14B
- **Training**: Fine-tuned from Qwen2.5-14B using LLaMA-Factory (see [original ComfyGPT repository](https://github.com/comfygpt/comfygpt/tree/main))
- **Status**: **Required** - This model is always needed

### 2. Embedding Model (Required)

- **Directory**: `paraphrase-multilingual-MiniLM-L12-v2/`
- **Purpose**: Semantic search for node name matching and validation
- **Base Model**: [sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2)
- **Status**: **Required** - Always needed for semantic search in NodeValidator

### 3. Node Validator Model (Optional)

- **File**: `Qwen2.5-7B-Instruct-q8_0.gguf`
- **Tokenizer**: `Qwen2.5-7B-Instruct/` directory
- **Purpose**: Refines and corrects node names in workflow diagrams (LLM refinement mode)
- **Base Model**: Qwen2.5-7B-Instruct (base model, not fine-tuned)
- **Status**: **Optional** - Only needed if using LLM refinement (`use_llm_refinement=True`)

## Model Training Information

### Workflow Generator Model

The `workflow-generator-q8_0.gguf` model was trained based on the [ComfyGPT research](https://github.com/comfygpt/comfygpt/tree/main) methodology:

- **Original Model Source**: [xiatianzs/resources](https://huggingface.co/xiatianzs/resources/tree/main) - Original fine-tuned model from ComfyGPT research team
- **Base Model**: [Qwen/Qwen2.5-14B](https://huggingface.co/Qwen/Qwen2.5-14B) from HuggingFace
- **Training Method**: Full fine-tuning (Supervised Fine-Tuning / SFT)
- **Training Framework**: [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory)
- **Training Dataset**: `FlowDataset.json` - Contains instruction-input-output pairs where:
  - Instruction: "Based on the description I provided, generate a JSON example of the required ComfyUi workflow."
  - Input: Natural language workflow descriptions
  - Output: JSON diagrams (list of edges representing workflow connections)
- **Training Hyperparameters**:
  - Learning rate: 1.0e-5
  - Epochs: 3.0
  - Batch size: 1 per device (gradient accumulation: 4 steps)
  - LR scheduler: Cosine with 0.1 warmup ratio
  - Precision: bf16
  - Cutoff length: 8,192 tokens (training cutoff; model architecture supports up to 131,072 tokens)
  - DeepSpeed: ZeRO-3 optimization
- **Quantization**: q8_0 (8-bit quantization for efficient inference)

For more details on the training process, see the [original ComfyGPT repository](https://github.com/comfygpt/comfygpt/tree/main) and [training configuration](https://github.com/comfygpt/comfygpt/tree/main/train/sft).

### Embedding Model

The `paraphrase-multilingual-MiniLM-L12-v2` model is a SentenceTransformer model used for semantic search in the NodeValidator. It encodes node names into embeddings and finds the most similar nodes when correcting invalid node names in workflow diagrams.

- **Original Model**: [sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2)
- **Type**: SentenceTransformer (HuggingFace format)
- **Size**: ~420 MB
- **Dimensions**: 384 (embedding vector size)
- **Use Case**: Semantic similarity search for node name matching

### Node Validator Model

The `Qwen2.5-7B-Instruct-q8_0.gguf` model is the base [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) model (not fine-tuned), used for its built-in instruction-following capabilities to select the best node from semantic search candidates.

## Quick Download

Download all models at once:

```bash
huggingface-cli download DanielPFlorian/comfyui-workflowgenerator-models \
    --local-dir ./ComfyUI/models/LLM/
```

Or download specific models:

```bash
# Download only the required models (workflow-generator + embedding model)
huggingface-cli download DanielPFlorian/comfyui-workflowgenerator-models \
    --include "workflow-generator-q8_0.gguf" "workflow-generator/*" "paraphrase-multilingual-MiniLM-L12-v2/*" \
    --local-dir ./ComfyUI/models/LLM/
```

## Installation and Setup

### Step 1: Download Models

Download the models to your ComfyUI models directory:

```bash
# Navigate to ComfyUI directory
cd /path/to/ComfyUI

# Download all models
huggingface-cli download DanielPFlorian/comfyui-workflowgenerator-models \
    --local-dir ./models/LLM/
```

### Step 2: Organize Files in LLM Directory

After downloading, organize the files in `ComfyUI/models/LLM/` as follows:

```
ComfyUI/models/LLM/
β”œβ”€β”€ workflow-generator-q8_0.gguf          # Main model (required)
β”œβ”€β”€ workflow-generator/                   # Main tokenizer (required)
β”‚   β”œβ”€β”€ tokenizer.json
β”‚   β”œβ”€β”€ tokenizer_config.json
β”‚   β”œβ”€β”€ vocab.json
β”‚   β”œβ”€β”€ merges.txt
β”‚   β”œβ”€β”€ special_tokens_map.json
β”‚   β”œβ”€β”€ added_tokens.json
β”‚   β”œβ”€β”€ config.json
β”‚   β”œβ”€β”€ generation_config.json
β”‚   └── model.safetensors.index.json
β”œβ”€β”€ paraphrase-multilingual-MiniLM-L12-v2/  # Embedding model (required)
β”‚   β”œβ”€β”€ config.json
β”‚   β”œβ”€β”€ model.safetensors
β”‚   β”œβ”€β”€ modules.json
β”‚   β”œβ”€β”€ sentence_bert_config.json
β”‚   β”œβ”€β”€ config_sentence_transformers.json
β”‚   β”œβ”€β”€ tokenizer.json
β”‚   β”œβ”€β”€ tokenizer_config.json
β”‚   β”œβ”€β”€ special_tokens_map.json
β”‚   β”œβ”€β”€ sentencepiece.bpe.model
β”‚   β”œβ”€β”€ unigram.json
β”‚   └── 1_Pooling/
β”‚       └── config.json
β”œβ”€β”€ Qwen2.5-7B-Instruct-q8_0.gguf         # NodeValidator model (optional)
└── Qwen2.5-7B-Instruct/                   # NodeValidator tokenizer (optional)
    β”œβ”€β”€ tokenizer.json
    β”œβ”€β”€ tokenizer_config.json
    β”œβ”€β”€ vocab.json
    β”œβ”€β”€ merges.txt
    β”œβ”€β”€ config.json
    └── generation_config.json
```

**Important**: The tokenizer directory name must match the model name (without `.gguf` extension and quantization suffix). The auto-detection code looks for:
- `workflow-generator-q8_0.gguf` β†’ `workflow-generator/` tokenizer
- `Qwen2.5-7B-Instruct-q8_0.gguf` β†’ `Qwen2.5-7B-Instruct/` tokenizer

## Usage

### Required Models

- **workflow-generator-q8_0.gguf** + **workflow-generator/** tokenizer - Always needed
- **paraphrase-multilingual-MiniLM-L12-v2/** - Always needed for semantic search

### Optional Models

- **Qwen2.5-7B-Instruct-q8_0.gguf** + **Qwen2.5-7B-Instruct/** tokenizer - Only needed if using LLM refinement (`use_llm_refinement=True`)

### Model Usage in ComfyUI-WorkflowGenerator

1. **WorkflowGenerator Node**: Uses `workflow-generator-q8_0.gguf` to generate workflow diagrams from natural language
2. **NodeValidator Node**: 
   - Uses `paraphrase-multilingual-MiniLM-L12-v2` for semantic search (always)
   - Uses `Qwen2.5-7B-Instruct-q8_0.gguf` for LLM refinement (optional, when `use_llm_refinement=True`)
3. **WorkflowBuilder Node**: No models needed (deterministic code)

## Model Specifications

### Workflow Generator Model

- **Format**: GGUF (q8_0 quantization)
- **Base**: Qwen2.5-14B
- **Size**: ~8-9 GB (quantized)
- **Context Window**: 131,072 tokens (128K) - Model architecture supports up to 131K tokens, though training used 16,384 token cutoff
- **Quantization**: q8_0 (8-bit, good balance of quality and size)

### Embedding Model

- **Format**: SentenceTransformer (HuggingFace format)
- **Base**: sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
- **Size**: ~420 MB
- **Dimensions**: 384 (embedding vector size)

### Node Validator Model

- **Format**: GGUF (q8_0 quantization)
- **Base**: Qwen2.5-7B-Instruct
- **Size**: ~4-5 GB (quantized)
- **Context Window**: 32,768 tokens
- **Quantization**: q8_0 (8-bit, good balance of quality and size)

## System Requirements

- **VRAM**: 
  - Minimum: 8 GB (for workflow-generator with CPU offloading)
  - Recommended: 16+ GB (for both models on GPU)
- **RAM**: 16+ GB recommended
- **Storage**: ~15-16 GB for all models, tokenizers, and embedding model

## Performance Tips

1. **Use GGUF models**: Smaller size and better VRAM efficiency than HuggingFace models
2. **GPU Layers**: Use "auto" setting for optimal GPU layer allocation
3. **LLM Refinement**: Only enable if you need higher accuracy (slower but more accurate)
4. **Semantic Search Only**: Faster execution, deterministic results (recommended for most use cases)

## Troubleshooting

### Model Not Found

- Verify models are in `ComfyUI/models/LLM/` directory
- Check tokenizer directory name matches model name (without `.gguf` and quantization suffix)
- Restart ComfyUI after moving files

### Tokenizer Not Found

- Ensure tokenizer directory exists with the correct name
- Verify tokenizer files (`tokenizer.json`, `tokenizer_config.json`, `vocab.json`) are present
- Check directory structure matches the expected format

### Out of Memory

- Reduce `n_gpu_layers` (try "auto" or lower number)
- Use smaller quantization (q4_0 instead of q8_0) - note: you'll need to re-quantize
- Set `device_preference` to "cpu" for some operations

## Related Resources

- **ComfyUI-WorkflowGenerator**: [GitHub Repository](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator)
- **Original ComfyGPT Research**: [GitHub Repository](https://github.com/comfygpt/comfygpt)
- **Research Paper**: [arXiv:2503.17671](https://arxiv.org/abs/2503.17671)
- **Project Website**: [https://comfygpt.github.io/](https://comfygpt.github.io/)

## Citation

If you use these models in your research, please cite the original ComfyGPT paper:

```bibtex
@article{huang2025comfygpt,
  title={ComfyGPT: A Self-Optimizing Multi-Agent System for Comprehensive ComfyUI Workflow Generation},
  author={Huang, Oucheng and Ma, Yuhang and Zhao, Zeng and Wu, Mingrui and Ji, Jiayi and Zhang, Rongsheng and Hu, Zhipeng and Sun, Xiaoshuai and Ji, Rongrong},
  journal={arXiv preprint arXiv:2503.17671},
  year={2025}
}
```

## License

These models are provided for use with ComfyUI-WorkflowGenerator. Please refer to:
- Original ComfyGPT repository for model training details and licensing
- Qwen2.5 model licenses from HuggingFace
- ComfyUI-WorkflowGenerator repository for usage terms

## Support

For issues, questions, or contributions:
- **Issues**: [ComfyUI-WorkflowGenerator Issues](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/issues)
- **Documentation**: [ComfyUI-WorkflowGenerator Wiki](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki)