Couldn't run the run_clip.py successfully
Author: lchustc
Pull request: no
Labels: name: bug

### System Info

I couldn't run the code successfully following the README.md (https://github.com/huggingface/transformers/tree/main/examples/pytorch/contrastive-image-text#readme)。
"""
COCO_DIR = "data"
ds = datasets.load_dataset("ydshieh/coco_dataset_script", "2017", data_dir=COCO_DIR)
"""
"""
python examples/pytorch/contrastive-image-text/run_clip.py \
    --output_dir ./clip-roberta-finetuned \
    --model_name_or_path ./clip-roberta \
    --data_dir ./data \
    --dataset_name ydshieh/coco_dataset_script \
    --dataset_config_name=2017 \
    --image_column image_path \
    --caption_column caption \
    --remove_unused_columns=False \
    --do_train  --do_eval \
    --per_device_train_batch_size="64" \
    --per_device_eval_batch_size="64" \
    --learning_rate="5e-5" --warmup_steps="0" --weight_decay 0.1 \
    --overwrite_output_dir \
    --push_to_hub
"""

The errors are:
FileNotFoundError: Couldn't find file at https://huggingface.co/datasets/ydshieh/coco_dataset_script/resolve/main/data/train2017.zip

- 

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

"""
COCO_DIR = "data"
ds = datasets.load_dataset("ydshieh/coco_dataset_script", "2017", data_dir=COCO_DIR)
"""
"""
python examples/pytorch/contrastive-image-text/run_clip.py \
    --output_dir ./clip-roberta-finetuned \
    --model_name_or_path ./clip-roberta \
    --data_dir ./data \
    --dataset_name ydshieh/coco_dataset_script \
    --dataset_config_name=2017 \
    --image_column image_path \
    --caption_column caption \
    --remove_unused_columns=False \
    --do_train  --do_eval \
    --per_device_train_batch_size="64" \
    --per_device_eval_batch_size="64" \
    --learning_rate="5e-5" --warmup_steps="0" --weight_decay 0.1 \
    --overwrite_output_dir \
    --push_to_hub
"""

The errors are:
FileNotFoundError: Couldn't find file at https://huggingface.co/datasets/ydshieh/coco_dataset_script/resolve/main/data/train2017.zip

- 

### Expected behavior

run the code successfully

Comments:
cc @ydshieh :)

Hi, @lchwhut 

I believe you already download the (real) coco datasets into `COCO_DIR = "data"`. In this case, 
`--data_dir ./data` should be changed to the **absolute path** of the data directory, instead of `./data`.

Please let me know if this solves the issue, thank you.

(you can use `--data_dir $PWD/data`) 

> Hi, @lchwhut
> 
> I believe you already download the (real) coco datasets into `COCO_DIR = "data"`. In this case, `--data_dir ./data` should be changed to the **absolute path** of the data directory, instead of `./data`.
> 
> Please let me know if this solves the issue, thank you.
> 
> (you can use `--data_dir $PWD/data`)

thx, it works. 

Hello, i think the "load_dataset" doesn't load the data i have downloaded unless "streaming=True" is set. But if i set that, i obtained IterableDataset(IterableDatasetDict) rather than Dataset(DatasetDict). How can i load the data i have downloaded?
<img width="1244" alt="image" src="https://user-images.githubusercontent.com/27990344/186414346-37107f40-ac97-4745-95c0-6c136834d1c2.png">
@ydshieh

Hi @lchwhut , could you explain what kind of issue you have when you say `the "load_dataset" doesn't load the data i have downloaded?`



![image](https://user-images.githubusercontent.com/27990344/186424214-f1a81fc9-c3a6-43ff-9616-b0890123df67.png)
Here

The train size of "ds" i got is 80, but the real size is at least greater than 20,000. 
As you see, the space occupied by the train2012.zip is 19GB

OK, will take a look

@lchwhut Before I take a more close look, could you try maybe `rm -rf`  the directory  `/root/.cache/huggingface/datasets/`.
Then running `load_dataset` without `streaming`.

I tried it before and didn't find a difference

Hi @lchwhut I am not able to reproduce the issue. Could you share what's your `datasets` version? You can get it by
```
pip show datasets
```

Here is what I got with `print(ds)`
```bash
>>> print(ds)
DatasetDict({
    train: Dataset({
        features: ['image_id', 'caption_id', 'caption', 'height', 'width', 'file_name', 'coco_url', 'image_path'],
        num_rows: 591753
    })
    validation: Dataset({
        features: ['image_id', 'caption_id', 'caption', 'height', 'width', 'file_name', 'coco_url', 'image_path'],
        num_rows: 25014
    })
    test: Dataset({
        features: ['image_id', 'caption_id', 'caption', 'height', 'width', 'file_name', 'coco_url', 'image_path'],
        num_rows: 40670
    })
})
```


My datasets version is 2.0.0. The issue was solved when "rm -rf /root/.cache/huggingface/datasets/". 
I just tried "rm -rf /root/.cache/huggingface/datasets/ydshieh___coco_dataset/" before because there was other important data(310GB), really sorry about that Orz.
If i specify another cache_dir in load_dataset(like: ds = datasets.load_dataset("ydshieh/coco_dataset_script", "2017", data_dir=COCO_DIR, cache_dir="test_load")), The issue also would be solved.

Actully, I follow these steps and the issue can reproduce:

1. download dataset from "https://huggingface.co/datasets/ydshieh/coco_dataset_script/tree/main/dummy_data" into data folder
2. "ds = datasets.load_dataset("ydshieh/coco_dataset_script", "2017", data_dir=COCO_DIR)", and than get the "ds" of size 80
3. "rm  data/*" and get the "ds" following the readme(https://github.com/huggingface/transformers/blob/main/examples/pytorch/contrastive-image-text/README.md) to get the 19GB dataset
4. rm -rf /root/.cache/huggingface/datasets/ydshieh___coco_dataset/
5. "ds = datasets.load_dataset("ydshieh/coco_dataset_script", "2017", data_dir=COCO_DIR)", and than get the "ds" of size 80
6. if specify another cache_dir or streaming=true, i will get the "ds" of real size(591753)

So, rm -rf ydshieh___coco_dataset is not enough, the data configuration is kept and will be reused when COCO_DIR stay the same. 
The old data configuration isn't used when i specify another cache_dir or streaming=True.
Thanks a lot for you help！

@lchwhut Thank you for the detailed information. Glad it works for you now. It's probably good for me to make a comment on my dataset page regarding this.