Issue: default config name doesn't work when config kwargs are specified.
State: closed
Author: npuichigo

### Describe the bug

https://github.com/huggingface/datasets/blob/12cfc1196e62847e2e8239fbd727a02cbc86ddec/src/datasets/builder.py#L518-L522

If `config_name` is `None`, `DEFAULT_CONFIG_NAME` should be select. But once users pass `config_kwargs` to their customized `BuilderConfig`, the logic is ignored, and dataset cannot select the default config from multiple configs.

### Steps to reproduce the bug

```python
import datasets

datasets.load_dataset('/dataset/with/multiple/config'')  # Ok
datasets.load_dataset('/dataset/with/multiple/config', some_field_in_config='some')  # Err
```

### Expected behavior

Default config behavior should be consistent.

### Environment info

- `datasets` version: 2.14.3
- Platform: Linux-5.15.0-76-generic-x86_64-with-glibc2.17
- Python version: 3.8.15
- Huggingface_hub version: 0.16.4
- PyArrow version: 12.0.1
- Pandas version: 1.5.3

Comments:
@lhoestq 

What should be the behavior in this case ? Should it override the default config with the added parameter ?

I know why it should be treated as a new config if overriding parameters are passed. But in some case, I just pass in some common fields like `data_dir`.

For example, I want to extend the FolderBasedBuilder as a multi-config version, the `data_dir` or `data_files` are always passed by user and should not be considered as overriding the default config. In current state, I cannot leverage the feature of default config since passing `data_dir` will disable the default config.

Thinking more about it I think the current behavior is the right one.

Provided parameters should be passed to instantiate a new BuilderConfig.

What's the error you're getting ?

For example, this works to use default config with name '_all_':
```python
datasets.load_dataset("indonesian-nlp/librivox-indonesia", split="train")
```
while this failed to use default config
```python
datasets.load_dataset("indonesian-nlp/librivox-indonesia", split="train", data_dir='.')
```
After manually specifying it, it works again.
```python
datasets.load_dataset("indonesian-nlp/librivox-indonesia", "_all_", split="train", data_dir='.')
```

@lhoestq 

It should work if you explicitly ask for the config you want to override

```python
load_dataset('/dataset/with/multiple/config', 'name_of_the_default_config', some_field_in_config='some')
```

Alternatively you can have a BuilderConfig class that when instantiated returns a config with the right default values. In this case this code would instantiate this config with the default values except for the parameter to override:

```python
load_dataset('/dataset/with/multiple/config', some_field_in_config='some')
```

@lhoestq Yes. But it doesn't work for me.

Here's my dataset for example.
```
lass MyDatasetConfig(datasets.BuilderConfig):
    def __init__(self, name: str, version: str, **kwargs):
        self.option1 = kwargs.pop("option1", False)
        self.option2 = kwargs.pop("option2", 5)

        super().__init__(
            name=name,
            version=datasets.Version(version),
            **kwargs)


class MyDataset(datasets.GeneratorBasedBuilder):
    DEFAULT_CONFIG_NAME = "v1"

    BUILDER_CONFIGS = [
        UnifiedTtsDatasetConfig(
            name="v1",
            version="1.0.0",
            description="Initial version of the dataset"
        ),
    ]

    def _info(self) -> DatasetInfo:
        _ = self.option1
        ....
```

Here it's okay to use `load_dataset('my_dataset.py')` for loading the default config `v1`.

But if I want to override the default values in config with `load_dataset('my_dataset.py', option2=3)`, it failed to find my default config `v1.

Unless I use `load_dataset('my_dataset.py', 'v1', option2=3)`

So according to your advice, how can I modify my dataset to be able to override default config without manually specifying it.

What's the error ? It should try to instantiate `MyDatasetConfig` with `option2=3`

@lhoestq The error is
```
def _info(self) -> DatasetInfo:
        _ = self.option1  <-
        ....
AttributeError: 'BuilderConfig' object has no attribute 'option1'
```
which seems to find another unknown config.

You can try this line `datasets.load_dataset("indonesian-nlp/librivox-indonesia", split="train", data_dir='.')`, it's a multi-config dataset on HF hub and the error is the same.

My insights:
https://github.com/huggingface/datasets/blob/12cfc1196e62847e2e8239fbd727a02cbc86ddec/src/datasets/builder.py#L518
if `config_kwargs` is provided here, the if branch is skipped.

I see, you just have to set this class attribute to your builder class :)

```python
BUILDER_CONFIG_CLASS = MyDatasetConfig
```

So what does this attribute do? In most cases it's not used and the [documents for multi-config dataset](https://huggingface.co/docs/datasets/main/en/image_dataset#multiple-configurations) never mentioned that.

It tells which builder config class to instantiate if additional config parameters are passed to load_dataset

@lhoestq maybe we can enhance the document to say something about the common attributes of `DatasetBuilder`

Ah indeed it's missing in the docs, thanks for reporting. I'm opening a PR