ComfyUI Extension: ComfyUI-E-Tier-TextSaver
A node for saving cleaned text outputs, useful for LoRA training. Removes unwanted tokens like <pad> and saves to .txt.
Custom Nodes (0)
README
π¦ ComfyUI-E-Tier-TextSaver
Sick of annoying <pad> tokens messing up your prompts? π This oneβs for you.
A secure and flexible text-saving node for ComfyUI.
After captioning with Florence2 or similar, it automatically strips unwanted tokens and saves a clean .txt
file.
β¨ Key Features
- β
Removes unwanted tokens like
<pad>
from caption text - π Strict path validation and filename sanitization
- π§© Works smoothly with Florence/BLIP captioning nodes
- π Supports LoRA-style image-text dataset workflows
π§βπ» Use Case Example
When training LoRA models, it's common to need .txt
caption files that match image filenames.
This node makes that easy by fitting naturally into a workflow like this:
[Image Loader] β‘οΈ [Captioning Node] β‘οΈ [Text Saver (E-Tier)]
π Security Design
All save paths go through strict validation checks:
| β
Allowed | β Blocked |
|-------------------------------|----------------------------------------------------------|
| Existing directories only | Non-existent paths (no auto-creation) |
| Absolute paths | Relative traversal (e.g., ../
) |
| Safe characters | Shell/metacharacters (e.g., |
, ;
, $
, etc.) |
| Clean text input | Suspicious patterns (e.g., eval
, <script>
, etc.) |
π The final save path is clearly printed to the console for full transparency.
βοΈ Node Parameters
| Parameter | Description |
|-------------|----------------------------------------------------|
| text
| The text content to be saved (required) |
| filename
| Filename for the resulting .txt
file (required) |
| save_to
| Output directory selected from a dropdown list |
About the save_to
Parameter
The save_to dropdown paths are specified in the node's YAML whitelist file. Users can set custom keys (names) and their corresponding directory paths in the YAML whitelist like this:
whitelist:
ComfyUI/output: "./ComfyUI/output"
CustomFolder: "./my_custom_output"
Here, "CustomFolder"
is the label shown in the dropdown, and "./my_custom_output"
is the actual directory path used for saving files.
This allows flexible and user-friendly naming of output locations.
β Other Notes
- Any validation errors will be clearly displayed in the console or UI.
- If no filename is given, it defaults to
"untitled.txt"
. - This node will not create directories β make sure your structure exists.
- Secure by default, but configurable for advanced users.
π οΈ Installation
git clone https://github.com/e-tier-newbie/ComfyUI-E-Tier-TextSaver
Place the folder under ComfyUI/custom_nodes/
and restart ComfyUI.
π Credits
E-tier-newbie
NDY