Hch Li
commited on
Commit
·
89c9ca7
1
Parent(s):
e584fc1
submission
Browse files- .gitignore +1 -0
- app.py +11 -22
- src/about.py +4 -28
- src/submission/submit.py +32 -95
.gitignore
CHANGED
|
@@ -11,3 +11,4 @@ eval-results/
|
|
| 11 |
eval-queue-bk/
|
| 12 |
eval-results-bk/
|
| 13 |
logs/
|
|
|
|
|
|
| 11 |
eval-queue-bk/
|
| 12 |
eval-results-bk/
|
| 13 |
logs/
|
| 14 |
+
dataset_repo
|
app.py
CHANGED
|
@@ -146,8 +146,12 @@ with demo:
|
|
| 146 |
|
| 147 |
with gr.Row():
|
| 148 |
with gr.Column():
|
| 149 |
-
|
|
|
|
| 150 |
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
|
|
|
|
|
|
|
|
|
| 151 |
model_type = gr.Dropdown(
|
| 152 |
choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],
|
| 153 |
label="Model type",
|
|
@@ -155,35 +159,20 @@ with demo:
|
|
| 155 |
value=None,
|
| 156 |
interactive=True,
|
| 157 |
)
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
precision = gr.Dropdown(
|
| 161 |
-
choices=[i.value.name for i in Precision if i != Precision.Unknown],
|
| 162 |
-
label="Precision",
|
| 163 |
-
multiselect=False,
|
| 164 |
-
value="float16",
|
| 165 |
-
interactive=True,
|
| 166 |
-
)
|
| 167 |
-
weight_type = gr.Dropdown(
|
| 168 |
-
choices=[i.value.name for i in WeightType],
|
| 169 |
-
label="Weights type",
|
| 170 |
-
multiselect=False,
|
| 171 |
-
value="Original",
|
| 172 |
-
interactive=True,
|
| 173 |
-
)
|
| 174 |
-
base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
|
| 175 |
|
| 176 |
submit_button = gr.Button("Submit Eval")
|
| 177 |
submission_result = gr.Markdown()
|
| 178 |
submit_button.click(
|
| 179 |
add_new_eval,
|
| 180 |
[
|
| 181 |
-
|
| 182 |
-
|
| 183 |
revision_name_textbox,
|
| 184 |
-
precision,
|
| 185 |
-
weight_type,
|
| 186 |
model_type,
|
|
|
|
|
|
|
| 187 |
],
|
| 188 |
submission_result,
|
| 189 |
)
|
|
|
|
| 146 |
|
| 147 |
with gr.Row():
|
| 148 |
with gr.Column():
|
| 149 |
+
method_name = gr.Textbox(label="Method name")
|
| 150 |
+
paper_link = gr.Textbox(label = "Paper Link")
|
| 151 |
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
with gr.Column():
|
| 155 |
model_type = gr.Dropdown(
|
| 156 |
choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],
|
| 157 |
label="Model type",
|
|
|
|
| 159 |
value=None,
|
| 160 |
interactive=True,
|
| 161 |
)
|
| 162 |
+
file_link = gr.Textbox(label = "File Link")
|
| 163 |
+
explanatin = gr.Textbox(label = "Explanation")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
submit_button = gr.Button("Submit Eval")
|
| 166 |
submission_result = gr.Markdown()
|
| 167 |
submit_button.click(
|
| 168 |
add_new_eval,
|
| 169 |
[
|
| 170 |
+
method_name,
|
| 171 |
+
paper_link,
|
| 172 |
revision_name_textbox,
|
|
|
|
|
|
|
| 173 |
model_type,
|
| 174 |
+
file_link,
|
| 175 |
+
explanatin,
|
| 176 |
],
|
| 177 |
submission_result,
|
| 178 |
)
|
src/about.py
CHANGED
|
@@ -40,35 +40,11 @@ To reproduce our results, here is the commands you can run:
|
|
| 40 |
"""
|
| 41 |
|
| 42 |
EVALUATION_QUEUE_TEXT = """
|
| 43 |
-
## Some good practices before submitting a
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
```python
|
| 47 |
-
from transformers import AutoConfig, AutoModel, AutoTokenizer
|
| 48 |
-
config = AutoConfig.from_pretrained("your model name", revision=revision)
|
| 49 |
-
model = AutoModel.from_pretrained("your model name", revision=revision)
|
| 50 |
-
tokenizer = AutoTokenizer.from_pretrained("your model name", revision=revision)
|
| 51 |
-
```
|
| 52 |
-
If this step fails, follow the error messages to debug your model before submitting it. It's likely your model has been improperly uploaded.
|
| 53 |
-
|
| 54 |
-
Note: make sure your model is public!
|
| 55 |
-
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!
|
| 56 |
-
|
| 57 |
-
### 2) Convert your model weights to [safetensors](https://huggingface.co/docs/safetensors/index)
|
| 58 |
-
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`!
|
| 59 |
-
|
| 60 |
-
### 3) Make sure your model has an open license!
|
| 61 |
-
This is a leaderboard for Open LLMs, and we'd love for as many people as possible to know they can use your model 🤗
|
| 62 |
-
|
| 63 |
-
### 4) Fill up your model card
|
| 64 |
-
When we add extra information about models to the leaderboard, it will be automatically taken from the model card
|
| 65 |
-
|
| 66 |
-
## In case of model failure
|
| 67 |
-
If your model is displayed in the `FAILED` category, its execution stopped.
|
| 68 |
-
Make sure you have followed the above steps first.
|
| 69 |
-
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).
|
| 70 |
"""
|
| 71 |
|
| 72 |
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
|
| 73 |
-
CITATION_BUTTON_TEXT = r"""
|
| 74 |
"""
|
|
|
|
| 40 |
"""
|
| 41 |
|
| 42 |
EVALUATION_QUEUE_TEXT = """
|
| 43 |
+
## Some good practices before submitting a baseline file.
|
| 44 |
+
TODO
|
| 45 |
+
We will run it for you offline!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
"""
|
| 47 |
|
| 48 |
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
|
| 49 |
+
CITATION_BUTTON_TEXT = r"""KV Benchmark!
|
| 50 |
"""
|
src/submission/submit.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
from datetime import datetime, timezone
|
|
|
|
| 4 |
|
| 5 |
from src.display.formatting import styled_error, styled_message, styled_warning
|
| 6 |
from src.envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
|
|
@@ -14,105 +15,41 @@ from src.submission.check_validity import (
|
|
| 14 |
REQUESTED_MODELS = None
|
| 15 |
USERS_TO_SUBMISSION_DATES = None
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
def add_new_eval(
|
| 18 |
-
|
| 19 |
-
|
| 20 |
revision: str,
|
| 21 |
-
precision: str,
|
| 22 |
-
weight_type: str,
|
| 23 |
model_type: str,
|
|
|
|
|
|
|
| 24 |
):
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
REQUESTED_MODELS, USERS_TO_SUBMISSION_DATES = already_submitted_models(EVAL_REQUESTS_PATH)
|
| 29 |
-
|
| 30 |
-
user_name = ""
|
| 31 |
-
model_path = model
|
| 32 |
-
if "/" in model:
|
| 33 |
-
user_name = model.split("/")[0]
|
| 34 |
-
model_path = model.split("/")[1]
|
| 35 |
-
|
| 36 |
-
precision = precision.split(" ")[0]
|
| 37 |
-
current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 38 |
-
|
| 39 |
-
if model_type is None or model_type == "":
|
| 40 |
-
return styled_error("Please select a model type.")
|
| 41 |
-
|
| 42 |
-
# Does the model actually exist?
|
| 43 |
-
if revision == "":
|
| 44 |
-
revision = "main"
|
| 45 |
-
|
| 46 |
-
# Is the model on the hub?
|
| 47 |
-
if weight_type in ["Delta", "Adapter"]:
|
| 48 |
-
base_model_on_hub, error, _ = is_model_on_hub(model_name=base_model, revision=revision, token=TOKEN, test_tokenizer=True)
|
| 49 |
-
if not base_model_on_hub:
|
| 50 |
-
return styled_error(f'Base model "{base_model}" {error}')
|
| 51 |
-
|
| 52 |
-
if not weight_type == "Adapter":
|
| 53 |
-
model_on_hub, error, _ = is_model_on_hub(model_name=model, revision=revision, token=TOKEN, test_tokenizer=True)
|
| 54 |
-
if not model_on_hub:
|
| 55 |
-
return styled_error(f'Model "{model}" {error}')
|
| 56 |
-
|
| 57 |
-
# Is the model info correctly filled?
|
| 58 |
-
try:
|
| 59 |
-
model_info = API.model_info(repo_id=model, revision=revision)
|
| 60 |
-
except Exception:
|
| 61 |
-
return styled_error("Could not get your model information. Please fill it up properly.")
|
| 62 |
-
|
| 63 |
-
model_size = get_model_size(model_info=model_info, precision=precision)
|
| 64 |
-
|
| 65 |
-
# Were the model card and license filled?
|
| 66 |
-
try:
|
| 67 |
-
license = model_info.cardData["license"]
|
| 68 |
-
except Exception:
|
| 69 |
-
return styled_error("Please select a license for your model")
|
| 70 |
-
|
| 71 |
-
modelcard_OK, error_msg = check_model_card(model)
|
| 72 |
-
if not modelcard_OK:
|
| 73 |
-
return styled_error(error_msg)
|
| 74 |
-
|
| 75 |
-
# Seems good, creating the eval
|
| 76 |
-
print("Adding new eval")
|
| 77 |
-
|
| 78 |
-
eval_entry = {
|
| 79 |
-
"model": model,
|
| 80 |
-
"base_model": base_model,
|
| 81 |
-
"revision": revision,
|
| 82 |
-
"precision": precision,
|
| 83 |
-
"weight_type": weight_type,
|
| 84 |
-
"status": "PENDING",
|
| 85 |
-
"submitted_time": current_time,
|
| 86 |
-
"model_type": model_type,
|
| 87 |
-
"likes": model_info.likes,
|
| 88 |
-
"params": model_size,
|
| 89 |
-
"license": license,
|
| 90 |
-
"private": False,
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
# Check for duplicate submission
|
| 94 |
-
if f"{model}_{revision}_{precision}" in REQUESTED_MODELS:
|
| 95 |
-
return styled_warning("This model has been already submitted.")
|
| 96 |
-
|
| 97 |
-
print("Creating eval file")
|
| 98 |
-
OUT_DIR = f"{EVAL_REQUESTS_PATH}/{user_name}"
|
| 99 |
-
os.makedirs(OUT_DIR, exist_ok=True)
|
| 100 |
-
out_path = f"{OUT_DIR}/{model_path}_eval_request_False_{precision}_{weight_type}.json"
|
| 101 |
-
|
| 102 |
-
with open(out_path, "w") as f:
|
| 103 |
-
f.write(json.dumps(eval_entry))
|
| 104 |
-
|
| 105 |
-
print("Uploading eval file")
|
| 106 |
-
API.upload_file(
|
| 107 |
-
path_or_fileobj=out_path,
|
| 108 |
-
path_in_repo=out_path.split("eval-queue/")[1],
|
| 109 |
-
repo_id=QUEUE_REPO,
|
| 110 |
-
repo_type="dataset",
|
| 111 |
-
commit_message=f"Add {model} to eval queue",
|
| 112 |
-
)
|
| 113 |
-
|
| 114 |
-
# Remove the local file
|
| 115 |
-
os.remove(out_path)
|
| 116 |
|
| 117 |
return styled_message(
|
| 118 |
"Your request has been submitted to the evaluation queue!\nPlease wait for up to an hour for the model to show in the PENDING list."
|
|
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
from datetime import datetime, timezone
|
| 4 |
+
from huggingface_hub import Repository
|
| 5 |
|
| 6 |
from src.display.formatting import styled_error, styled_message, styled_warning
|
| 7 |
from src.envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
|
|
|
|
| 15 |
REQUESTED_MODELS = None
|
| 16 |
USERS_TO_SUBMISSION_DATES = None
|
| 17 |
|
| 18 |
+
def write_strings_to_dataset(dataset_repo: str, file_name: str, strings: list):
|
| 19 |
+
"""
|
| 20 |
+
Write strings to a new file in a Hugging Face dataset repository.
|
| 21 |
+
|
| 22 |
+
Args:
|
| 23 |
+
dataset_repo (str): Repository name (e.g., "username/dataset_name").
|
| 24 |
+
file_name (str): Name of the new file to create.
|
| 25 |
+
strings (list): List of strings to write to the file.
|
| 26 |
+
token (str): Hugging Face token for authentication.
|
| 27 |
+
"""
|
| 28 |
+
# Clone the repository locally
|
| 29 |
+
repo = Repository(local_dir="dataset_repo", clone_from=dataset_repo)
|
| 30 |
+
repo.git_pull() # Ensure you have the latest changes
|
| 31 |
+
|
| 32 |
+
# Write strings to the new file
|
| 33 |
+
file_path = f"dataset_repo/{file_name}"
|
| 34 |
+
with open(file_path, "w") as f:
|
| 35 |
+
f.write("\n".join(strings))
|
| 36 |
+
|
| 37 |
+
# Commit and push the new file to the repository
|
| 38 |
+
repo.git_add(file_name)
|
| 39 |
+
repo.git_commit(f"Add new file: {file_name}")
|
| 40 |
+
repo.git_push()
|
| 41 |
+
|
| 42 |
def add_new_eval(
|
| 43 |
+
method: str,
|
| 44 |
+
paper: str,
|
| 45 |
revision: str,
|
|
|
|
|
|
|
| 46 |
model_type: str,
|
| 47 |
+
file_link: str,
|
| 48 |
+
explanation: str,
|
| 49 |
):
|
| 50 |
+
str_list = [method, paper, revision, model_type, file_link, explanation]
|
| 51 |
+
submission_dataset = "https://huggingface.co/datasets/lmcache-benchmark/submissions"
|
| 52 |
+
write_strings_to_dataset(submission_dataset, f"{method}_{model_type}_{revision}_record", str_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
return styled_message(
|
| 55 |
"Your request has been submitted to the evaluation queue!\nPlease wait for up to an hour for the model to show in the PENDING list."
|