Load a [`~evaluate.EvaluationModule`]. Args: path (`str`): Path to the evaluation processing script with the evaluation builder. Can be either: - a local path to processing script or the directory containing the script (if the script has the same name as the
(
path: str,
config_name: Optional[str] = None,
module_type: Optional[str] = None,
process_id: int = 0,
num_process: int = 1,
cache_dir: Optional[str] = None,
experiment_id: Optional[str] = None,
keep_in_memory: bool = False,
download_config: Optional[DownloadConfig] = None,
download_mode: Optional[DownloadMode] = None,
revision: Optional[Union[str, Version]] = None,
**init_kwargs,
)
| 687 | |
| 688 | |
| 689 | def load( |
| 690 | path: str, |
| 691 | config_name: Optional[str] = None, |
| 692 | module_type: Optional[str] = None, |
| 693 | process_id: int = 0, |
| 694 | num_process: int = 1, |
| 695 | cache_dir: Optional[str] = None, |
| 696 | experiment_id: Optional[str] = None, |
| 697 | keep_in_memory: bool = False, |
| 698 | download_config: Optional[DownloadConfig] = None, |
| 699 | download_mode: Optional[DownloadMode] = None, |
| 700 | revision: Optional[Union[str, Version]] = None, |
| 701 | **init_kwargs, |
| 702 | ) -> EvaluationModule: |
| 703 | """Load a [`~evaluate.EvaluationModule`]. |
| 704 | |
| 705 | Args: |
| 706 | |
| 707 | path (`str`): |
| 708 | Path to the evaluation processing script with the evaluation builder. Can be either: |
| 709 | - a local path to processing script or the directory containing the script (if the script has the same name as the directory), |
| 710 | e.g. `'./metrics/rouge'` or `'./metrics/rouge/rouge.py'` |
| 711 | - a evaluation module identifier on the HuggingFace evaluate repo e.g. `'rouge'` or `'bleu'` that are in either `'metrics/'`, |
| 712 | `'comparisons/'`, or `'measurements/'` depending on the provided `module_type` |
| 713 | config_name (`str`, *optional*): |
| 714 | Selecting a configuration for the metric (e.g. the GLUE metric has a configuration for each subset). |
| 715 | module_type (`str`, default `'metric'`): |
| 716 | Type of evaluation module, can be one of `'metric'`, `'comparison'`, or `'measurement'`. |
| 717 | process_id (`int`, *optional*): |
| 718 | For distributed evaluation: id of the process. |
| 719 | num_process (`int`, *optional*): |
| 720 | For distributed evaluation: total number of processes. |
| 721 | cache_dir (`str`, *optional*): |
| 722 | Path to store the temporary predictions and references (default to `~/.cache/huggingface/evaluate/`). |
| 723 | experiment_id (`str`): |
| 724 | A specific experiment id. This is used if several distributed evaluations share the same file system. |
| 725 | This is useful to compute metrics in distributed setups (in particular non-additive metrics like F1). |
| 726 | keep_in_memory (`bool`): |
| 727 | Whether to store the temporary results in memory (defaults to `False`). |
| 728 | download_config ([`~evaluate.DownloadConfig`], *optional*): |
| 729 | Specific download configuration parameters. |
| 730 | download_mode ([`DownloadMode`], defaults to `REUSE_DATASET_IF_EXISTS`): |
| 731 | Download/generate mode. |
| 732 | revision (`Union[str, evaluate.Version]`, *optional*): |
| 733 | If specified, the module will be loaded from the datasets repository |
| 734 | at this version. By default it is set to the local version of the lib. Specifying a version that is different from |
| 735 | your local version of the lib might cause compatibility issues. |
| 736 | |
| 737 | Returns: |
| 738 | [`evaluate.EvaluationModule`] |
| 739 | |
| 740 | Example: |
| 741 | |
| 742 | ```py |
| 743 | >>> from evaluate import load |
| 744 | >>> accuracy = load("accuracy") |
| 745 | ``` |
| 746 | """ |
searching dependent graphs…