Nodes/ComfyUI-huggingface_dataset/πŸ€— Dataset Remove Columns
ComfyUI Node

πŸ€— Dataset Remove Columns

Drop the columns you don't need β€” before the rows ever hit your memory

By StableLlamaΒ·Created a day agoΒ·Updated a day agoΒ· 1
πŸ€— Dataset Remove Columns
  • dataset
  • dataset
β—„columnsβ–Ί

Loaded a dataset and only care about two of its nine columns? Carrying the other seven around is pure waste - every row dict is bigger than it needs to be, and if those columns hold images or audio you're paying real RAM for them. πŸ€— Dataset Remove Columns drops the ones you name, so the rest of your graph only ever sees what matters.

How it works

It maps onto datasets.Dataset.remove_columns. You feed in a HUGGINGFACE_DATASET, type a comma-separated list into columns (the tooltip's example is text, label), and get the dataset back without those columns. Two inputs, one output.

It's the mirror image of πŸ€— Dataset Select Columns - Remove says what to exclude, Select says what to keep - and which you reach for is pure preference. Remove wins when you want to drop a couple of heavy fields from an otherwise useful table; Select wins when you want a whitelist and don't want to type every column you don't care about. If you're about to materialize thousands of rows into a Data List for a prompt loop, trimming unused columns first is one of the cheapest optimizations in the pack.

Notes and gotchas

  • Works on streaming too. Unlike the loaded-only nodes, this one handles IterableDataset fine, so you can slim a lazy stream before it's iterated - genuinely useful for image/audio columns that would otherwise decode on the way through.
  • Typo behavior. Remove a column that doesn't exist and you'll get an error rather than silent success - which is the right failure mode, since silently keeping everything would read as the column being gone.
  • Order independence. Remove is just the complement of keep; you don't need to remove "before" selecting. Chain either way.
  • It removes whole columns - it will not prune a field nested inside a column. Nested cleanup is Flatten's territory, not this node's.

Installing it

Part of StableLlama/ComfyUI-huggingface_dataset. ComfyUI-Manager β†’ search "Hugging Face dataset", or:

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

Restart ComfyUI. The only runtime dependency is datasets, installed for you by Manager.

CategoryHugging Face πŸ€—

Inputs (2)

NameTypeDefaultDescription
datasetHUGGINGFACE_DATASETDataset to remove columns from (from the πŸ€— Dataset Loader or another dataset node).
columnsSTRINGComma-separated columns to remove, e.g. text, label.

Outputs (1)

NameTypeDescription
datasetHUGGINGFACE_DATASETThe dataset without the removed columns.