# Datasets use out of date loading script

**URL:** <https://discuss.huggingface.co/t/datasets-use-out-of-date-loading-script/105033>\
**Category:** Beginners\
**Created:** [September 3, 2024, 3:50am UTC](https://discuss.huggingface.co/t/datasets-use-out-of-date-loading-script/105033 "2024-09-03T03:50:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ljw20180420](https://avatars.discourse-cdn.com/v4/letter/l/d6d6ee/32.png) [@ljw20180420](https://discuss.huggingface.co/u/ljw20180420)\
**Post date:** [September 3, 2024, 3:50am UTC](https://discuss.huggingface.co/t/datasets-use-out-of-date-loading-script/105033/1 "2024-09-03T03:50:54Z")

</div>

When I update my loading script in my dataset repo, the load\_dataset function still use the cached local loading script. I have tried to set verification\_mode=“all\_checks”, but it still use out-of-date local loading script. Seems that this is relevant:

> <https://github.com/huggingface/datasets/issues/6465>
>
> \### Describe the bug
> 
> When a dataset is updated on the hub, using \`load\_dataset\`… will load the locally cached dataset instead of re-downloading the updated dataset
> 
> \### Steps to reproduce the bug
> 
> Here is a minimal example script to
> 1. create an initial dataset and upload
> 2. download it so it is stored in cache
> 3. change the dataset and re-upload
> 4. redownload 
> 
> \`\`\`python
> import time                                                                                                                                                    
>                                                                                                                                                                
> from datasets import Dataset, DatasetDict, DownloadMode, load\_dataset                                                                                 
>        
> username = "YOUR\_USERNAME\_HERE"                                                                                                                                          
>                                                                                                                                                                
> initial = Dataset.from\_dict({"foo": \[1, 2, 3\]})                                                                                                                
> print(f"Intial {initial\['foo'\]}")                                                                                                                              
> initial\_ds = DatasetDict({"train": initial})                                                                                                                   
> initial\_ds.push\_to\_hub("test")                                                                                                                                 
>                                                                                                                                                                
> time.sleep(1)                                                                                                                                                  
>                                                                                                                                                                
> download = load\_dataset(f"{username}/test", split="train")                                                                                                     
> changed = download.map(lambda x: {"foo": x\["foo"\] + 1})                                                                                                        
> print(f"Changed {changed\['foo'\]}")                                                                                                                             
> changed.push\_to\_hub("test")                                                                                                                                    
>                                                                                                                                                                
> time.sleep(1)                                                                                                                                                  
>                                                                                                                                                                
> download\_again = load\_dataset(f"{username}/test", split="train")                                                                                               
> print(f"Download Changed {download\_again\['foo'\]}")                                                                                                             
> \# \>\>\> gives the out-dated \[1,2,3\] when it should be changed \[2,3,4\]                                                                                                                                                                               
> \`\`\`
> 
> The redownloaded dataset should be the changed dataset but it is actually the cached, initial dataset. Force-redownloading gives the correct dataset
> 
> \`\`\`python
> download\_again\_force = load\_dataset(f"{username}/test", split="train", download\_mode=DownloadMode.FORCE\_REDOWNLOAD)                                            
> print(f"Force Download Changed {download\_again\_force\['foo'\]}")                                                                                                 
> \# \>\>\> \[2,3,4\]                                                                                                                                                                              
> \`\`\`
> 
>  
> 
> \### Expected behavior
> 
> I assumed there should be some sort of hashing that should check for changes in the dataset and re-download if the hashes don't match
> 
> \### Environment info
> 
> \- \`datasets\` version: 2.15.0 │
> \- Platform: Linux-5.15.0-1028-nvidia-x86\_64-with-glibc2.17 │
> \- Python version: 3.8.17 │
> \- \`huggingface\_hub\` version: 0.19.4 │
> \- PyArrow version: 13.0.0 │
> \- Pandas version: 2.0.3 │
> \- \`fsspec\` version: 2023.6.0

The issue says that dataset not using loading script works correctly:

> <https://github.com/huggingface/datasets/pull/6459>
>
> I drafted the logic to retrieve a no-script dataset in the cache.
> For example i…t can reload datasets that were pushed to hub if they exist in the cache.
> 
> example:
> 
> \`\`\`python
> \>\>\> Dataset.from\_dict({"a": \[1, 2\]}).push\_to\_hub("lhoestq/tmp")
> \>\>\> load\_dataset("lhoestq/tmp")
> DatasetDict({
> train: Dataset({
> features: \['a'\],
> num\_rows: 2
> })
> })
> \`\`\`
> 
> and later, without connection:
> 
> \`\`\`python
> \>\>\> load\_dataset("lhoestq/tmp")
> Using the latest cached version of the dataset from /Users/quentinlhoest/.cache/huggingface/datasets/lhoestq\_\_\_tmp/\*/\*/0b3caccda1725efb(last modified on Wed Nov 29 16:50:27 2023) since it couldn't be found locally at lhoestq/tmp.
> DatasetDict({
> train: Dataset({
> features: \['a'\],
> num\_rows: 2
> })
> })
> \`\`\`
> 
> fix https://github.com/huggingface/datasets/issues/3547
> 
> \## Implementation details (EDITED)
> 
> I continued in https://github.com/huggingface/datasets/pull/6493, see the changes there
> 
> TODO:
> \- \[x\] tests
> \- \[\] compatible with https://github.com/huggingface/datasets/pull/6458
