Nodes/EternalKernel PyTorch Nodes/PyTorchDatasetDownloader
ComfyUI Node

PyTorchDatasetDownloader

The dataset faucet — though it really only does MNIST

By TashaSkyUp·Created about a year ago·Updated about a year ago· 1
PyTorchDatasetDownloader
    • Full Dataset
    • Features tensor
    • labels tensor
    dataset_namemnist
    download_path./data
    mode

    Every neural network needs data, and this is the tap. PyTorchDatasetDownloader pulls down a torchvision dataset on first run and hands it to the rest of your graph either as a proper TORCH_DATASET or as separate features/labels tensors. It's the start of the canonical "download data → build net → train → evaluate" flow that this whole pack is built around.

    One important correction up front: the README lists MNIST, CIFAR and friends, but the shipped code only actually supports MNIST. Feed it "cifar10" and you get a ValueError: Unsupported dataset straight out of the function. It's the classic README-outruns-the-code situation, so treat this node as a MNIST faucet and nothing more.

    How it works

    Under the hood it calls torchvision.datasets.MNIST with transforms.ToTensor(), so the image data comes out as float32 tensors in the 0–1 range with labels as plain integers. It tries download=False first and falls back to download=True if the files aren't there - so the first run downloads roughly 11 MB into the path you give it.

    The mode dropdown decides what you get:

    • dataset - returns the full TORCH_DATASET out of the "Full Dataset" output; the two tensor outputs are None.
    • tensors - skips the dataset output and returns Features tensor (all 60k images stacked, shape (60000, 1, 28, 28)) and labels tensor ((60000,)).

    Because both outputs are always emitted, the mode you didn't pick leaves a None on a TORCH output - a return-type mismatch that the pack's global validate_inputs patch silently tolerates. Don't panic at the ghost None; just don't wire it.

    Inputs and outputs

    • dataset_name (required STRING) - default mnist, and honestly the only value that works.
    • download_path (required STRING) - default ./data, resolved relative to wherever you launched ComfyUI, not the pack folder.
    • mode (required enum) - dataset or tensors.
    • Outputs: Full Dataset (TORCH_DATASET), Features tensor (TORCH_TENSOR), labels tensor (TORCH_TENSOR).

    Installing it

    It's part of the EternalKernel PyTorch Nodes pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TashaSkyUp/EternalKernelPytorchNodes.git
    cd EternalKernelPytorchNodes
    pip install -r requirements.txt
    

    Restart ComfyUI; the node lives under ETK/pytorch. Or use ComfyUI Manager and search "EternalKernel PyTorch Nodes". The requirements add torchvision (needed for the dataset classes) alongside torch, scipy, scikit-learn and friends.

    Troubleshooting

    Three things bite beginners. The download path is relative to ComfyUI's working directory, so if your data keeps appearing "somewhere weird," that's why - give it an absolute path. If the download fails partway, the node re-downloads next run, but a corrupt partial folder can trip it up; delete the folder and retry. And remember it's MNIST-only - that error message about unsupported datasets isn't a config problem, it's the actual feature list.

    CategoryETK/pytorch

    Inputs (3)

    NameTypeDefaultDescription
    dataset_nameSTRINGmnist
    download_pathSTRING./data
    modeCOMBO2 options: dataset, tensors

    Outputs (3)

    NameTypeDescription
    Full DatasetTORCH_DATASET
    Features tensorTORCH_TENSOR
    labels tensorTORCH_TENSOR