Skip to main content

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)

Source distribution for babymmlu 0.0.4
File Size Uploaded
babymmlu-0.0.4.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for babymmlu 0.0.4
File Interpreter ABI Platform
babymmlu-0.0.4-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page