# Creating my own Dataset

**URL:** <https://discuss.huggingface.co/t/creating-my-own-dataset/30661>\
**Category:** 🤗Transformers\
**Created:** [January 29, 2023, 3:13am UTC](https://discuss.huggingface.co/t/creating-my-own-dataset/30661 "2023-01-29T03:13:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yugen2](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/yugen2/32/13883_2.png) [@yugen2](https://discuss.huggingface.co/u/yugen2)\
**Post date:** [January 29, 2023, 3:13am UTC](https://discuss.huggingface.co/t/creating-my-own-dataset/30661/1 "2023-01-29T03:13:15Z")

</div>

Hello,

I am trying to train a transformer on my own text dataset, which requires passing it a Dataset argument. However, I have read through the Datasets guide [Overview](https://huggingface.co/docs/datasets/tutorial), and it seems to only discuss loading existing datasets. Maybe I missed something, but how can I create my own Dataset object from a directory of text files?

Thanks!

---

<div class="post-metadata">

**Author:** ![BerkanDogan](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/berkandogan/32/13890_2.png) [@BerkanDogan](https://discuss.huggingface.co/u/BerkanDogan)\
**Post date:** [January 29, 2023, 6:30pm UTC](https://discuss.huggingface.co/t/creating-my-own-dataset/30661/2 "2023-01-29T18:30:32Z")

</div>

Hello, if you are not going to make a very large data set, you can create a csv file with excel and upload it through the hugging face.

---

<div class="post-metadata">

**Author:** ![stevhliu](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stevhliu/32/18373_2.png) [@stevhliu](https://discuss.huggingface.co/u/stevhliu)\
**Post date:** [January 30, 2023, 5:06pm UTC](https://discuss.huggingface.co/t/creating-my-own-dataset/30661/3 "2023-01-30T17:06:03Z")

</div>

Hi @yugen2 , thanks for the feedback! We’re working on updating the tutorials to include something on how to create your own dataset.

To create your own dataset, you can do:

```plaintext
from datasets import load_dataset

# map specific text files to different splits
dataset = load_dataset("text", data_files={"train": ["my_text_1.txt", "my_text_2.txt"], "test": "my_test_file.txt"})

# load dataset from directory
dataset = load_dataset("text", data_dir="path/to/text/dataset")

```

Check out the [Load text data guide](https://huggingface.co/docs/datasets/nlp_load) for more information, and if you’re curious about loading other file formats, take a look at our [Local and remote files guide](https://huggingface.co/docs/datasets/loading#local-and-remote-files). 😄
