<commit_before>from dataclasses import dataclass, field
from typing import Any, List, Optional

from typing_extensions import TypeAlias


ModelIndexSet: TypeAlias = "List[ModelIndex]"


@dataclass
class ModelIndex:
    name: str
    results: "List[SingleResult]"


@dataclass
class SingleMetric:
    type: str
    """
    Example: wer. Use metric id from https://hf.co/metrics
    """

    value: Any
    """
    Example: 20.0 or "20.0 ± 1.2"
    """

    name: Optional[str] = None
    """
    Example: Test WER
    """

    config: Optional[str] = None
    """
    The name of the metric configuration used in `load_metric()`. Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`. \
    See the `datasets` docs for more info: https://huggingface.co/docs/datasets/v2.1.0/en/loading#load-configurations
    """

    args: Any = field(default=None)
    """
    The arguments passed during `Metric.compute()`. Example for `bleu`: max_order: 4
    """

    verified: Optional[bool] = False
    """
    If true, indicates that evaluation was generated by Hugging Face (vs. self-reported).
    """


@dataclass
class SingleResultTask:
    type: str
    """
    Example: automatic-speech-recognition Use task id from
    https://github.com/huggingface/huggingface_hub/blob/main/js/src/lib/int
    erfaces/Types.ts
    """

    name: Optional[str] = None
    """
    Example: Speech Recognition
    """


@dataclass
class SingleResultDataset:
    """
    This will switch to required at some point. in any case, we need them to
    link to PWC
    """

    name: str
    """
    Example: Common Voice (French). A pretty name for the dataset.
    """

    type: str
    """
    Example: common_voice. Use dataset id from https://hf.co/datasets
    """

    config: Optional[str] = None
    """
    Example: fr. The name of the dataset configuration used in `load_dataset()`
    """

    split: Optional[str] = None
    """
    Example: test.
    """

    revision: Optional[str] = None
    """
    Example: 5503434ddd753f426f4b38109466949a1217c2bb.
    """

    args: Any = None
    """
    Example: zh-CN
    """


@dataclass
class SingleResult:
    task: "SingleResultTask"
    dataset: "Optional[SingleResultDataset]"
    metrics: "List[SingleMetric]"
    """
    This will switch to required at some point. in any case, we need them to
    link to PWC
    """
<commit_msg>Followup to #901: Tweak `repocard_types.py` (#931)<commit_after>from dataclasses import dataclass, field
from typing import Any, List, Optional

from typing_extensions import TypeAlias


ModelIndexSet: TypeAlias = "List[ModelIndex]"


@dataclass
class ModelIndex:
    name: str
    results: "List[SingleResult]"


@dataclass
class SingleMetric:
    type: str
    """
    Example: wer. Use metric id from https://hf.co/metrics
    """

    value: Any
    """
    Example: 20.0 or "20.0 ± 1.2"
    """

    name: Optional[str] = None
    """
    Example: Test WER
    """

    config: Optional[str] = None
    """
    The name of the metric configuration used in `load_metric()`. Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`. \
    See the `datasets` docs for more info: https://huggingface.co/docs/datasets/v2.1.0/en/loading#load-configurations
    """

    args: Any = field(default=None)
    """
    The arguments passed during `Metric.compute()`. Example for `bleu`: max_order: 4
    """

    verified: Optional[bool] = None
    """
    If true, indicates that evaluation was generated by Hugging Face (vs. self-reported).
    """


@dataclass
class SingleResultTask:
    type: str
    """
    Example: automatic-speech-recognition Use task id from
    hhttps://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Types.ts
    """

    name: Optional[str] = None
    """
    Example: Speech Recognition
    """


@dataclass
class SingleResultDataset:
    name: str
    """
    Example: Common Voice (French). A pretty name for the dataset.
    """

    type: str
    """
    Example: common_voice. Use dataset id from https://hf.co/datasets
    """

    config: Optional[str] = None
    """
    Example: fr. The name of the dataset configuration used in `load_dataset()`
    """

    split: Optional[str] = None
    """
    Example: test.
    """

    revision: Optional[str] = None
    """
    Example: 5503434ddd753f426f4b38109466949a1217c2bb.
    """

    args: Any = None
    """
    Optional. Additional arguments to `load_dataset()`. Example for wikipedia: { language: "en" }
    """


@dataclass
class SingleResult:
    task: "SingleResultTask"
    dataset: "Optional[SingleResultDataset]"
    """
    This will switch to required at some point. in any case, we need them to
    link to PWC
    """
    metrics: "List[SingleMetric]"

{'fraction_non_alphanumeric': 0.12431865828092244, 'fraction_numerical': 0.021383647798742137, 'mean_word_length': 2.8229166666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6630608', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1487, 'n_words': 436}