Nodes/ComfyUI-mnemic-nodes/πŸ–ΌοΈ+πŸ“ Load Text-Image Pairs (List)
ComfyUI Node

πŸ–ΌοΈ+πŸ“ Load Text-Image Pairs (List)

A whole caption dataset as parallel lists

By MNeMoNiCuZΒ·Created 3 years agoΒ·Updated 23 days agoΒ· 105
πŸ–ΌοΈ+πŸ“ Load Text-Image Pairs (List)
  • image_input
  • image_list
  • string_list
  • image_path_list
  • image_filename_list
  • total_count
β—„seed0β–Ί
β—„folder_pathβ–Ί
β—„force_reloadfalseβ–Ί
β—„text_inputβ€”β–Ί
β—„limit_count0β–Ί
β—„text_format_extensiontxtβ–Ί

This is the batch version of this pack's Load Text-Image Pair (Single) node. Instead of picking one image/caption pair out of a dataset folder, it hands you the entire dataset at once as parallel lists - every image, every matching caption, rotated so the pair your seed points at comes first.

How it works

Same basename-matching logic as the Single node - image1.png pairs with image1.txt (or whatever extension text_format_extension is set to) - but the output is a full set of lists rather than one item. seed still matters here, but as a rotation point rather than a strict pick: it's where the returned lists start from, cycling through the rest of the set after that. force_reload bypasses whatever's cached from disk, which you want after editing caption files and re-running without restarting ComfyUI. limit_count caps how many pairs come back at all (0 means everything).

The inputs and outputs that matter

  • seed - the rotation starting point into the dataset.
  • folder_path - the dataset folder, used only when image_input/text_input aren't connected.
  • force_reload - forces a fresh read from disk instead of using a cached result.
  • limit_count (optional, default 0) - cap the number of pairs returned; 0 = no cap.
  • image_input / text_input (optional) - connections that take priority over folder_path.
  • text_format_extension (optional, default txt) - the caption file extension to match.

Outputs: image_list, string_list, image_path_list, image_filename_list, and total_count.

How to install it

Via ComfyUI Manager: search ComfyUI-mnemic-nodes, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes

Restart ComfyUI. No model downloads or extra dependencies.

Common issues & troubleshooting

Mismatched counts between images and captions. Same caveat as the Single node, just at scale - if a caption file is missing for one image in the set, that pair still comes back but with an empty string in string_list at that position rather than the whole load failing. Worth a quick scan of the lists (or total_count against a manual folder count) before trusting a large dataset is fully paired.

Editing captions and not seeing the changes. This is what force_reload is for - leave it off during normal use and it's fine, but if you've just hand-edited a .txt file and re-queue without seeing the update, that's a caching issue force_reload fixes.

Loading way more than you meant to. For a large dataset, set limit_count while you're still testing a downstream pipeline - there's no reason to pull ten thousand images into memory just to check that your batch captioning or metadata-stripping logic works on the first fifty.

Categorysd

Inputs (7)

NameTypeDefaultDescription
seedINT00–18446744073709550000The seed determines the starting point for selecting pairs. Set to 'increment' in the workflow options to cycle through all available pairs sequentially.
folder_pathSTRINGPath to a folder containing image and text files with matching basenames. This is used only if image_input and text_input are not connected.
force_reloadBOOLEANfalseIf true, forces a reload of data from disk, bypassing the cache.
image_inputoptIMAGEA single image or a list/batch of images. This input has priority over the folder_path.
text_inputoptSTRINGA single text string or a list of strings. This input has priority over the folder_path.
limit_countoptINT00–10000The maximum number of pairs to return in the output lists. If set to 0, all found pairs will be returned.
text_format_extensionoptSTRINGtxtThe file extension for the text files to look for (without the dot).

Outputs (5)

NameTypeDescription
image_listIMAGEA list of all images from the dataset, rotated so that the selected image is the first item in the list.
string_listSTRINGA list of all text strings from the dataset, rotated so that the selected text is the first item in the list.
image_path_listSTRINGA list of full absolute paths of all images.
image_filename_listSTRINGA list of filenames (without extension) of all images.
total_countINTThe total number of pairs found in the dataset.