LocalDatasetModuleFactoryWithoutScript extracts invalid builder name
CONTRIBUTOR
Ok, so
```
os.path.basename("/home/user/")
```
gives `''` while 
```
os.path.basename("/home/user")
```
gives `user`. 
The code should check if the last char is a slash.

2022-05-24T18:05:14Z
https://github.com/huggingface/datasets/issues/4399#issuecomment-1136274216
https://api.github.com/repos/huggingface/datasets/issues/4399
IC_kwDODunzps5Duiso
https://api.github.com/repos/huggingface/datasets/issues/comments/1136274216/reactions
2022-05-24T18:05:32Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1136274216
https://avatars.githubusercontent.com/u/40543?v=4
https://api.github.com/users/apohllo/events{/privacy}
https://api.github.com/users/apohllo/followers
https://api.github.com/users/apohllo/following{/other_user}
https://api.github.com/users/apohllo/gists{/gist_id}
https://github.com/apohllo
apohllo
MDQ6VXNlcjQwNTQz
https://api.github.com/users/apohllo/orgs
https://api.github.com/users/apohllo/received_events
https://api.github.com/users/apohllo/repos
https://api.github.com/users/apohllo/starred{/owner}{/repo}
https://api.github.com/users/apohllo/subscriptions
User
https://api.github.com/users/apohllo
public
CONTRIBUTOR
The fix is:
```
"name": os.path.basename(self.path[:-1] if self.path[-1] == "/" else self.path)
```
2022-05-24T18:13:56Z
https://github.com/huggingface/datasets/issues/4399#issuecomment-1136282838
https://api.github.com/repos/huggingface/datasets/issues/4399
IC_kwDODunzps5DukzW
https://api.github.com/repos/huggingface/datasets/issues/comments/1136282838/reactions
2022-05-24T18:13:56Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1136282838
https://avatars.githubusercontent.com/u/40543?v=4
https://api.github.com/users/apohllo/events{/privacy}
https://api.github.com/users/apohllo/followers
https://api.github.com/users/apohllo/following{/other_user}
https://api.github.com/users/apohllo/gists{/gist_id}
https://github.com/apohllo
apohllo
MDQ6VXNlcjQwNTQz
https://api.github.com/users/apohllo/orgs
https://api.github.com/users/apohllo/received_events
https://api.github.com/users/apohllo/repos
https://api.github.com/users/apohllo/starred{/owner}{/repo}
https://api.github.com/users/apohllo/subscriptions
User
https://api.github.com/users/apohllo
public
NONE
I came through the same issue , just removing the last slash in the dataset path fixed it for me, may be this repo moderators could accept this as an accepted answer atleast if this could not be integrated

> The fix is:
> 
> ```
> "name": os.path.basename(self.path[:-1] if self.path[-1] == "/" else self.path)
> ```

@apohllo consider making a pull request on this 

Thanks for the amazing contributions from huggingface people !!

2022-08-16T13:25:44Z
https://github.com/huggingface/datasets/issues/4399#issuecomment-1216636104
https://api.github.com/repos/huggingface/datasets/issues/4399
IC_kwDODunzps5IhGTI
https://api.github.com/repos/huggingface/datasets/issues/comments/1216636104/reactions
2022-08-16T13:25:44Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1216636104
https://avatars.githubusercontent.com/u/26043350?v=4
https://api.github.com/users/TheSeriousProgrammer/events{/privacy}
https://api.github.com/users/TheSeriousProgrammer/followers
https://api.github.com/users/TheSeriousProgrammer/following{/other_user}
https://api.github.com/users/TheSeriousProgrammer/gists{/gist_id}
https://github.com/TheSeriousProgrammer
TheSeriousProgrammer
MDQ6VXNlcjI2MDQzMzUw
https://api.github.com/users/TheSeriousProgrammer/orgs
https://api.github.com/users/TheSeriousProgrammer/received_events
https://api.github.com/users/TheSeriousProgrammer/repos
https://api.github.com/users/TheSeriousProgrammer/starred{/owner}{/repo}
https://api.github.com/users/TheSeriousProgrammer/subscriptions
User
https://api.github.com/users/TheSeriousProgrammer
public
COLLABORATOR
@apohllo Would you be interested in submitting a PR with the fix?
2022-09-08T17:11:10Z
https://github.com/huggingface/datasets/issues/4399#issuecomment-1240991424
https://api.github.com/repos/huggingface/datasets/issues/4399
IC_kwDODunzps5J-AbA
https://api.github.com/repos/huggingface/datasets/issues/comments/1240991424/reactions
2022-09-08T17:11:10Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1240991424
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 here we go:

