Confucius4 Hotwords
Stop your transcript from mangling every brand name
- hotwords
- count
The node does nothing, and that's the point
Every speech-to-text model has the same failure mode: it nails the sentence and tortures the proper nouns. Brand names come out as whatever Chinese homophone the decoder liked better, and English words inside Chinese speech get transliterated. The fix in this pack is hotwords - and Confucius4 Hotwords is the node where you type them.
It's a string formatter with no model, no GPU work, no inference of any kind. It does two jobs, and the second one is why it's a separate node instead of a widget you fill in by hand. First, it turns a messy pasted list into the exact comma-joined string Confucius4 Transcribe wants. Second, it acts as a value node: one word list, one text box, wired into three Transcribe nodes. Edit once, all three pick it up - the difference between a 40-term lexicon maintained in one place and the same lexicon copy-pasted into four nodes where it will quietly drift.
What it actually does with your words
The parsing is normalize_hotwords in hotwords.py. It splits on newlines, ASCII and full-width commas, semicolons, and the Chinese enumeration comma 、; strips whitespace and stray BOM characters; drops duplicates while keeping first-seen order; then joins everything with ", ". New York survives as one phrase, because only the separators split - spacing inside an entry is preserved.
That string goes into Transcribe's hotwords input, gets appended to your context as Hotwords: <words>, and lands in the system turn of the model's chat prompt, ahead of the audio tokens and before the decoder writes a single character.
Being in the prompt is the mechanism. It biases the decoder toward those spellings. It is not a find-and-replace pass running after recognition - the README says so outright ("used to assist recognition, not force correction"), and you should believe it. A hotword that never appears in the audio does nothing, and an ambiguous syllable can still lose to the wrong candidate.
The two inputs, the two outputs
-
words- the paste box. One per line, or separated by commas/semicolons. Full-width,;、all work, so you can paste straight out of a spreadsheet or a Chinese doc. -
hotword_file- optional UTF-8 TXT path relative toComfyUI/input, e.g.r2t2_hotwords/brands.txt. Merged with the paste box and deduplicated. -
hotwords(STRING) → the socket on Transcribe, or the Live node'scontextfield. -
count(INT) → wire it into anything that shows a number. It's your sanity check: pasted 40 terms and count reads 3? They ended up space-separated on one line and the parser treated that line as one phrase. Count is post-dedupe.
One nicety most nodes get wrong: IS_CHANGED hashes the contents of hotword_file, not the path. Edit brands.txt in Notepad, hit Run, and the node re-executes (and takes Transcribe with it) despite the graph being untouched.
Install
Windows and NVIDIA only - the whole pack is PowerShell scripts and a CUDA build, so a Mac or a Linux box is out of luck here.
cd ComfyUI/custom_nodes
git clone https://github.com/T8mars/comfyui-confucius-r2t2-t8
cd comfyui-confucius-r2t2-t8
.\scripts\setup_worker_windows.ps1
Prerequisites: Python 3.12, Git, CMake, Visual Studio 2022 C++ build tools, CUDA Toolkit 12.8. The first run downloads and verifies roughly 2.19 GB of Q8 model plus audio projector, then compiles a pinned llama.cpp CUDA extension - budget real time for that. Default build target is RTX 50-series (CUDA arch 120); on anything else run setup_worker_windows.ps1 -SkipNativeBuild and then build_native_windows.ps1 -CudaArch 86. Restart ComfyUI when it's done. Manager is wired up (publisher t8star, "Confucius4-R2T2 Q8 ASR") but the README notes the registry install needs its review to clear, so cloning is the path that always works today.
Worth knowing why there's a setup script at all: inference runs in its own Python 3.12 worker under .runtime/ instead of pip-installing into your ComfyUI environment. This ecosystem's number-one structural complaint is that every custom node shares one environment and they fight over it - an ASR stack dragging in its own numpy, onnxruntime and audio libs is exactly the pack that would break your other nodes. This one doesn't.
Where people get burned
The 8192-character budget is shared. Hotwords, your context prompt, and the Hotwords: label all count against the same limit. A 300-term list plus a long context and you'll get a CONTEXT_LIMIT error mid-run. Keep the list to names, brands and jargon - a hotword list is a nudge, not a dictionary, and a bloated one dilutes attention on the terms that matter.
The file has to be legal. .txt, UTF-8, inside ComfyUI/input, relative path only. A typo throws instead of silently ignoring you, and ../ or absolute paths are refused outright. File cap is 64 KiB.
The microphone workflow has no hotwords socket. On the Live node you put them in context as Hotwords: 品牌甲, 品牌乙, and they only apply to sessions started afterward. Also update if you're on an old build: 0.1.7 fixed leading-BOM pastes creating hidden duplicate entries, and older versions quietly miscount a list pasted from Word.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| words | STRING | Paste hotwords, one per line or separated by commas/semicolons. Phrases may contain spaces. | |
| hotword_fileopt | STRING | Optional UTF-8 TXT path relative to ComfyUI/input, e.g. r2t2_hotwords/brands.txt. Merged with words. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| hotwords | STRING | — |
| count | INT | — |