Nodes/comfyui-spawner-nodes/保存训练数据对 (UUID命名)
ComfyUI Node

保存训练数据对 (UUID命名)

Save image-plus-embedding pairs for a custom training dataset

By spawner1145·Created about a year ago·Updated 11 months ago· 2
保存训练数据对 (UUID命名)
  • image
  • conditioning
  • saved_path_info
root_pathdatasets/my_training_data
style_namestyle_a

The only node in this pack that's an output node and the one aimed at a completely different job: building a training dataset. You give it an image, a conditioning, a root folder and a style name, and it writes a data pair - the image as a PNG, and the conditioning's embedding as a .pt tensor file - into root_path/style_name/. Every pair gets a random UUID filename, so nothing ever collides and the naming is done for you ("保存训练数据对 (UUID命名)").

The inputs:

  • root_path (default datasets/my_training_data) - where the dataset tree goes.
  • style_name (default style_a) - a subfolder under the root; each style/class you train gets its own folder.
  • image - the training image.
  • conditioning - the conditioning whose embedding becomes the pair's .pt file.

Per pair it writes up to four files, all sharing the UUID basename: the image PNG, the embedding .pt (the whole ComfyUI conditioning tuple - tensor plus details dict), and, if the details carry them, a separate _pooled.pt and _mask.pt. Everything is moved to CPU before saving, so file size is what it is and nothing lingers on the GPU. It returns a saved_path_info string telling you where it wrote.

Here's the important reality check, because the name invites a wrong assumption: this is not a standard LoRA dataset. The ecosystem's normal convention is image + matching .txt caption sidecar (same basename, .txt beside the PNG - the kohya/ai-toolkit/OneTrainer format). This node writes no .txt at all; it writes .pt embedding files. So the output of this node will not feed kohya or ai-toolkit as-is. It's a custom format, and its natural consumer is this pack's own (apparently intended) embedding-based training pipeline - or your own script that reads _img.png + _embed.pt pairs. If you came here hoping to produce a caption sidecar dataset, this is the wrong tool; use the standard image-plus-txt convention instead.

Two more things worth knowing. First, only image[0] is saved - the first frame of a batch. Second, the conditioning it saves is exactly what you wire in, so if you've been fiddling with embeddings (say, via ConditioningInspector → tensor nodes → ConditioningPacker), this is how you'd snapshot the result. That's arguably the node's real niche: capturing hand-built or model-built embeddings alongside their images for later training experiments, not as a mainstream dataset prep tool.

Install

ComfyUI Manager → search comfyui-spawner-nodes → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/spawner1145/comfyui-spawner-nodes

Deps: piexif, pypng, xmltodict (it uses Pillow/torch that ComfyUI already has). No model downloads. The README is a stub; author spawner1145 is a Chinese-speaking dev known for a Wan2.1 SD extension. The pack is a personal toolkit that escaped - expect to own the documentation yourself.

Troubleshooting

  • Output folder doesn't exist / empty - the node creates root_path/style_name/ with os.makedirs(..., exist_ok=True), so if the folder's not there, the run didn't complete. Check the console for the printed save message.
  • saved_path_info returns but you see no .pt - if the conditioning details carried no pooled_output or attention_mask, those extra files simply aren't written. The embedding .pt always is.
  • Files don't import into kohya/ai-toolkit - by design; this is a custom embedding-pair format, not a caption sidecar. See the note above about the standard .txt convention.
Categoryspawner/dataset

Inputs (4)

NameTypeDefaultDescription
root_pathSTRINGdatasets/my_training_data
style_nameSTRINGstyle_a
imageIMAGE
conditioningCONDITIONING

Outputs (1)

NameTypeDescription
saved_path_infoSTRING