Streaming with num_workers != 0
CONTRIBUTOR
I can confirm that I was able to reproduce the bug. This seems odd given that #3423 reports duplicate data retrieval when `num_workers` and `streaming` are used together, which is obviously different from what is reported here. 
2021-12-28T03:50:17Z
https://github.com/huggingface/datasets/issues/3148#issuecomment-1001854234
https://api.github.com/repos/huggingface/datasets/issues/3148
IC_kwDODunzps47txUa
https://api.github.com/repos/huggingface/datasets/issues/comments/1001854234/reactions
2021-12-28T04:12:25Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1001854234
https://avatars.githubusercontent.com/u/25360440?v=4
https://api.github.com/users/jaketae/events{/privacy}
https://api.github.com/users/jaketae/followers
https://api.github.com/users/jaketae/following{/other_user}
https://api.github.com/users/jaketae/gists{/gist_id}
https://github.com/jaketae
jaketae
MDQ6VXNlcjI1MzYwNDQw
https://api.github.com/users/jaketae/orgs
https://api.github.com/users/jaketae/received_events
https://api.github.com/users/jaketae/repos
https://api.github.com/users/jaketae/starred{/owner}{/repo}
https://api.github.com/users/jaketae/subscriptions
User
https://api.github.com/users/jaketae
public
CONTRIBUTOR
Any update? A possible solution is to have multiple arrow files as shards, and handle them like what webdatasets does.
![image](https://user-images.githubusercontent.com/11533479/148176637-72746b2c-c122-47aa-bbfe-224b13ee9a71.png)

Pytorch's new dataset RFC is supporting sharding now, which may helps avoid duplicate data under streaming mode. (https://github.com/pytorch/pytorch/blob/master/torch/utils/data/datapipes/iter/grouping.py#L13)

2022-01-05T07:23:45Z
https://github.com/huggingface/datasets/issues/3148#issuecomment-1005442163
https://api.github.com/repos/huggingface/datasets/issues/3148
IC_kwDODunzps477dRz
https://api.github.com/repos/huggingface/datasets/issues/comments/1005442163/reactions
2022-01-05T07:23:45Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1005442163
https://avatars.githubusercontent.com/u/11533479?v=4
https://api.github.com/users/npuichigo/events{/privacy}
https://api.github.com/users/npuichigo/followers
https://api.github.com/users/npuichigo/following{/other_user}
https://api.github.com/users/npuichigo/gists{/gist_id}
https://github.com/npuichigo
npuichigo
MDQ6VXNlcjExNTMzNDc5
https://api.github.com/users/npuichigo/orgs
https://api.github.com/users/npuichigo/received_events
https://api.github.com/users/npuichigo/repos
https://api.github.com/users/npuichigo/starred{/owner}{/repo}
https://api.github.com/users/npuichigo/subscriptions
User
https://api.github.com/users/npuichigo
public
MEMBER
Hi ! Thanks for the insights :) Note that in streaming mode there're usually no arrow files. The data are streamed from TAR, ZIP, text, etc. files directly from the web. Though for sharded datasets we can definitely adopt a similar strategy !
2022-01-05T14:30:49Z
https://github.com/huggingface/datasets/issues/3148#issuecomment-1005734792
https://api.github.com/repos/huggingface/datasets/issues/3148
IC_kwDODunzps478kuI
https://api.github.com/repos/huggingface/datasets/issues/comments/1005734792/reactions
2022-01-05T14:30:49Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1005734792
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
fixed by #4375 
2022-07-04T12:14:58Z
https://github.com/huggingface/datasets/issues/3148#issuecomment-1173749737
https://api.github.com/repos/huggingface/datasets/issues/3148
IC_kwDODunzps5F9f_p
https://api.github.com/repos/huggingface/datasets/issues/comments/1173749737/reactions
2022-07-04T12:14:58Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1173749737
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
When using dataset streaming with pytorch DataLoader, the setting num_workers to anything other than 0 causes the code to freeze forever before yielding the first batch.

The code owner is likely @lhoestq 

## Steps to reproduce the bug

For your convenience, we've prepped a colab notebook that reproduces the bug
https://colab.research.google.com/drive/1Mgl0oTZSNIE3UeGl_oX9wPCOIxRg19h1?usp=sharing
```python
!pip install datasets==1.14.0

should_freeze_forever = True
# ^-- set this to True in order to freeze forever, set to False in order to work normally

import torch
from datasets import load_dataset

data = load_dataset("oscar", "unshuffled_deduplicated_bn", split="train", streaming=True)
data = data.map(lambda x: {"text": x["text"], "orig": f"oscar[{x['id']}]"}, batched=True)
data = data.shuffle(100, seed=1337)

data = data.with_format("torch")
loader = torch.utils.data.DataLoader(data, batch_size=2, num_workers=2 if should_freeze_forever else 0)

# v-- the code should freeze forever at this line
for i, row in enumerate(loader):
  print(row)
  if i > 10: break
print("DONE!")
```

## Expected results
The code should not freeze forever with num_workers=2

## Actual results
The code freezes forever with num_workers=2

## Environment info
- `datasets` version: 1.14.0 (also found in previous versions)
- Platform: google colab (also locally)
- Python version: 3.7, (also 3.8)
- PyArrow version: 3.0.0

