ZML_随机文本权重
Random tags with random weights, straight from a bundled 1000-artist bank
- 文本
- help
ZML_随机文本权重 is the "surprise me" node: it picks random lines or tags from a text file and slaps a random weight on each one, then outputs the result as a prompt fragment. Out of the box it ships with a 1000-artist danbooru tag file - the kind of thing you point at when you want a random artist style, or a random tag salad for testing - and you can point it at any txt file you drop into zml_w/txt.
The mechanism is simple and worth knowing because of one detail: the node uses random.sample (no repeats) to pick 随机个数 items, and each item gets a weight drawn uniformly between your 最小权重 and 最大权重, formatted to the precision you chose. Trailing commas get stripped so the output is clean for joining. And the always-dirty trick is in play - its IS_CHANGED returns NaN, which the KB's plumbing essay names as the canonical way to force a node to re-run every time. In plain terms: it re-rolls on every execution, no cache fights.
What to set
- 文件 - dropdown of txt files in
zml_w/txt, or禁用 (使用文本框)to use the optional text box instead. - 随机模式 - 按行随机 (random whole lines) vs 按标签随机 (split on commas and random tags).
- 小数位数 - 两位 or 一位 decimals on the weights.
- 随机个数 - how many lines/tags to pick.
- 最小权重 / 最大权重 - FLOAT 0–3, default 0.3/0.5. The bounds for the random weight.
- 文本 (optional) - your own tags/lines when the file selector is disabled.
Outputs: 文本 (the weighted fragment) and help (the author's own usage instructions - a rare, genuinely useful extra; wire it to a text display).
The honest take on weights
Here's the part that requires judgment, and the KB's prompt-engineering refresh is the grounding. Random tags are a time-honored way to discover new directions in SDXL-lineage models (Illustrious, NoobAI, Pony, Wan) where the encoder is CLIP and (tag:1.2)-style weights work. On the 2026 LLM-encoded models, attention weights are silently discarded and tag lists aren't how the prompt is read - so this node is great fun on the SDXL family and close to meaningless on a Z-Image/Flux-2-style encoder. Know which one you're on. The author builds this kind of thing for their Wan/SDXL rotation, which tells you its natural habitat.
The other thing to know: it's a one-person, Chinese-first pack (translation patch in the README), and the node is thin by design - pick, weight, output. It's a discovery tool, not a prompt engineer. Pair it with the pack's text-format node if you want the weighted output normalized into your SDXL/NAI weight syntax.
Install
ComfyUI Manager → search ComfyUI-ZML-Image, or:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
restart. The artist txt files ship with the pack - no downloads needed. Drop your own .txt into zml_w/txt (top level) and it appears in the dropdown after a restart.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| 文件 | COMBO | 5 options: 禁用 (使用文本框), 1000图以上画师danbooru的tag.txt, 光辉画师串plus.txt, 画师-1348.txt, 画师(1000).txt | |
| 随机模式 | COMBO | 按行随机 | 2 options: 按行随机, 按标签随机 |
| 小数位数 | COMBO | 两位 | 2 options: 两位, 一位 |
| 随机个数 | INT | 1 | — |
| 最小权重 | FLOAT | 0.300–3 | — |
| 最大权重 | FLOAT | 0.500–3 | — |
| 文本opt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 文本 | STRING | — |
| help | STRING | — |