ComfyUI-huggingface_dataset Introduction
ComfyUI-huggingface_dataset brings datasets from Hugging Face into ComfyUI. A dataset is a collection of records, often arranged like a spreadsheet: each row is one item, and columns might contain text, labels, or images.
The extension lets you load a dataset, choose which records and columns you need, and then use those values in a ComfyUI workflow. For example, you can pull prompts from a text column, preview images from an image column, or filter a collection before working with it. This is especially useful when a dataset is too large to handle conveniently all at once.
The author also provides in-app node documentation, parameter tooltips, and example workflows that you can open through Workflow → Browse Templates under Hugging Face dataset.
How ComfyUI-huggingface_dataset Works
Think of the extension as a three-stage path from a collection of files or records to usable ComfyUI inputs:
- Load a source. The Load Hugging Face Dataset node opens a dataset from the Hugging Face Hub, a supported file, or a local dataset directory. You choose a split—such as
train,validation, ortest—if the source provides one. - Shape the collection. Dataset nodes can keep a small number of rows, filter by a label, select columns, shuffle records, and more. At this stage, the dataset remains a dataset connection in the graph rather than a list of individual ComfyUI values.
- Convert what you need. 🤗 Dataset To Data List or 🤗 Dataset To LIST turns the selected records into values that other nodes can use.
For instance, to preview dataset images, you could connect:
Load Hugging Face Dataset → 🤗 Dataset Take → 🤗 Dataset To Data List (column=image) → Preview Image
The Take node limits how many images reach the conversion step. The conversion node changes dataset image cells into ComfyUI IMAGE values; connecting the loader directly to Preview Image would not do that.
You can choose between two loading approaches:
- Full load (
streamingoff): The Hugging Facedatasetslibrary downloads and caches the selected split. This supports all of the extension’s dataset operations, but a large split can take time and storage. - Streaming (
streamingon): Records are read as you iterate over them rather than downloading the whole split up front. This is useful when you only need a small portion of a large dataset. Some operations, including sorting and counting the entire dataset, are not available in this mode.
ComfyUI-huggingface_dataset Features
Load datasets from different sources
Load Hugging Face Dataset accepts several kinds of path:
| Source | Example or guidance |
|---|---|
| Hugging Face Hub dataset | Use its repository ID, such as stanfordnlp/imdb. Leave loader at auto. |
| Local or remote file | Supported formats include CSV, TSV, JSON, JSONL, Parquet, Arrow, and text. Paths can also use globs such as data/*.parquet, or remote https:// and hf:// URLs. |
| Local dataset directory | Point to a directory in Hugging Face dataset format. |
The loader’s main settings are:
| Setting | What it changes |
|---|---|
loader | auto infers a file format from its extension. You can instead choose hub, csv, json, parquet, arrow, or text. |
split | Selects the part of the dataset to open. The dropdown refreshes when you change source-related settings or use Force reload. |
config | Selects a named subset when a Hub dataset offers several; for example, nyu-mll/glue with config mrpc. |
revision | Selects a particular Hub tag, branch, or commit. Leave it empty if you do not need a specific revision. |
streaming | Switches between a fully loaded split and lazy, record-by-record access. |
When available splits can be discovered, the dropdown lists them and favors train, then validation, then test as a default. If the extension cannot check the source—for example, while offline—it shows fallback choices and checks your selection when the workflow runs.
Force reload refreshes the split choices and tells ComfyUI to fetch the dataset again on the next run. Use it if a source has changed but your workflow still appears to use the previous data.
Shape a dataset before converting it
You can chain these nodes between the loader and a conversion node:
| Node | What you can use it for | Streaming support |
|---|---|---|
| 🤗 Dataset Shuffle | Reorder rows randomly; set a seed when you want a repeatable order. | Yes |
| 🤗 Dataset Skip | Ignore the first n rows. | Yes |
| 🤗 Dataset Take | Keep only the first n rows. | Yes |
| 🤗 Dataset Sort | Order rows by a chosen column. | Full load only |
| 🤗 Dataset Shard | Keep one numbered portion out of num_shards portions. | Yes |
| 🤗 Dataset Select Rows | Keep specified row numbers or ranges, such as 0,2,4 or 0:100. | Full load only |
| 🤗 Dataset Select Columns | Keep only named columns. | Yes |
| 🤗 Dataset Remove Columns | Drop named columns you do not need. | Yes |
| 🤗 Dataset Rename Column | Give a column a different name for later nodes. | Yes |
| 🤗 Dataset Flatten | Expand nested data into top-level columns. | Full load only |
| 🤗 Dataset Filter | Keep rows that meet a condition. | Yes |
| 🤗 Dataset Map Column | Add or replace a column with a constant, a copy of another column, or a row index. | Yes |
| 🤗 Dataset Train/Test Split | Randomly divide records into separate train and test outputs. | Full load only |
| 🤗 Dataset Unique | Get the distinct values in a column as a Data List. | Full load only |
| 🤗 Dataset Count | Get the total number of rows as an integer. | Full load only |
Filter supports comparisons such as ==, !=, <, and >=; text checks such as contains, starts with, and ends with; membership checks using in or not in with comma-separated values; and is null or is not null. For example, column=label, operator===, value=1 keeps rows whose label equals 1.
A typical workflow for choosing material before processing it is:
flowchart LR
A[Load Hugging Face Dataset<br/>path=stanfordnlp/imdb] --> B[🤗 Dataset Filter<br/>column=label, operator===, value=1]
B --> C[🤗 Dataset Take<br/>n=20]
C --> D[🤗 Dataset To Data List]
Convert rows into ComfyUI-friendly values
Both conversion nodes work with fully loaded and streaming datasets:
- 🤗 Dataset To Data List exposes records as a ComfyUI Data List, with one item per row. If you set
column=image, each item is an image instead of a whole row. - 🤗 Dataset To LIST produces one
LISTvalue containing all selected rows. Setcolumn=text, for example, to get a list of text values rather than a list of row records.
Each has a limit setting: -1 means all available rows. For a large source, set a smaller limit—or use 🤗 Dataset Take first—so you do not convert more records than you intend.
A whole row is represented as a dictionary: its column names act as keys. The optional Basic data handling pack can help you inspect and process these results. For example, use Data List → get item to pick one row, then DICT → get with key=text to read that row’s text. Connecting a Data List to a compatible per-row Basic node lets ComfyUI apply it to each record.
Dataset image cells are converted to single-image ComfyUI IMAGE values for nodes such as Preview Image and Save Image. If an image has transparency, the extension also makes a separate mask available through a virtual column such as image_mask. You can select that column or retrieve it from a whole row. Images without transparency do not get a virtual mask column.
Start from an example workflow
Open Workflow → Browse Templates and look under Hugging Face dataset for:
imdb_filter_to_data_list— keeps positive IMDb reviews and converts them to a Data List.imdb_map_select_to_list— adds a row index, keeps review text, and produces aLISTof strings.imdb_streaming_skip_take— demonstrates choosing a small set of records in streaming mode without a full download.
What's New with ComfyUI-huggingface_dataset
For workflows created with version 1.x: the loader no longer has a rows output or a limit setting. Previously, it converted rows on every run even when no other node needed them. The current design leaves the dataset unconverted until you explicitly add a conversion node, giving you more control over how much data enters the rest of your workflow.
To update an older workflow, connect the loader’s dataset output to 🤗 Dataset To Data List. Use 🤗 Dataset Take or the conversion node’s limit if you only want some rows.
The loader’s Force reload button also refreshes split choices, replacing the separate manual Refresh splits action described for the older interface.
Troubleshooting ComfyUI-huggingface_dataset
My workflow cannot load a dataset
- Check that
pathpoints to the intended Hub dataset, file, or directory. - For a Hub dataset, check your network connection. If it has multiple subsets, set the required
config. - Check that
splitexists for that source. Changingpath,config,revision, orloaderrefreshes the dropdown; Force reload refreshes it again. - If ComfyUI reports that the Hugging Face
datasetspackage is missing, the environment running ComfyUI needs that dependency. It is normally supplied when the extension is installed through a supported manager or registry.
I changed the source, but the result looks unchanged
Click Force reload, then run the workflow again. ComfyUI may otherwise reuse the loader’s cached output.
A dataset node says it needs a fully loaded dataset
Turn off streaming in Load Hugging Face Dataset and run again. Sort, Select Rows, Flatten, Train/Test Split, Unique, and Count require a fully loaded dataset.
An image cannot be connected to Preview Image
Make sure the image passes through 🤗 Dataset To Data List or 🤗 Dataset To LIST with the appropriate image column selected. The loader’s dataset output is not itself a ComfyUI IMAGE.
If the dataset stores images as JPEG XL (.jxl) and they fail to decode, JPEG XL support requires the optional Pillow JPEG XL plugin. The ComfyUI startup log reports JPEG XL image support: enabled or disabled.
Frequently asked questions
Do I need to download an entire dataset to use a few records?
Not necessarily. Enable streaming, use 🤗 Dataset Take or another supported selection node, and set a sensible conversion limit.
Why can’t I count rows with 🤗 Dataset Count while streaming?
Streaming provides records as they are read, rather than a fully loaded collection with a known length. Turn off streaming if you need this node.
What is the difference between Data List and LIST?
A Data List provides items in a form that ComfyUI can process one by one through compatible nodes. A LIST holds the selected items together as one list value. Choose the shape expected by your next node.
Does this extension include image-generation models?
No. It loads and prepares dataset content for workflows; your other ComfyUI nodes determine how that content is used.
Learn More about ComfyUI-huggingface_dataset
- Example workflows — ready-made graphs to explore in ComfyUI’s template browser.
- Hugging Face Datasets: loading datasets — background on dataset sources, splits, and loading options.
- ComfyUI documentation and custom-node introduction — help with ComfyUI workflows and nodes.
- Basic data handling — additional nodes for inspecting lists and dictionaries and processing dataset rows.
You can also hover over an extension node and open its help panel, or find its page in ComfyUI’s Node Library, for guidance on that node’s settings.
