# How to load cached dataset offline?

**URL:** <https://discuss.huggingface.co/t/how-to-load-cached-dataset-offline/18338>\
**Category:** Beginners\
**Created:** [May 25, 2022, 4:38am UTC](https://discuss.huggingface.co/t/how-to-load-cached-dataset-offline/18338 "2022-05-25T04:38:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![plkmn](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@plkmn](https://discuss.huggingface.co/u/plkmn)\
**Post date:** [May 25, 2022, 4:38am UTC](https://discuss.huggingface.co/t/how-to-load-cached-dataset-offline/18338/1 "2022-05-25T04:38:01Z")

</div>

Hello, all!

My computer doesn’t have internet connection. So I have to first download dataset on another computer and copy the dataset to my offline computer.

I use the following code snippet to download wikitext-2-raw-v1 dataset.

```nohighlight
from datasets import load_dataset
datasets = load_dataset("wikitext", "wikitext-2-raw-v1")

```

And I found that some cached files are in the `~/.cache/huggingface/` 's sub dirs.

In the `~/.cache/huggingface/modules/datasets_modules/datasets/wikitext/a241db52902eaf2c6aa732210bead40c090019a499ceb13bcbfa3f8ab646a126` dir I can see:  
` __init__.py`, ` __pycache__ `, `dataset_infos.json`, `wikitext.json`, `wikitext.py`

In the `~/.cache/huggingface/datasets/wikitext/wikitext-2-raw-v1/1.0.0/a241db52902eaf2c6aa732210bead40c090019a499ceb13bcbfa3f8ab646a1 26` dir I can see:  
LICENSE dataset\_info.json wikitext-test.arrow wikitext-train.arrow wikitext-validation.arrow

Do I have to copy all those files to the offline computer? Can I change `a241db52902eaf2c6aa732210bead40c090019a499ceb13bcbfa3f8ab646a126` to other names?

Or how to change those `arrow` files to `csv` files?

---

<div class="post-metadata">

**Author:** ![mariosasko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mariosasko/32/31548_2.png) [@mariosasko](https://discuss.huggingface.co/u/mariosasko)\
**Post date:** [May 27, 2022, 12:02pm UTC](https://discuss.huggingface.co/t/how-to-load-cached-dataset-offline/18338/2 "2022-05-27T12:02:59Z")

</div>

Hi! You only need the `arrow` files, but instead of looking for them in cache, it’s more convenient to save the dataset to disk with `save_to_disk` and transfer the generated folder to another computer, where you can simply load the dataset with `load_from_disk("path/to/folder")`.

> Or how to change those `arrow` files to `csv` files?

You can use `Dataset`’s `to_csv` method for that.

---

<div class="post-metadata">

**Author:** ![plkmn](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@plkmn](https://discuss.huggingface.co/u/plkmn)\
**Post date:** [May 29, 2022, 1:07pm UTC](https://discuss.huggingface.co/t/how-to-load-cached-dataset-offline/18338/3 "2022-05-29T13:07:57Z")

</div>

Thanks for helping me!
