NNT HuggingFace Data Loader
Grab MNIST (or any dataset) by ID
- dataset
- info
- metadata
The fastest way to get a classic dataset into an NNT workflow is NNT HuggingFace Data Loader. Type a dataset ID, pick a split, and it pulls it down from the Hugging Face Hub with the datasets library - no API key, no CSV wrangling, no download_click_here drama. mnist is the default repo_id precisely because that's the dataset the pack's own examples train on.
What it actually does
It calls datasets.load_dataset(repo_id, split=split) under the hood, then applies your selection window. start_idx and num_samples slice out a contiguous chunk (start at 0, take 1000 samples, for example); shuffle with a seed randomizes before the slice if you want a random subset instead. Outputs are dataset (the Hugging Face Dataset object), info (a STRING summary of what was loaded - split, sample count, columns, cache location), and metadata (a DICT with features, column names, and total size). From there, the pack's NntDatasetToImageTensor / NntDatasetToTensor family nodes convert it into trainable tensors.
Inputs that matter
repo_id- any public dataset on the Hub, e.g.mnist,cifar10,fashion_mnist,imdb. Names are case-sensitive and some classic names live under namespaces, so if a bare ID fails, check the Hub page for the exact path.split- train, test, or validation.mnisthas train/test but no validation, so don't pickvalidationfor it.num_samples/start_idx- the selection window; cap it small while experimenting so downloads stay snappy.use_auth_token+token- only needed for gated/private datasets. For public data leave itFalseand empty.cache_dir- leave empty for the default Hugging Face cache; set it if you want datasets stored somewhere specific.
Gotchas
First, some datasets are gated and will reject an anonymous download - that's what the token fields are for (generate an access token in your HF account). Second, dataset IDs occasionally need the namespace: mnist works, but other classics like fashion_mnist may resolve under fashion_mnist or a namespaced path depending on how they're hosted; when in doubt, check the Hub. And remember num_samples is a cap, not a guarantee - if the split is shorter, you get whatever's there. The node also returns errors as a None dataset plus the message in info, so when a downstream node complains about a missing dataset, read info first.
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. This node specifically needs the datasets library (and huggingface-hub), both in the requirements - the full list is a heavy scientific stack (torch, scikit-learn, pandas, transformers, shap), so the first install takes a while. The pack's MNIST workflow in workflows/ is the canonical demo, and it also wants ComfyUI-Jjk-Nodes for text output.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| repo_id | STRING | mnist | — |
| split | COMBO | train | 3 options: train, test, validation |
| use_auth_token | COMBO | False | 2 options: True, False |
| token | STRING | — | |
| cache_dir | STRING | — | |
| num_samples | INT | 10001–100000 | — |
| start_idx | INT | 00–100000 | — |
| shuffle | COMBO | True | 2 options: True, False |
| seed | INT | 420–99999999 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| dataset | DATASET | — |
| info | STRING | — |
| metadata | DICT | — |