Evaluate is a Hugging Face community-driven open-source library providing a standardized interface for accessing and comparing over 80+ evaluation metrics, datasets, and models. It simplifies the process of evaluating machine learning models, offering a consistent API for various tasks. The library is actively maintained with frequent patch releases, currently at version 0.4.6.
pip install evaluateVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load a metric (e.g., 'accuracy') using `evaluate.load()` and then compute its results with sample predictions and references. While 'accuracy' doesn't require authentication, the commented section illustrates how an `HF_TOKEN` environment variable would be used with the `token` parameter for metrics or evaluators requiring access to private resources on the Hugging Face Hub. Remember that many metrics require specific input formats (e.g., text for BERTScore) and may need additional `pip install` commands for their dependencies.
Update your code to use `token='your_huggingface_token'` instead of `use_auth_token=True` or `use_auth_token='your_token'` when loading metrics or interacting with the Hub.
Ensure `huggingface_hub` is updated to version `1.0.0` or higher to maintain compatibility and access the latest authentication mechanisms. Older `huggingface_hub` versions might cause issues with token loading.
When `evaluate.load()` reports a `ModuleNotFoundError`, check the metric's documentation on the Hugging Face Hub to identify and install the required extra packages (e.g., `pip install transformers` for 'perplexity' or `pip install evaluate[full]` for a broad set of common dependencies).
If you encounter unexpected results, try restarting your environment or manually managing the cache (`evaluate.config.set_caching_path()`, `evaluate.config.HF_EVALUATE_OFFLINE`, `evaluate.config.set_verbosity()`). Refer to the official documentation for advanced cache management options if needed.