https://github.com/huggingface/datasets/pull/4967

TBH I haven't tested it yet, but should work, since this is a basic change.
2022-09-11T23:10:35Z
https://github.com/huggingface/datasets/issues/4399#issuecomment-1243062639
https://api.github.com/repos/huggingface/datasets/issues/4399
IC_kwDODunzps5KF6Fv
https://api.github.com/repos/huggingface/datasets/issues/comments/1243062639/reactions
2022-09-11T23:10:35Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1243062639
https://avatars.githubusercontent.com/u/40543?v=4
https://api.github.com/users/apohllo/events{/privacy}
https://api.github.com/users/apohllo/followers
https://api.github.com/users/apohllo/following{/other_user}
https://api.github.com/users/apohllo/gists{/gist_id}
https://github.com/apohllo
apohllo
MDQ6VXNlcjQwNTQz
https://api.github.com/users/apohllo/orgs
https://api.github.com/users/apohllo/received_events
https://api.github.com/users/apohllo/repos
https://api.github.com/users/apohllo/starred{/owner}{/repo}
https://api.github.com/users/apohllo/subscriptions
User
https://api.github.com/users/apohllo
public
## Describe the bug
Trying to load a local dataset raises an error indicating that the config builder has to have a name.
No error should be reported, since the call is completly valid.

## Steps to reproduce the bug
```python
load_dataset("./data/some-dataset/", name="some-name")
```

## Expected results
The dataset should be loaded.

## Actual results
```
Traceback (most recent call last):
  File "train_lquad.py", line 19, in <module>
    load(tokenize_target_function, tokenize_target_function, {}, tokenizer)
  File "train_lquad.py", line 14, in load
    dataset = load_dataset("./data/lquad/", name="lquad")
  File "/net/pr2/scratch/people/plgapohl/python-3.8.6/lib/python3.8/site-packages/datasets/load.py", line 1708, in load_dataset                                                                           
    builder_instance = load_dataset_builder(
  File "/net/pr2/scratch/people/plgapohl/python-3.8.6/lib/python3.8/site-packages/datasets/load.py", line 1560, in load_dataset_builder                                                                   
    builder_instance: DatasetBuilder = builder_cls(
  File "/net/pr2/scratch/people/plgapohl/python-3.8.6/lib/python3.8/site-packages/datasets/builder.py", line 269, in __init__                                                                             
    self.config, self.config_id = self._create_builder_config(
  File "/net/pr2/scratch/people/plgapohl/python-3.8.6/lib/python3.8/site-packages/datasets/builder.py", line 403, in _create_builder_config                                                               
    raise ValueError(f"BuilderConfig must have a name, got {builder_config.name}")
ValueError: BuilderConfig must have a name, got
```

## Environment info
- `datasets` version: 2.2.2
- Platform: Linux-4.18.0-348.20.1.el8_5.x86_64-x86_64-with-glibc2.2.5
- Python version: 3.8.6
- PyArrow version: 8.0.0
- Pandas version: 1.4.2

The error is probably in line 795 in load.py:

```
 builder_kwargs = {                        
     "hash": hash,
     "data_files": data_files,
     "name": os.path.basename(self.path),
     "base_path": self.path,
     **builder_kwargs,
 }
```

`os.path.basename` for a directory returns an empty string, rather than the name of the directory.
