Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 13,066 Bytes
2a5f9fb 7499b46 43c2b1a 95f85ed 7499b46 58733e4 eef299c 7499b46 67cd6fc 7499b46 67cd6fc 7499b46 439afd4 03f7287 67cd6fc 0227006 77a5f61 439afd4 7499b46 03f7287 439afd4 7499b46 67cd6fc 7499b46 8c49cb6 67cd6fc 6e8f400 d313dbd 439afd4 6e8f400 7499b46 58733e4 8c49cb6 58733e4 d2e8eca d313dbd 256c5d3 7499b46 43c2b1a 7499b46 256c5d3 d313dbd 7499b46 d2e8eca 698f471 d2e8eca 7499b46 e3aaf53 7499b46 d16cee2 2246286 395f537 9839977 2246286 d313dbd 12cea14 2246286 77a5f61 183ec61 2246286 1253c3b 7499b46 2246286 1253c3b 2246286 7499b46 2246286 7499b46 2246286 7499b46 2246286 43c2b1a 7499b46 88675db 2246286 d313dbd a761927 2246286 7499b46 eef299c d313dbd 439afd4 d313dbd 2246286 d313dbd 8c49cb6 b323764 1253c3b d313dbd 7499b46 d313dbd 7499b46 ad4383d d313dbd 8c49cb6 06919ed 58733e4 2a73469 c14ac9f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
from src.display.utils import ModelType
from src.display.utils import Tasks
from src.envs import REPO_ID, QUEUE_REPO, RESULTS_REPO, PATH_TO_COLLECTION, LEADERBOARD_NAME, TRUST_REMOTE_CODE, TASK_CONFIG, RAW_RESULTS_REPO
LM_EVAL_URL = "https://github.com/eduagarcia/lm-evaluation-harness-pt"
TITLE = F"""<h1 align="center" id="space-title">π {LEADERBOARD_NAME}</h1>"""
GENERAL_DESCRIPTION = f"π The π {LEADERBOARD_NAME} aims to track, rank and evaluate open LLMs and chatbots. "
SUPPORT_DESCRIPTION = ""
if 'readme' in TASK_CONFIG:
if 'general_description' in TASK_CONFIG['readme']:
GENERAL_DESCRIPTION = TASK_CONFIG['readme']['general_description']
if 'support_description' in TASK_CONFIG['readme']:
SUPPORT_DESCRIPTION = TASK_CONFIG['readme']['support_description']
INTRODUCTION_TEXT = f"""
{GENERAL_DESCRIPTION}
Submit a model for automated evaluation on our GPU cluster on the "Submit" page!
The leaderboard's backend runs on a [fork](https://github.com/eduagarcia/lm-evaluation-harness-pt) of the great [Eleuther AI Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) - read more details in the "About" page!
{SUPPORT_DESCRIPTION}
"""
task_count = 0
TASKS_LIST= ""
for task in Tasks:
task = task.value
data_sources = ""
for i, source in enumerate(task.sources):
if i == 0:
data_sources += " - Data sources: "
else:
data_sources += ", "
data_sources += f"[\\[{i+1}\\]]({source})"
TASKS_LIST += f'- <a href="{task.link}" target="_blank"> {task.col_name} </a> ({task.few_shot}-shot) - {task.description}{data_sources}\n'
task_count += 1
TASKS_PARAMETERS = ""
for task in Tasks:
task = task.value
TASKS_PARAMETERS += f"- {task.col_name}: {task.few_shot}-shot, *{','.join(task.task_list)}* (`{task.metric}`)\n"
ABOUT_DESCRIPTION_CONTEXT = f"""
This is a fork of the <a href="https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard" target="_blank">π€ Open LLM Leaderboard</a> with different benchmarks.
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.
"""
if 'readme' in TASK_CONFIG:
if 'about_description' in TASK_CONFIG['readme']:
ABOUT_DESCRIPTION_CONTEXT = TASK_CONFIG['readme']['about_description']
LLM_BENCHMARKS_TEXT = f"""
# Context
{ABOUT_DESCRIPTION_CONTEXT}
## How it works
π We evaluate models on {task_count} 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.
{TASKS_LIST}
For all these evaluations, a higher score is a better score.
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.
## Details and logs
You can find:
- detailed numerical results in the `results` Hugging Face dataset: https://huggingface.co/datasets/{RESULTS_REPO}
{"- 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" if RAW_RESULTS_REPO is not None else ""}
- community queries and running status in the `requests` Hugging Face dataset: https://huggingface.co/datasets/{QUEUE_REPO}
## Reproducibility
To reproduce our results, here is the commands you can run, using [this fork]({LM_EVAL_URL}) of the Eleuther AI Harness:
`lm_eval --model=huggingface --model_args="pretrained=<your_model>,revision=<your_model_revision>"`
` --tasks=<task_list> --num_fewshot=<n_few_shot> --batch_size=1 --output_path=<output_path> --log_samples --show_config`
The total batch size we get for models which fit on one A100 node is 8 (8 GPUs * 1). If you don't use parallelism, adapt your batch size to fit.
*You can expect results to vary slightly for different batch sizes because of padding.*
The tasks and few shots parameters are:
{TASKS_PARAMETERS}
Side note on the baseline scores:
- The baseline is the random model mean result for the task
## Icons
- {ModelType.PT.to_str(" : ")} model: new, base models, trained on a given corpora
- {ModelType.LA.to_str(" : ")} model: pretained models adapted to another language with more further-pretraining or finetuning
- {ModelType.FT.to_str(" : ")} model: pretrained models finetuned or further-pretrained on more data
- {ModelType.chat.to_str(" : ")} model: chat like fine-tunes, either using IFT (datasets of task instruction), RLHF or DPO (changing the model loss a bit with an added policy), etc
- {ModelType.merges.to_str(" : ")} model: merges or MoErges, models which have been merged or fused without additional fine-tuning.
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!
"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.
## Quantization
To get more information about quantization, see:
- 8 bits: [blog post](https://huggingface.co/blog/hf-bitsandbytes-integration), [paper](https://arxiv.org/abs/2208.07339)
- 4 bits: [blog post](https://huggingface.co/blog/4bit-transformers-bitsandbytes), [paper](https://arxiv.org/abs/2305.14314)
## Useful links
- [Community resources](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard/discussions/174)
- [Collection of best models](https://huggingface.co/collections/{PATH_TO_COLLECTION})
"""
if 'citation' in TASK_CONFIG['readme']:
LLM_BENCHMARKS_TEXT += f"""
## Citation
```bibtex
{TASK_CONFIG['readme']['citation']}
```
"""
REMOTE_CODE_EXAPLANATION = f"- *Yes.*"
if not TRUST_REMOTE_CODE:
REMOTE_CODE_EXAPLANATION = f"- *We only support models that have been integrated in a stable version of the `transformers` library for automatic submission, as we don't want to run possibly unsage code on our cluster.*"
FAQ_TEXT = f"""
---------------------------
# FAQ
Below are some common questions - if this FAQ does not answer you, feel free to create a new issue, and we'll take care of it as soon as we can!
## 1) Submitting a model
My model requires `trust_remote_code=True`, can I submit it?
{REMOTE_CODE_EXAPLANATION}
What about models of type X?
- *We only support models that have been integrated in a stable version of the `transformers` library for automatic submission.*
How can I follow when my model is launched?
- *You can look for its request file [here](https://huggingface.co/datasets/{QUEUE_REPO}) and follow the status evolution, or directly in the queues above the submit form.*
My model disappeared from all the queues, what happened?
- *A model disappearing from all the queues usually means that there has been a failure. You can check if that is the case by looking for your model [here](https://huggingface.co/datasets/{QUEUE_REPO}).*
What causes an evaluation failure?
- *Most of the failures we get come from problems in the submissions (corrupted files, config problems, wrong parameters selected for eval ...), so we'll be grateful if you first make sure you have followed the steps in `About`. However, from time to time, we have failures on our side (hardware/node failures, problem with an update of our backend, connectivity problem ending up in the results not being saved, ...).*
How can I report an evaluation failure?
- *As we store the logs for all models, feel free to create an issue, **where you link to the requests file of your model** (look for it [here](https://huggingface.co/datasets/{QUEUE_REPO}/tree/main)), so we can investigate! If the model failed due to a problem on our side, we'll relaunch it right away!*
*Note: Please do not re-upload your model under a different name, it will not help*
## 2) Model results
What kind of information can I find?
- *Let's imagine you are interested in the Yi-34B results. You have access to {"3" if RAW_RESULTS_REPO is not None else "2"} different information categories:*
- *The [request file](https://huggingface.co/datasets/{QUEUE_REPO}/blob/main/01-ai/Yi-34B_eval_request_False_bfloat16_Original.json): it gives you information about the status of the evaluation*
- *The [aggregated results folder](https://huggingface.co/datasets/{RESULTS_REPO}/tree/main/01-ai/Yi-34B): it gives you aggregated scores, per experimental run*
{f"- *The [details dataset](https://huggingface.co/datasets/{RAW_RESULTS_REPO}/tree/main/01-ai/Yi-34B): it gives you the full details (scores and examples for each task and a given model)*" if RAW_RESULTS_REPO is not None else ""}
Why do models appear several times in the leaderboard?
- *We run evaluations with user selected precision and model commit. Sometimes, users submit specific models at different commits and at different precisions (for example, in float16 and 4bit to see how quantization affects performance). You should be able to verify this by displaying the `precision` and `model sha` columns in the display. If, however, you see models appearing several time with the same precision and hash commit, this is not normal.*
What is this concept of "flagging"?
- *This mechanism allows user to report models that have unfair performance on the leaderboard. This contains several categories: exceedingly good results on the leaderboard because the model was (maybe accidentally) trained on the evaluation data, models that are copy of other models not atrributed properly, etc.*
My model has been flagged improperly, what can I do?
- *Every flagged model has a discussion associated with it - feel free to plead your case there, and we'll see what to do together with the community.*
## 3) Editing a submission
I upgraded my model and want to re-submit, how can I do that?
- *Please open an issue with the precise name of your model, and we'll remove your model from the leaderboard so you can resubmit. You can also resubmit directly with the new commit hash!*
## 4) Other
I have an issue about accessing the leaderboard through the Gradio API
- *Since this is not the recommended way to access the leaderboard, we won't provide support for this, but you can look at tools provided by the community for inspiration!*
"""
REMOTE_CODE_NOTE = f"Note: if your model needs `use_remote_code=True`, it will not be automatically added to the leaderboard by the Submit tab. You can still [open an issue](discussions/new) to have it manually submitted."
EVALUATION_QUEUE_TEXT = f"""
# Evaluation Queue for the π {LEADERBOARD_NAME}
Models added here will be automatically evaluated on our evaluation cluster.
## First steps before submitting a model
### 1) Make sure you can load your model and tokenizer using AutoClasses:
```python
from transformers import AutoConfig, AutoModel, AutoTokenizer
config = AutoConfig.from_pretrained("your model name", revision=revision)
model = AutoModel.from_pretrained("your model name", revision=revision)
tokenizer = AutoTokenizer.from_pretrained("your model name", revision=revision)
```
If this step fails, follow the error messages to debug your model before submitting it. It's likely your model has been improperly uploaded.
Note: make sure your model is public!
{REMOTE_CODE_NOTE if not TRUST_REMOTE_CODE else ""}
### 2) Convert your model weights to [safetensors](https://huggingface.co/docs/safetensors/index)
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`!
### 3) Fill up your model card
When we add extra information about models to the leaderboard, it will be automatically taken from the model card
### 4) Select the correct precision
Not all models are converted properly from `float16` to `bfloat16`, and selecting the wrong precision can sometimes cause evaluation error (as loading a `bf16` model in `fp16` can sometimes generate NaNs, depending on the weight range).
## In case of model failure
If your model is displayed in the `FAILED` category, its execution stopped.
Make sure you have followed the above steps first.
If everything is done, check you can launch the EleutherAIHarness on your model locally, using the command in the About tab under "Reproducibility" with all arguments specified (you can add `--limit` to limit the number of examples per task).
"""
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
CITATION_BUTTON_TEXT = ""
if 'citation' in TASK_CONFIG['readme']:
CITATION_BUTTON_TEXT += TASK_CONFIG['readme']['citation'] + '\n'
for task in Tasks:
task = task.value
if task.citation is not None:
CITATION_BUTTON_TEXT += task.citation |