Manually dataset info made not taken into account
Opened by jplu (closed)

### Describe the bug

Hello,

I'm manually building an image dataset with the `from_dict` approach. I also build the features with the `cast_features` methods. Once the dataset is created I push it on the hub, and a default `dataset_infos.json` file seems to have been automatically added to the repo in same time. Hence I update it manually with all the missing info, but when I download the dataset the info are never updated.

Former `dataset_infos.json` file:
```
{"default": {
    "description": "",
    "citation": "",
    "homepage": "",
    "license": "",
    "features": {
        "image": {
            "_type": "Image"
        },
        "labels": {
            "names": [
                "Fake",
                "Real"
            ],
            "_type": "ClassLabel"
        }
    },
    "splits": {
        "validation": {
            "name": "validation",
            "num_bytes": 901010094.0,
            "num_examples": 3200,
            "dataset_name": null
        },
        "train": {
            "name": "train",
            "num_bytes": 901010094.0,
            "num_examples": 3200,
            "dataset_name": null
        }
    },
    "download_size": 1802008414,
    "dataset_size": 1802020188.0,
    "size_in_bytes": 3604028602.0
}}
```

After I update it manually it looks like:
```
{
   "bstrai--deepfake-detection":{
      "description":"",
      "citation":"",
      "homepage":"",
      "license":"",
      "features":{
         "image":{
            "decode":true,
            "id":null,
            "_type":"Image"
         },
         "labels":{
            "num_classes":2,
            "names":[
               "Fake",
               "Real"
            ],
            "id":null,
            "_type":"ClassLabel"
         }
      },
      "supervised_keys":{
         "input":"image",
         "output":"labels"
      },
      "task_templates":[
         {
            "task":"image-classification",
            "image_column":"image",
            "label_column":"labels"
         }
      ],
      "config_name":null,
      "splits":{
         "validation":{
            "name":"validation",
            "num_bytes":36627822,
            "num_examples":123,
            "dataset_name":"deepfake-detection"
         },
         "train":{
            "name":"train",
            "num_bytes":901023694,
            "num_examples":3200,
            "dataset_name":"deepfake-detection"
         }
      },
      "download_checksums":null,
      "download_size":937562209,
      "dataset_size":937651516,
      "size_in_bytes":1875213725
   }
}
```

Anything I should do to have the new infos in the `dataset_infos.json` to be taken into account? Or it is not possible yet?

Thanks!

### Steps to reproduce the bug

-

### Expected behavior

-

### Environment info

- `datasets` version: 2.11.0
- Platform: Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
- Python version: 3.10.10
- Huggingface_hub version: 0.13.3
- PyArrow version: 11.0.0
- Pandas version: 2.0.0

Comments:
hi @jplu ! Did I understand you correctly that you create the dataset, push it to the Hub with `.push_to_hub` and you see a `dataset_infos.json` file there, then you edit this file, load the dataset with `load_dataset` and you don't see any changes in `.info` attribute of a dataset object? 

This is actually weird that when you push your dataset to the Hub, a `dataset_infos.json` file is created, because this file is deprecated and it should create `README.md` with the `dataset_info` field instead. Some keys are also deprecated, like "supervised_keys" and "task_templates".

Can you please provide a toy reproducible example of how you create and push the dataset? And also why do you want to change this file, especially the number of bytes and examples?

Hi @polinaeterna Yes I have created the dataset with `Dataset.from_dict` applied some updates afterward and when I pushed to the hub I had a `dataset_infos.json` file and there was a `README.md` file as well.

I didn't know that the JSON file was deprecated. So I have built my dataset with `ImageBuilder` instead and now it works like a charm without having to touch anything.

I haven't succeed to reproduce the creation of the JSON file with a toy example, hence, I certainly did some mistakes when I have manipulated my dataset manually at first. My bad.