weird result during dataset split when data path starts with `/data`
NONE
Same problem.
2023-04-13T07:58:25Z
https://github.com/huggingface/datasets/issues/5739#issuecomment-1506519710
https://api.github.com/repos/huggingface/datasets/issues/5739
IC_kwDODunzps5Zy6qe
https://api.github.com/repos/huggingface/datasets/issues/comments/1506519710/reactions
2023-04-13T07:58:25Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1506519710
https://avatars.githubusercontent.com/u/16949651?v=4
https://api.github.com/users/Jhangsy/events{/privacy}
https://api.github.com/users/Jhangsy/followers
https://api.github.com/users/Jhangsy/following{/other_user}
https://api.github.com/users/Jhangsy/gists{/gist_id}
https://github.com/Jhangsy
Jhangsy
MDQ6VXNlcjE2OTQ5NjUx
https://api.github.com/users/Jhangsy/orgs
https://api.github.com/users/Jhangsy/received_events
https://api.github.com/users/Jhangsy/repos
https://api.github.com/users/Jhangsy/starred{/owner}{/repo}
https://api.github.com/users/Jhangsy/subscriptions
User
https://api.github.com/users/Jhangsy
public
CONTRIBUTOR
hi! 
I think you can run python from `/data/train/raw/` directory and load dataset as `load_dataset("code_contests")` to mitigate this issue as a workaround. 
@ericxsun Do you want to open a PR to fix the regex? As you already found the solution :) 
2023-04-13T13:25:21Z
https://github.com/huggingface/datasets/issues/5739#issuecomment-1506961514
https://api.github.com/repos/huggingface/datasets/issues/5739
IC_kwDODunzps5Z0mhq
https://api.github.com/repos/huggingface/datasets/issues/comments/1506961514/reactions
2023-04-13T13:25:21Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1506961514
https://avatars.githubusercontent.com/u/16348744?v=4
https://api.github.com/users/polinaeterna/events{/privacy}
https://api.github.com/users/polinaeterna/followers
https://api.github.com/users/polinaeterna/following{/other_user}
https://api.github.com/users/polinaeterna/gists{/gist_id}
https://github.com/polinaeterna
polinaeterna
MDQ6VXNlcjE2MzQ4NzQ0
https://api.github.com/users/polinaeterna/orgs
https://api.github.com/users/polinaeterna/received_events
https://api.github.com/users/polinaeterna/repos
https://api.github.com/users/polinaeterna/starred{/owner}{/repo}
https://api.github.com/users/polinaeterna/subscriptions
User
https://api.github.com/users/polinaeterna
public
NONE
> hi! I think you can run python from `/data/train/raw/` directory and load dataset as `load_dataset("code_contests")` to mitigate this issue as a workaround. @ericxsun Do you want to open a PR to fix the regex? As you already found the solution :)

Sure, please see https://github.com/huggingface/datasets/pull/5748  @polinaeterna 
2023-04-14T05:08:15Z
https://github.com/huggingface/datasets/issues/5739#issuecomment-1507930645
https://api.github.com/repos/huggingface/datasets/issues/5739
IC_kwDODunzps5Z4TIV
https://api.github.com/repos/huggingface/datasets/issues/comments/1507930645/reactions
2023-04-14T06:11:05Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1507930645
https://avatars.githubusercontent.com/u/1772912?v=4
https://api.github.com/users/airlsyn/events{/privacy}
https://api.github.com/users/airlsyn/followers
https://api.github.com/users/airlsyn/following{/other_user}
https://api.github.com/users/airlsyn/gists{/gist_id}
https://github.com/airlsyn
airlsyn
MDQ6VXNlcjE3NzI5MTI=
https://api.github.com/users/airlsyn/orgs
https://api.github.com/users/airlsyn/received_events
https://api.github.com/users/airlsyn/repos
https://api.github.com/users/airlsyn/starred{/owner}{/repo}
https://api.github.com/users/airlsyn/subscriptions
User
https://api.github.com/users/airlsyn
public
MEMBER
I think `string_to_dict` is ok, and that the issue is that it gets `'/data2/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet'` as input instead of `'data/test-00000-of-00001-9c49eeff30aacaa8.parquet'`. The path should be relative to the directory being loaded by `load_dataset`
2023-04-21T14:20:58Z
https://github.com/huggingface/datasets/issues/5739#issuecomment-1517910036
https://api.github.com/repos/huggingface/datasets/issues/5739
IC_kwDODunzps5aeXgU
https://api.github.com/repos/huggingface/datasets/issues/comments/1517910036/reactions
2023-04-21T14:20:58Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1517910036
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

