Add skip and take
CONTRIBUTOR
@lhoestq looks good. I tried with https://huggingface.co/datasets/vblagoje/wikipedia_snippets_streamed and it worked nicely. I would add more unit tests for edge cases. What happens if the n is larger than the total number of samples? Just to make sure these cases are handled properly. 
2021-07-05T03:52:46Z
https://github.com/huggingface/datasets/pull/2582#issuecomment-873763585
https://api.github.com/repos/huggingface/datasets/issues/2582
MDEyOklzc3VlQ29tbWVudDg3Mzc2MzU4NQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/873763585/reactions
2021-07-05T03:52:46Z
https://api.github.com/repos/huggingface/datasets/issues/comments/873763585
https://avatars.githubusercontent.com/u/458335?v=4
https://api.github.com/users/vblagoje/events{/privacy}
https://api.github.com/users/vblagoje/followers
https://api.github.com/users/vblagoje/following{/other_user}
https://api.github.com/users/vblagoje/gists{/gist_id}
https://github.com/vblagoje
vblagoje
MDQ6VXNlcjQ1ODMzNQ==
https://api.github.com/users/vblagoje/orgs
https://api.github.com/users/vblagoje/received_events
https://api.github.com/users/vblagoje/repos
https://api.github.com/users/vblagoje/starred{/owner}{/repo}
https://api.github.com/users/vblagoje/subscriptions
User
https://api.github.com/users/vblagoje
public
MEMBER
Yup I'll add the tests thanks ;)

Moreover, I just noticed something in your wiki snippets code. FYI you're using `++passage_counter ` at https://huggingface.co/datasets/vblagoje/wikipedia_snippets_streamed/blob/main/wikipedia_snippets_streamed.py#L102 but in python this doesn't increment the value @vblagoje 
2021-07-05T09:02:33Z
https://github.com/huggingface/datasets/pull/2582#issuecomment-873938910
https://api.github.com/repos/huggingface/datasets/issues/2582
MDEyOklzc3VlQ29tbWVudDg3MzkzODkxMA==
https://api.github.com/repos/huggingface/datasets/issues/comments/873938910/reactions
2021-07-05T09:03:06Z
https://api.github.com/repos/huggingface/datasets/issues/comments/873938910
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
CONTRIBUTOR
Thanks @lhoestq - not easy to convert after 10+ years of Java
2021-07-05T10:28:54Z
https://github.com/huggingface/datasets/pull/2582#issuecomment-874001861
https://api.github.com/repos/huggingface/datasets/issues/2582
MDEyOklzc3VlQ29tbWVudDg3NDAwMTg2MQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/874001861/reactions
2021-07-05T10:28:54Z
https://api.github.com/repos/huggingface/datasets/issues/comments/874001861
https://avatars.githubusercontent.com/u/458335?v=4
https://api.github.com/users/vblagoje/events{/privacy}
https://api.github.com/users/vblagoje/followers
https://api.github.com/users/vblagoje/following{/other_user}
https://api.github.com/users/vblagoje/gists{/gist_id}
https://github.com/vblagoje
vblagoje
MDQ6VXNlcjQ1ODMzNQ==
https://api.github.com/users/vblagoje/orgs
https://api.github.com/users/vblagoje/received_events
https://api.github.com/users/vblagoje/repos
https://api.github.com/users/vblagoje/starred{/owner}{/repo}
https://api.github.com/users/vblagoje/subscriptions
User
https://api.github.com/users/vblagoje
public
As discussed in https://github.com/huggingface/datasets/pull/2375#discussion_r657084544 I added the `IterableDataset.skip` and `IterableDataset.take` methods that allows to do basic splitting of iterable datasets.

You can create new dataset with the first `n` examples using `IterableDataset.take()`, or you can get a dataset with the rest of the examples by skipping the first `n` examples with `IterableDataset.skip()`

One implementation detail:

Using `take` (or `skip`) prevents future dataset shuffling from shuffling the dataset shards, otherwise the taken examples could come from other shards. In this case it only uses the shuffle buffer.
I would have loved to allow the shards of the taken examples to be shuffled anyway, but since we don't know in advance the length of each shard we don't know what shards to take or skip.
I think this is ok though since users can shuffle before doing take or skip. I mentioned this in the documentation

cc @vblagoje @lewtun 