Audiofolder creates empty Dataset if files same level as metadata
COLLABORATOR
Hi! Unfortunately, I can't reproduce this behavior. Instead, I get `ValueError: audio at 2063_fe9936e7-62b2-4e62-a276-acbd344480ce_1.wav doesn't have metadata in /audio-data/metadata.csv`, which can be fixed by removing the `./` from the file name.

(Link to a Colab that tries to reproduce this behavior: https://colab.research.google.com/drive/1IhQzULYi0Van1xLrN_SddBX1JF7mLZZK?usp=sharing)
2022-10-17T15:17:56Z
https://github.com/huggingface/datasets/issues/5046#issuecomment-1281036746
https://api.github.com/repos/huggingface/datasets/issues/5046
IC_kwDODunzps5MWxHK
https://api.github.com/repos/huggingface/datasets/issues/comments/1281036746/reactions
2022-10-17T15:17:56Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1281036746
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
I think we can make the file name matching part more robust by replacing `file_name` with `os.path.normpath(file_name)`, to ignore "./" among other things, in these two places:
* https://github.com/huggingface/datasets/blob/85cd129bde605cd9acacdff0d065fc02e39e09b1/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py#L319
* https://github.com/huggingface/datasets/blob/85cd129bde605cd9acacdff0d065fc02e39e09b1/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py#L388
2022-10-17T15:24:00Z
https://github.com/huggingface/datasets/issues/5046#issuecomment-1281047722
https://api.github.com/repos/huggingface/datasets/issues/5046
IC_kwDODunzps5MWzyq
https://api.github.com/repos/huggingface/datasets/issues/comments/1281047722/reactions
2022-10-17T15:24:00Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1281047722
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
CONTRIBUTOR
@mariosasko Some tests failed (see my PR). Any thoughts on that?
2022-10-18T08:36:45Z
https://github.com/huggingface/datasets/issues/5046#issuecomment-1282018604
https://api.github.com/repos/huggingface/datasets/issues/5046
IC_kwDODunzps5Mag0s
https://api.github.com/repos/huggingface/datasets/issues/comments/1282018604/reactions
2022-10-18T08:36:45Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1282018604
https://avatars.githubusercontent.com/u/9295277?v=4
https://api.github.com/users/riccardobucco/events{/privacy}
https://api.github.com/users/riccardobucco/followers
https://api.github.com/users/riccardobucco/following{/other_user}
https://api.github.com/users/riccardobucco/gists{/gist_id}
https://github.com/riccardobucco
riccardobucco
MDQ6VXNlcjkyOTUyNzc=
https://api.github.com/users/riccardobucco/orgs
https://api.github.com/users/riccardobucco/received_events
https://api.github.com/users/riccardobucco/repos
https://api.github.com/users/riccardobucco/starred{/owner}{/repo}
https://api.github.com/users/riccardobucco/subscriptions
User
https://api.github.com/users/riccardobucco
public
COLLABORATOR
Yes, I mentioned the solution in my review.
2022-10-18T14:34:53Z
https://github.com/huggingface/datasets/issues/5046#issuecomment-1282497562
https://api.github.com/repos/huggingface/datasets/issues/5046
IC_kwDODunzps5McVwa
https://api.github.com/repos/huggingface/datasets/issues/comments/1282497562/reactions
2022-10-18T14:34:53Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1282497562
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
NONE
I realized what I was doing wrong.

The documentation puts the files in a subfolder.
Once I have done that, it worked.

But l agree that this should be handled better if possible.
2022-10-18T16:27:56Z
https://github.com/huggingface/datasets/issues/5046#issuecomment-1282667346
https://api.github.com/repos/huggingface/datasets/issues/5046
IC_kwDODunzps5Mc_NS
https://api.github.com/repos/huggingface/datasets/issues/comments/1282667346/reactions
2022-10-18T16:27:56Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1282667346
https://avatars.githubusercontent.com/u/577139?v=4
https://api.github.com/users/msis/events{/privacy}
https://api.github.com/users/msis/followers
https://api.github.com/users/msis/following{/other_user}
https://api.github.com/users/msis/gists{/gist_id}
https://github.com/msis
msis
MDQ6VXNlcjU3NzEzOQ==
https://api.github.com/users/msis/orgs
https://api.github.com/users/msis/received_events
https://api.github.com/users/msis/repos
https://api.github.com/users/msis/starred{/owner}{/repo}
https://api.github.com/users/msis/subscriptions
User
https://api.github.com/users/msis
public
## Describe the bug
When audio files are at the same level as the metadata (`metadata.csv` or `metadata.jsonl` ), the `load_dataset` returns a `DatasetDict` with no rows but the correct columns.

https://github.com/huggingface/datasets/blob/1ea4d091b7a4b83a85b2eeb8df65115d39af3766/docs/source/audio_dataset.mdx?plain=1#L88

## Steps to reproduce the bug
`metadata.csv`:
```csv
file_name,duration,transcription
./2063_fe9936e7-62b2-4e62-a276-acbd344480ce_1.wav,10.768,hello
```


```python
>>> audio_dataset = load_dataset("audiofolder", data_dir="/audio-data/")
>>> audio_dataset
DatasetDict({
    train: Dataset({
        features: ['audio', 'duration', 'transcription'],
        num_rows: 0
    })
    validation: Dataset({
        features: ['audio', 'duration', 'transcription'],
        num_rows: 0
    })
})
```

I've tried, with no success,:
- setting `split` to something else so I don't get a `DatasetDict`,
- removing the `./`,
- using `.jsonl`.


## Expected results
```
 Dataset({
        features: ['audio', 'duration', 'transcription'],
        num_rows: 1
})
```

## Actual results
```
DatasetDict({
    train: Dataset({
        features: ['audio', 'duration', 'transcription'],
        num_rows: 0
    })
    validation: Dataset({
        features: ['audio', 'duration', 'transcription'],
        num_rows: 0
    })
})
```

## Environment info
- `datasets` version: 2.5.1
- Platform: Linux-5.13.0-1025-aws-x86_64-with-glibc2.29
- Python version: 3.8.10
- PyArrow version: 9.0.0
- Pandas version: 1.5.0

