ComfyUI-TITrain

ComfyUI-TITrain
★ 13

文本反演训练SDXLDiffusers兼容自定义嵌入
在ComfyUI内直接进行Textual Inversion训练,生成用于SDXL/Stable Diffusion的自定义词嵌入,基于diffusers示例改造,便于集成与可视化管理。
💡 在ComfyUI管线中训练并导出自定义文本嵌入以扩展模型词汇。
🍴 5 Forks💻 Python🔄 2025-07-21
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/79aaff81621b
📦 requirements.txt
accelerate>=0.16.0
torchvision
transformers>=4.25.1
ftfy
tensorboard
Jinja2
pexpect
📄 README

ComfyUI Textual Inversion Training

To train textual inversion embedding directly from ComfyUI pipeline.

Training scripts are modified version of diffusers examples: https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion

Install

Follow the installation here:

https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion

Then clone the repository inside custom_nodes:

git clone github.com/mbrostami/ComfyUI-TITrain
cd ComfyUI-TITrain
pip install -r requirements.txt

Restart and refresh the ComfyUI.

Nodes

Textual Inversion Training SD1.5

This node is designed to train SD 1.5 encoder (with progress bar)

([./screenshot.png)[img]

Parameters

train_dir

This is where the input images are going to be stored, if directory doesn’t exist in ComfyUI/output/ it will be created. Consider changing the value if you want to train different embeddings.

extra_prompts

There are list of prompts inside the training script, that is shuffled with each image to be used for training. I added this extra prompts that you can put additional prompt in each line, so randomly selected line from here will be appended to the final prompt. Usually you should put a part of prompt that you don’t want to be considered as the embedding itself. (e.g. white background, close up, tattoo, etc)

Other parameters are explained in diffusers repository:

https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion