# Load\_dataset is very slow

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-dataset-is-very-slow%2F74957%3E%5C
**Category:** Beginners\
**Created:** [February 27, 2024, 9:27am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-dataset-is-very-slow%2F74957 "2024-02-27T09:27:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cogns3942](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cogns3942](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcogns3942)%5C
**Post date:** [February 27, 2024, 9:27am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-dataset-is-very-slow%2F74957%2F1 "2024-02-27T09:27:54Z")

</div>

i have a big problem load\_dataset indexing is very slow ex) x[“text”][idx] or x[“audio”][idx][‘array’] this line take 30 second what should i do? already keep\_in\_memory is True

---

<div class="post-metadata">

**Author:** ![varadhbhatnagar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/varadhbhatnagar/32/31383_2.png) [@varadhbhatnagar](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvaradhbhatnagar)%5C
**Post date:** [February 27, 2024, 9:34am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-dataset-is-very-slow%2F74957%2F2 "2024-02-27T09:34:55Z")

</div>

@cogns3942 Try `x[idx]["text"]` instead, it should be faster.

My guess is that when you request `x["text"][idx]`, the entire list `x["text"]` has to be brought into memory which makes it slower.

---

<div class="post-metadata">

**Author:** ![cogns3942](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cogns3942](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcogns3942)%5C
**Post date:** [February 27, 2024, 9:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-dataset-is-very-slow%2F74957%2F3 "2024-02-27T09:39:43Z")

</div>

oh my god thank you I was using it wrong

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [February 27, 2024, 9:40pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-dataset-is-very-slow%2F74957%2F4 "2024-02-27T21:40:21Z")

</div>

Closed on February 27, 2024, 9:40pm UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
