TagRAG Image
Give it tags — or an image — and get the related tags back
- image
- tags
- refined_prompt
- retrieved_tags
- status
TagRAG Image is the pack's bridge from "I have a picture" to "I have a better prompt." Feed it Danbooru-style tags from an external tagger node (or type them), and it retrieves related tags from your CSV dataset. Flip refine on and a local LLM turns the whole combined set into a structured prompt. It's the node that connects the tag-to-prompt world to the image-to-tag world without you copy-pasting anything.
The key design decision, and the one to read first: it's tag-string first. If you provide the tags input, that wins - no image tagging happens at all. That's deliberate: it keeps the node deterministic and composable with whatever tagger you already run, since the pack author isn't betting on you switching taggers to use this. The built-in built_in_wd14 backend exists for when you want tagging in-node, but it's strictly opt-in.
How it works
If tags is blank and an IMAGE tensor is wired in with image_tagging_backend=built_in_wd14, the node runs a WD14-style ONNX tagger - the same Danbooru-vocabulary tagger lineage the anime-model crowd has used for years, and the right tool for models trained on booru tags (the KB's danbooru-tags essay covers why: a correct tag beats a sentence on those checkpoints). threshold (0.35) and character_threshold (0.85) control which tags survive; exclude_tags and replace_underscores are the usual cleanups.
Then the retrieval half kicks in regardless of backend: query = tags + optional idea, matched against your index_ref's CSV via lexical/semantic/hybrid search, and retrieved_tags comes back with related tags your dataset knows. If refine is true it calls the generation backend with the image-prompt template to assemble a polished prompt; with refine off it returns original tags plus related tags with zero LLM calls - the cheap, deterministic path.
Inputs that matter
- index_ref - the JSON string from TagRAG Index.
- tags - comma-separated tags (multiline). Required unless you're using the WD14 path.
- image - IMAGE tensor, only used when
image_tagging_backend=built_in_wd14. - image_tagging_backend -
existing_tags(default) orbuilt_in_wd14. - threshold / character_threshold - WD14 tag cutoffs.
- refine - whether to run the LLM at all.
- model_path - GGUF for native refinement.
Outputs
tags (the tag set actually used), refined_prompt (empty unless refine is on), retrieved_tags (the related tags from your CSV), and status.
Install
ComfyUI Manager - search comfyui-tag-rag - or:
cd ComfyUI/custom_nodes
git clone https://github.com/FrostySDXL/comfyui-tag-rag
cd comfyui-tag-rag
pip install -r requirements.txt
Restart after installing. For the built-in WD14 path you also need image extras (pip install -r requirements-image.txt - onnxruntime + Pillow) and model files placed manually at ComfyUI/models/tag_rag/wd14/<model_name>/model.onnx plus the tag metadata CSV. The node will not download any of that for you - missing deps or files just return an actionable status string. The default tagger_model name it looks for is wd-v1-4-moat-tagger-v2.
Where people get burned
existing_tagswith no tags and no tagger wired up - you get an error telling you exactly that. Either wire an external tagger intotagsor switch to the WD14 path.- WD14 "missing model files" - you have to supply the ONNX model and tag CSV yourself; nothing auto-downloads. Set
tagger_model_pathif they live somewhere non-standard. - Both
tagsandimageprovided -tagswins, silently. The status string notes it, so glance at that if tagging seems to do nothing. - Expecting vision. Scope check: the README is explicit that there's no vision-language chat, no Florence2, no ColPali, no llama.cpp vision/mmproj. This node tags or accepts tags, retrieves, and optionally rewrites - that's the whole job. WD14 won't describe a scene either; that's not what it does.
It's pre-alpha (0.1.0a0), so treat it as a tool to poke at. But as a glue node between your existing tagger and your CSV library, it's genuinely useful even with refine left off.
Inputs (37)
| Name | Type | Default | Description |
|---|---|---|---|
| index_refopt | STRING | — | |
| tagsopt | STRING | — | |
| imageopt | IMAGE | — | |
| image_tagging_backendopt | COMBO | existing_tags | 2 options: existing_tags, built_in_wd14 |
| tagger_modelopt | STRING | wd-v1-4-moat-tagger-v2 | — |
| tagger_model_pathopt | STRING | — | |
| thresholdopt | FLOAT | 0.350–1 | — |
| character_thresholdopt | FLOAT | 0.850–1 | — |
| exclude_tagsopt | STRING | — | |
| replace_underscoresopt | BOOLEAN | false | — |
| retrieval_modeopt | COMBO | from_index | 4 options: from_index, lexical, semantic, hybrid |
| refineopt | BOOLEAN | false | — |
| ideaopt | STRING | — | |
| base_urlopt | STRING | http://127.0.0.1:8080 | — |
| allow_remote_base_urlopt | BOOLEAN | false | — |
| embedding_backendopt | COMBO | from_index | 3 options: from_index, llama_cpp_python, llama_server |
| embedding_model_pathopt | STRING | — | |
| embedding_n_ctxopt | INT | 2048256–262144 | — |
| embedding_n_gpu_layersopt | INT | -1-1–200 | — |
| embedding_base_urlopt | STRING | — | |
| embedding_modelopt | STRING | — | |
| embedding_endpoint_styleopt | COMBO | from_index | 3 options: from_index, openai_compatible, llama_cpp_legacy |
| generation_backendopt | COMBO | llama_cpp_python | 2 options: llama_cpp_python, llama_server |
| modelopt | STRING | — | |
| model_pathopt | STRING | — | |
| chat_formatopt | STRING | llama-2 | — |
| n_ctxopt | INT | 2048256–262144 | — |
| n_gpu_layersopt | INT | -1-1–200 | — |
| top_kopt | INT | 101–100 | — |
| max_tokensopt | INT | 5121–4096 | — |
| temperatureopt | FLOAT | 0.700–2 | — |
| top_popt | FLOAT | 0.950–1 | — |
| top_k_samplingopt | INT | 400–400 | — |
| repeat_penaltyopt | FLOAT | 1.101–5 | — |
| seedopt | INT | -1-1–2147483647 | — |
| timeout_secondsopt | FLOAT | 301–300 | — |
| system_prompt_overrideopt | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| tags | STRING | — |
| refined_prompt | STRING | — |
| retrieved_tags | STRING | — |
| status | STRING | — |