Pt Data Loader
The feeding tube for your no-code training loop
- dataset
- PTDATALOADER
A training loop is only as good as what you feed it, and Pt Data Loader is the part of the pipeline that decides how that feeding happens. It's the node between your dataset and your model: take a dataset, chop it into batches, optionally shuffle it, and hand the whole thing to a training node like Pt Train Model as a PTDATALOADER. If you're building one of the no-code PyTorch training workflows this pack is famous for, this is the standard way to get your data into the loop.
How it works
Under the hood it's a thin wrapper around PyTorch's own torch.utils.data.DataLoader. Your dataset input has to be a PTVDATASET - meaning it comes out of a Pt-Wrapper dataset node like Ptv Dataset (the torchvision wrapper) or Ptv Image Folder Dataset (for your own folder of images). The node builds a DataLoader around it with the batch size and shuffle flag you give it, so every time the training node asks for data it gets one batch of batch_size samples, and each epoch starts from a fresh reshuffle if you asked for one.
One thing worth knowing: this node forces a re-run every time (the author sets IS_CHANGED to NaN), so it never caches its output. That's actually desirable here - a stale DataLoader would quietly train on the wrong data after you change the dataset.
The inputs that matter
There are only three you'll touch regularly:
- dataset - a
PTVDATASETfrom a Pt-Wrapper dataset node. No dataset node, no training. - batch_size - integer, default 1. For real training you'll want this higher; 1 means pure stochastic gradient descent, which trains noisier and slower.
- shuffle - boolean, default off. Turn it on for training so the model doesn't memorize sample order; leave it off for evaluation loaders.
The optional parameters field accepts a Python dict of extra DataLoader arguments, like {"num_workers": 2, "drop_last": True}.
Where people get burned
The parameters field has a default of "" (empty), and the node parses it with ast.literal_eval. An empty string is not valid Python, so leaving the default in place will throw a syntax error and the node will fail. If you have nothing to add, type {} - a literal empty dict - and it sails through. This one trips up basically everyone on their first try.
Installing it
This node ships inside ComfyUI-Pt-Wrapper, so you install the whole pack:
- ComfyUI Manager → Install Custom Nodes → search "ComfyUI-Pt-Wrapper" → Install → restart ComfyUI.
- Or manually:
cd ComfyUI/custom_nodes && git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapperand restart.
Fair warning: the pack's requirements.txt is a heavy lift - transformers, datasets, peft, accelerate, scikit-learn, scipy, gensim, sentencepiece, plus the usual plotting libraries. The first launch after install will spend a while resolving all of that. There's no model download needed for this node itself; datasets download on demand through the dataset nodes.
This pack has a tiny community footprint (you'll find almost nothing about it on Reddit), so when something breaks, your best move is the author's own docs in docs/reference/ or opening an issue on the repo - the README explicitly invites issues but closes unsolicited PRs.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| dataset | PTVDATASET | — | |
| batch_size | INT | 11–1000000 | — |
| shuffle | BOOLEAN | false | — |
| parametersopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PTDATALOADER | PTDATALOADER | — |