Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babymmlu

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babymmlu

Sample implementation of babymmlu benchmark

  • 0.0.4
  • PyPI
  • Socket score

Maintainers
1

babymmlu

Implementation of utilities to measure babymmlu benchmark (see https://huggingface.co/datasets/ai-forever/baby_mmlu).

Methods

eval_parallel

Calculates babymmlu measures.

ParameterOptionalTypeDefault valueDescription
modelNoAutoModelForCausalLMModel to evaluate.
tokenizerNoAutoTokenizerTokenizer used with model.
datasetYesDataset (Optional) or strai-forever/baby_mmluDataset to evaluate model on.
q_batch_sizeYesint10Number 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.

ParameterOptionalTypeDescription
pathNostrPath to load model and tokenizer from.
use_cudaYesboolWhether 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.

ParameterOptionalTypeDescription
model_pathNostrPath to load model from.
use_cudaYesboolWhether to load model to cuda or to cpu.
Return value

The function returns loaded model.

load_tokenizer

Loads tokenizer from the specified location.

ParameterOptionalTypeDescription
tokenizer_pathNostrPath 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)

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc