Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
pminervini
commited on
Commit
•
dc1ba50
1
Parent(s):
d01d881
update
Browse files- beta-cli.py +3 -3
- src/display/about.py +6 -170
- src/display/utils.py +15 -50
- src/leaderboard/read_evals.py +18 -16
- src/populate.py +5 -5
- src/tools/plots.py +4 -22
beta-cli.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
from huggingface_hub import snapshot_download
|
4 |
from src.leaderboard.read_evals import get_raw_eval_results
|
5 |
-
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH,
|
6 |
|
7 |
snapshot_download(repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30)
|
8 |
snapshot_download(repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30)
|
@@ -10,7 +10,7 @@ snapshot_download(repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="
|
|
10 |
raw_data = get_raw_eval_results(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH)
|
11 |
|
12 |
for entry in raw_data:
|
13 |
-
|
14 |
-
|
15 |
|
16 |
# print(raw_data)
|
|
|
2 |
|
3 |
from huggingface_hub import snapshot_download
|
4 |
from src.leaderboard.read_evals import get_raw_eval_results
|
5 |
+
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, RESULTS_REPO
|
6 |
|
7 |
snapshot_download(repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30)
|
8 |
snapshot_download(repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30)
|
|
|
10 |
raw_data = get_raw_eval_results(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH)
|
11 |
|
12 |
for entry in raw_data:
|
13 |
+
if '125m' in entry.eval_name:
|
14 |
+
print(entry)
|
15 |
|
16 |
# print(raw_data)
|
src/display/about.py
CHANGED
@@ -10,113 +10,21 @@ The leaderboard's backend runs the great [Eleuther AI Language Model Evaluation
|
|
10 |
"""
|
11 |
|
12 |
LLM_BENCHMARKS_TEXT = f"""
|
13 |
-
|
14 |
-
|
15 |
-
# Context
|
16 |
-
With the plethora of large language models (LLMs) and chatbots being released week upon week, often with grandiose claims of their performance, it can be hard to filter out the genuine progress that is being made by the open-source community and which model is the current state of the art.
|
17 |
-
|
18 |
-
## Icons
|
19 |
-
- {ModelType.PT.to_str(" : ")} model: new, base models, trained on a given corpora
|
20 |
-
- {ModelType.FT.to_str(" : ")} model: pretrained models finetuned on more data
|
21 |
-
Specific fine-tune subcategories (more adapted to chat):
|
22 |
-
- {ModelType.IFT.to_str(" : ")} model: instruction fine-tunes, which are model fine-tuned specifically on datasets of task instruction
|
23 |
-
- {ModelType.RL.to_str(" : ")} model: reinforcement fine-tunes, which usually change the model loss a bit with an added policy.
|
24 |
-
If there is no icon, we have not uploaded the information on the model yet, feel free to open an issue with the model information!
|
25 |
-
|
26 |
-
"Flagged" indicates that this model has been flagged by the community, and should probably be ignored! Clicking the link will redirect you to the discussion about the model.
|
27 |
-
(For ex, the model was trained on the evaluation data, and is therefore cheating on the leaderboard.)
|
28 |
-
|
29 |
-
## How it works
|
30 |
-
|
31 |
-
📈 We evaluate models on 4 key benchmarks using the <a href="https://github.com/EleutherAI/lm-evaluation-harness" target="_blank"> Eleuther AI Language Model Evaluation Harness </a>, a unified framework to test generative language models on a large number of different evaluation tasks.
|
32 |
-
|
33 |
-
- <a href="https://arxiv.org/abs/1803.05457" target="_blank"> AI2 Reasoning Challenge </a> (25-shot) - a set of grade-school science questions.
|
34 |
-
- <a href="https://arxiv.org/abs/1905.07830" target="_blank"> HellaSwag </a> (10-shot) - a test of commonsense inference, which is easy for humans (~95%) but challenging for SOTA models.
|
35 |
-
- <a href="https://arxiv.org/abs/2009.03300" target="_blank"> MMLU </a> (5-shot) - a test to measure a text model's multitask accuracy. The test covers 57 tasks including elementary mathematics, US history, computer science, law, and more.
|
36 |
-
- <a href="https://arxiv.org/abs/2109.07958" target="_blank"> TruthfulQA </a> (0-shot) - a test to measure a model's propensity to reproduce falsehoods commonly found online. Note: TruthfulQA in the Harness is actually a minima a 6-shots task, as it is prepended by 6 examples systematically, even when launched using 0 for the number of few-shot examples.
|
37 |
-
- <a href="https://arxiv.org/abs/1907.10641" target="_blank"> Winogrande </a> (5-shot) - an adversarial and difficult Winograd benchmark at scale, for commonsense reasoning.
|
38 |
-
- <a href="https://arxiv.org/abs/2110.14168" target="_blank"> GSM8k </a> (5-shot) - diverse grade school math word problems to measure a model's ability to solve multi-step mathematical reasoning problems.
|
39 |
-
- <a href="https://arxiv.org/abs/1903.00161" target="_blank"> DROP </a> (3-shot) - English reading comprehension benchmark requiring Discrete Reasoning Over the content of Paragraphs.
|
40 |
-
|
41 |
-
For all these evaluations, a higher score is a better score.
|
42 |
-
We chose these benchmarks as they test a variety of reasoning and general knowledge across a wide variety of fields in 0-shot and few-shot settings.
|
43 |
-
|
44 |
-
## Details and logs
|
45 |
-
You can find:
|
46 |
-
- detailed numerical results in the `results` Hugging Face dataset: https://huggingface.co/datasets/open-llm-leaderboard/results
|
47 |
-
- details on the input/outputs for the models in the `details` of each model, that you can access by clicking the 📄 emoji after the model name
|
48 |
-
- community queries and running status in the `requests` Hugging Face dataset: https://huggingface.co/datasets/open-llm-leaderboard/requests
|
49 |
-
|
50 |
-
## Reproducibility
|
51 |
-
To reproduce our results, here is the commands you can run, using [this version](https://github.com/EleutherAI/lm-evaluation-harness/tree/b281b0921b636bc36ad05c0b0b0763bd6dd43463) of the Eleuther AI Harness:
|
52 |
-
`python main.py --model=hf-causal --model_args="pretrained=<your_model>,use_accelerate=True,revision=<your_model_revision>"`
|
53 |
-
` --tasks=<task_list> --num_fewshot=<n_few_shot> --batch_size=2 --output_path=<output_path>`
|
54 |
-
|
55 |
-
The total batch size we get for models which fit on one A100 node is 16 (8 GPUs * 2). If you don't use parallelism, adapt your batch size to fit.
|
56 |
-
*You can expect results to vary slightly for different batch sizes because of padding.*
|
57 |
-
|
58 |
-
The tasks and few shots parameters are:
|
59 |
-
- ARC: 25-shot, *arc-challenge* (`acc_norm`)
|
60 |
-
- HellaSwag: 10-shot, *hellaswag* (`acc_norm`)
|
61 |
-
- TruthfulQA: 0-shot, *truthfulqa-mc* (`mc2`)
|
62 |
-
- MMLU: 5-shot, *hendrycksTest-abstract_algebra,hendrycksTest-anatomy,hendrycksTest-astronomy,hendrycksTest-business_ethics,hendrycksTest-clinical_knowledge,hendrycksTest-college_biology,hendrycksTest-college_chemistry,hendrycksTest-college_computer_science,hendrycksTest-college_mathematics,hendrycksTest-college_medicine,hendrycksTest-college_physics,hendrycksTest-computer_security,hendrycksTest-conceptual_physics,hendrycksTest-econometrics,hendrycksTest-electrical_engineering,hendrycksTest-elementary_mathematics,hendrycksTest-formal_logic,hendrycksTest-global_facts,hendrycksTest-high_school_biology,hendrycksTest-high_school_chemistry,hendrycksTest-high_school_computer_science,hendrycksTest-high_school_european_history,hendrycksTest-high_school_geography,hendrycksTest-high_school_government_and_politics,hendrycksTest-high_school_macroeconomics,hendrycksTest-high_school_mathematics,hendrycksTest-high_school_microeconomics,hendrycksTest-high_school_physics,hendrycksTest-high_school_psychology,hendrycksTest-high_school_statistics,hendrycksTest-high_school_us_history,hendrycksTest-high_school_world_history,hendrycksTest-human_aging,hendrycksTest-human_sexuality,hendrycksTest-international_law,hendrycksTest-jurisprudence,hendrycksTest-logical_fallacies,hendrycksTest-machine_learning,hendrycksTest-management,hendrycksTest-marketing,hendrycksTest-medical_genetics,hendrycksTest-miscellaneous,hendrycksTest-moral_disputes,hendrycksTest-moral_scenarios,hendrycksTest-nutrition,hendrycksTest-philosophy,hendrycksTest-prehistory,hendrycksTest-professional_accounting,hendrycksTest-professional_law,hendrycksTest-professional_medicine,hendrycksTest-professional_psychology,hendrycksTest-public_relations,hendrycksTest-security_studies,hendrycksTest-sociology,hendrycksTest-us_foreign_policy,hendrycksTest-virology,hendrycksTest-world_religions* (average of all the results `acc`)
|
63 |
-
- Winogrande: 5-shot, *winogrande* (`acc`)
|
64 |
-
- GSM8k: 5-shot, *gsm8k* (`acc`)
|
65 |
-
- DROP: 3-shot, *drop* (`f1`)
|
66 |
-
|
67 |
-
Side note on the baseline scores:
|
68 |
-
- for log-likelihood evaluation, we select the random baseline
|
69 |
-
- for DROP, we select the best submission score according to [their leaderboard](https://leaderboard.allenai.org/drop/submissions/public) when the paper came out (NAQANet score)
|
70 |
-
- for GSM8K, we select the score obtained in the paper after inetuning a 6B model on the full GSM8K training set for 50 epochs
|
71 |
-
|
72 |
-
## Quantization
|
73 |
-
To get more information about quantization, see:
|
74 |
-
- 8 bits: [blog post](https://huggingface.co/blog/hf-bitsandbytes-integration), [paper](https://arxiv.org/abs/2208.07339)
|
75 |
-
- 4 bits: [blog post](https://huggingface.co/blog/4bit-transformers-bitsandbytes), [paper](https://arxiv.org/abs/2305.14314)
|
76 |
"""
|
77 |
|
78 |
EVALUATION_QUEUE_TEXT = """
|
79 |
-
|
80 |
-
|
81 |
-
Models added here will be automatically evaluated on the 🤗 cluster.
|
82 |
-
|
83 |
-
## Some good practices before submitting a model
|
84 |
-
|
85 |
-
### 1) Make sure you can load your model and tokenizer using AutoClasses:
|
86 |
-
```python
|
87 |
-
from transformers import AutoConfig, AutoModel, AutoTokenizer
|
88 |
-
config = AutoConfig.from_pretrained("your model name", revision=revision)
|
89 |
-
model = AutoModel.from_pretrained("your model name", revision=revision)
|
90 |
-
tokenizer = AutoTokenizer.from_pretrained("your model name", revision=revision)
|
91 |
-
```
|
92 |
-
If this step fails, follow the error messages to debug your model before submitting it. It's likely your model has been improperly uploaded.
|
93 |
-
|
94 |
-
Note: make sure your model is public!
|
95 |
-
Note: if your model needs `use_remote_code=True`, we do not support this option yet but we are working on adding it, stay posted!
|
96 |
-
|
97 |
-
### 2) Convert your model weights to [safetensors](https://huggingface.co/docs/safetensors/index)
|
98 |
-
It's a new format for storing weights which is safer and faster to load and use. It will also allow us to add the number of parameters of your model to the `Extended Viewer`!
|
99 |
-
|
100 |
-
### 3) Make sure your model has an open license!
|
101 |
-
This is a leaderboard for Open LLMs, and we'd love for as many people as possible to know they can use your model 🤗
|
102 |
-
|
103 |
-
### 4) Fill up your model card
|
104 |
-
When we add extra information about models to the leaderboard, it will be automatically taken from the model card
|
105 |
-
|
106 |
-
## In case of model failure
|
107 |
-
If your model is displayed in the `FAILED` category, its execution stopped.
|
108 |
-
Make sure you have followed the above steps first.
|
109 |
-
If everything is done, check you can launch the EleutherAIHarness on your model locally, using the above command without modifications (you can add `--limit` to limit the number of examples per task).
|
110 |
"""
|
111 |
|
112 |
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
|
113 |
CITATION_BUTTON_TEXT = r"""
|
114 |
-
@misc{
|
115 |
-
author = {
|
116 |
-
title = {
|
117 |
year = {2023},
|
118 |
publisher = {Hugging Face},
|
119 |
-
howpublished = "\url{https://huggingface.co/spaces/
|
120 |
}
|
121 |
@software{eval-harness,
|
122 |
author = {Gao, Leo and
|
@@ -144,76 +52,4 @@ CITATION_BUTTON_TEXT = r"""
|
|
144 |
doi = {10.5281/zenodo.5371628},
|
145 |
url = {https://doi.org/10.5281/zenodo.5371628}
|
146 |
}
|
147 |
-
@misc{clark2018think,
|
148 |
-
title={Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge},
|
149 |
-
author={Peter Clark and Isaac Cowhey and Oren Etzioni and Tushar Khot and Ashish Sabharwal and Carissa Schoenick and Oyvind Tafjord},
|
150 |
-
year={2018},
|
151 |
-
eprint={1803.05457},
|
152 |
-
archivePrefix={arXiv},
|
153 |
-
primaryClass={cs.AI}
|
154 |
-
}
|
155 |
-
@misc{zellers2019hellaswag,
|
156 |
-
title={HellaSwag: Can a Machine Really Finish Your Sentence?},
|
157 |
-
author={Rowan Zellers and Ari Holtzman and Yonatan Bisk and Ali Farhadi and Yejin Choi},
|
158 |
-
year={2019},
|
159 |
-
eprint={1905.07830},
|
160 |
-
archivePrefix={arXiv},
|
161 |
-
primaryClass={cs.CL}
|
162 |
-
}
|
163 |
-
@misc{hendrycks2021measuring,
|
164 |
-
title={Measuring Massive Multitask Language Understanding},
|
165 |
-
author={Dan Hendrycks and Collin Burns and Steven Basart and Andy Zou and Mantas Mazeika and Dawn Song and Jacob Steinhardt},
|
166 |
-
year={2021},
|
167 |
-
eprint={2009.03300},
|
168 |
-
archivePrefix={arXiv},
|
169 |
-
primaryClass={cs.CY}
|
170 |
-
}
|
171 |
-
@misc{lin2022truthfulqa,
|
172 |
-
title={TruthfulQA: Measuring How Models Mimic Human Falsehoods},
|
173 |
-
author={Stephanie Lin and Jacob Hilton and Owain Evans},
|
174 |
-
year={2022},
|
175 |
-
eprint={2109.07958},
|
176 |
-
archivePrefix={arXiv},
|
177 |
-
primaryClass={cs.CL}
|
178 |
-
}
|
179 |
-
@misc{DBLP:journals/corr/abs-1907-10641,
|
180 |
-
title={{WINOGRANDE:} An Adversarial Winograd Schema Challenge at Scale},
|
181 |
-
author={Keisuke Sakaguchi and Ronan Le Bras and Chandra Bhagavatula and Yejin Choi},
|
182 |
-
year={2019},
|
183 |
-
eprint={1907.10641},
|
184 |
-
archivePrefix={arXiv},
|
185 |
-
primaryClass={cs.CL}
|
186 |
-
}
|
187 |
-
@misc{DBLP:journals/corr/abs-2110-14168,
|
188 |
-
title={Training Verifiers to Solve Math Word Problems},
|
189 |
-
author={Karl Cobbe and
|
190 |
-
Vineet Kosaraju and
|
191 |
-
Mohammad Bavarian and
|
192 |
-
Mark Chen and
|
193 |
-
Heewoo Jun and
|
194 |
-
Lukasz Kaiser and
|
195 |
-
Matthias Plappert and
|
196 |
-
Jerry Tworek and
|
197 |
-
Jacob Hilton and
|
198 |
-
Reiichiro Nakano and
|
199 |
-
Christopher Hesse and
|
200 |
-
John Schulman},
|
201 |
-
year={2021},
|
202 |
-
eprint={2110.14168},
|
203 |
-
archivePrefix={arXiv},
|
204 |
-
primaryClass={cs.CL}
|
205 |
-
}
|
206 |
-
@misc{DBLP:journals/corr/abs-1903-00161,
|
207 |
-
title={{DROP:} {A} Reading Comprehension Benchmark Requiring Discrete Reasoning
|
208 |
-
Over Paragraphs},
|
209 |
-
author={Dheeru Dua and
|
210 |
-
Yizhong Wang and
|
211 |
-
Pradeep Dasigi and
|
212 |
-
Gabriel Stanovsky and
|
213 |
-
Sameer Singh and
|
214 |
-
Matt Gardner},
|
215 |
-
year={2019},
|
216 |
-
eprinttype={arXiv},
|
217 |
-
eprint={1903.00161},
|
218 |
-
primaryClass={cs.CL}
|
219 |
}"""
|
|
|
10 |
"""
|
11 |
|
12 |
LLM_BENCHMARKS_TEXT = f"""
|
13 |
+
XXX
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
"""
|
15 |
|
16 |
EVALUATION_QUEUE_TEXT = """
|
17 |
+
XXX
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
"""
|
19 |
|
20 |
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
|
21 |
CITATION_BUTTON_TEXT = r"""
|
22 |
+
@misc{hallucinations-leaderboard,
|
23 |
+
author = {Pasquale Minervini},
|
24 |
+
title = {Hallucinations Leaderboard},
|
25 |
year = {2023},
|
26 |
publisher = {Hugging Face},
|
27 |
+
howpublished = "\url{https://huggingface.co/spaces/hallucinations-leaderboard/leaderboard}"
|
28 |
}
|
29 |
@software{eval-harness,
|
30 |
author = {Gao, Leo and
|
|
|
52 |
doi = {10.5281/zenodo.5371628},
|
53 |
url = {https://doi.org/10.5281/zenodo.5371628}
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}"""
|
src/display/utils.py
CHANGED
@@ -3,6 +3,7 @@ from enum import Enum
|
|
3 |
|
4 |
import pandas as pd
|
5 |
|
|
|
6 |
def fields(raw_class):
|
7 |
return [v for k, v in raw_class.__dict__.items() if k[:2] != "__" and k[-2:] != "__"]
|
8 |
|
@@ -14,14 +15,15 @@ class Task:
|
|
14 |
col_name: str
|
15 |
|
16 |
class Tasks(Enum):
|
17 |
-
arc = Task("arc:challenge", "acc_norm", "ARC")
|
18 |
-
hellaswag = Task("hellaswag", "acc_norm", "HellaSwag")
|
19 |
-
mmlu = Task("hendrycksTest", "acc", "MMLU")
|
20 |
-
truthfulqa = Task("truthfulqa:mc", "mc2", "TruthfulQA")
|
21 |
# winogrande = Task("winogrande", "acc", "Winogrande")
|
22 |
# gsm8k = Task("gsm8k", "acc", "GSM8K")
|
23 |
-
drop = Task("drop", "f1", "DROP")
|
24 |
nqopen = Task("nq_open", "em", "NQ Open")
|
|
|
25 |
|
26 |
# These classes are for user facing column names,
|
27 |
# to avoid having to change them all around the code
|
@@ -69,51 +71,10 @@ class EvalQueueColumn: # Queue column
|
|
69 |
status = ColumnContent("status", "str", True)
|
70 |
|
71 |
|
72 |
-
baseline_row = {
|
73 |
-
AutoEvalColumn.model.name: "<p>Baseline</p>",
|
74 |
-
AutoEvalColumn.revision.name: "N/A",
|
75 |
-
AutoEvalColumn.precision.name: None,
|
76 |
-
AutoEvalColumn.average.name: 31.0,
|
77 |
-
AutoEvalColumn.arc.name: 25.0,
|
78 |
-
AutoEvalColumn.hellaswag.name: 25.0,
|
79 |
-
AutoEvalColumn.mmlu.name: 25.0,
|
80 |
-
AutoEvalColumn.truthfulqa.name: 25.0,
|
81 |
-
# AutoEvalColumn.winogrande.name: 50.0,
|
82 |
-
# AutoEvalColumn.gsm8k.name: 0.21,
|
83 |
-
AutoEvalColumn.drop.name: 0.47,
|
84 |
-
AutoEvalColumn.dummy.name: "baseline",
|
85 |
-
AutoEvalColumn.model_type.name: "",
|
86 |
-
}
|
87 |
-
|
88 |
-
# Average ⬆️ human baseline is 0.897 (source: averaging human baselines below)
|
89 |
-
# ARC human baseline is 0.80 (source: https://lab42.global/arc/)
|
90 |
-
# HellaSwag human baseline is 0.95 (source: https://deepgram.com/learn/hellaswag-llm-benchmark-guide)
|
91 |
-
# MMLU human baseline is 0.898 (source: https://openreview.net/forum?id=d7KBjmI3GmQ)
|
92 |
-
# TruthfulQA human baseline is 0.94(source: https://arxiv.org/pdf/2109.07958.pdf)
|
93 |
-
# Drop: https://leaderboard.allenai.org/drop/submissions/public
|
94 |
-
# Winogrande: https://leaderboard.allenai.org/winogrande/submissions/public
|
95 |
-
# GSM8K: paper
|
96 |
-
# Define the human baselines
|
97 |
-
human_baseline_row = {
|
98 |
-
AutoEvalColumn.model.name: "<p>Human performance</p>",
|
99 |
-
AutoEvalColumn.revision.name: "N/A",
|
100 |
-
AutoEvalColumn.precision.name: None,
|
101 |
-
AutoEvalColumn.average.name: 92.75,
|
102 |
-
AutoEvalColumn.arc.name: 80.0,
|
103 |
-
AutoEvalColumn.hellaswag.name: 95.0,
|
104 |
-
AutoEvalColumn.mmlu.name: 89.8,
|
105 |
-
AutoEvalColumn.truthfulqa.name: 94.0,
|
106 |
-
# AutoEvalColumn.winogrande.name: 94.0,
|
107 |
-
# AutoEvalColumn.gsm8k.name: 100,
|
108 |
-
AutoEvalColumn.drop.name: 96.42,
|
109 |
-
AutoEvalColumn.dummy.name: "human_baseline",
|
110 |
-
AutoEvalColumn.model_type.name: "",
|
111 |
-
}
|
112 |
-
|
113 |
@dataclass
|
114 |
class ModelDetails:
|
115 |
name: str
|
116 |
-
symbol: str = ""
|
117 |
|
118 |
|
119 |
class ModelType(Enum):
|
@@ -138,12 +99,15 @@ class ModelType(Enum):
|
|
138 |
return ModelType.IFT
|
139 |
return ModelType.Unknown
|
140 |
|
|
|
141 |
class WeightType(Enum):
|
142 |
Adapter = ModelDetails("Adapter")
|
143 |
Original = ModelDetails("Original")
|
144 |
Delta = ModelDetails("Delta")
|
145 |
|
|
|
146 |
class Precision(Enum):
|
|
|
147 |
float16 = ModelDetails("float16")
|
148 |
bfloat16 = ModelDetails("bfloat16")
|
149 |
qt_8bit = ModelDetails("8bit")
|
@@ -151,7 +115,10 @@ class Precision(Enum):
|
|
151 |
qt_GPTQ = ModelDetails("GPTQ")
|
152 |
Unknown = ModelDetails("?")
|
153 |
|
154 |
-
|
|
|
|
|
|
|
155 |
if precision in ["torch.float16", "float16"]:
|
156 |
return Precision.float16
|
157 |
if precision in ["torch.bfloat16", "bfloat16"]:
|
@@ -165,8 +132,6 @@ class Precision(Enum):
|
|
165 |
return Precision.Unknown
|
166 |
|
167 |
|
168 |
-
|
169 |
-
|
170 |
# Column selection
|
171 |
COLS = [c.name for c in fields(AutoEvalColumn) if not c.hidden]
|
172 |
TYPES = [c.type for c in fields(AutoEvalColumn) if not c.hidden]
|
|
|
3 |
|
4 |
import pandas as pd
|
5 |
|
6 |
+
|
7 |
def fields(raw_class):
|
8 |
return [v for k, v in raw_class.__dict__.items() if k[:2] != "__" and k[-2:] != "__"]
|
9 |
|
|
|
15 |
col_name: str
|
16 |
|
17 |
class Tasks(Enum):
|
18 |
+
# arc = Task("arc:challenge", "acc_norm", "ARC")
|
19 |
+
# hellaswag = Task("hellaswag", "acc_norm", "HellaSwag")
|
20 |
+
# mmlu = Task("hendrycksTest", "acc", "MMLU")
|
21 |
+
# truthfulqa = Task("truthfulqa:mc", "mc2", "TruthfulQA")
|
22 |
# winogrande = Task("winogrande", "acc", "Winogrande")
|
23 |
# gsm8k = Task("gsm8k", "acc", "GSM8K")
|
24 |
+
# drop = Task("drop", "f1", "DROP")
|
25 |
nqopen = Task("nq_open", "em", "NQ Open")
|
26 |
+
triviaqa = Task("triviaqa", "em", "TriviaQA")
|
27 |
|
28 |
# These classes are for user facing column names,
|
29 |
# to avoid having to change them all around the code
|
|
|
71 |
status = ColumnContent("status", "str", True)
|
72 |
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
@dataclass
|
75 |
class ModelDetails:
|
76 |
name: str
|
77 |
+
symbol: str = "" # emoji, only for the model type
|
78 |
|
79 |
|
80 |
class ModelType(Enum):
|
|
|
99 |
return ModelType.IFT
|
100 |
return ModelType.Unknown
|
101 |
|
102 |
+
|
103 |
class WeightType(Enum):
|
104 |
Adapter = ModelDetails("Adapter")
|
105 |
Original = ModelDetails("Original")
|
106 |
Delta = ModelDetails("Delta")
|
107 |
|
108 |
+
|
109 |
class Precision(Enum):
|
110 |
+
float32 = ModelDetails("float32")
|
111 |
float16 = ModelDetails("float16")
|
112 |
bfloat16 = ModelDetails("bfloat16")
|
113 |
qt_8bit = ModelDetails("8bit")
|
|
|
115 |
qt_GPTQ = ModelDetails("GPTQ")
|
116 |
Unknown = ModelDetails("?")
|
117 |
|
118 |
+
@staticmethod
|
119 |
+
def from_str(precision: str):
|
120 |
+
if precision in ["torch.float32", "float32"]:
|
121 |
+
return Precision.float32
|
122 |
if precision in ["torch.float16", "float16"]:
|
123 |
return Precision.float16
|
124 |
if precision in ["torch.bfloat16", "bfloat16"]:
|
|
|
132 |
return Precision.Unknown
|
133 |
|
134 |
|
|
|
|
|
135 |
# Column selection
|
136 |
COLS = [c.name for c in fields(AutoEvalColumn) if not c.hidden]
|
137 |
TYPES = [c.type for c in fields(AutoEvalColumn) if not c.hidden]
|
src/leaderboard/read_evals.py
CHANGED
@@ -5,8 +5,6 @@ import os
|
|
5 |
from dataclasses import dataclass
|
6 |
|
7 |
import dateutil
|
8 |
-
from datetime import datetime
|
9 |
-
from transformers import AutoConfig
|
10 |
import numpy as np
|
11 |
|
12 |
from src.display.formatting import make_clickable_model
|
@@ -59,9 +57,8 @@ class EvalResult:
|
|
59 |
result_key = f"{org}_{model}_{precision.value.name}"
|
60 |
full_model = "/".join(org_and_model)
|
61 |
|
62 |
-
still_on_hub, error, model_config =
|
63 |
-
full_model, config.get("model_sha", "main"), trust_remote_code=True, test_tokenizer=False
|
64 |
-
)
|
65 |
architecture = "?"
|
66 |
if model_config is not None:
|
67 |
architectures = getattr(model_config, "architectures", None)
|
@@ -96,21 +93,19 @@ class EvalResult:
|
|
96 |
mean_acc = np.mean(accs) * 100.0
|
97 |
results[task.benchmark] = mean_acc
|
98 |
|
|
|
|
|
99 |
# XXX
|
100 |
if 'nq_open' not in results:
|
101 |
results['nq_open'] = 0.0
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
revision= config.get("model_sha", ""),
|
111 |
-
still_on_hub=still_on_hub,
|
112 |
-
architecture=architecture
|
113 |
-
)
|
114 |
|
115 |
def update_with_request_file(self, requests_path):
|
116 |
"""Finds the relevant request file for the current model and updates info with it"""
|
@@ -191,6 +186,9 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
|
|
191 |
except dateutil.parser._parser.ParserError:
|
192 |
files = [files[-1]]
|
193 |
|
|
|
|
|
|
|
194 |
for file in files:
|
195 |
model_result_filepaths.append(os.path.join(root, file))
|
196 |
|
@@ -207,6 +205,8 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
|
|
207 |
else:
|
208 |
eval_results[eval_name] = eval_result
|
209 |
|
|
|
|
|
210 |
results = []
|
211 |
for v in eval_results.values():
|
212 |
try:
|
@@ -215,4 +215,6 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
|
|
215 |
except KeyError: # not all eval values present
|
216 |
continue
|
217 |
|
|
|
|
|
218 |
return results
|
|
|
5 |
from dataclasses import dataclass
|
6 |
|
7 |
import dateutil
|
|
|
|
|
8 |
import numpy as np
|
9 |
|
10 |
from src.display.formatting import make_clickable_model
|
|
|
57 |
result_key = f"{org}_{model}_{precision.value.name}"
|
58 |
full_model = "/".join(org_and_model)
|
59 |
|
60 |
+
still_on_hub, error, model_config = \
|
61 |
+
is_model_on_hub(full_model, config.get("model_sha", "main"), trust_remote_code=True, test_tokenizer=False)
|
|
|
62 |
architecture = "?"
|
63 |
if model_config is not None:
|
64 |
architectures = getattr(model_config, "architectures", None)
|
|
|
93 |
mean_acc = np.mean(accs) * 100.0
|
94 |
results[task.benchmark] = mean_acc
|
95 |
|
96 |
+
# print(json_filepath, results)
|
97 |
+
|
98 |
# XXX
|
99 |
if 'nq_open' not in results:
|
100 |
results['nq_open'] = 0.0
|
101 |
|
102 |
+
# XXX
|
103 |
+
if 'triviaqa' not in results:
|
104 |
+
results['triviaqa'] = 0.0
|
105 |
+
|
106 |
+
return self(eval_name=result_key, full_model=full_model, org=org, model=model, results=results,
|
107 |
+
precision=precision, revision=config.get("model_sha", ""), still_on_hub=still_on_hub,
|
108 |
+
architecture=architecture)
|
|
|
|
|
|
|
|
|
109 |
|
110 |
def update_with_request_file(self, requests_path):
|
111 |
"""Finds the relevant request file for the current model and updates info with it"""
|
|
|
186 |
except dateutil.parser._parser.ParserError:
|
187 |
files = [files[-1]]
|
188 |
|
189 |
+
# if '125m' in root:
|
190 |
+
# breakpoint()
|
191 |
+
|
192 |
for file in files:
|
193 |
model_result_filepaths.append(os.path.join(root, file))
|
194 |
|
|
|
205 |
else:
|
206 |
eval_results[eval_name] = eval_result
|
207 |
|
208 |
+
# breakpoint()
|
209 |
+
|
210 |
results = []
|
211 |
for v in eval_results.values():
|
212 |
try:
|
|
|
215 |
except KeyError: # not all eval values present
|
216 |
continue
|
217 |
|
218 |
+
# print('XXX', results_path, requests_path, results)
|
219 |
+
|
220 |
return results
|
src/populate.py
CHANGED
@@ -4,19 +4,19 @@ import os
|
|
4 |
import pandas as pd
|
5 |
|
6 |
from src.display.formatting import has_no_nan_values, make_clickable_model
|
7 |
-
from src.display.utils import AutoEvalColumn, EvalQueueColumn
|
8 |
from src.leaderboard.filter_models import filter_models
|
9 |
from src.leaderboard.read_evals import get_raw_eval_results
|
10 |
|
11 |
|
12 |
-
def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
|
13 |
# Returns a list of EvalResult
|
14 |
-
#
|
15 |
# EvalResult(eval_name='EleutherAI_pythia-1.3b_torch.float16', full_model='EleutherAI/pythia-1.3b', org='EleutherAI', model='pythia-1.3b', revision='34b668ff0acfe56f2d541aa46b385557ee39eb3f', results={'arc:challenge': 31.14334470989761, 'hellaswag': 51.43397729535949, 'hendrycksTest': 26.55151159544371, 'truthfulqa:mc': 39.24322830092449, 'winogrande': 57.37963693764798, 'gsm8k': 0.9855951478392722, 'drop': 4.056312919463095}, precision='torch.float16', model_type=<ModelType.PT: ModelTypeDetails(name='pretrained', symbol='🟢')>, weight_type='Original', architecture='GPTNeoXForCausalLM', license='apache-2.0', likes=7, num_params=1.312, date='2023-09-09T10:52:17Z', still_on_hub=True)
|
16 |
# EvalResult and get_raw_eval_results are defined in ./src/leaderboard/read_evals.py, the results slots are not hardcoded
|
17 |
raw_data = get_raw_eval_results(results_path, requests_path)
|
18 |
all_data_json = [v.to_dict() for v in raw_data]
|
19 |
-
all_data_json.append(baseline_row)
|
20 |
filter_models(all_data_json)
|
21 |
|
22 |
df = pd.DataFrame.from_records(all_data_json)
|
@@ -28,7 +28,7 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
28 |
return raw_data, df
|
29 |
|
30 |
|
31 |
-
def get_evaluation_queue_df(save_path: str, cols: list) ->
|
32 |
entries = [entry for entry in os.listdir(save_path) if not entry.startswith(".")]
|
33 |
all_evals = []
|
34 |
|
|
|
4 |
import pandas as pd
|
5 |
|
6 |
from src.display.formatting import has_no_nan_values, make_clickable_model
|
7 |
+
from src.display.utils import AutoEvalColumn, EvalQueueColumn
|
8 |
from src.leaderboard.filter_models import filter_models
|
9 |
from src.leaderboard.read_evals import get_raw_eval_results
|
10 |
|
11 |
|
12 |
+
def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchmark_cols: list) -> tuple[dict, pd.DataFrame]:
|
13 |
# Returns a list of EvalResult
|
14 |
+
# raw_data[0]:
|
15 |
# EvalResult(eval_name='EleutherAI_pythia-1.3b_torch.float16', full_model='EleutherAI/pythia-1.3b', org='EleutherAI', model='pythia-1.3b', revision='34b668ff0acfe56f2d541aa46b385557ee39eb3f', results={'arc:challenge': 31.14334470989761, 'hellaswag': 51.43397729535949, 'hendrycksTest': 26.55151159544371, 'truthfulqa:mc': 39.24322830092449, 'winogrande': 57.37963693764798, 'gsm8k': 0.9855951478392722, 'drop': 4.056312919463095}, precision='torch.float16', model_type=<ModelType.PT: ModelTypeDetails(name='pretrained', symbol='🟢')>, weight_type='Original', architecture='GPTNeoXForCausalLM', license='apache-2.0', likes=7, num_params=1.312, date='2023-09-09T10:52:17Z', still_on_hub=True)
|
16 |
# EvalResult and get_raw_eval_results are defined in ./src/leaderboard/read_evals.py, the results slots are not hardcoded
|
17 |
raw_data = get_raw_eval_results(results_path, requests_path)
|
18 |
all_data_json = [v.to_dict() for v in raw_data]
|
19 |
+
# all_data_json.append(baseline_row)
|
20 |
filter_models(all_data_json)
|
21 |
|
22 |
df = pd.DataFrame.from_records(all_data_json)
|
|
|
28 |
return raw_data, df
|
29 |
|
30 |
|
31 |
+
def get_evaluation_queue_df(save_path: str, cols: list) -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]:
|
32 |
entries = [entry for entry in os.listdir(save_path) if not entry.startswith(".")]
|
33 |
all_evals = []
|
34 |
|
src/tools/plots.py
CHANGED
@@ -4,12 +4,11 @@ import plotly.express as px
|
|
4 |
from plotly.graph_objs import Figure
|
5 |
|
6 |
from src.leaderboard.filter_models import FLAGGED_MODELS
|
7 |
-
from src.display.utils import
|
8 |
from src.leaderboard.read_evals import EvalResult
|
9 |
|
10 |
|
11 |
-
|
12 |
-
def create_scores_df(raw_data: list[EvalResult]) -> pd.DataFrame:
|
13 |
"""
|
14 |
Generates a DataFrame containing the maximum scores until each date.
|
15 |
|
@@ -77,9 +76,7 @@ def create_plot_df(scores_df: dict[str: pd.DataFrame]) -> pd.DataFrame:
|
|
77 |
return concat_df
|
78 |
|
79 |
|
80 |
-
def create_metric_plot_obj(
|
81 |
-
df: pd.DataFrame, metrics: list[str], title: str
|
82 |
-
) -> Figure:
|
83 |
"""
|
84 |
Create a Plotly figure object with lines representing different metrics
|
85 |
and horizontal dotted lines representing human baselines.
|
@@ -96,7 +93,7 @@ def create_metric_plot_obj(
|
|
96 |
df = df[df["task"].isin(metrics)]
|
97 |
|
98 |
# Filter the human baselines based on the specified metrics
|
99 |
-
filtered_human_baselines = {k: v for k, v in HUMAN_BASELINE.items() if k in metrics}
|
100 |
|
101 |
# Create a line figure using plotly express with specified markers and custom data
|
102 |
fig = px.line(
|
@@ -131,21 +128,6 @@ def create_metric_plot_obj(
|
|
131 |
for trace in fig.data:
|
132 |
metric_color_mapping[trace.name] = trace.line.color
|
133 |
|
134 |
-
# Iterate over filtered human baselines and add horizontal lines to the figure
|
135 |
-
for metric, value in filtered_human_baselines.items():
|
136 |
-
color = metric_color_mapping.get(metric, "blue") # Retrieve color from mapping; default to blue if not found
|
137 |
-
location = "top left" if metric == "HellaSwag" else "bottom left" # Set annotation position
|
138 |
-
# Add horizontal line with matched color and positioned annotation
|
139 |
-
fig.add_hline(
|
140 |
-
y=value,
|
141 |
-
line_dash="dot",
|
142 |
-
annotation_text=f"{metric} human baseline",
|
143 |
-
annotation_position=location,
|
144 |
-
annotation_font_size=10,
|
145 |
-
annotation_font_color=color,
|
146 |
-
line_color=color,
|
147 |
-
)
|
148 |
-
|
149 |
return fig
|
150 |
|
151 |
|
|
|
4 |
from plotly.graph_objs import Figure
|
5 |
|
6 |
from src.leaderboard.filter_models import FLAGGED_MODELS
|
7 |
+
from src.display.utils import AutoEvalColumn, Tasks, Task, BENCHMARK_COLS
|
8 |
from src.leaderboard.read_evals import EvalResult
|
9 |
|
10 |
|
11 |
+
def create_scores_df(raw_data: list[EvalResult]) -> dict[str, pd.DataFrame]:
|
|
|
12 |
"""
|
13 |
Generates a DataFrame containing the maximum scores until each date.
|
14 |
|
|
|
76 |
return concat_df
|
77 |
|
78 |
|
79 |
+
def create_metric_plot_obj(df: pd.DataFrame, metrics: list[str], title: str) -> Figure:
|
|
|
|
|
80 |
"""
|
81 |
Create a Plotly figure object with lines representing different metrics
|
82 |
and horizontal dotted lines representing human baselines.
|
|
|
93 |
df = df[df["task"].isin(metrics)]
|
94 |
|
95 |
# Filter the human baselines based on the specified metrics
|
96 |
+
# filtered_human_baselines = {k: v for k, v in HUMAN_BASELINE.items() if k in metrics}
|
97 |
|
98 |
# Create a line figure using plotly express with specified markers and custom data
|
99 |
fig = px.line(
|
|
|
128 |
for trace in fig.data:
|
129 |
metric_color_mapping[trace.name] = trace.line.color
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
return fig
|
132 |
|
133 |
|