babymmlu
Implementation of utilities to measure babymmlu benchmark (see https://huggingface.co/datasets/ai-forever/baby_mmlu).
Methods
eval_parallel
Calculates babymmlu measures.
| Parameter | Optional | Type | Default value | Description |
|---|---|---|---|---|
| model | No | AutoModelForCausalLM | Model to evaluate. | |
| tokenizer | No | AutoTokenizer | Tokenizer used with model. | |
| dataset | Yes | Dataset (Optional) or str | ai-forever/baby_mmlu | Dataset to evaluate model on. |
| q_batch_size | Yes | int | 10 | Number of questions to process in parallel. |
Return value
The function returns a tuple with 3 elements: babymmlu measured be crossentropy-per-char, crossentropy-per-token and crossentropy-total.
load_model_and_tokenizer
Loads model and tokenizer from the same location.
| Parameter | Optional | Type | Description |
|---|---|---|---|
| path | No | str | Path to load model and tokenizer from. |
| use_cuda | Yes | bool | Whether to load model to cuda or to cpu. |
Return value
The function returns a tuple with 2 elements:
- model
- tokenizer
load_model
Loads model from the specified location.
| Parameter | Optional | Type | Description |
|---|---|---|---|
| model_path | No | str | Path to load model from. |
| use_cuda | Yes | bool | Whether to load model to cuda or to cpu. |
Return value
The function returns loaded model.
load_tokenizer
Loads tokenizer from the specified location.
| Parameter | Optional | Type | Description |
|---|---|---|---|
| tokenizer_path | No | str | Path to load tokenizer from. |
Return value
The function returns loaded tokenizer.
Example
import babymmlu
model, tokenizer = babymmlu.load_model_and_tokenizer('ai-forever/rugpt3small_based_on_gpt2')
result = babymmlu.eval_parallel(model, tokenizer)
print('babymmlu crossentropy-per-char, crossentropy-per-token and crossentropy-total', result)
Metadata
Release files for babymmlu 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| babymmlu-0.0.4.tar.gz | 6.0 kB | Without provenance | Details for babymmlu-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| babymmlu-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for babymmlu-0.0.4-py3-none-any.whl |
Total release size: 11.5 kB
Release files / babymmlu-0.0.4.tar.gz
| Download URL | babymmlu-0.0.4.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37211de6bb9de73bbd95cb3b67ad41097d2625340055dc6ac9092aaf824b560b
|
|
BLAKE2b-256 checksum How to use checksums |
b40dfe713bd103a63468e387c86ae28c2e72ef35f4417daa58afbe88260af9dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.5
|
Release files / babymmlu-0.0.4-py3-none-any.whl
| Download URL | babymmlu-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fdcee562b27d38e0ebd70ad45be5ed612af0abe47f9a326da2bd867d1f05bde
|
|
BLAKE2b-256 checksum How to use checksums |
d9d1d367027a97c565df89eb83c63ae4816d981c7d5add8dafbabfcfa136fcb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.5
|
Security for babymmlu 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.