# How do i load part of the data set

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-load-part-of-the-data-set%2F153049%3E%5C
**Category:** Beginners\
**Created:** [April 30, 2025, 6:34pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-load-part-of-the-data-set%2F153049 "2025-04-30T18:34:29Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Zelgodiz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/zelgodiz/32/45662_2.png) [@Zelgodiz](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FZelgodiz)%5C
**Post date:** [May 5, 2025, 4:10am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-load-part-of-the-data-set%2F153049%2F4 "2025-05-05T04:10:39Z")

</div>

You can load a **subset** of your dataset in Hugging Face using the `load_dataset()` function with filtering options. Here are a few ways to do it:

### **1. Using `.select()` to Load a Specific Number of Rows**

If your dataset is already loaded, you can select **200,000 rows** like this:

```python
from datasets import load_dataset

dataset = load_dataset("your_dataset_name")
subset = dataset["train"].select(range(200000)) # Select first 200k rows

```

### **2. Using Streaming to Avoid Full Download**

If your dataset is **too large** to fit in memory, use **streaming mode** :

```python
dataset = load_dataset("your_dataset_name", split="train", streaming=True)
subset = dataset.take(200000) # Load only 200k rows

```

This prevents downloading the entire dataset at once.

### **3. Using `data_files` to Load a Specific File**

If your dataset consists of multiple files, you can load only a **specific portion** :

```python
dataset = load_dataset("your_dataset_name", data_files={"train": "train_part1.csv"})

```

For more details, check out the [Hugging Face documentation](https://huggingface.co/docs/datasets/loading) or [community discussions](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Floading-just-part-of-dataset%2F38463). Let me know if you need help with a specific dataset! 🚀

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-load-part-of-the-data-set%2F153049)._
