-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mmlu eval for llama 3.2 pretrained models
- Loading branch information
Showing
5 changed files
with
84 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 9 additions & 8 deletions
17
tools/benchmarks/llm_eval_harness/meta_eval/eval_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tools/benchmarks/llm_eval_harness/meta_eval/meta_template/mmlu/mmlu.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
task: meta_mmlu | ||
dataset_path: meta-llama/Llama-3.1-8B-evals | ||
dataset_name: Llama-3.1-8B-evals__mmlu__details | ||
test_split: latest | ||
output_type: multiple_choice | ||
process_docs: !function utils.process_docs | ||
doc_to_text: !function utils.doc_to_text | ||
doc_to_target: !function utils.doc_to_target | ||
doc_to_choice: ["A", "B", "C", "D"] | ||
# 5-shot prompts are already included in the dataset | ||
# So no need to generate | ||
num_fewshot: 0 | ||
metadata: | ||
version: 1.0 |
31 changes: 31 additions & 0 deletions
31
tools/benchmarks/llm_eval_harness/meta_eval/meta_template/mmlu/utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import string | ||
import datasets | ||
|
||
def doc_to_text(doc: dict) -> str: | ||
# Strip out the last two characters, which is a space and the answer | ||
# E.g., "Answer: B" -> "Answer:" | ||
return doc["input_final_prompts"][0][:-2] | ||
|
||
def process_docs(dataset: datasets.Dataset) -> datasets.Dataset: | ||
def _process_doc(doc: dict) -> dict: | ||
# input_correct_responses is in format of: "Answer: B" | ||
answer = doc["input_correct_responses"][0] | ||
# Indexes are always A: 0, B: 1, C: 2, D: 3 | ||
answer_index = string.ascii_uppercase.index(answer[-1]) | ||
|
||
out_doc = { | ||
"problem": doc["input_question"], | ||
# The answer is the index of the correct response (0-indexed) | ||
"gold": answer_index, | ||
} | ||
return out_doc | ||
|
||
dataset = dataset.select_columns( | ||
["input_question", "input_correct_responses", "input_final_prompts", "is_correct", "input_question_hash", | ||
"input_choice_list"]) | ||
dataset = dataset.rename_column("is_correct", "previously_is_correct") | ||
dataset = dataset.map(_process_doc) | ||
return dataset.map(_process_doc) | ||
|
||
def doc_to_target(doc: dict) -> str: | ||
return doc["gold"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters