euroeval.dataset_configs
docs
package
euroeval.dataset_configs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 | """All dataset configurations used in EuroEval."""
from ..data_models import DatasetConfig
from ..languages import get_all_languages
from ..tasks import SPEED
from .danish import * # noqa: F403
from .dutch import * # noqa: F403
from .english import * # noqa: F403
from .faroese import * # noqa: F403
from .french import * # noqa: F403
from .german import * # noqa: F403
from .icelandic import * # noqa: F403
from .italian import * # noqa: F403
from .norwegian import * # noqa: F403
from .spanish import * # noqa: F403
from .swedish import * # noqa: F403
def get_all_dataset_configs() -> dict[str, DatasetConfig]:
"""Get a mapping of all the dataset configurations.
Returns:
A mapping between names of datasets and their configurations.
"""
dataset_configs = [
cfg for cfg in globals().values() if isinstance(cfg, DatasetConfig)
]
assert len(dataset_configs) == len({cfg.name for cfg in dataset_configs}), (
"There are duplicate dataset configurations. Please ensure that each dataset "
"has a unique name."
)
return {cfg.name: cfg for cfg in dataset_configs}
def get_dataset_config(dataset_name: str) -> DatasetConfig:
"""Get the dataset configuration for a dataset.
Args:
dataset_name:
The name of the dataset.
Returns:
The dataset configuration.
Raises:
ValueError:
If the dataset is not found.
"""
dataset_configs = get_all_dataset_configs()
if dataset_name not in dataset_configs:
raise ValueError(f"No dataset config found for dataset {dataset_name}.")
return dataset_configs[dataset_name]
SPEED_CONFIG = DatasetConfig(
name="speed",
pretty_name="the speed estimation benchmark",
huggingface_id="",
task=SPEED,
languages=list(get_all_languages().values()),
)
|