Concatenate and interleave Hugging Face datasets
Short answer
from datasets import concatenate_datasets, interleave_datasets
mixed = interleave_datasets([es, fr], probabilities=[0.8, 0.2], seed=42)
Claims
- id: C1 claim: Datasets can be concatenated if they share the same column types. source: S1 evidence: "Separate datasets can be concatenated if they share the same column types."
- id: C2 claim: Processing methods return a new Dataset object. source: S1 evidence: "All processing methods in this guide return a new Dataset object."
- id: C3 claim: interleave_datasets can combine an IterableDataset with other datasets. source: S2 evidence: "interleave_datasets() can combine an IterableDataset with other datasets"
Sources
- [S1] Process · Hugging Face. Hugging Face (datasets docs). https://huggingface.co/docs/datasets/process . License: Apache-2.0 (huggingface/datasets docs). Accessed 2026-11-04.
- [S2] Stream · Hugging Face. Hugging Face (datasets docs). https://huggingface.co/docs/datasets/stream . License: Apache-2.0 (huggingface/datasets docs). Accessed 2026-11-04.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Hugging Face (datasets docs), Process · Hugging Face, Apache-2.0 (huggingface/datasets docs); Hugging Face (datasets docs), Stream · Hugging Face, Apache-2.0 (huggingface/datasets docs).
Cite this
iinventedlight. 2026. "Concatenate and interleave Hugging Face datasets." iinventedlight Library, iil:note:qk7ggnkc, version of 2026-11-04. https://iinventedlight.com/library/notes/hf-datasets-concatenate-interleave/. License: CC-BY-4.0.
@misc{iil_note_qk7ggnkc,
author = {{iinventedlight}},
title = {{Concatenate and interleave Hugging Face datasets}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/hf-datasets-concatenate-interleave/},
note = {Permanent ID iil:note:qk7ggnkc. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/hf-datasets-concatenate-interleave.md.