# Dataset not caching

**URL:** <https://discuss.huggingface.co/t/dataset-not-caching/68690>\
**Category:** Spaces\
**Created:** [January 10, 2024, 5:48pm UTC](https://discuss.huggingface.co/t/dataset-not-caching/68690 "2024-01-10T17:48:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danavery](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/danavery/32/22853_2.png) [@danavery](https://discuss.huggingface.co/u/danavery)\
**Post date:** [January 10, 2024, 5:48pm UTC](https://discuss.huggingface.co/t/dataset-not-caching/68690/1 "2024-01-10T17:48:04Z")

</div>

I have a Gradio app in a Space. Its first action is:

```auto
self.dataset = load_dataset(dataset_name)
self.dataset = self.dataset.cast_column("audio", Audio(sampling_rate=16000))

```

I’ve added persistent storage to my Space, but every time I restart the app with a git push, it spends several minutes reloading the dataset. It doesn’t seem to be caching it at all. What am I missing?

Thanks!

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [January 10, 2024, 7:05pm UTC](https://discuss.huggingface.co/t/dataset-not-caching/68690/2 "2024-01-10T19:05:53Z")

</div>

hi @danavery ,

In order to use the persistent storage to cache the dataset, you have to set the `huggingface_hub` cache folder to `/data`.

got to: `https://huggingface.co/spaces/...../settings`  
Set Variable

`HF_HOME` to `/data/.huggingface`

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/0/6/06dcc991f90b45d65f8df8549335aa7e63f5bda4.png)

---

<div class="post-metadata">

**Author:** ![danavery](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/danavery/32/22853_2.png) [@danavery](https://discuss.huggingface.co/u/danavery)\
**Post date:** [January 10, 2024, 7:22pm UTC](https://discuss.huggingface.co/t/dataset-not-caching/68690/3 "2024-01-10T19:22:30Z")

</div>

Thank you!  
I had wrongly assumed it would use the default cache path somehow, but it’s helpful to know that it doesn’t.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [January 11, 2024, 7:22am UTC](https://discuss.huggingface.co/t/dataset-not-caching/68690/4 "2024-01-11T07:22:56Z")

</div>

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