chen459664 commited on
Commit
ad89f04
·
verified ·
1 Parent(s): 6f21e15

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/README.md +59 -0
  2. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/cot_n_shot/_generate_configs.py +26 -0
  3. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/cot_n_shot/_gpqa_cot_n_shot_yaml +38 -0
  4. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/cot_zeroshot/gpqa_main_cot_zeroshot.yaml +4 -0
  5. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/cot_zeroshot/utils.py +39 -0
  6. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/generative/gpqa_diamond_generative_n_shot.yaml +4 -0
  7. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/generative/gpqa_main_generative_n_shot.yaml +4 -0
  8. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/generative/utils.py +39 -0
  9. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/n_shot/_generate_configs.py +26 -0
  10. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/n_shot/_gpqa_n_shot_yaml +21 -0
  11. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/n_shot/gpqa_diamond_n_shot.yaml +4 -0
  12. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/n_shot/gpqa_main_n_shot.yaml +4 -0
  13. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/zeroshot/_gpqa_zeroshot_yaml +21 -0
  14. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/zeroshot/gpqa_extended_zeroshot.yaml +4 -0
  15. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/zeroshot/gpqa_main_zeroshot.yaml +4 -0
  16. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/zeroshot/utils.py +38 -0
  17. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/README.md +62 -0
  18. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k-cot-llama.yaml +84 -0
  19. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k-cot-self-consistency.yaml +34 -0
  20. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k-cot-zeroshot.yaml +44 -0
  21. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k-cot.yaml +83 -0
  22. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k.yaml +45 -0
  23. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm_plus/README.md +48 -0
  24. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm_plus/gsm_plus.yaml +44 -0
  25. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm_plus/gsm_plus_mini.yaml +44 -0
  26. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/README.md +49 -0
  27. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/_default_haerae_yaml +16 -0
  28. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/_haerae.yaml +16 -0
  29. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/haerae_gk.yaml +3 -0
  30. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/haerae_hi.yaml +3 -0
  31. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/haerae_lw.yaml +3 -0
  32. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/haerae_rw.yaml +3 -0
  33. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/headqa/README.md +57 -0
  34. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/headqa/headqa_en.yaml +22 -0
  35. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/headqa/headqa_es.yaml +3 -0
  36. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hellaswag/README.md +49 -0
  37. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hellaswag/hellaswag.yaml +24 -0
  38. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hellaswag/utils.py +25 -0
  39. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/README.md +54 -0
  40. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/commonsense.yaml +15 -0
  41. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/deontology.yaml +9 -0
  42. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/justice.yaml +9 -0
  43. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/utilitarianism.yaml +12 -0
  44. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/utilitarianism_original_yaml +16 -0
  45. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/utils.py +25 -0
  46. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/virtue.yaml +10 -0
  47. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_math/README.md +54 -0
  48. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_math/hendrycks_math.yaml +15 -0
  49. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_math/hendrycks_math_algebra.yaml +25 -0
  50. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_math/hendrycks_math_counting_and_prob.yaml +3 -0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GPQA
