Changing sampling rate in audio dataset and subsequently mapping with `num_proc > 1` leads to weird bug
CONTRIBUTOR
Same error occures when using max samples with https://github.com/huggingface/transformers/blob/master/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py
2021-12-28T21:00:34Z
https://github.com/huggingface/datasets/issues/3497#issuecomment-1002279929
https://api.github.com/repos/huggingface/datasets/issues/3497
IC_kwDODunzps47vZP5
https://api.github.com/repos/huggingface/datasets/issues/comments/1002279929/reactions
2021-12-28T21:00:34Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1002279929
https://avatars.githubusercontent.com/u/47894090?v=4
https://api.github.com/users/flozi00/events{/privacy}
https://api.github.com/users/flozi00/followers
https://api.github.com/users/flozi00/following{/other_user}
https://api.github.com/users/flozi00/gists{/gist_id}
https://github.com/flozi00
flozi00
MDQ6VXNlcjQ3ODk0MDkw
https://api.github.com/users/flozi00/orgs
https://api.github.com/users/flozi00/received_events
https://api.github.com/users/flozi00/repos
https://api.github.com/users/flozi00/starred{/owner}{/repo}
https://api.github.com/users/flozi00/subscriptions
User
https://api.github.com/users/flozi00
public
NONE
I'm seeing this too, when using preprocessing_num_workers with 
https://github.com/huggingface/transformers/blob/master/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py
2022-01-03T23:55:50Z
https://github.com/huggingface/datasets/issues/3497#issuecomment-1004434626
https://api.github.com/repos/huggingface/datasets/issues/3497
IC_kwDODunzps473nTC
https://api.github.com/repos/huggingface/datasets/issues/comments/1004434626/reactions
2022-01-03T23:55:50Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1004434626
https://avatars.githubusercontent.com/u/24724502?v=4
https://api.github.com/users/laphang/events{/privacy}
https://api.github.com/users/laphang/followers
https://api.github.com/users/laphang/following{/other_user}
https://api.github.com/users/laphang/gists{/gist_id}
https://github.com/laphang
laphang
MDQ6VXNlcjI0NzI0NTAy
https://api.github.com/users/laphang/orgs
https://api.github.com/users/laphang/received_events
https://api.github.com/users/laphang/repos
https://api.github.com/users/laphang/starred{/owner}{/repo}
https://api.github.com/users/laphang/subscriptions
User
https://api.github.com/users/laphang
public
Running: 

```python
from datasets import load_dataset, DatasetDict
import datasets
from transformers import AutoFeatureExtractor

raw_datasets = DatasetDict()

raw_datasets["train"] = load_dataset("common_voice", "ab", split="train")

feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")

raw_datasets = raw_datasets.cast_column(
    "audio", datasets.features.Audio(sampling_rate=feature_extractor.sampling_rate)
)

num_workers = 16

def prepare_dataset(batch):
    sample = batch["audio"]

    inputs = feature_extractor(sample["array"], sampling_rate=sample["sampling_rate"])
    batch["input_values"] = inputs.input_values[0]
    batch["input_length"] = len(batch["input_values"])
    return batch

raw_datasets.map(
    prepare_dataset,
    remove_columns=next(iter(raw_datasets.values())).column_names,
    num_proc=16,
    desc="preprocess datasets",
)
```

gives

```bash
  File "/home/patrick/experiments/run_bug.py", line 25, in <module>
    raw_datasets.map(
  File "/home/patrick/python_bin/datasets/dataset_dict.py", line 492, in map
    {
  File "/home/patrick/python_bin/datasets/dataset_dict.py", line 493, in <dictcomp>
    k: dataset.map(
  File "/home/patrick/python_bin/datasets/arrow_dataset.py", line 2139, in map
    shards = [
  File "/home/patrick/python_bin/datasets/arrow_dataset.py", line 2140, in <listcomp>
    self.shard(num_shards=num_proc, index=rank, contiguous=True, keep_in_memory=keep_in_memory)
  File "/home/patrick/python_bin/datasets/arrow_dataset.py", line 3164, in shard
    return self.select(
  File "/home/patrick/python_bin/datasets/arrow_dataset.py", line 485, in wrapper
    out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
  File "/home/patrick/python_bin/datasets/fingerprint.py", line 411, in wrapper
    out = func(self, *args, **kwargs)
  File "/home/patrick/python_bin/datasets/arrow_dataset.py", line 2756, in select
    return self._new_dataset_with_indices(indices_buffer=buf_writer.getvalue(), fingerprint=new_fingerprint)
  File "/home/patrick/python_bin/datasets/arrow_dataset.py", line 2667, in _new_dataset_with_indices
    return Dataset(
  File "/home/patrick/python_bin/datasets/arrow_dataset.py", line 659, in __init__
    raise ValueError(
ValueError: External features info don't match the dataset:
Got
{'client_id': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'audio': Audio(sampling_rate=16000, mono=True, _storage_dtype='string', id=None), 'sentence': Value(dtype='string', id=None), 'up_votes': Value(dtype='int64', id=None), 'down_votes': Value(dtype='int64', id=None), 'age': Value(dtype='string', id=None), 'gender': Value(dtype='string', id=None), 'accent': Value(dtype='string', id=None), 'locale': Value(dtype='string', id=None), 'segment': Value(dtype='string', id=None)}
with type
struct<client_id: string, path: string, audio: string, sentence: string, up_votes: int64, down_votes: int64, age: string, gender: string, accent: string, locale: string, segment: string>

but expected something like
{'client_id': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'audio': {'path': Value(dtype='string', id=None), 'bytes': Value(dtype='binary', id=None)}, 'sentence': Value(dtype='string', id=None), 'up_votes': Value(dtype='int64', id=None), 'down_votes': Value(dtype='int64', id=None), 'age': Value(dtype='string', id=None), 'gender': Value(dtype='string', id=None), 'accent': Value(dtype='string', id=None), 'locale': Value(dtype='string', id=None), 'segment': Value(dtype='string', id=None)}
with type
struct<client_id: string, path: string, audio: struct<path: string, bytes: binary>, sentence: string, up_votes: int64, down_votes: int64, age: string, gender: string, accent: string, locale: string, segment: string>
```

Versions:

```python
- `datasets` version: 1.16.2.dev0
- Platform: Linux-5.15.8-76051508-generic-x86_64-with-glibc2.33
- Python version: 3.9.7
- PyArrow version: 6.0.1
```

and `transformers`:

```
- `transformers` version: 4.16.0.dev0
- Platform: Linux-5.15.8-76051508-generic-x86_64-with-glibc2.33
- Python version: 3.9.7
```