Preserve split type when realoding dataset
MEMBER
Thanks for diving into this !

Before going further, I just want to make sure if using `eval` is the right solution
Personally I'm not a big fan of `eval` since it has many security concerns. Also storing string representations of python objects in the json files is not ideal either IMO, so maybe it's possible to change this aspect instead.

Maybe it would be better to convert the `_RelativeInstruction` to a string (or "specs") ?
It looks like `ReadInstruction.from_spec` already exists, but not the other way around.
The specs are the string representation of instructions. For example: `train+validation[:50%]`.

Let me know what you think ! And thanks again, this issue has been here for a while now ^^
2021-04-06T14:52:39Z
https://github.com/huggingface/datasets/pull/2168#issuecomment-814185653
https://api.github.com/repos/huggingface/datasets/issues/2168
MDEyOklzc3VlQ29tbWVudDgxNDE4NTY1Mw==
https://api.github.com/repos/huggingface/datasets/issues/comments/814185653/reactions
2021-04-06T14:52:39Z
https://api.github.com/repos/huggingface/datasets/issues/comments/814185653
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
COLLABORATOR
@lhoestq Yes, before going with `eval`, I thought about this approach with the "spec". The only issue with this approach is that we have to come up with a represenation for the `rounding` arg.

What do you think about this (maybe too verbose)?
```python
>>> print(ReadInstruction("train", rounding="pct1_dropremainder", from_=10, to=30).to_spec())
train[10:30](pct1_dropremainder)
2021-04-12T11:30:23Z
https://github.com/huggingface/datasets/pull/2168#issuecomment-817733557
https://api.github.com/repos/huggingface/datasets/issues/2168
MDEyOklzc3VlQ29tbWVudDgxNzczMzU1Nw==
https://api.github.com/repos/huggingface/datasets/issues/comments/817733557/reactions
2021-04-12T11:30:23Z
https://api.github.com/repos/huggingface/datasets/issues/comments/817733557
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
MEMBER
Good idea !

First we must note that the rounding is only used for percentage instructions.
For absolute instructions there's no rounding ambiguity.

By default the rounding is set to `closest`. For example if you have a train set of 999 examples and if you provide an instruction spec `"train[:1%]"`, you're going to get the first ten examples (while the `pct1_dropremainder ` rounding would return 9 examples).

Currently there's no way to get an instruction with a `pct1_dropremainder` rounding strategy from an instruction spec.
So we can either drop the support of `pct1_dropremainder` or define a way to use this strategy from a spec.
I don't think dropping `pct1_dropremainder` would be a good idea since it allows to load each percent to all have the same number of examples (even the last one). Therefore I think your suggestion makes total sense and we should add a representation of this rounding strategy.

I like what you suggested `train[10%:30%](pct1_dropremainder)` is fine, and it seems compatible with the regex that parses the instructions specs.
2021-04-12T14:10:35Z
https://github.com/huggingface/datasets/pull/2168#issuecomment-817844764
https://api.github.com/repos/huggingface/datasets/issues/2168
MDEyOklzc3VlQ29tbWVudDgxNzg0NDc2NA==
https://api.github.com/repos/huggingface/datasets/issues/comments/817844764/reactions
2021-04-12T14:10:35Z
https://api.github.com/repos/huggingface/datasets/issues/comments/817844764
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
COLLABORATOR
@lhoestq I've made the changes as you suggested. Ready for the review.
2021-04-15T15:26:41Z
https://github.com/huggingface/datasets/pull/2168#issuecomment-820518701
https://api.github.com/repos/huggingface/datasets/issues/2168
MDEyOklzc3VlQ29tbWVudDgyMDUxODcwMQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/820518701/reactions
2021-04-15T15:26:41Z
https://api.github.com/repos/huggingface/datasets/issues/comments/820518701
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
COLLABORATOR
@lhoestq I've added a test and addressed the comments.

Additionally, `ReadInstruction` is converted to its spec form in `builder.py` to avoid a circular import that would happen if this logic was in `arrow_reader.py`.  If you think it's better to have this logic in `arrow_reader.py`, the import can be delayed by putting it inside a function.
2021-04-17T13:17:41Z
https://github.com/huggingface/datasets/pull/2168#issuecomment-821821325
https://api.github.com/repos/huggingface/datasets/issues/2168
MDEyOklzc3VlQ29tbWVudDgyMTgyMTMyNQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/821821325/reactions
2021-04-17T13:17:41Z
https://api.github.com/repos/huggingface/datasets/issues/comments/821821325
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
Fixes #2167 

Using `eval` is not ideal for security reasons (in web apps I assume), but without it the code would be much more complex IMO.

In terms of style, instead of explicitly importing a private member (`_RelativeInstruction`), we can add these imports at the top of the module:
```python
from . import arrow_reader  # gives us access to ReadInstruction and _RelativeInstruction
from . import splits # gives us access to NamedSplit
```

and then define the `eval` globals as follows:
```python
{**arrow_reader.__dict__, **splits.__dict__}
```


