Skip to content

Commit

Permalink
Document BUILDER_CONFIG_CLASS (huggingface#6166)
Browse files Browse the repository at this point in the history
document BUILDER_CONFIG_CLASS
  • Loading branch information
lhoestq authored Aug 23, 2023
1 parent 9d79322 commit 4566827
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/source/dataset_script.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ class SuperGlueConfig(datasets.BuilderConfig):
class SuperGlue(datasets.GeneratorBasedBuilder):
"""The SuperGLUE benchmark."""

BUILDER_CONFIG_CLASS = SuperGlueConfig

BUILDER_CONFIGS = [
SuperGlueConfig(
name="boolq",
Expand Down Expand Up @@ -173,6 +175,13 @@ class SuperGlue(datasets.GeneratorBasedBuilder):
>>> dataset = load_dataset('super_glue', 'boolq')
```

Additionally, users can instantiate a custom builder configuration by passing the builder configuration arguments to [`load_dataset`]:

```py
>>> from datasets import load_dataset
>>> dataset = load_dataset('super_glue', data_url="https://custom_url")
```

### Default configurations

Users must specify a configuration name when they load a dataset with multiple configurations. Otherwise, 🤗 Datasets will raise a `ValueError`, and prompt the user to select a configuration name. You can avoid this by setting a default dataset configuration with the `DEFAULT_CONFIG_NAME` attribute:
Expand Down

0 comments on commit 4566827

Please sign in to comment.