load_dataset('natural_questions') fails with "ValueError: External features info don't match the dataset"
NONE
I faced the similar problem. Downgrading datasets to 1.5.0 fixed it.
2021-05-30T09:48:33Z
https://github.com/huggingface/datasets/issues/2401#issuecomment-850971970
https://api.github.com/repos/huggingface/datasets/issues/2401
MDEyOklzc3VlQ29tbWVudDg1MDk3MTk3MA==
https://api.github.com/repos/huggingface/datasets/issues/comments/850971970/reactions
2021-05-30T09:48:33Z
https://api.github.com/repos/huggingface/datasets/issues/comments/850971970
https://avatars.githubusercontent.com/u/79786680?v=4
https://api.github.com/users/lawliet19189/events{/privacy}
https://api.github.com/users/lawliet19189/followers
https://api.github.com/users/lawliet19189/following{/other_user}
https://api.github.com/users/lawliet19189/gists{/gist_id}
https://github.com/lawliet19189
lawliet19189
MDQ6VXNlcjc5Nzg2Njgw
https://api.github.com/users/lawliet19189/orgs
https://api.github.com/users/lawliet19189/received_events
https://api.github.com/users/lawliet19189/repos
https://api.github.com/users/lawliet19189/starred{/owner}{/repo}
https://api.github.com/users/lawliet19189/subscriptions
User
https://api.github.com/users/lawliet19189
public
MEMBER
Thanks for reporting, I'm looking into it
2021-06-01T09:58:59Z
https://github.com/huggingface/datasets/issues/2401#issuecomment-851996462
https://api.github.com/repos/huggingface/datasets/issues/2401
MDEyOklzc3VlQ29tbWVudDg1MTk5NjQ2Mg==
https://api.github.com/repos/huggingface/datasets/issues/comments/851996462/reactions
2021-06-01T09:58:59Z
https://api.github.com/repos/huggingface/datasets/issues/comments/851996462
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
MEMBER
I just opened #2438 to fix this :)
2021-06-01T16:20:53Z
https://github.com/huggingface/datasets/issues/2401#issuecomment-852257280
https://api.github.com/repos/huggingface/datasets/issues/2401
MDEyOklzc3VlQ29tbWVudDg1MjI1NzI4MA==
https://api.github.com/repos/huggingface/datasets/issues/comments/852257280/reactions
2021-06-01T16:20:53Z
https://api.github.com/repos/huggingface/datasets/issues/comments/852257280
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
MEMBER
Hi ! This has been fixed in the 1.8.0 release of `datasets`
2021-06-09T09:07:25Z
https://github.com/huggingface/datasets/issues/2401#issuecomment-857524664
https://api.github.com/repos/huggingface/datasets/issues/2401
MDEyOklzc3VlQ29tbWVudDg1NzUyNDY2NA==
https://api.github.com/repos/huggingface/datasets/issues/comments/857524664/reactions
2021-06-09T09:07:25Z
https://api.github.com/repos/huggingface/datasets/issues/comments/857524664
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
## Describe the bug
load_dataset('natural_questions') throws ValueError

## Steps to reproduce the bug
```python
from datasets import load_dataset
datasets = load_dataset('natural_questions', split='validation[:10]')
```

## Expected results
Call to load_dataset returns data.

