Evaluation of pretrained language models on mono- or multilingual language tasks.
Project description
Evaluation of pretrained language models on mono- or multilingual language tasks.
Maintainers
- Dan Saattrup Nielsen (@saattrupdan, dan.nielsen@alexandra.dk)
- Kenneth Enevoldsen (@KennethEnevoldsen, kenneth.enevoldsen@cas.au.dk)
Installation
To install the package simply write the following command in your favorite terminal:
$ pip install scandeval
Quickstart
Benchmarking from the Command Line
The easiest way to benchmark pretrained models is via the command line interface. After having installed the package, you can benchmark your favorite model like so:
$ scandeval --model-id <model-id>
Here model_id
is the HuggingFace model ID, which can be found on the HuggingFace
Hub. By default this will benchmark the model on all
the datasets eligible. If you want to benchmark on a specific dataset, this can be done
via the --dataset
flag. This will for instance evaluate the model on the
AngryTweets
dataset:
$ scandeval --model-id <model-id> --dataset angry-tweets
We can also separate by language. To benchmark all Danish models on all Danish
datasets, say, this can be done using the language
tag, like so:
$ scandeval --language da
Multiple models, datasets and/or languages can be specified by just attaching multiple arguments. Here is an example with two models:
$ scandeval --model-id <model-id1> --model-id <model-id2> --dataset angry-tweets
The specific model version to use can also be added after the suffix '@':
$ scandeval --model-id <model-id>@<commit>
It can be a branch name, a tag name, or a commit id. It defaults to 'main' for latest.
See all the arguments and options available for the scandeval
command by typing
$ scandeval --help
Benchmarking from a Script
In a script, the syntax is similar to the command line interface. You simply initialise
an object of the Benchmarker
class, and call this benchmark object with your favorite
models and/or datasets:
>>> from scandeval import Benchmarker
>>> benchmark = Benchmarker()
>>> benchmark('<model-id>')
To benchmark on a specific dataset, you simply specify the second argument, shown here
with the AngryTweets
dataset again:
>>> benchmark('<model_id>', 'angry-tweets')
If you want to benchmark a subset of all the models on the Hugging Face Hub, you can
specify several parameters in the Benchmarker
initializer to narrow down the list of
models to the ones you care about. As a simple example, the following would benchmark
all the Nynorsk models on Nynorsk datasets:
>>> benchmark = Benchmarker(language='nn')
>>> benchmark()
Citing ScandEval
If you want to cite the framework then feel free to use this:
@inproceedings{nielsen2023scandeval,
title={ScandEval: A Benchmark for Scandinavian Natural Language Processing},
author={Nielsen, Dan Saattrup},
booktitle={The 24rd Nordic Conference on Computational Linguistics},
year={2023}
}
Remarks
The image used in the logo has been created by the amazing Scandinavia and the World team. Go check them out!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for scandeval-10.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12feb137c1f46db41f26ea22873b16592f9973629b4d30a2791bbbbeb8ad3266 |
|
MD5 | f3ed9e46b613c58013d7cb01f0484285 |
|
BLAKE2b-256 | cd4af0eaf37f6a2a971539c8d75dbf53a0644eb04bd78494c147bcff8d81e9c4 |