NNT TorchVision Datasets
The leaner, older dataset loader in the pack
- images
- labels
- dataset_info
- num_classes
If you open the NNT node menu and see both this and NntTorchvisionDataLoader, don't panic - you're not double-booking your dataset needs, you're looking at the pack's older, smaller sibling. NNT TorchVision Datasets loads the four classic torchvision datasets - CIFAR10, CIFAR100, MNIST, FashionMNIST - with the same basic recipe: download, transform, slice, hand back images and labels. The bigger loader covers ten datasets and lives in the "Data Loading" category; this one sits under "Tensors" and looks like an earlier version of the same idea that stuck around.
Which one should you use? For anything except a quick test, the Data Loader. This node has fewer datasets, a smaller sample cap, and - here's the kicker - a different default save location that will absolutely confuse you the first time you look for your data.
How it works
The inputs mirror the big loader: dataset_name (four choices, default CIFAR10), split (train/test), download, normalize_data, enable_augmentation (defaults to True here, unlike the big loader's False), samples_to_return (max 512, not 50000), and start_index. Normalization here is MNIST-specific - (0.1307,) mean, (0.3081,) std - hardcoded rather than the generic (0.5,) the other loader uses. Small detail, but it means its CIFAR outputs are scaled differently than the big loader's, so don't swap the two mid-workflow and expect identical results.
Outputs are the same shape as the big loader: images (TENSOR), labels (TENSOR), dataset_info (STRING), num_classes (INT).
The trap: where the data lands
The default data_dir here is data/torchvision - a relative path. The big loader defaults to an absolute path inside ComfyUI/models/torchvision_datasets/. This one writes wherever ComfyUI's working directory happens to be when you run the graph. On most installs that's your ComfyUI root, so you'll get a data/torchvision/ folder sitting next to your main.py. It works, it's just… not where you'd look. If you ever wonder "where did my CIFAR download go," it's there. You can override it with an absolute path, and you probably should for anything you care about keeping.
When you'd actually use it
Honestly: when the pack's own example workflow asks for it, or when you want the MNIST-tuned normalization. The augmentation defaults to on, which is handy if you're following along with a CIFAR example that expects flipped/rotated data and you don't want to think about transforms. And because it's capped at 512 samples, it's a good "does the pipeline run at all" smoke-test node - load 32 CIFAR10 images, wire them into a small conv stack, confirm the shapes line up, then switch to the big loader for real training.
Install
Pack-level install:
cd ComfyUI/custom_nodes
git clone https://github.com/inventorado/ComfyUI_NNT.git
cd ComfyUI_NNT
pip install -r requirements.txt
Restart ComfyUI (or Manager → "ComfyUI Neural Network Toolkit NNT"). Needs torchvision (in requirements), and the first run downloads the dataset - CIFAR10 is ~170MB, so budget a moment on a slow connection. Heavy requirements overall (torch, sklearn, statsmodels, transformers, onnx, shap 0.41.0, …) mean a long first install. It's the older sibling, but for a quick MNIST/CIFAR10 test it still does the job.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| dataset_name | COMBO | CIFAR10 | 4 options: CIFAR10, CIFAR100, MNIST, FashionMNIST |
| split | COMBO | train | 2 options: train, test |
| data_dir | STRING | data/torchvision | — |
| download | COMBO | True | 2 options: True, False |
| normalize_data | COMBO | True | 2 options: True, False |
| enable_augmentation | COMBO | True | 2 options: True, False |
| samples_to_return | INT | 321–512 | — |
| start_index | INT | 00–50000 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| images | TENSOR | — |
| labels | TENSOR | — |
| dataset_info | STRING | — |
| num_classes | INT | — |