## Actual results
```
Using custom data configuration default
Reusing dataset natural_questions (/mnt/d/huggingface/datasets/natural_questions/default/0.0.2/19bc04755018a3ad02ee74f7045cde4ba9b4162cb64450a87030ab786b123b76)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-d55ab8a8cc1c> in <module>
----> 1 datasets = load_dataset('natural_questions', split='validation[:10]', cache_dir='/mnt/d/huggingface/datasets')

~/miniconda3/lib/python3.8/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, script_version, use_auth_token, **config_kwargs)
    756         keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size)
    757     )
--> 758     ds = builder_instance.as_dataset(split=split, ignore_verifications=ignore_verifications, in_memory=keep_in_memory)
    759     if save_infos:
    760         builder_instance._save_infos()

~/miniconda3/lib/python3.8/site-packages/datasets/builder.py in as_dataset(self, split, run_post_process, ignore_verifications, in_memory)
    735 
    736         # Create a dataset for each of the given splits
--> 737         datasets = utils.map_nested(
    738             partial(
    739                 self._build_single_dataset,

~/miniconda3/lib/python3.8/site-packages/datasets/utils/py_utils.py in map_nested(function, data_struct, dict_only, map_list, map_tuple, map_numpy, num_proc, types)
    193     # Singleton
    194     if not isinstance(data_struct, dict) and not isinstance(data_struct, types):
--> 195         return function(data_struct)
    196 
    197     disable_tqdm = bool(logger.getEffectiveLevel() > INFO)

~/miniconda3/lib/python3.8/site-packages/datasets/builder.py in _build_single_dataset(self, split, run_post_process, ignore_verifications, in_memory)
    762 
    763         # Build base dataset
--> 764         ds = self._as_dataset(
    765             split=split,
    766             in_memory=in_memory,

~/miniconda3/lib/python3.8/site-packages/datasets/builder.py in _as_dataset(self, split, in_memory)
    838             in_memory=in_memory,
    839         )
--> 840         return Dataset(**dataset_kwargs)
    841 
    842     def _post_process(self, dataset: Dataset, resources_paths: Dict[str, str]) -> Optional[Dataset]:

~/miniconda3/lib/python3.8/site-packages/datasets/arrow_dataset.py in __init__(self, arrow_table, info, split, indices_table, fingerprint)
    271         assert self._fingerprint is not None, "Fingerprint can't be None in a Dataset object"
    272         if self.info.features.type != inferred_features.type:
--> 273             raise ValueError(
    274                 "External features info don't match the dataset:\nGot\n{}\nwith type\n{}\n\nbut expected something like\n{}\nwith type\n{}".format(
    275                     self.info.features, self.info.features.type, inferred_features, inferred_features.type

ValueError: External features info don't match the dataset:
Got
{'id': Value(dtype='string', id=None), 'document': {'title': Value(dtype='string', id=None), 'url': Value(dtype='string', id=None), 'html': Value(dtype='string', id=None), 'tokens': Sequence(feature={'token': Value(dtype='string', id=None), 'is_html': Value(dtype='bool', id=None)}, length=-1, id=None)}, 'question': {'text': Value(dtype='string', id=None), 'tokens': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None)}, 'annotations': Sequence(feature={'id': Value(dtype='string', id=None), 'long_answer': {'start_token': Value(dtype='int64', id=None), 'end_token': Value(dtype='int64', id=None), 'start_byte': Value(dtype='int64', id=None), 'end_byte': Value(dtype='int64', id=None)}, 'short_answers': Sequence(feature={'start_token': Value(dtype='int64', id=None), 'end_token': Value(dtype='int64', id=None), 'start_byte': Value(dtype='int64', id=None), 'end_byte': Value(dtype='int64', id=None), 'text': Value(dtype='string', id=None)}, length=-1, id=None), 'yes_no_answer': ClassLabel(num_classes=2, names=['NO', 'YES'], names_file=None, id=None)}, length=-1, id=None)}
with type
struct<annotations: struct<id: list<item: string>, long_answer: list<item: struct<start_token: int64, end_token: int64, start_byte: int64, end_byte: int64>>, short_answers: list<item: struct<end_byte: list<item: int64>, end_token: list<item: int64>, start_byte: list<item: int64>, start_token: list<item: int64>, text: list<item: string>>>, yes_no_answer: list<item: int64>>, document: struct<title: string, url: string, html: string, tokens: struct<is_html: list<item: bool>, token: list<item: string>>>, id: string, question: struct<text: string, tokens: list<item: string>>>

but expected something like
{'id': Value(dtype='string', id=None), 'document': {'html': Value(dtype='string', id=None), 'title': Value(dtype='string', id=None), 'tokens': {'is_html': Sequence(feature=Value(dtype='bool', id=None), length=-1, id=None), 'token': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None)}, 'url': Value(dtype='string', id=None)}, 'question': {'text': Value(dtype='string', id=None), 'tokens': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None)}, 'annotations': {'id': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'long_answer': [{'end_byte': Value(dtype='int64', id=None), 'end_token': Value(dtype='int64', id=None), 'start_byte': Value(dtype='int64', id=None), 'start_token': Value(dtype='int64', id=None)}], 'short_answers': [{'end_byte': Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None), 'end_token': Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None), 'start_byte': Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None), 'start_token': Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None), 'text': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None)}], 'yes_no_answer': Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None)}}
with type
struct<annotations: struct<id: list<item: string>, long_answer: list<item: struct<end_byte: int64, end_token: int64, start_byte: int64, start_token: int64>>, short_answers: list<item: struct<end_byte: list<item: int64>, end_token: list<item: int64>, start_byte: list<item: int64>, start_token: list<item: int64>, text: list<item: string>>>, yes_no_answer: list<item: int64>>, document: struct<html: string, title: string, tokens: struct<is_html: list<item: bool>, token: list<item: string>>, url: string>, id: string, question: struct<text: string, tokens: list<item: string>>>
```

## Environment info
<!-- You can run the command `datasets-cli env` and copy-and-paste its output below. -->
- `datasets` version: 1.6.2
- Platform: Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.10
- Python version: 3.8.3
- PyTorch version (GPU?): 1.6.0 (False)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No
