-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
```bash | ||
source $STORAGE_DIR/llama-recipes/.venv/bin/activate | ||
``` | ||
|
||
```bash | ||
huggingface-cli login | ||
``` | ||
|
||
```bash | ||
python prepare_meta_eval.py --config_path ./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.2-1B-evals | ||
dataset_name: Llama-3.2-1B-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 do not need to generate them | ||
num_fewshot: 0 | ||
metadata: | ||
version: 1.0 |
30 changes: 30 additions & 0 deletions
30
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,30 @@ | ||
import string | ||
import datasets | ||
|
||
def doc_to_text(doc: dict) -> str: | ||
# Strip out the last two characters, which is a space and the answer | ||
return doc["input_final_prompts"][0][:-2] | ||
|
||
def process_docs(dataset: datasets.Dataset) -> datasets.Dataset: | ||
def _process_doc(doc: dict) -> dict: | ||
# E.g., "Answer: B" | ||
answer = doc["input_correct_responses"][0] | ||
# Assumes that 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"] |