# Load dataset from cache in offline mode

**URL:** <https://discuss.huggingface.co/t/load-dataset-from-cache-in-offline-mode/30025>\
**Category:** 🤗Datasets\
**Created:** [January 19, 2023, 3:56pm UTC](https://discuss.huggingface.co/t/load-dataset-from-cache-in-offline-mode/30025 "2023-01-19T15:56:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![manandey](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/manandey/32/3332_2.png) [@manandey](https://discuss.huggingface.co/u/manandey)\
**Post date:** [January 19, 2023, 3:56pm UTC](https://discuss.huggingface.co/t/load-dataset-from-cache-in-offline-mode/30025/1 "2023-01-19T15:56:19Z")

</div>

Suppose I load 2 files from the c4 dataset and cache it in a particular folder by doing something like:

`dataset = load_dataset("allenai/c4", data_files={"train": ["en/c4-train.00000-of-01024.json.gz", "en/c4-train.00001-of-01024.json.gz"]}, split="train", cache_dir="temp_cache")`

Then, I would like to load the same files of the c4 dataset from the cache\_dir mentioned above in offline\_mode : `os.environ["HF_DATASETS_OFFLINE"] = "1"`.

Can you suggest me what needs to be done for the same?

cc. @albertvillanova @mariosasko @lhoestq

---

<div class="post-metadata">

**Author:** ![lhoestq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/32/52888_2.png) [@lhoestq](https://discuss.huggingface.co/u/lhoestq)\
**Post date:** [January 23, 2023, 1:21pm UTC](https://discuss.huggingface.co/t/load-dataset-from-cache-in-offline-mode/30025/2 "2023-01-23T13:21:41Z")

</div>

This is not supported right now, though this can be fixed at the same time as [Datasets created with `push_to_hub` can't be accessed in offline mode · Issue #3547 · huggingface/datasets · GitHub](https://github.com/huggingface/datasets/issues/3547) IMO

In the meantime you can save and reload your dataset using `.save_to_disk()` and `load_from_disk()`
