rum_mlm crashes with bookcorpus and --preprocessing_num_workers
## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.9.0
- Platform: Linux-5.8.0-63-generic-x86_64-with-debian-bullseye-sid
- Python version: 3.7.10
- PyTorch version (GPU?): 1.8.1+cu111 (True)
- Tensorflow version (GPU?): 2.5.0 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: yes

### Who can help
@LysandreJik
Models:

- albert, bert, xlm: @LysandreJik @sgugger @patil-suraj

Library:
- trainer: @sgugger
- pipelines: @LysandreJik


Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj 


## Information
Trying to train BERT from scratch on wikipedia and bookcorpus using the run_mlm.py example.
As the dataset is large and I am using a strong machine (80 CPU cores 350GB RAM) I set the --preprocessing_num_workers flag to 64 to accelerate the preprocessing. 
When running a wikipedia or squad for sanity check, everything works fine but with bookcorpus, after dataset mapping is supposedly completed (all three occurrences), it gets stuck on with the info:
`Spawning 64 processes `
for a while and crashes with 
`BrokenPipeError: [Errno 32] Broken pipe`
This does not occur when dropping the --preprocessing_num_workers flag but then processing wiki + bookcorpus will take nearly two days.

I tried changing the transformer version or upgrading/downgrading the multiprocessing and dill packages and it didn't help

The problem arises when using:
* [ x] the official example scripts: (give details below)


## To reproduce

Steps to reproduce the behavior:

run:
`python transformers/examples/pytorch/language-modeling/run_mlm.py --output_dir transformers/trained_models/bert_base --dataset_name bookcorpus --model_type bert --preprocessing_num_workers 64 --tokenizer_name bert-base-uncased --do_train --do_eval --per_device_train_batch_size 16 --overwrite_output_dir --dataloader_num_workers 64 --max_steps 1000000 --learning_rate 1e-4 --warmup_steps 10000 --save_steps 25000 --adam_epsilon 1e-6 --adam_beta1 0.9 --adam_beta2 0.999 --weight_decay 0.0'


## Expected behavior

Training should begin as done properly when loading wiki and other datasets

Thanks is advance,
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.