The regex defined here https://github.com/huggingface/datasets/blob/f2607935c4e45c70c44fcb698db0363ca7ba83d4/src/datasets/utils/py_utils.py#L158 

will cause a weird result during dataset split when data path starts with `/data`

### Steps to reproduce the bug

1.  clone dataset into local path
```
cd /data/train/raw/
git lfs clone  https://huggingface.co/datasets/deepmind/code_contests.git

ls /data/train/raw/code_contests
# README.md  data  dataset_infos.json

ls /data/train/raw/code_contests/data
# test-00000-of-00001-9c49eeff30aacaa8.parquet
# train-[0-9]+-of-[0-9]+-xx.parquet
# valid-00000-of-00001-5e672c5751f060d3.parquet

```

2. loading data from local 
```
from datasets import load_dataset
dataset = load_dataset('/data/train/raw/code_contests')

FileNotFoundError: Unable to resolve any data file that matches '['data/train/raw/code_contests/data/train-[0-9][0-9][0-9][0-9][0-9]-of-[0-9][0-9][0-9][0-9][0-9]*.*']' at /data/train/raw/code_contests with any supported extension
```

weird path `data/train/raw/code_contests/data/train-[0-9][0-9][0-9][0-9][0-9]-of-[0-9][0-9][0-9][0-9][0-9]*.*`

While dive deep into `LocalDatasetModuleFactoryWithoutScript` defined in [load.py](https://github.com/huggingface/datasets/blob/f2607935c4e45c70c44fcb698db0363ca7ba83d4/src/datasets/load.py#L627) and _get_data_files_patterns https://github.com/huggingface/datasets/blob/f2607935c4e45c70c44fcb698db0363ca7ba83d4/src/datasets/data_files.py#L228. I found the weird behavior caused by `string_to_dict`

3. check `string_to_dict`
```
p = '/data/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet'
split_pattern = 'data/{split}-[0-9][0-9][0-9][0-9][0-9]-of-[0-9][0-9][0-9][0-9][0-9]*.*'

string_to_dict(p, split_pattern)
# {'split': 'train/raw/code_contests/data/test'}

p = '/data2/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet'
string_to_dict(p, split_pattern)
{'split': 'test'}
```

go deep into string_to_dict https://github.com/huggingface/datasets/blob/f2607935c4e45c70c44fcb698db0363ca7ba83d4/src/datasets/utils/py_utils.py#L158. 

4. test the regex:
<img width="680" alt="image" src="https://user-images.githubusercontent.com/1772912/231351129-75179f01-fb9f-4f12-8fa9-0dfcc3d5f3bd.png">

<img width="679" alt="image" src="https://user-images.githubusercontent.com/1772912/231351025-009f3d83-2cf3-4e15-9ed4-6b9663dcb2ee.png">




### Expected behavior

statement in `steps to reproduce the bug`

3. check `string_to_dict`
```
p = '/data/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet'
split_pattern = 'data/{split}-[0-9][0-9][0-9][0-9][0-9]-of-[0-9][0-9][0-9][0-9][0-9]*.*'

string_to_dict(p, split_pattern)
# {'split': 'train/raw/code_contests/data/test'}

p = '/data2/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet'
string_to_dict(p, split_pattern)
{'split': 'test'}
```


### Environment info

- linux(debian)
- python 3.7
- datasets 2.8.0