ComfyUI Node

Ptv Dataset

Download a real ML dataset without leaving the graph

By HowToSD·Created about a year ago·Updated about a year ago· 7
Ptv Dataset
  • transform
  • PTVDATASET
name
downloadtrue
root
parameters

The fastest way to get from "I want to try training a model" to "something is actually training" in ComfyUI-Pt-Wrapper is Ptv Dataset. It's a wrapper around PyTorch's own torchvision.datasets - the same MNIST, FashionMNIST, CIFAR-10, and friends you'd load in a Python notebook - exposed as a node. You type the dataset name, it downloads it, and out pops a PTVDATASET you can feed into the pack's data loader and then into a training node.

The inputs that matter:

  • name - the dataset class name as a string, like MNIST or FashionMNIST. It's resolved to the torchvision class internally, so any torchvision dataset should work in principle.
  • download - Boolean, default true. Leave it on; that's how the data gets there.
  • root - where the data lands. Leave it blank and it downloads under the pack's own datasets directory; give it an absolute path to stash it elsewhere.
  • parameters (optional) - a Python dict as a string, e.g. {"train": False} to grab the test split instead of the train split. This is how you pass extra constructor args through to torchvision.
  • transform (optional) - plug in one of the pack's Ptv Transforms nodes (ToTensor, resize, normalize) and it gets applied to every sample.

The output is a PTVDATASET. That's a pack-private type, so it only connects to other Pt-Wrapper nodes - next stop is Pt Data Loader (which turns it into a PTDATALOADER with batch size and shuffling) and then a train node. The reference docs are honest about scope: only FashionMNIST and CIFAR-10 are explicitly tested. Other torchvision datasets probably work, and the author says to file an issue if one doesn't.

One practical note: if root is blank, your data lands inside the custom node folder, which means a ComfyUI reinstall or pack update could theoretically orphan it. If you're going to train a lot, set root to a path you control.

Install

ComfyUI Manager (search "ComfyUI-Pt-Wrapper"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper

Restart ComfyUI. The pack's requirements are heavy (transformers, datasets, peft, accelerate, scikit-learn, pandas, seaborn, matplotlib, gensim, sentencepiece). No model files - but datasets download at runtime on first run, so the first queue after wiring up a dataset node can hang for a while on a slow connection.

Common issues

The parameters string is where most beginners trip. It has to be valid Python dict syntax as text - {"train": False} with curly braces, not train=False. A typo there usually fails loudly when the node runs. And if name is misspelled or unsupported, you'll get an import/attribute error that points at torchvision, not at your typo. When in doubt, stick to the tested trio (MNIST, FashionMNIST, CIFAR-10) until you're comfortable.

CategoryTraining

Inputs (5)

NameTypeDefaultDescription
nameSTRING
downloadBOOLEANtrue
rootSTRING
transformoptPTVTRANSFORM
parametersoptSTRING

Outputs (1)

NameTypeDescription
PTVDATASETPTVDATASET