Nodes/MOSS-TTS 1.5/MOSS-TTS Save Tokens
ComfyUI Node

MOSS-TTS Save Tokens

Write the Voice to Disk So It Outlives the Session

By eehrich·Created 4 months ago·Updated 21 days ago· 3
MOSS-TTS Save Tokens
  • tokens
  • path
◄filename_prefixmoss_tokens/voice►

Encoding a voice reference is the part of a MOSS-TTS run you should only ever pay once. MOSS-TTS Encode Tokens gets you the codes; this node gets them past the end of the process. Kill ComfyUI, reboot, run a different workflow three days later - the base voice is a file on disk, not something you re-derive.

It is also, quietly, the thing that makes an API-driven pipeline sane. Encode and save in one prompt, then every later prompt points at the file and starts straight at generation.

What it writes

tokens in, a file out, in ComfyUI's output directory. The filename comes from filename_prefix (default moss_tokens/voice), and the node appends a counter and a suffix:

output/moss_tokens/voice_00001_.moss_tokens.pt

Subfolders are created for you, and the counter increments per run, so saving repeatedly doesn't silently clobber the previous file. Under the hood this goes through the same get_save_image_path helper SaveImage and SaveAudio use, which is why prefix escaping out of the output directory is blocked for free.

The payload is a plain torch.save dict - format, format_version, audio_codes [frames, n_vq], frames, n_vq, frames_per_second - and nothing else. That shape is deliberate: MOSS-TTS Load Tokens reads it with weights_only=True, meaning tensors only, no pickled code execution. A token file that arrives from someone else can't run anything on your machine. You can also load it with vanilla torch.load(..., weights_only=True) if you want to poke at it in a notebook.

The inputs and the one output

  • tokens - anything MOSS_TOKENS: Encode Tokens for a base voice, or the tokens output of Speak / Voice Clone / Voice Continue if you liked what a run invented and want to keep it around.
  • filename_prefix (default moss_tokens/voice) - a path prefix inside the output directory, not a filename. The counter and .moss_tokens.pt are appended.

The output is a single path (STRING), the absolute path of what was just written. This node is an output node, so ComfyUI will run it even if nothing downstream consumes it - and the path is printed in the node's UI and present in ComfyUI's /history response, so an HTTP client can read back exactly which file it created.

Wire path into MOSS-TTS Load Tokens' path_override when you want the same graph to save once and load later, or just pick the file from the loader's dropdown on the next run. In the UI a freshly written file appears in that dropdown after a page reload; over HTTP, path_override sidesteps the question entirely.

Where people get burned

Tokens are model-specific. A file saved from the default Local-Transformer is meaningless to the 8B and vice versa - the loader's n_vq check stops you with a clear error rather than noise. If you swap models, re-encode the base voice and save a second file. Name the prefix accordingly (moss_tokens/voice_8b) and you'll thank yourself later.

A token file is not a backup of the audio. It's codes. To hear what you saved, run it into MOSS-TTS Decode Tokens → PreviewAudio. Worth doing once, because a token file gives you no clue by name whether it holds the voice you meant.

Saving doesn't shrink your VRAM bill. The codes still get carried through generation at roughly the same cost as the source audio. Save Tokens buys you encode time and reproducibility, not headroom.

Windows network paths are refused. filename_prefix rejects UNC paths like \\host\share\... - the argument being that touching one hands the remote host your NTLM hash, and a shared workflow shouldn't be able to do that. A share mapped to a drive letter is fine, and so is anything inside ComfyUI's own output directory even if that directory is itself a share.

Installing it

ComfyUI-Manager: search MOSS-TTS 1.5 (by enrico); there are similarly-named packs. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/eehrich/ComfyUI-MOSS-TTS-1.5.git

Restart ComfyUI. The pack intentionally installs no pip packages - its pyproject.toml says as much and relies on ComfyUI's existing torch, torchaudio and transformers. Note that this node itself doesn't need a model loaded: you can save or inspect token files with no MOSS model in VRAM at all.

Troubleshooting

  • Nothing was written - check filename_prefix doesn't try to escape the output directory; the shared save helper refuses that. Also remember the counter: look for voice_00002_, the newest file isn't always 00001.
  • File exists but Load Tokens won't take it - make sure the suffix was kept. The loader scans for files ending .moss_tokens.pt, and a renamed file won't be found by the dropdown.
  • Update the node pack error on load - the file was written by a newer token format version than your build understands. Update the pack rather than the file.
  • transformers 5.4.0 / 5.5.0 - if you hit non-default argument 'sampling_rate' follows default argument anywhere in the chain, that's the known one: python -m pip install -U "transformers>=5.5.1" in ComfyUI's Python environment.

Small node, big leverage. If you clone the same voice more than twice, save the tokens.

CategoryMOSS TTS 1.5

Inputs (2)

NameTypeDefaultDescription
tokensMOSS_TOKENSCodes to persist, e.g. from MOSS-TTS Encode Tokens or a 'tokens' output.
filename_prefixSTRINGmoss_tokens/voicePath prefix inside ComfyUI's output directory. Subfolders are created automatically and a counter plus '.moss_tokens.pt' is appended, e.g. 'moss_tokens/voice' -> 'output/moss_tokens/voice_00001_.moss_tokens.pt'.

Outputs (1)

NameTypeDescription
pathSTRINGAbsolute path of the written file. Feed it into MOSS-TTS Load Tokens (in this or a later run) or read it from ComfyUI's /history output.