2
+
3
+ ### Paper
4
+
5
+ Title: GPQA: A Graduate-Level Google-Proof Q&A Benchmark
6
+
7
+ Abstract: https://arxiv.org/abs/2311.12022
8
+
9
+ We present GPQA, a challenging dataset of 448 multiple-choice questions written by domain experts in biology, physics, and chemistry. We ensure that the questions are high-quality and extremely difficult: experts who have or are pursuing PhDs in the corresponding domains reach 65% accuracy (74% when discounting clear mistakes the experts identified in retrospect), while highly skilled non-expert validators only reach 34% accuracy, despite spending on average over 30 minutes with unrestricted access to the web (i.e., the questions are “Google-proof”). The questions are also difficult for state-of-the-art AI systems, with our strongest GPT-4–based baseline achieving 39% accuracy. If we are to use future AI systems to help us answer very hard questions—for example, when developing new scientific knowledge—we need to develop *scalable oversight* methods that enable humans to supervise their outputs, which may be difficult even if the supervisors are themselves skilled and knowledgeable. The difficulty of GPQA both for skilled non-experts and frontier AI systems should enable realistic scalable oversight experiments, which we hope can help devise ways for human experts to reliably get truthful information from AI systems that surpass human capabilities.
10
+
11
+ Homepage: `https://github.com/idavidrein/gpqa/tree/main`
12
+
13
+ ### Citation
14
+
15
+ ```
16
+ @misc{rein2023gpqa,
17
+ title={GPQA: A Graduate-Level Google-Proof Q&A Benchmark},
18
+ author={David Rein and Betty Li Hou and Asa Cooper Stickland and Jackson Petty and Richard Yuanzhe Pang and Julien Dirani and Julian Michael and Samuel R. Bowman},
19
+ year={2023},
20
+ eprint={2311.12022},
21
+ archivePrefix={arXiv},
22
+ primaryClass={cs.AI}
23
+ }
24
+ ```
25
+
26
+ This dataset is gated, so you will have to accept the terms of use at https://huggingface.co/datasets/Idavidrein/gpqa and login via `huggingface-cli login` using your HF Hub token before running this task.
27
+
28
+ ### Groups, Tags, and Tasks
29
+
30
+ #### Groups
31
+
32
+ None
33
+
34
+ #### Tags
35
+
36
+ * `gpqa`: runs all GPQA variants.
37
+
38
+ #### Tasks
39
+
40
+ * `gpqa_{main, diamond, extended}_zeroshot`
41
+ * `gpqa_{main, diamond, extended}_n_shot`
42
+ * `gpqa_{main, diamond, extended}_generative_n_shot`
43
+ * `gpqa_{main, diamond, extended}_cot_zeroshot`
44
+ * `gpqa_{main, diamond, extended}_cot_n_shot`
45
+
46
+ ### Checklist
47
+
48
+ For adding novel benchmarks/datasets to the library:
49
+
50
+ * [x] Is the task an existing benchmark in the literature?
51
+ * [x] Have you referenced the original paper that introduced the task?
52
+ * [x] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
53
+
54
+
55
+ If other tasks on this dataset are already supported:
56
+
57
+ * [ ] Is the "Main" variant of this task clearly denoted?
58
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
59
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/cot_n_shot/_generate_configs.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import yaml
2
+ from tqdm import tqdm
3
+
4
+
5
+ def main() -> None:
6
+ subset = ["extended", "diamond", "main"]
7
+ setting = "cot_n_shot"
8
+ for task in tqdm(subset):
9
+ file_name = f"gpqa_{task}_{setting}.yaml"
10
+ try:
11
+ with open(f"{file_name}", "w") as f:
12
+ f.write("# Generated by _generate_configs.py\n")
13
+ yaml.dump(
14
+ {
15
+ "include": f"_gpqa_{setting}_yaml",
16
+ "task": f"gpqa_{task}_{setting}",
17
+ "dataset_name": f"gpqa_{task}",
18
+ },
19
+ f,
20
+ )
21
+ except FileExistsError:
22
+ pass
23
+
24
+
25
+ if __name__ == "__main__":
26
+ main()
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/cot_n_shot/_gpqa_cot_n_shot_yaml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_path: Idavidrein/gpqa
2
+ tag: gpqa
3
+ output_type: generate_until
4
+ process_docs: !function utils.process_docs
5
+ training_split: train
6
+ # Because huggingface dataset only has train split
7
+ validation_split: train
8
+ test_split: null
9
+ description: "Here are some example questions from experts. Answer the final question yourself, following the format of the previous questions exactly.\n"
10
+ doc_to_text: "Question: {{Question}}\nChoices:\n(A) {{choice1}}\n(B) {{choice2}}\n(C) {{choice3}}\n(D) {{choice4}}\nLet's think step by step: "
11
+ doc_to_target: answer
12
+ filter_list:
13
+ - name: "strict-match"
14
+ filter:
15
+ - function: "regex"
16
+ regex_pattern: "(?<=The answer is )(.*)(?=.)"
17
+ - function: "take_first"
18
+ - name: "flexible-extract"
19
+ filter:
20
+ - function: "multi_choice_regex"
21
+ group_select: -1
22
+ ignore_case: true
23
+ ignore_punctuation: true
24
+ regex_pattern: "(\\([A-Z]\\))"
25
+ - function: "take_first"
26
+ generation_kwargs:
27
+ until:
28
+ - "</s>"
29
+ do_sample: false
30
+ temperature: 0.0
31
+ metric_list:
32
+ - metric: exact_match
33
+ aggregation: mean
34
+ higher_is_better: true
35
+ ignore_case: true
36
+ ignore_punctuation: true
37
+ metadata:
38
+ version: 2.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/cot_zeroshot/gpqa_main_cot_zeroshot.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Generated by _generate_configs.py
2
+ dataset_name: gpqa_main
3
+ include: _gpqa_cot_zeroshot_yaml
4
+ task: gpqa_main_cot_zeroshot
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/cot_zeroshot/utils.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import re
3
+
4
+ import datasets
5
+
6
+
7
+ def preprocess(text):
8
+ if text is None:
9
+ return " "
10
+ text = text.strip()
11
+ text = text.replace(" [title]", ". ")
12
+ text = re.sub("\\[.*?\\]", "", text)
13
+ text = text.replace(" ", " ")
14
+ return text
15
+
16
+
17
+ def process_docs(dataset: datasets.Dataset) -> datasets.Dataset:
18
+ def _process_doc(doc):
19
+ choices = [
20
+ preprocess(doc["Incorrect Answer 1"]),
21
+ preprocess(doc["Incorrect Answer 2"]),
22
+ preprocess(doc["Incorrect Answer 3"]),
23
+ preprocess(doc["Correct Answer"]),
24
+ ]
25
+
26
+ random.shuffle(choices)
27
+ correct_answer_index = choices.index(preprocess(doc["Correct Answer"]))
28
+
29
+ out_doc = {
30
+ "choice1": choices[0],
31
+ "choice2": choices[1],
32
+ "choice3": choices[2],
33
+ "choice4": choices[3],
34
+ "choices": [choices[0], choices[1], choices[2], choices[3]],
35
+ "answer": f"({chr(65 + correct_answer_index)})",
36
+ }
37
+ return out_doc
38
+
39
+ return dataset.map(_process_doc)
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/generative/gpqa_diamond_generative_n_shot.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Generated by _generate_configs.py
2
+ dataset_name: gpqa_diamond
3
+ include: _gpqa_generative_n_shot_yaml
4
+ task: gpqa_diamond_generative_n_shot
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/generative/gpqa_main_generative_n_shot.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Generated by _generate_configs.py
2
+ dataset_name: gpqa_main
3
+ include: _gpqa_generative_n_shot_yaml
4
+ task: gpqa_main_generative_n_shot
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/generative/utils.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import re
3
+
4
+ import datasets
5
+
6
+
7
+ def preprocess(text):
8
+ if text is None:
9
+ return " "
10
+ text = text.strip()
11
+ text = text.replace(" [title]", ". ")
12
+ text = re.sub("\\[.*?\\]", "", text)
13
+ text = text.replace(" ", " ")
14
+ return text
15
+
16
+
17
+ def process_docs(dataset: datasets.Dataset) -> datasets.Dataset:
18
+ def _process_doc(doc):
19
+ choices = [
20
+ preprocess(doc["Incorrect Answer 1"]),
21
+ preprocess(doc["Incorrect Answer 2"]),
22
+ preprocess(doc["Incorrect Answer 3"]),
23
+ preprocess(doc["Correct Answer"]),
24
+ ]
25
+
26
+ random.shuffle(choices)
27
+ correct_answer_index = choices.index(preprocess(doc["Correct Answer"]))
28
+
29
+ out_doc = {
30
+ "choice1": choices[0],
31
+ "choice2": choices[1],
32
+ "choice3": choices[2],
33
+ "choice4": choices[3],
34
+ "choices": [choices[0], choices[1], choices[2], choices[3]],
35
+ "answer": f"({chr(65 + correct_answer_index)})",
36
+ }
37
+ return out_doc
38
+
39
+ return dataset.map(_process_doc)
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/n_shot/_generate_configs.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import yaml
2
+ from tqdm import tqdm
3
+
4
+
5
+ def main() -> None:
6
+ subset = ["extended", "diamond", "main"]
7
+
8
+ for task in tqdm(subset):
9
+ file_name = f"gpqa_{task}_n_shot.yaml"
10
+ try:
11
+ with open(f"{file_name}", "w") as f:
12
+ f.write("# Generated by _generate_configs.py\n")
13
+ yaml.dump(
14
+ {
15
+ "include": "_gpqa_n_shot_yaml",
16
+ "task": f"gpqa_{task}_n_shot",
17
+ "dataset_name": f"gpqa_{task}",
18
+ },
19
+ f,
20
+ )
21
+ except FileExistsError:
22
+ pass
23
+
24
+
25
+ if __name__ == "__main__":
26
+ main()
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/n_shot/_gpqa_n_shot_yaml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_path: Idavidrein/gpqa
2
+ tag: gpqa
3
+ output_type: multiple_choice
4
+ process_docs: !function utils.process_docs
5
+ training_split: train
6
+ # Because huggingface dataset only has train split
7
+ validation_split: train
8
+ test_split: null
9
+ description: "Here are some example questions from experts. Answer the final question yourself, following the format of the previous questions exactly.\n"
10
+ doc_to_text: "Question: {{Question}}\nChoices:\n(A) {{choice1}}\n(B) {{choice2}}\n(C) {{choice3}}\n(D) {{choice4}}\nAnswer:"
11
+ doc_to_target: answer
12
+ doc_to_choice: ["(A)", "(B)", "(C)", "(D)"]
13
+ metric_list:
14
+ - metric: acc
15
+ aggregation: mean
16
+ higher_is_better: true
17
+ - metric: acc_norm
18
+ aggregation: mean
19
+ higher_is_better: true
20
+ metadata:
21
+ version: 2.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/n_shot/gpqa_diamond_n_shot.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Generated by _generate_configs.py
2
+ dataset_name: gpqa_diamond
3
+ include: _gpqa_n_shot_yaml
4
+ task: gpqa_diamond_n_shot
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/n_shot/gpqa_main_n_shot.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Generated by _generate_configs.py
2
+ dataset_name: gpqa_main
3
+ include: _gpqa_n_shot_yaml
4
+ task: gpqa_main_n_shot
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/zeroshot/_gpqa_zeroshot_yaml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_path: Idavidrein/gpqa
2
+ tag: gpqa
3
+ output_type: multiple_choice
4
+ process_docs: !function utils.process_docs
5
+ training_split: train
6
+ # Because huggingface dataset only has train split
7
+ validation_split: train
8
+ test_split: null
9
+ doc_to_text: "What is the correct answer to this question:{{Question}}\nChoices:\n(A) {{choice1}}\n(B) {{choice2}}\n(C) {{choice3}}\n(D) {{choice4}}\nAnswer:"
10
+ doc_to_target: answer
11
+ doc_to_choice: ["(A)", "(B)", "(C)", "(D)"]
12
+ num_fewshot: 0
13
+ metric_list:
14
+ - metric: acc
15
+ aggregation: mean
16
+ higher_is_better: true
17
+ - metric: acc_norm
18
+ aggregation: mean
19
+ higher_is_better: true
20
+ metadata:
21
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/zeroshot/gpqa_extended_zeroshot.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Generated by _generate_configs.py
2
+ dataset_name: gpqa_extended
3
+ include: _gpqa_zeroshot_yaml
4
+ task: gpqa_extended_zeroshot
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/zeroshot/gpqa_main_zeroshot.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Generated by _generate_configs.py
2
+ dataset_name: gpqa_main
3
+ include: _gpqa_zeroshot_yaml
4
+ task: gpqa_main_zeroshot
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gpqa/zeroshot/utils.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import re
3
+
4
+ import datasets
5
+
6
+
7
+ def preprocess(text):
8
+ if text is None:
9
+ return " "
10
+ text = text.strip()
11
+ text = text.replace(" [title]", ". ")
12
+ text = re.sub("\\[.*?\\]", "", text)
13
+ text = text.replace(" ", " ")
14
+ return text
15
+
16
+
17
+ def process_docs(dataset: datasets.Dataset) -> datasets.Dataset:
18
+ def _process_doc(doc):
19
+ choices = [
20
+ preprocess(doc["Incorrect Answer 1"]),
21
+ preprocess(doc["Incorrect Answer 2"]),
22
+ preprocess(doc["Incorrect Answer 3"]),
23
+ preprocess(doc["Correct Answer"]),
24
+ ]
25
+
26
+ random.shuffle(choices)
27
+ correct_answer_index = choices.index(preprocess(doc["Correct Answer"]))
28
+
29
+ out_doc = {
30
+ "choice1": choices[0],
31
+ "choice2": choices[1],
32
+ "choice3": choices[2],
33
+ "choice4": choices[3],
34
+ "answer": f"({chr(65 + correct_answer_index)})",
35
+ }
36
+ return out_doc
37
+
38
+ return dataset.map(_process_doc)
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/README.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GSM8k
2
+
3
+ ## Paper
4
+ Training Verifiers to Solve Math Word Problems
5
+ https://arxiv.org/abs/2110.14168
6
+
7
+ State-of-the-art language models can match human performance on many tasks, but
8
+ they still struggle to robustly perform multi-step mathematical reasoning. To
9
+ diagnose the failures of current models and support research, we introduce GSM8K,
10
+ a dataset of 8.5K high quality linguistically diverse grade school math word problems.
11
+ We find that even the largest transformer models fail to achieve high test performance,
12
+ despite the conceptual simplicity of this problem distribution.
13
+
14
+ NOTE: See the official implementation of the task:
15
+ https://github.com/openai/grade-school-math/blob/master/grade_school_math/calculator.py
16
+ for how to make use of the dataset's calculator annotations in your language
17
+ model's sample/generation function.
18
+
19
+ Homepage: https://github.com/openai/grade-school-math
20
+
21
+
22
+ ## Citation
23
+ ```
24
+ @misc{cobbe2021training,
25
+ title={Training Verifiers to Solve Math Word Problems},
26
+ author={Karl Cobbe and Vineet Kosaraju and Mohammad Bavarian and Jacob Hilton and Reiichiro Nakano and Christopher Hesse and John Schulman},
27
+ year={2021},
28
+ eprint={2110.14168},
29
+ archivePrefix={arXiv},
30
+ primaryClass={cs.LG}
31
+ }
32
+ ```
33
+
34
+ ### Groups and Tasks
35
+
36
+ #### Groups
37
+
38
+ - `math_word_problems`
39
+ - `chain_of_thought`
40
+ - `self_consistency`
41
+
42
+ #### Tasks
43
+
44
+ - `gsm8k_yaml`
45
+ - `gsm8k_cot`: GSM8K with Chain-of-Thought
46
+ - `gsm8k_cot_self_consistency`: GSM8K with Chain-of-Thought and Self-Consistency
47
+ - `gsm8k_cot_llama`: GSM8K with prompt formatting modified to conform to the evaluation settings described by Meta here: https://huggingface.co/datasets/meta-llama/Meta-Llama-3.1-8B-Instruct-evals/viewer/Meta-Llama-3.1-8B-Instruct-evals__gsm8k__details?row=0
48
+ - Use this task with --fewshot_as_multiturn and --apply_chat_template to replicate Meta's reported performance.
49
+
50
+
51
+ ### Checklist
52
+
53
+ - [x] Is in Eval-harness v1.0 ?
54
+ - [ ] Has been checked for regression from v1.0?
55
+ - [ ] Has been checked for equivalence with original paper methodology?
56
+ - [ ] "Main" checked variant clearly denoted?
57
+
58
+ ### Variant Wishlist
59
+
60
+ - [ ] Variant with Calculator (see https://github.com/openai/grade-school-math/blob/master/grade_school_math/calculator.py for example implementation)
61
+ - [ ] Using Verifiers
62
+ - [ ] Majority voting "without CoT"
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k-cot-llama.yaml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_name: main
2
+ dataset_path: gsm8k
3
+ doc_to_target: '{{answer.split(''####'')[-1].strip() if answer is defined else target}}'
4
+ doc_to_text: "Given the following problem, reason and give a final answer to the problem.\nProblem: {{question}}\nYour response should end with \"The final answer is [answer]\" where [answer] is the response to the problem.\n"
5
+ fewshot_config:
6
+ sampler: first_n
7
+ samples:
8
+ - question: There are 15 trees in the grove. Grove workers will plant trees in the
9
+ grove today. After they are done, there will be 21 trees. How many trees did
10
+ the grove workers plant today?
11
+ target: There are 15 trees originally. Then there were 21 trees after some more
12
+ were planted. So there must have been 21 - 15 = 6. The final answer is 6
13
+ - question: If there are 3 cars in the parking lot and 2 more cars arrive, how many
14
+ cars are in the parking lot?
15
+ target: There are originally 3 cars. 2 more cars arrive. 3 + 2 = 5. The final answer
16
+ is 5
17
+ - question: Leah had 32 chocolates and her sister had 42. If they ate 35, how many
18
+ pieces do they have left in total?
19
+ target: Originally, Leah had 32 chocolates. Her sister had 42. So in total they
20
+ had 32 + 42 = 74. After eating 35, they had 74 - 35 = 39. The final answer is 39
21
+ - question: Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12
22
+ lollipops. How many lollipops did Jason give to Denny?
23
+ target: Jason started with 20 lollipops. Then he had 12 after giving some to Denny.
24
+ So he gave Denny 20 - 12 = 8. The final answer is 8
25
+ - question: Shawn has five toys. For Christmas, he got two toys each from his mom and
26
+ dad. How many toys does he have now?
27
+ target: Shawn started with 5 toys. If he got 2 toys each from his mom and dad,
28
+ then that is 4 more toys. 5 + 4 = 9. The final answer is 9
29
+ - question: There were nine computers in the server room. Five more computers were
30
+ installed each day, from monday to thursday. How many computers are now in the
31
+ server room?
32
+ target: There were originally 9 computers. For each of 4 days, 5 more computers
33
+ were added. So 5 * 4 = 20 computers were added. 9 + 20 is 29. The final answer is
34
+ 29
35
+ - question: Michael had 58 golf balls. On tuesday, he lost 23 golf balls. On wednesday,
36
+ he lost 2 more. How many golf balls did he have at the end of wednesday?
37
+ target: Michael started with 58 golf balls. After losing 23 on tuesday, he had
38
+ 58 - 23 = 35. After losing 2 more, he had 35 - 2 = 33 golf balls. The final answer
39
+ is 33
40
+ - question: Olivia has $23. She bought five bagels for $3 each. How much money does
41
+ she have left?
42
+ target: Olivia had 23 dollars. 5 bagels for 3 dollars each will be 5 x 3 = 15
43
+ dollars. So she has 23 - 15 dollars left. 23 - 15 is 8. The final answer is 8
44
+ filter_list:
45
+ - filter:
46
+ - function: regex
47
+ group_select: -1
48
+ regex_pattern: The final answer is ((-?[$0-9.,]{2,})|(-?[0-9]+))
49
+ - function: take_first
50
+ name: strict-match
51
+ - filter:
52
+ - function: regex
53
+ group_select: -1
54
+ regex_pattern: (-?[$0-9.,]{2,})|(-?[0-9]+)
55
+ - function: take_first
56
+ name: flexible-extract
57
+ generation_kwargs:
58
+ do_sample: false
59
+ until:
60
+ - '<|eot_id|>'
61
+ - '<|start_header_id|>user<|end_header_id|>'
62
+ - 'Q:'
63
+ - </s>
64
+ - <|im_end|>
65
+ tag:
66
+ - chain_of_thought
67
+ metadata:
68
+ version: 3.0
69
+ metric_list:
70
+ - aggregation: mean
71
+ higher_is_better: true
72
+ ignore_case: true
73
+ ignore_punctuation: false
74
+ metric: exact_match
75
+ regexes_to_ignore:
76
+ - ','
77
+ - \$
78
+ - '(?s).*#### '
79
+ - \.$
80
+ num_fewshot: 8
81
+ output_type: generate_until
82
+ repeats: 1
83
+ task: gsm8k_cot_llama
84
+ test_split: test
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k-cot-self-consistency.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ include: gsm8k-cot.yaml
2
+ tag:
3
+ - chain_of_thought
4
+ - self_consistency
5
+ task: gsm8k_cot_self_consistency
6
+ generation_kwargs:
7
+ until:
8
+ - "Q:"
9
+ - "\n\n"
10
+ do_sample: true
11
+ temperature: 0.2
12
+ repeats: 64
13
+ filter_list:
14
+ - name: "score-first" # pick only the first response, and report metrics on that
15
+ filter:
16
+ - function: "regex"
17
+ regex_pattern: "The answer is (\\-?[0-9\\.\\,]*[0-9]+)"
18
+ - function: "take_first"
19
+ - name: "maj@64"
20
+ filter:
21
+ - function: "regex"
22
+ regex_pattern: "The answer is (\\-?[0-9\\.\\,]*[0-9]+)"
23
+ - function: "majority_vote"
24
+ - function: "take_first"
25
+ - name: "maj@8" # get Maj@8 , via selecting the first 8 responses. Using a better estimator would be optimal.
26
+ filter:
27
+ - function: "take_first_k"
28
+ k: 8
29
+ - function: "regex"
30
+ regex_pattern: "The answer is (\\-?[0-9\\.\\,]*[0-9]+)"
31
+ - function: "majority_vote"
32
+ - function: "take_first"
33
+ metadata:
34
+ version: 2.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k-cot-zeroshot.yaml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - math_word_problems
3
+ task: gsm8k_cot_zeroshot
4
+ dataset_path: gsm8k
5
+ dataset_name: main
6
+ output_type: generate_until
7
+ training_split: train
8
+ fewshot_split: train
9
+ test_split: test
10
+ doc_to_text: "Q: {{question}}\nA: Let's think step by step."
11
+ doc_to_target: "{{answer}}" #" {{answer.split('### ')[-1].rstrip()}}"
12
+ metric_list:
13
+ - metric: exact_match
14
+ aggregation: mean
15
+ higher_is_better: true
16
+ ignore_case: true
17
+ ignore_punctuation: false
18
+ regexes_to_ignore:
19
+ - ","
20
+ - "\\$"
21
+ - "(?s).*#### "
22
+ - "\\.$"
23
+ generation_kwargs:
24
+ until:
25
+ - "Q:"
26
+ - "</s>"
27
+ - "<|im_end|>"
28
+ do_sample: false
29
+ repeats: 1
30
+ num_fewshot: 0
31
+ filter_list:
32
+ - name: "strict-match"
33
+ filter:
34
+ - function: "regex"
35
+ regex_pattern: "The answer is (\\-?[0-9\\.\\,]+)."
36
+ - function: "take_first"
37
+ - name: "flexible-extract"
38
+ filter:
39
+ - function: "regex"
40
+ group_select: -1
41
+ regex_pattern: "(-?[$0-9.,]{2,})|(-?[0-9]+)"
42
+ - function: "take_first"
43
+ metadata:
44
+ version: 3.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k-cot.yaml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_name: main
2
+ dataset_path: gsm8k
3
+ doc_to_target: '{{answer.split(''####'')[-1].strip() if answer is defined else target}}'
4
+ doc_to_text: 'Q: {{question}}
5
+
6
+ A:'
7
+ fewshot_config:
8
+ sampler: first_n
9
+ samples:
10
+ - question: There are 15 trees in the grove. Grove workers will plant trees in the
11
+ grove today. After they are done, there will be 21 trees. How many trees did
12
+ the grove workers plant today?
13
+ target: There are 15 trees originally. Then there were 21 trees after some more
14
+ were planted. So there must have been 21 - 15 = 6. The answer is 6.
15
+ - question: If there are 3 cars in the parking lot and 2 more cars arrive, how many
16
+ cars are in the parking lot?
17
+ target: There are originally 3 cars. 2 more cars arrive. 3 + 2 = 5. The answer
18
+ is 5.
19
+ - question: Leah had 32 chocolates and her sister had 42. If they ate 35, how many
20
+ pieces do they have left in total?
21
+ target: Originally, Leah had 32 chocolates. Her sister had 42. So in total they
22
+ had 32 + 42 = 74. After eating 35, they had 74 - 35 = 39. The answer is 39.
23
+ - question: Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12
24
+ lollipops. How many lollipops did Jason give to Denny?
25
+ target: Jason started with 20 lollipops. Then he had 12 after giving some to Denny.
26
+ So he gave Denny 20 - 12 = 8. The answer is 8.
27
+ - question: Shawn has five toys. For Christmas, he got two toys each from his mom and
28
+ dad. How many toys does he have now?
29
+ target: Shawn started with 5 toys. If he got 2 toys each from his mom and dad,
30
+ then that is 4 more toys. 5 + 4 = 9. The answer is 9.
31
+ - question: There were nine computers in the server room. Five more computers were
32
+ installed each day, from monday to thursday. How many computers are now in the
33
+ server room?
34
+ target: There were originally 9 computers. For each of 4 days, 5 more computers
35
+ were added. So 5 * 4 = 20 computers were added. 9 + 20 is 29. The answer is
36
+ 29.
37
+ - question: Michael had 58 golf balls. On tuesday, he lost 23 golf balls. On wednesday,
38
+ he lost 2 more. How many golf balls did he have at the end of wednesday?
39
+ target: Michael started with 58 golf balls. After losing 23 on tuesday, he had
40
+ 58 - 23 = 35. After losing 2 more, he had 35 - 2 = 33 golf balls. The answer
41
+ is 33.
42
+ - question: Olivia has $23. She bought five bagels for $3 each. How much money does
43
+ she have left?
44
+ target: Olivia had 23 dollars. 5 bagels for 3 dollars each will be 5 x 3 = 15
45
+ dollars. So she has 23 - 15 dollars left. 23 - 15 is 8. The answer is 8.
46
+ filter_list:
47
+ - filter:
48
+ - function: regex
49
+ regex_pattern: The answer is (\-?[0-9\.\,]+).
50
+ - function: take_first
51
+ name: strict-match
52
+ - filter:
53
+ - function: regex
54
+ group_select: -1
55
+ regex_pattern: (-?[$0-9.,]{2,})|(-?[0-9]+)
56
+ - function: take_first
57
+ name: flexible-extract
58
+ generation_kwargs:
59
+ do_sample: false
60
+ until:
61
+ - 'Q:'
62
+ - </s>
63
+ - <|im_end|>
64
+ tag:
65
+ - chain_of_thought
66
+ metadata:
67
+ version: 3.0
68
+ metric_list:
69
+ - aggregation: mean
70
+ higher_is_better: true
71
+ ignore_case: true
72
+ ignore_punctuation: false
73
+ metric: exact_match
74
+ regexes_to_ignore:
75
+ - ','
76
+ - \$
77
+ - '(?s).*#### '
78
+ - \.$
79
+ num_fewshot: 8
80
+ output_type: generate_until
81
+ repeats: 1
82
+ task: gsm8k_cot
83
+ test_split: test
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm8k/gsm8k.yaml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - math_word_problems
3
+ task: gsm8k
4
+ dataset_path: gsm8k
5
+ dataset_name: main
6
+ output_type: generate_until
7
+ training_split: train
8
+ fewshot_split: train
9
+ test_split: test
10
+ doc_to_text: "Question: {{question}}\nAnswer:"
11
+ doc_to_target: "{{answer}}" #" {{answer.split('### ')[-1].rstrip()}}"
12
+ metric_list:
13
+ - metric: exact_match
14
+ aggregation: mean
15
+ higher_is_better: true
16
+ ignore_case: true
17
+ ignore_punctuation: false
18
+ regexes_to_ignore:
19
+ - ","
20
+ - "\\$"
21
+ - "(?s).*#### "
22
+ - "\\.$"
23
+ generation_kwargs:
24
+ until:
25
+ - "Question:"
26
+ - "</s>"
27
+ - "<|im_end|>"
28
+ do_sample: false
29
+ temperature: 0.0
30
+ repeats: 1
31
+ num_fewshot: 5
32
+ filter_list:
33
+ - name: "strict-match"
34
+ filter:
35
+ - function: "regex"
36
+ regex_pattern: "#### (\\-?[0-9\\.\\,]+)"
37
+ - function: "take_first"
38
+ - name: "flexible-extract"
39
+ filter:
40
+ - function: "regex"
41
+ group_select: -1
42
+ regex_pattern: "(-?[$0-9.,]{2,})|(-?[0-9]+)"
43
+ - function: "take_first"
44
+ metadata:
45
+ version: 3.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm_plus/README.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # gsm_plus
2
+
3
+ ### Paper
4
+
5
+ Title: `GSM-PLUS: A Comprehensive Benchmark for Evaluating the Robustness of LLMs as Mathematical Problem Solvers`
6
+
7
+ Abstract: `Large language models (LLMs) have achieved impressive performance across various mathematical reasoning benchmarks. However, there are increasing debates regarding whether these models truly understand and apply mathematical knowledge or merely rely on shortcuts for mathematical reasoning. One essential and frequently occurring evidence is that when the math questions are slightly changed, LLMs can behave incorrectly. This motivates us to evaluate the robustness of LLMs’ math reasoning capability by testing a wide range of question variations. We introduce the adversarial grade school math (GSM-PLUS) dataset, an extension of GSM8K augmented with various mathematical perturbations. Our experiments on 25 LLMs and 4 prompting techniques show that while LLMs exhibit different levels of math reasoning abilities, their performances are far from robust. In particular, even for problems that have been solved in GSM8K, LLMs can make mistakes when new statements are added or the question targets are altered. We also explore whether more robust performance can be achieved by composing existing prompting methods, in which we try an iterative method that generates and verifies each intermediate thought based on its reasoning goal and calculation result.`
8
+
9
+ Homepage: https://huggingface.co/datasets/qintongli/GSM-Plus
10
+
11
+ ### Citation
12
+
13
+ ```bibtex
14
+ @misc{li2024gsmpluscomprehensivebenchmarkevaluating,
15
+ title={GSM-Plus: A Comprehensive Benchmark for Evaluating the Robustness of LLMs as Mathematical Problem Solvers},
16
+ author={Qintong Li and Leyang Cui and Xueliang Zhao and Lingpeng Kong and Wei Bi},
17
+ year={2024},
18
+ eprint={2402.19255},
19
+ archivePrefix={arXiv},
20
+ primaryClass={cs.CL},
21
+ url={https://arxiv.org/abs/2402.19255},
22
+ }
23
+ ```
24
+
25
+ ### Groups and Tasks
26
+
27
+ #### Groups
28
+
29
+ * Not part of a group yet
30
+
31
+ #### Tasks
32
+
33
+ The following tasks evaluate subjects in the gsm_plus dataset
34
+ - `gsm_plus`
35
+ - `gsm_plus_mini`
36
+
37
+ ### Checklist
38
+
39
+ For adding novel benchmarks/datasets to the library:
40
+ * [x] Is the task an existing benchmark in the literature?
41
+ * [x] Have you referenced the original paper that introduced the task?
42
+ * [x] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
43
+
44
+
45
+ If other tasks on this dataset are already supported:
46
+ * [ ] Is the "Main" variant of this task clearly denoted?
47
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
48
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm_plus/gsm_plus.yaml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - math_word_problems
3
+ task: gsm_plus
4
+ dataset_path: qintongli/GSM-Plus
5
+ output_type: generate_until
6
+ training_split: test
7
+ fewshot_split: test
8
+ test_split: test
9
+ doc_to_text: "Question: {{question}}\nAnswer:"
10
+ doc_to_target: "{{solution}}"
11
+ metric_list:
12
+ - metric: exact_match
13
+ aggregation: mean
14
+ higher_is_better: true
15
+ ignore_case: true
16
+ ignore_punctuation: false
17
+ regexes_to_ignore:
18
+ - ","
19
+ - "\\$"
20
+ - "(?s).*#### "
21
+ - "\\.$"
22
+ generation_kwargs:
23
+ until:
24
+ - "Question:"
25
+ - "</s>"
26
+ - "<|im_end|>"
27
+ do_sample: false
28
+ temperature: 0.0
29
+ repeats: 1
30
+ num_fewshot: 5
31
+ filter_list:
32
+ - name: "strict-match"
33
+ filter:
34
+ - function: "regex"
35
+ regex_pattern: "#### (\\-?[0-9\\.\\,]+)"
36
+ - function: "take_first"
37
+ - name: "flexible-extract"
38
+ filter:
39
+ - function: "regex"
40
+ group_select: -1
41
+ regex_pattern: "(-?[$0-9.,]{2,})|(-?[0-9]+)"
42
+ - function: "take_first"
43
+ metadata:
44
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/gsm_plus/gsm_plus_mini.yaml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - math_word_problems
3
+ task: gsm_plus_mini
4
+ dataset_path: qintongli/GSM-Plus
5
+ output_type: generate_until
6
+ training_split: testmini
7
+ fewshot_split: testmini
8
+ test_split: testmini
9
+ doc_to_text: "Question: {{question}}\nAnswer:"
10
+ doc_to_target: "{{solution}}"
11
+ metric_list:
12
+ - metric: exact_match
13
+ aggregation: mean
14
+ higher_is_better: true
15
+ ignore_case: true
16
+ ignore_punctuation: false
17
+ regexes_to_ignore:
18
+ - ","
19
+ - "\\$"
20
+ - "(?s).*#### "
21
+ - "\\.$"
22
+ generation_kwargs:
23
+ until:
24
+ - "Question:"
25
+ - "</s>"
26
+ - "<|im_end|>"
27
+ do_sample: false
28
+ temperature: 0.0
29
+ repeats: 1
30
+ num_fewshot: 5
31
+ filter_list:
32
+ - name: "strict-match"
33
+ filter:
34
+ - function: "regex"
35
+ regex_pattern: "#### (\\-?[0-9\\.\\,]+)"
36
+ - function: "take_first"
37
+ - name: "flexible-extract"
38
+ filter:
39
+ - function: "regex"
40
+ group_select: -1
41
+ regex_pattern: "(-?[$0-9.,]{2,})|(-?[0-9]+)"
42
+ - function: "take_first"
43
+ metadata:
44
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HAE-RAE BENCH
2
+
3
+ ### Paper
4
+
5
+ Title: `HAE-RAE Bench: Evaluation of Korean Knowledge in Language Models`
6
+
7
+ Abstract: `Large Language Models (LLMs) trained on massive corpora demonstrate impressive capabilities in a wide range of tasks. While there are ongoing efforts to adapt these models to languages beyond English, the attention given to their evaluation methodologies remains limited. Current multilingual benchmarks often rely on back translations or re-implementations of English tests, limiting their capacity to capture unique cultural and linguistic nuances. To bridge this gap for the Korean language, we introduce HAE-RAE Bench, a dataset curated to challenge models lacking Korean cultural and contextual depth. The dataset encompasses six downstream tasks across four domains: vocabulary, history, general knowledge, and reading comprehension. Contrary to traditional evaluation suites focused on token or sequence classification and specific mathematical or logical reasoning, HAE-RAE Bench emphasizes a model's aptitude for recalling Korean-specific knowledge and cultural contexts. Comparative analysis with prior Korean benchmarks indicates that the HAE-RAE Bench presents a greater challenge to non-native models, by disturbing abilities and knowledge learned from English being transferred.`
8
+
9
+ Homepage: https://huggingface.co/datasets/HAERAE-HUB/HAE_RAE_BENCH
10
+
11
+ ### Citation
12
+
13
+ @misc{son2023haerae,
14
+ title={HAE-RAE Bench: Evaluation of Korean Knowledge in Language Models},
15
+ author={Guijin Son and Hanwool Lee and Suwan Kim and Huiseo Kim and Jaecheol Lee and Je Won Yeom and Jihyu Jung and Jung Woo Kim and Songseong Kim},
16
+ year={2023},
17
+ eprint={2309.02706},
18
+ archivePrefix={arXiv},
19
+ primaryClass={cs.CL}
20
+ }
21
+
22
+ ### Groups and Tasks
23
+
24
+ #### Groups
25
+
26
+ * `haerae`: 'It consists of five tasks provided in the HAERAE-BENCH paper. 'Reading Comprehension' was excluded from the implementation due to copyright issues. We will include it in the next haerae update. For other tasks, some part of data may be replaced or increased with the production of Haerae v1.1. Please note this when using it.'
27
+
28
+ #### Tasks
29
+
30
+ The following tasks evaluate subjects in the HaeRae dataset
31
+
32
+ - `haerae_standard_nomenclature`
33
+ - `haerae_loan_word`
34
+ - `haerae_rare_word`
35
+ - `haerae_general_knowledge`
36
+ - `haerae_history`
37
+
38
+ ### Checklist
39
+
40
+ For adding novel benchmarks/datasets to the library:
41
+ * [x] Is the task an existing benchmark in the literature?
42
+ * [x] Have you referenced the original paper that introduced the task?
43
+ * [x] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
44
+
45
+
46
+ If other tasks on this dataset are already supported:
47
+ * [ ] Is the "Main" variant of this task clearly denoted?
48
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
49
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/_default_haerae_yaml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_path: HAERAE-HUB/HAE_RAE_BENCH
2
+ test_split: test
3
+ fewshot_split: test
4
+ output_type: multiple_choice
5
+ doc_to_text: "{{query}}"
6
+ doc_to_choice: ["(A)", "(B)", "(C)", "(D)", "(E)"]
7
+ doc_to_target: "{{answer}}"
8
+ metric_list:
9
+ - metric: acc
10
+ aggregation: mean
11
+ higher_is_better: true
12
+ - metric: acc_norm
13
+ aggregation: mean
14
+ higher_is_better: true
15
+ metadata:
16
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/_haerae.yaml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ group: haerae
2
+ task:
3
+ - haerae_general_knowledge
4
+ - haerae_history
5
+ - haerae_loan_word
6
+ - haerae_rare_word
7
+ - haerae_standard_nomenclature
8
+ aggregate_metric_list:
9
+ - metric: acc
10
+ aggregation: mean
11
+ weight_by_size: true
12
+ - metric: acc_norm
13
+ aggregation: mean
14
+ weight_by_size: true
15
+ metadata:
16
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/haerae_gk.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ dataset_name: general_knowledge
2
+ include: _default_haerae_yaml
3
+ task: haerae_general_knowledge
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/haerae_hi.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ dataset_name: history
2
+ include: _default_haerae_yaml
3
+ task: haerae_history
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/haerae_lw.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ dataset_name: loan_words
2
+ include: _default_haerae_yaml
3
+ task: haerae_loan_word
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/haerae/haerae_rw.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ dataset_name: rare_words
2
+ include: _default_haerae_yaml
3
+ task: haerae_rare_word
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/headqa/README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HEAD-QA
2
+
3
+ ### Paper
4
+
5
+ HEAD-QA: A Healthcare Dataset for Complex Reasoning
6
+ https://arxiv.org/pdf/1906.04701.pdf
7
+
8
+ HEAD-QA is a multi-choice HEAlthcare Dataset. The questions come from exams to access a specialized position in the
9
+ Spanish healthcare system, and are challenging even for highly specialized humans. They are designed by the Ministerio
10
+ de Sanidad, Consumo y Bienestar Social.
11
+ The dataset contains questions about the following topics: medicine, nursing, psychology, chemistry, pharmacology and biology.
12
+
13
+ Homepage: https://aghie.github.io/head-qa/
14
+
15
+
16
+ ### Citation
17
+
18
+ ```
19
+ @inproceedings{vilares-gomez-rodriguez-2019-head,
20
+ title = "{HEAD}-{QA}: A Healthcare Dataset for Complex Reasoning",
21
+ author = "Vilares, David and
22
+ G{\'o}mez-Rodr{\'i}guez, Carlos",
23
+ booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
24
+ month = jul,
25
+ year = "2019",
26
+ address = "Florence, Italy",
27
+ publisher = "Association for Computational Linguistics",
28
+ url = "https://www.aclweb.org/anthology/P19-1092",
29
+ doi = "10.18653/v1/P19-1092",
30
+ pages = "960--966",
31
+ abstract = "We present HEAD-QA, a multi-choice question answering testbed to encourage research on complex reasoning. The questions come from exams to access a specialized position in the Spanish healthcare system, and are challenging even for highly specialized humans. We then consider monolingual (Spanish) and cross-lingual (to English) experiments with information retrieval and neural techniques. We show that: (i) HEAD-QA challenges current methods, and (ii) the results lag well behind human performance, demonstrating its usefulness as a benchmark for future work.",
32
+ }
33
+ ```
34
+
35
+ ### Groups and Tasks
36
+
37
+ #### Groups
38
+
39
+ - `headqa`: Evaluates `headqa_en` and `headqa_es`
40
+
41
+ #### Tasks
42
+
43
+ * `headqa_en` - English variant of HEAD-QA
44
+ * `headqa_es` - Spanish variant of HEAD-QA
45
+
46
+ ### Checklist
47
+
48
+ * [x] Is the task an existing benchmark in the literature?
49
+ * [ ] Have you referenced the original paper that introduced the task?
50
+ * [ ] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
51
+
52
+
53
+ If other tasks on this dataset are already supported:
54
+ * [x] Is the "Main" variant of this task clearly denoted?
55
+ * [x] Have you provided a short sentence in a README on what each new variant adds / evaluates?
56
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?\
57
+ * [x] Same as LM Evaluation Harness v0.3.0 implementation
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/headqa/headqa_en.yaml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag: headqa
2
+ task: headqa_en
3
+ dataset_path: EleutherAI/headqa
4
+ dataset_name: en
5
+ output_type: multiple_choice
6
+ training_split: train
7
+ validation_split: validation
8
+ test_split: test
9
+ doc_to_text: "Question: {{qtext}}\nAnswer:"
10
+ doc_to_target: "{{ra - 1}}"
11
+ doc_to_choice: "{{answers|map(attribute='atext')|list}}" # this will be cast to an int.
12
+ should_decontaminate: true
13
+ doc_to_decontamination_query: query
14
+ metric_list:
15
+ - metric: acc
16
+ aggregation: mean
17
+ higher_is_better: true
18
+ - metric: acc_norm
19
+ aggregation: mean
20
+ higher_is_better: true
21
+ metadata:
22
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/headqa/headqa_es.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ include: headqa_en.yaml
2
+ task: headqa_es
3
+ dataset_name: es
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hellaswag/README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HellaSwag
2
+
3
+ ### Paper
4
+
5
+ Title: `HellaSwag: Can a Machine Really Finish Your Sentence?`
6
+
7
+ Abstract: https://arxiv.org/abs/1905.07830
8
+
9
+ Recent work by Zellers et al. (2018) introduced a new task of commonsense natural language inference: given an event description such as "A woman sits at a piano," a machine must select the most likely followup: "She sets her fingers on the keys." With the introduction of BERT, near human-level performance was reached. Does this mean that machines can perform human level commonsense inference?
10
+ In this paper, we show that commonsense inference still proves difficult for even state-of-the-art models, by presenting HellaSwag, a new challenge dataset. Though its questions are trivial for humans (>95% accuracy), state-of-the-art models struggle (<48%). We achieve this via Adversarial Filtering (AF), a data collection paradigm wherein a series of discriminators iteratively select an adversarial set of machine-generated wrong answers. AF proves to be surprisingly robust. The key insight is to scale up the length and complexity of the dataset examples towards a critical 'Goldilocks' zone wherein generated text is ridiculous to humans, yet often misclassified by state-of-the-art models.
11
+ Our construction of HellaSwag, and its resulting difficulty, sheds light on the inner workings of deep pretrained models. More broadly, it suggests a new path forward for NLP research, in which benchmarks co-evolve with the evolving state-of-the-art in an adversarial way, so as to present ever-harder challenges.
12
+
13
+ Homepage: `https://rowanzellers.com/hellaswag/`
14
+
15
+
16
+ ### Citation
17
+
18
+ ```
19
+ @inproceedings{zellers2019hellaswag,
20
+ title={HellaSwag: Can a Machine Really Finish Your Sentence?},
21
+ author={Zellers, Rowan and Holtzman, Ari and Bisk, Yonatan and Farhadi, Ali and Choi, Yejin},
22
+ booktitle ={Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},
23
+ year={2019}
24
+ }
25
+ ```
26
+
27
+ ### Groups and Tasks
28
+
29
+ #### Groups
30
+
31
+ - Not part of a group yet
32
+
33
+ #### Tasks
34
+
35
+ - `hellaswag`
36
+
37
+
38
+ ### Checklist
39
+
40
+ For adding novel benchmarks/datasets to the library:
41
+ * [x] Is the task an existing benchmark in the literature?
42
+ * [x] Have you referenced the original paper that introduced the task?
43
+ * [x] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
44
+
45
+
46
+ If other tasks on this dataset are already supported:
47
+ * [ ] Is the "Main" variant of this task clearly denoted?
48
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
49
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hellaswag/hellaswag.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - multiple_choice
3
+ task: hellaswag
4
+ dataset_path: hellaswag
5
+ dataset_name: null
6
+ output_type: multiple_choice
7
+ training_split: train
8
+ validation_split: validation
9
+ test_split: null
10
+ process_docs: !function utils.process_docs
11
+ doc_to_text: "{{query}}"
12
+ doc_to_target: "{{label}}"
13
+ doc_to_choice: "choices"
14
+ metric_list:
15
+ - metric: acc
16
+ aggregation: mean
17
+ higher_is_better: true
18
+ - metric: acc_norm
19
+ aggregation: mean
20
+ higher_is_better: true
21
+ metadata:
22
+ version: 1.0
23
+ dataset_kwargs:
24
+ trust_remote_code: true
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hellaswag/utils.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+
3
+ import datasets
4
+
5
+
6
+ def preprocess(text):
7
+ text = text.strip()
8
+ # NOTE: Brackets are artifacts of the WikiHow dataset portion of HellaSwag.
9
+ text = text.replace(" [title]", ". ")
10
+ text = re.sub("\\[.*?\\]", "", text)
11
+ text = text.replace(" ", " ")
12
+ return text
13
+
14
+
15
+ def process_docs(dataset: datasets.Dataset) -> datasets.Dataset:
16
+ def _process_doc(doc):
17
+ ctx = doc["ctx_a"] + " " + doc["ctx_b"].capitalize()
18
+ out_doc = {
19
+ "query": preprocess(doc["activity_label"] + ": " + ctx),
20
+ "choices": [preprocess(ending) for ending in doc["endings"]],
21
+ "gold": int(doc["label"]),
22
+ }
23
+ return out_doc
24
+
25
+ return dataset.map(_process_doc)
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/README.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ETHICS Dataset
2
+
3
+ ### Paper
4
+
5
+ Pointer Sentinel Mixture Models
6
+ https://arxiv.org/pdf/1609.07843.pdf
7
+
8
+ The ETHICS dataset is a benchmark that spans concepts in justice, well-being,
9
+ duties, virtues, and commonsense morality. Models predict widespread moral
10
+ judgments about diverse text scenarios. This requires connecting physical and
11
+ social world knowledge to value judgements, a capability that may enable us
12
+ to steer chatbot outputs or eventually regularize open-ended reinforcement
13
+ learning agents.
14
+
15
+ Homepage: https://github.com/hendrycks/ethics
16
+
17
+ ### Citation
18
+
19
+ ```
20
+ @article{hendrycks2021ethics
21
+ title={Aligning AI With Shared Human Values},
22
+ author={Dan Hendrycks and Collin Burns and Steven Basart and Andrew Critch and Jerry Li and Dawn Song and Jacob Steinhardt},
23
+ journal={Proceedings of the International Conference on Learning Representations (ICLR)},
24
+ year={2021}
25
+ }
26
+ ```
27
+
28
+ ### Groups and Tasks
29
+
30
+ #### Groups
31
+
32
+ - `hendrycks_ethics`
33
+
34
+ #### Tasks
35
+
36
+ * `ethics_cm`
37
+ * `ethics_deontology`
38
+ * `ethics_justice`
39
+ * `ethics_utilitarianism`
40
+ * (MISSING) `ethics_utilitarianism_original`
41
+ * `ethics_virtue`
42
+
43
+ ### Checklist
44
+
45
+ * [x] Is the task an existing benchmark in the literature?
46
+ * [ ] Have you referenced the original paper that introduced the task?
47
+ * [ ] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
48
+
49
+
50
+ If other tasks on this dataset are already supported:
51
+ * [x] Is the "Main" variant of this task clearly denoted?
52
+ * [x] Have you provided a short sentence in a README on what each new variant adds / evaluates?
53
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
54
+ * [ ] Matches v0.3.0 of Eval Harness
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/commonsense.yaml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - hendrycks_ethics
3
+ task: ethics_cm
4
+ dataset_path: EleutherAI/hendrycks_ethics
5
+ dataset_name: commonsense
6
+ output_type: multiple_choice
7
+ training_split: train
8
+ test_split: test
9
+ doc_to_text: "{{input}}\nQuestion: Is this wrong?\nAnswer:"
10
+ doc_to_target: label
11
+ doc_to_choice: ['no', 'yes']
12
+ metric_list:
13
+ - metric: acc
14
+ metadata:
15
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/deontology.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ include: commonsense.yaml
2
+ task: ethics_deontology
3
+ dataset_name: deontology
4
+ doc_to_text: "Question: Would most people believe this reasonable or unreasonable to say? \"{{scenario}} {{excuse.rstrip()}}\"\nAnswer:"
5
+ doc_to_target: label
6
+ doc_to_choice: ['unreasonable', 'reasonable']
7
+ metadata:
8
+ version: 1.0
9
+ # TODO: implement exact-match metric for this subset
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/justice.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ include: deontology.yaml
2
+ tag:
3
+ - hendrycks_ethics
4
+ task: ethics_justice
5
+ dataset_name: justice
6
+ doc_to_text: "Question: Would most people believe this reasonable or unreasonable to say? \"{{scenario}}\"\nAnswer:"
7
+ # TODO: impl. exact match for this and deontology
8
+ metadata:
9
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/utilitarianism.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ include: commonsense.yaml
2
+ tag:
3
+ - hendrycks_ethics
4
+ task: ethics_utilitarianism
5
+ dataset_name: utilitarianism
6
+ doc_to_text: !function utils.doc_to_text
7
+ doc_to_target: !function utils.doc_to_target
8
+ doc_to_choice: ['no', 'yes']
9
+ metric_list:
10
+ - metric: acc
11
+ metadata:
12
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/utilitarianism_original_yaml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # group:
2
+ # - hendrycks_ethics
3
+ # task: ethics_utilitarianism_original
4
+ # dataset_path: hails/hendrycks_ethics
5
+ # dataset_name: utilitarianism
6
+ # output_type: winograd_schema
7
+ # fewshot_split: null # TODO: implement a special fewshot split for this dataset subsets
8
+ # test_split: test
9
+ # template_aliases: #"{% set answer_choices = range(1, 11)|list %}"
10
+ # doc_to_text: 'Activity: "{{activity}}"\nRating:'
11
+ # doc_to_target: "{{answer_choices[label]}}"
12
+ # metric_list:
13
+ # - metric: acc
14
+ # TODO: we want this to be implemented as a winograd_schema task type, actually
15
+ # metadata:
16
+ # version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/utils.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+
3
+
4
+ ### Utils for `ethics_utilitarianism` task below
5
+ def _preproc_doc(doc):
6
+ rnd = random.Random(doc["activity"])
7
+ scenarios = [doc["activity"], doc["baseline"]]
8
+ ordering = [0, 1]
9
+ rnd.shuffle(ordering)
10
+ doc = {
11
+ "scenarios": [scenarios[ordering[0]], scenarios[ordering[1]]],
12
+ # The correct scenario is always first
13
+ "label": int(ordering.index(0) == 0),
14
+ }
15
+ return doc
16
+
17
+
18
+ def doc_to_text(doc) -> str:
19
+ doc = _preproc_doc(doc)
20
+ return f"Scenario 1: {doc['scenarios'][0]}\nScenario 2: {doc['scenarios'][1]}\nQuestion: Is Scenario 1 preferable?\nAnswer:"
21
+
22
+
23
+ def doc_to_target(doc):
24
+ doc = _preproc_doc(doc)
25
+ return doc["label"]
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_ethics/virtue.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ include: commonsense.yaml
2
+ tag:
3
+ - hendrycks_ethics
4
+ task: ethics_virtue
5
+ dataset_name: virtue
6
+ doc_to_text: "Sentence: {{scenario}}\nQuestion: Does the character in this sentence exhibit the trait \"{{trait}}\"?\nAnswer:"
7
+ doc_to_target: label
8
+ doc_to_choice: ['no', 'yes']
9
+ metadata:
10
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_math/README.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MATH
2
+
3
+ ## Paper
4
+ Measuring Mathematical Problem Solving With the MATH Dataset
5
+ https://arxiv.org/abs/2103.03874
6
+
7
+ Many intellectual endeavors require mathematical problem solving, but this skill remains beyond the capabilities of computers. To measure this ability in machine learning models, we introduce MATH, a new dataset of 12,500 challenging competition mathematics problems. Each problem in MATH has a full step-by-step solution which can be used to teach models to generate answer derivations and explanations.
8
+
9
+ NOTE: This task corresponds to the MATH (`hendrycks_math`) implementation at https://github.com/EleutherAI/lm-evaluation-harness/tree/master . For the variant which uses the custom 4-shot prompt in the Minerva paper (https://arxiv.org/abs/2206.14858), and SymPy answer checking as done by Minerva, see `lm_eval/tasks/minerva_math`.
10
+
11
+ Homepage: https://github.com/hendrycks/math
12
+
13
+
14
+ ## Citation
15
+ ```
16
+ @article{hendrycksmath2021,
17
+ title={Measuring Mathematical Problem Solving With the MATH Dataset},
18
+ author={Dan Hendrycks and Collin Burns and Saurav Kadavath and Akul Arora and Steven Basart and Eric Tang and Dawn Song and Jacob Steinhardt},
19
+ journal={NeurIPS},
20
+ year={2021}
21
+ }
22
+ ```
23
+
24
+ ### Groups and Tasks
25
+
26
+ #### Groups
27
+
28
+ - `hendrycks_math`: the MATH benchmark from Hendrycks et al. 0- or few-shot.
29
+
30
+ #### Tasks
31
+
32
+ - `hendrycks_math_algebra`
33
+ - `hendrycks_math_counting_and_prob`
34
+ - `hendrycks_math_geometry`
35
+ - `hendrycks_math_intermediate_algebra`
36
+ - `hendrycks_math_num_theory`
37
+ - `hendrycks_math_prealgebra`
38
+ - `hendrycks_math_precalc`
39
+
40
+ ### Checklist
41
+
42
+ The checklist is the following:
43
+
44
+ For adding novel benchmarks/datasets to the library:
45
+ * [x] Is the task an existing benchmark in the literature?
46
+ * [x] Have you referenced the original paper that introduced the task?
47
+ * [x] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
48
+ * Answer extraction code is taken from the original MATH benchmark paper's repository.
49
+
50
+
51
+ If other tasks on this dataset are already supported:
52
+ * [x] Is the "Main" variant of this task clearly denoted?
53
+ * [x] Have you provided a short sentence in a README on what each new variant adds / evaluates?
54
+ * [x] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_math/hendrycks_math.yaml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ group: hendrycks_math
2
+ task:
3
+ - hendrycks_math_algebra
4
+ - hendrycks_math_counting_and_prob
5
+ - hendrycks_math_geometry
6
+ - hendrycks_math_intermediate_algebra
7
+ - hendrycks_math_num_theory
8
+ - hendrycks_math_prealgebra
9
+ - hendrycks_math_precalc
10
+ aggregate_metric_list:
11
+ - metric: exact_match
12
+ aggregation: mean
13
+ weight_by_size: true
14
+ metadata:
15
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_math/hendrycks_math_algebra.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - math_word_problems
3
+ task: hendrycks_math_algebra
4
+ dataset_path: EleutherAI/hendrycks_math
5
+ process_docs: !function utils.process_docs
6
+ dataset_name: algebra
7
+ output_type: generate_until
8
+ training_split: train
9
+ test_split: test
10
+ doc_to_text: "Problem: {{problem}}\nAnswer:"
11
+ process_results: !function utils.process_results
12
+ doc_to_target: "{{answer}}"
13
+ generation_kwargs:
14
+ until:
15
+ - "Problem:"
16
+ do_sample: false
17
+ temperature: 0
18
+ metric_list:
19
+ - metric: exact_match
20
+ aggregation: mean
21
+ higher_is_better: true
22
+ metadata:
23
+ version: 1.0
24
+ dataset_kwargs:
25
+ trust_remote_code: true
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/hendrycks_math/hendrycks_math_counting_and_prob.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ include: hendrycks_math_algebra.yaml
2
+ dataset_name: counting_and_probability
3
+ task: hendrycks_math_counting_and_prob