{"id":33624610,"url":"https://github.com/DanielPFlorian/ComfyUI-WorkflowGenerator","last_synced_at":"2025-12-16T21:00:47.083Z","repository":{"id":325542720,"uuid":"1101583467","full_name":"DanielPFlorian/ComfyUI-WorkflowGenerator","owner":"DanielPFlorian","description":"Generate ComfyUI workflows from natural language descriptions.","archived":false,"fork":false,"pushed_at":"2025-11-22T00:19:26.000Z","size":88,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-22T00:19:49.714Z","etag":null,"topics":["comfyui","comfyui-custom-node","comfyui-nodes","comfyui-workflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielPFlorian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-21T22:18:41.000Z","updated_at":"2025-11-22T00:19:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/DanielPFlorian/ComfyUI-WorkflowGenerator","commit_stats":null,"previous_names":["danielpflorian/comfyui-workflowgenerator"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/DanielPFlorian/ComfyUI-WorkflowGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielPFlorian%2FComfyUI-WorkflowGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielPFlorian%2FComfyUI-WorkflowGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielPFlorian%2FComfyUI-WorkflowGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielPFlorian%2FComfyUI-WorkflowGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielPFlorian","download_url":"https://codeload.github.com/DanielPFlorian/ComfyUI-WorkflowGenerator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielPFlorian%2FComfyUI-WorkflowGenerator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27771143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-16T02:00:10.477Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comfyui","comfyui-custom-node","comfyui-nodes","comfyui-workflow"],"created_at":"2025-12-02T00:00:33.082Z","updated_at":"2025-12-16T21:00:47.061Z","avatar_url":"https://github.com/DanielPFlorian.png","language":"Python","funding_links":[],"categories":["Workflows (3567) sorted by GitHub Stars"],"sub_categories":[],"readme":"# ComfyUI Workflow Generator\n\nGenerate ComfyUI workflows from natural language descriptions using Large Language Models (LLMs).\n\nThis custom node enables users to describe a workflow in natural language (e.g., *\"Create a text-to-image workflow using SDXL\"*) and automatically constructs the corresponding node graph. It leverages Large Language Models (LLMs) to bridge the gap between intent and execution.\n\n## Implementation Note\n\nThis project is an independent implementation of the [ComfyGPT research](https://arxiv.org/abs/2503.17671), designed to bring that architecture directly into ComfyUI as a native node suite.\n\nMy goal was to preserve the core functionality of the original research—specifically the multi-stage pipeline of generation, validation, and construction, while optimizing it for the local ComfyUI environment. This implementation focuses on modularity, allowing users to inspect and intervene at each stage of the generation process.\n\n**Current Limitations:**\nThe system's knowledge is bounded by its training data. While it excels at standard patterns and known nodes, it cannot inherently \"know\" about custom nodes released after its training cutoff without additional context. It acts as a powerful accelerator for workflow creation, but supervision is recommended.\n\n## Based on ComfyGPT Research\n\n**Title:** \"ComfyGPT: A Self-Optimizing Multi-Agent System for Comprehensive ComfyUI Workflow Generation\"\n- **Original Repository:** https://github.com/comfygpt/comfygpt\n- **Project Website:** https://comfygpt.github.io/\n\n### How It Works\n\nThis implementation uses a specialized LLM fine-tuned on workflow data to execute a three-stage pipeline:\n1.  **Generator:** Interprets the natural language prompt to generate a logical graph structure (JSON).\n2.  **Validator:** Verifies node names against the local installation or semantic embeddings to ensure compatibility.\n3.  **Builder:** Compiles the validated structure into an executable ComfyUI workflow format.\n\n---\n\n### Model Sources\n\nThe models used in this implementation are based on the original ComfyGPT research:\n\n- **WorkflowGenerator Model**: Original fine-tuned model from [xiatianzs/resources](https://huggingface.co/xiatianzs/resources/tree/main) (ComfyGPT research team)\n  - Base model: Qwen2.5-14B, fine-tuned for workflow generation\n  - Training context window: 8,192 tokens (cutoff length used during training - see [training config](https://github.com/comfygpt/comfygpt/blob/main/train/sft/qwen2.5_full_sft.yaml))\n  - Model architecture context window: 131,072 tokens (128K) - Maximum supported by model architecture (see [model config](https://huggingface.co/xiatianzs/resources/blob/main/model/flow_agent/config.json))\n  - Quantized to GGUF format (q8_0) for efficient inference\n\n- **Embedding Model**: [sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2) (original SentenceTransformer model)\n  - Used for semantic search in NodeValidator\n\n- **NodeValidator Model**: Base [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) model (not fine-tuned)\n  - Context window: 32,768 tokens\n  - Used for LLM refinement (optional)\n  - Quantized to GGUF format (q8_0) for efficient inference\n\n**Model Repositories:**\n- **Original Models**: [xiatianzs/resources](https://huggingface.co/xiatianzs/resources/tree/main) - Original fine-tuned models from ComfyGPT research team (HuggingFace format)\n- **Pre-quantized GGUF Models**: [DanielPFlorian/comfyui-workflowgenerator-models](https://huggingface.co/DanielPFlorian/comfyui-workflowgenerator-models) - Ready-to-use quantized GGUF models for this implementation\n\n\n## Installation\n\n### Prerequisites\n\n- ComfyUI installed and running\n- Python 3.10 or higher (see note below)\n- CUDA-capable GPU (recommended) or CPU\n- Git installed (for cloning the repository)\n\n**Python Requirements:**\n- **Standard ComfyUI Installation:** Python 3.10 or higher must be installed separately. ComfyUI requires Python to run, so if ComfyUI is working, Python is already installed.\n- **Portable ComfyUI Installation:** Python is included (embedded in the `python_embeded` folder), so no separate Python installation is needed. The custom node will use ComfyUI's embedded Python.\n\n**Note:** If Git is not installed, download it from [git-scm.com](https://git-scm.com/). You can verify Git installation by running `git --version` in your terminal.\n\n### Model Recommendation\n\n**Model Format Comparison:**\n\n- **GGUF models**: Use significantly less VRAM with similar generation quality compared to HuggingFace models. Quantization (q8_0, q4_0) provides a good balance between quality and memory usage.\n\n- **HuggingFace models**: Use more VRAM but offer full precision. Both formats are fully supported and produce similar quality results.\n\n### Step 1: Clone the Repository\n\nNavigate to your ComfyUI `custom_nodes` directory and clone this repository:\n\n```bash\ncd ComfyUI/custom_nodes\ngit clone https://github.com/danielpflorian/ComfyUI-WorkflowGenerator.git\n```\n\n### Step 2: Install Dependencies\n\nInstall the required Python dependencies by opening your terminal inside the ComfyUI-WorkflowGenerator folder:\n\n```bash\ncd ComfyUI/custom_nodes/ComfyUI-WorkflowGenerator\npip install -r requirements.txt\n```\n\n**For Portable ComfyUI Installations:**\n\nFor portable installations, use the embedded Python from the portable ComfyUI root directory:\n\n```bash\ncd \u003cportable_comfyui_root\u003e\npython_embeded\\python.exe -s -m pip install -r ComfyUI\\custom_nodes\\ComfyUI-WorkflowGenerator\\requirements.txt\n```\n\n### Step 3: Install llama-cpp-python (Required for GGUF Models)\n\n**Important:** `llama-cpp-python` is **required** for GGUF models. It must be installed separately based on your system configuration.\n\n**Note:** The quick install commands below may not work for all Windows/CUDA configurations. If they fail or if CUDA support isn't detected, **local compilation is often necessary**. See the [Wiki - llama-cpp-python Installation](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki/Installation#llama-cpp-python-installation) for detailed instructions on compiling from source.\n\n**Quick install (try this first):**\n- **CPU only**: `pip install llama-cpp-python`\n- **CUDA (NVIDIA)**: `pip install llama-cpp-python[cuda]`\n- **Metal (macOS)**: `pip install llama-cpp-python[metal]`\n\n**For Portable ComfyUI Installations:**\n\nFor portable installations, use the embedded Python from the portable ComfyUI root directory:\n\n```bash\ncd \u003cportable_comfyui_root\u003e\npython_embeded\\python.exe -s -m pip install llama-cpp-python[cuda]\n```\n\n**Note:** If you plan to use HuggingFace models instead, you can skip this step.\n\n### Step 4: Copy Models\n\nCopy your GGUF models and tokenizers to `ComfyUI/models/LLM/`:\n\n```\nComfyUI/models/LLM/\n├── workflow-generator-q8_0.gguf    # WorkflowGenerator model\n├── workflow-generator/             # WorkflowGenerator tokenizer\n├── Qwen2.5-7B-Instruct-q8_0.gguf   # NodeValidator model (optional)\n├── Qwen2.5-7B-Instruct/            # NodeValidator tokenizer (optional)\n└── paraphrase-multilingual-MiniLM-L12-v2/  # Embedding model\n```\n\n### Step 5: Restart ComfyUI\n\nRestart ComfyUI to load the custom nodes. The nodes will appear in the `WorkflowGenerator` category.\n\n## Quick Start\n\nThe easiest way to get started is using the **Workflow Generator Pipeline** node, which processes your instruction through all three stages sequentially:\n\n1. **Install the custom node** (see Installation above)\n2. **Install llama-cpp-python** (required for GGUF models - see [Wiki - llama-cpp-python Installation](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki/Installation#llama-cpp-python-installation))\n3. **Run the \"Update Node Catalog\" node first** - This scans and catalogs all available ComfyUI nodes (native and custom) and is required before generating workflows\n4. **Add the \"Workflow Generator Pipeline\" node** to your ComfyUI workflow\n5. **Enter your instruction**, for example: `\"Create a text-to-image workflow\"`\n6. **Configure model path** (see Model Format Comparison above for guidance)\n7. **Execute the node** to generate a complete workflow\n8. **Use the generated workflow** - it will appear as a workflow JSON that you can load or save\n\n**Expected Results:**\n- The Pipeline node automatically generates the workflow diagram, validates node names, and converts it to executable ComfyUI workflow JSON\n- You can save the workflow to a file for later use. By default it will be saved in comfyUI/output.\n\n**Note:** For detailed documentation on individual nodes and advanced usage, see the [Wiki](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki).\n\n## Available Nodes\n\nThis section provides a high-level overview of each node.\n\n#### [Workflow Generator Pipeline](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki/Node-Reference#workflow-generator-pipeline)\n\n- **Purpose**: One-click solution for complete workflow generation\n- **What it does**: Processes your instruction through all three stages sequentially: generates the workflow diagram, validates and corrects node names, then builds the final ComfyUI workflow JSON\n- **Best for**: Quick workflow creation without intermediate steps\n- **Key inputs**: Instruction, model path, configuration options\n- **Key outputs**: Complete workflow JSON, optional file save\n\nFor more control, you can use individual nodes to inspect and modify intermediate results:\n\n**Important:** Before using individual nodes or the pipeline, **run the \"Update Node Catalog\" node first** to scan and catalog all available ComfyUI nodes. This is required for proper node validation and workflow building.\n\n**Note:** WorkflowGenerator, NodeValidator, and WorkflowBuilder are designed to be used in sequence. NodeValidator is optional—you can connect WorkflowGenerator directly to WorkflowBuilder if you want to skip validation.\n\n#### 1. [WorkflowGenerator](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki/Node-Reference#workflowgenerator-node)\n\n- **Purpose**: Generates workflow diagrams from natural language\n- **Key inputs**: Instruction, model selection\n- **Key outputs**: Workflow diagram (JSON string)\n- **Usage**: First step in the pipeline\n\n#### 2. [NodeValidator](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki/Node-Reference#nodevalidator-node)\n\n- **Purpose**: Validates and corrects node names in workflow diagrams\n- **Key inputs**: Workflow diagram, optional instruction for context\n- **Key outputs**: Refined diagram with corrected node names\n- **Usage**: Optional second step (can be skipped)\n- **Two modes**: \n  - Semantic search only (faster, deterministic)\n  - LLM refinement (slower, more accurate)\n\n#### 3. [WorkflowBuilder](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki/Node-Reference#workflowbuilder-node)\n\n- **Purpose**: Converts workflow diagrams into executable ComfyUI workflow JSON\n- **Key inputs**: Refined diagram (from NodeValidator) or raw diagram (from WorkflowGenerator)\n- **Key outputs**: Workflow JSON, optional file save\n- **Usage**: Final step in the pipeline\n\n#### [UpdateNodeCatalog](https://github.com/danielpflorian/ComfyUI-WorkflowGenerator/wiki/Node-Reference#updatenodecatalog-node)\n\n- **Purpose**: Scans and catalogs all available ComfyUI nodes (native and custom)\n- **When to run**: After installing new custom nodes or updating ComfyUI\n- **Key inputs**: Catalog directory path (optional)\n- **Key outputs**: Updated catalog files\n\n## Troubleshooting\n\n**Quick fixes:**\n- **Models not found**: Verify models are in `ComfyUI/models/LLM/`\n- **OOM errors**: `auto_gpu_layers` is enabled by default to prevent this. If issues persist, verify your VRAM is sufficient for the model size.\n- **Slow performance**: Use GGUF models (lower VRAM usage), disable LLM refinement\n- **Invalid nodes**: Run **Update Node Catalog** node\n\n## Architectural Insights \u0026 Future Vision\n\nWhile this implementation successfully brings the ComfyGPT architecture to ComfyUI, the rapid evolution of the generative AI landscape suggests that the next generation of workflow generation tools will need to evolve beyond static fine-tuning.\n\n### The Problem with Static Models\nThe ComfyUI custom node ecosystem changes daily. New nodes and unforeseen architectures are released constantly. A model fine-tuned on a dataset from last month (like the current WorkflowGenerator) is inherently \"frozen\" in time. It cannot hallucinate the correct connections for a node it has never seen during training.\n\n### Ideas on Future Workflow Generators\nTo achieve true state-of-the-art performance that keeps pace with the community, future architectures should likely move toward:\n\n1.  **Retrieval-Augmented Generation (RAG) for Nodes**: Instead of baking node knowledge into the model weights, an agent could query a dynamic, vector-embedded database that includes both the user's *currently installed* nodes and an updated database of repositories. This allows the system to discover and use completely new nodes or updated versions directly from the internet, enabling it to \"read\" the documentation of a node released today and use it immediately.\n\n2.  **Input/Output Type Awareness**: The current approach uses semantic search to correct node names (e.g., matching \"Load Image\" to \"Image Loader\"). However, a robust system needs to understand **I/O Schema**.\n    *   *Current*: \"Does this node name look right?\"\n    *   *Future*: \"Does the `LATENT` output of Node A actually fit into the `LATENT` input of Node B?\"\n    *   An agent needs to reason about data types (Float, Image, Conditioning, Model) to ensure generated workflows are not just linguistically plausible, but executably valid.\n\n3.  **Small Graph-Reasoning Models (SLMs)**: We may not need massive 70B+ parameter models for this task. Specialized, smaller models trained specifically on Graph Theory and Directed Acyclic Graphs (DAGs) could offer superior reasoning capabilities for connecting logical blocks, while relying on the RAG system for the specific node vocabulary.\n\n4.  **Case-Based Reasoning \u0026 Workflow Retrieval**: Thousands of high-quality workflows exist online, often accompanied by images and descriptions. A future system should not just generate from scratch but actively **retrieve and adapt existing workflows**. By indexing these community-created workflows as \"knowledge patterns,\" the agent can identify how experts typically solve specific sub-problems (e.g. \"How is ControlNet usually connected to Wan Video Generation Nodes?\") and apply those proven sub-graphs to the current task.\n\nThis project serves as a foundational step, implementing the current research (ComfyGPT). However, the future lies in agents that can actively explore, reason about, and validate the live ComfyUI environment they inhabit.\n\n## License\n\nGNU General Public License v3\n\n## Acknowledgments\n\n- **ComfyUI**: Built on top of [ComfyUI](https://github.com/comfyanonymous/ComfyUI)\n- **ComfyGPT Research Team**: This project is based on the [ComfyGPT research paper](https://arxiv.org/abs/2503.17671) and [original repository](https://github.com/comfygpt/comfygpt) by Oucheng Huang, Yuhang Ma, Zeng Zhao, Mingrui Wu, Jiayi Ji, Rongsheng Zhang, Zhipeng Hu, Xiaoshuai Sun, and Rongrong Ji\n- **llama-cpp-python**: Uses [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) for GGUF model support\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDanielPFlorian%2FComfyUI-WorkflowGenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDanielPFlorian%2FComfyUI-WorkflowGenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDanielPFlorian%2FComfyUI-WorkflowGenerator/lists"}