NNT File Data Loader
Get your data into the graph without an API key
- data
- paired_data
- info_message
- batch_size
Every model needs data, and in the Neural Network Toolkit the "my data lives on disk" path runs through NNT File Data Loader. It's the node that turns plain files - numpy arrays, txt tables, pickles, or folders of images - into TENSORs your compiled model can actually train on. If NntHuggingFaceDataLoader is the "download the benchmark" route, this one is the "I have my own data, thanks" route.
What it actually does
You tell it what kind of source you have via data_source, point it at a directory with data_dir and a file_pattern, and it loads everything matching, converts to the data_type you picked (float32, int64, uint8, bool, ...), and applies normalization if you want it. The source options: txt, numpy (.npy files), python_pickle, image_folder, image_text_pairs, and text_text_pairs. The paired modes are the interesting ones - for image_text_pairs you give a second directory with paired_data_dir/paired_file_pattern, and you get both halves of the dataset aligned, which is exactly what you need for a classification or captioning toy model.
Normalization is handled in-node: normalize_range of 0-1 or -1-1 rescales, and standardize computes mean/std (z-scoring). For images there are image_size (resize to, 224 default), image_channels, and image_interpolation (nearest/bilinear/bicubic). Outputs are data, an optional paired_data, an info_message, and batch_size (the number of samples loaded).
Inputs that matter
data_source- what kind of files you have. Everything else on the node is scoped by this.data_dir- default is the pack'sComfyUI/models/nnt_datasets/folder (register your files there, or type an absolute path).file_pattern- glob pattern, e.g.*.npyfor numpy.normalize+normalize_range- if your model isn't training, a mismatch between your data range and what the network expects is a classic culprit. Standardize is the safe default for most toy models.use_cache- keeps an in-memory cache keyed by your settings; if you're iterating on a workflow, leave it on so reloading a huge dataset is instant. Toggle off if you change files and want fresh data.
Gotchas
The image_text_pairs and text_text_pairs modes require both paired_data_dir and paired_file_pattern to be filled in, or the node raises a clear error - that's the honest version of "you forgot the other half." Also, with shuffle on, the node builds a PyTorch DataLoader under the hood; with it off you get a plain tensor. If you're comparing runs, mind the cache: it hashes your parameters, so the same settings give you the same cached tensor even after you swap files. Turn use_cache off when you replace data mid-experiment.
Installing NNT
Part of inventorado/ComfyUI_NNT. ComfyUI Manager (search "ComfyUI Neural Network Toolkit") or:
cd ComfyUI/custom_nodes
git clone https://github.com/inventorado/ComfyUI_NNT.git
cd ComfyUI_NNT
pip install -r requirements.txt
Restart ComfyUI after. The requirements are a heavy scientific stack - torch, numpy, scikit-learn, pandas, Pillow, transformers - so the first install takes a while. The pack's MNIST/CIFAR workflows show the intended data → train → evaluate loop; they also want ComfyUI-Jjk-Nodes for text display, which Manager's "Install Missing Custom Nodes" fetches.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| data_source | COMBO | numpy | 6 options: txt, numpy, python_pickle, image_folder, image_text_pairs, text_text_pairs |
| data_dir | STRING | /tmp/ComfyUI/models/nnt_datasets | — |
| file_pattern | STRING | *.npy | — |
| data_type | COMBO | float32 | 7 options: float32, float64, int32, int64, uint8, bool, +1 |
| normalize | COMBO | True | 2 options: True, False |
| normalize_range | COMBO | 0-1 | 3 options: 0-1, -1-1, standardize |
| batch_first | COMBO | True | 2 options: True, False |
| shuffle | COMBO | False | 2 options: True, False |
| image_channels | INT | 31–4 | — |
| image_size | INT | 22416–2048 | — |
| image_interpolation | COMBO | bilinear | 3 options: nearest, bilinear, bicubic |
| use_cache | COMBO | True | 2 options: True, False |
| paired_data_diropt | STRING | — | |
| paired_file_patternopt | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| data | TENSOR | — |
| paired_data | TENSOR | — |
| info_message | STRING | — |
| batch_size | INT | — |