# How to load a large hf dataset efficiently?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-a-large-hf-dataset-efficiently%2F69288%3E%5C
**Category:** 🤗Datasets\
**Created:** [January 16, 2024, 3:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-a-large-hf-dataset-efficiently%2F69288 "2024-01-16T03:52:35Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![lhoestq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/32/64813_2.png) [@lhoestq](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flhoestq)%5C
**Post date:** [January 22, 2024, 6:02pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-a-large-hf-dataset-efficiently%2F69288%2F6 "2024-01-22T18:02:22Z")

</div>

It’s generally a good idea indeed if you want to save disk space or to not have to wait to download the full dataset.

For example you can stream the dataset using the `datasets` library, by passing `streaming=True` to `load_dataset()`.

However even in streaming mode, you better have multiple shards in order to do parallel streaming. And ideally use file formats that work well with streaming like WebDataset or Parquet.

@aaditya did try streaming mode on this dataset but the custom loading script of this dataset uses the `jsonlines` package that we don’t support for streaming (we only extend the builtin `open()` for streaming)

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-a-large-hf-dataset-efficiently%2F69288)._
