Nodes/ComfyUI-Ichis-Pack/ICHIS Tag Sampler
ComfyUI Node

ICHIS Tag Sampler

The randomization engine of the tag pipeline

By ichabodcole·Created about a year ago·Updated 11 months ago· 2
ICHIS Tag Sampler
  • tag_metadata
  • tag_selection
  • category_list
  • tags
  • count
  • tags_list
min_count1
max_count5
seed0
unique_onlytrue
per_categoryfalse
ignore_case_categoriestrue
debugfalse

This is the payoff node of the Ichis tag pipeline. Loader and Category Select feed it a catalog and a narrowed-down set of categories; the sampler draws a random selection of tags from them and hands you a ready-to-paste prompt string. If you've ever wanted "random tags, but only from the curated categories I chose, and always between 3 and 6 of them," this is the node that makes the wheel spin honestly.

How it works

You feed it tag_metadata (required - from the loader) and it samples min_count to max_count tags at random, joining them with ", ". It can take the category narrowing two ways, both optional:

  • tag_selection - the structured payload from ICHIS Tag Category Select.
  • category_list - a plain list of category names, if you'd rather wire categories in directly.

If neither is provided, it samples from all categories in the file. unique_only (default on) means no duplicate tags in a single roll; turn it off if your catalog is small and you want more noise. seed makes the draw reproducible - and here's the caching subtlety: seed 0 (the default) means "surprise me," and the node forces a re-run on every queue because a randomized pick must execute even when nothing else changed. Set a nonzero seed and it becomes a normal, cacheable deterministic node.

There's also per_category. Off, it samples min..max tags from the combined pool across your selected categories. On, it samples min..max tags from each category individually and concatenates - which is how you guarantee "2–3 hair tags, 2–3 clothing tags" instead of occasionally getting all your tags from one bucket.

Outputs: tags (the joined STRING, ready for a CLIP Text Encode), count (how many were picked), and tags_list (the LIST, handy for the Save Tags node).

Inputs at a glance

  • tag_metadata - required, from the loader.
  • min_count / max_count - the range to draw (0–4096). If min exceeds max, the node swaps them rather than erroring.
  • tag_selection, category_list, seed, unique_only, per_category, ignore_case_categories, debug.

Gotchas

If min_count is 0, a draw of zero is legal, and you'll get an empty tags string - fine if that's intentional, annoying if it's not. With unique_only on and a tiny catalog, max_count silently clamps to the number of available tags. And when the metadata payload looks empty, check the loader before this node: the sampler faithfully samples nothing from an empty catalog and returns ("", 0, []) rather than complaining.

Installing it

It ships with the rest of the Ichis pack:

cd ComfyUI/custom_nodes
git clone https://github.com/ichabodcole/ComfyUI-Ichis-Pack

Restart ComfyUI, or install ComfyUI-Ichis-Pack from ComfyUI Manager. No models, no heavy deps - just torch, which you already have.

Where it fits

The full loop is loader → category select → sampler → save tags. Wire tags into a CLIP Text Encode positive prompt, batch a handful of runs with seed 0, and log the good rolls to disk with ICHIS Save Tags. For tag-driven SDXL-lineage models this is a genuinely nice way to explore a category catalog without retyping prompts.

CategoryICHIS

Inputs (10)

NameTypeDefaultDescription
tag_metadataICHIS_TAG_METADATA
min_countINT10–4096
max_countINT51–4096
tag_selectionoptICHIS_TAG_SELECTION
category_listoptLIST
seedoptINT00–18446744073709550000
unique_onlyoptBOOLEANtrue
per_categoryoptBOOLEANfalse
ignore_case_categoriesoptBOOLEANtrue
debugoptBOOLEANfalse

Outputs (3)

NameTypeDescription
tagsSTRING
countINT
tags_listLIST