Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,8 +13,9 @@ from io import BytesIO
|
|
| 13 |
import tempfile
|
| 14 |
import sys
|
| 15 |
|
|
|
|
| 16 |
# --------------------------------------------------------------------
|
| 17 |
-
# PART 1: YOUR EXISTING DATA & PLOTS
|
| 18 |
# --------------------------------------------------------------------
|
| 19 |
|
| 20 |
data_full = [
|
|
@@ -23,29 +24,9 @@ data_full = [
|
|
| 23 |
['CultriX/Qwen2.5-14B-FinalMerge', 'https://huggingface.co/CultriX/Qwen2.5-14B-FinalMerge', 0.7248, 0.8277, 0.7113, 0.7052, 0.57, 0.7001],
|
| 24 |
['CultriX/Qwen2.5-14B-MultiCultyv2', 'https://huggingface.co/CultriX/Qwen2.5-14B-MultiCultyv2', 0.7295, 0.8359, 0.7363, 0.5767, 0.44, 0.7316],
|
| 25 |
['CultriX/Qwen2.5-14B-Brocav7', 'https://huggingface.co/CultriX/Qwen2.5-14B-Brocav7', 0.7445, 0.8353, 0.7508, 0.6292, 0.46, 0.7629],
|
| 26 |
-
|
| 27 |
-
['CultriX/Qwen2.5-14B-Brocav3', 'https://huggingface.co/CultriX/Qwen2.5-14B-Brocav3', 0.7395, 0.8388, 0.7393, 0.6405, 0.47, 0.7659],
|
| 28 |
-
['CultriX/Qwen2.5-14B-Brocav4', 'https://huggingface.co/CultriX/Qwen2.5-14B-Brocav4', 0.7432, 0.8377, 0.7444, 0.6277, 0.48, 0.758],
|
| 29 |
-
['CultriX/Qwen2.5-14B-Brocav2', 'https://huggingface.co/CultriX/Qwen2.5-14B-Brocav2', 0.7492, 0.8302, 0.7508, 0.6377, 0.51, 0.7478],
|
| 30 |
-
['CultriX/Qwen2.5-14B-Brocav5', 'https://huggingface.co/CultriX/Qwen2.5-14B-Brocav5', 0.7445, 0.8313, 0.7547, 0.6376, 0.5, 0.7304],
|
| 31 |
-
['CultriX/Qwen2.5-14B-Brocav6', 'https://huggingface.co/CultriX/Qwen2.5-14B-Brocav6', 0.7179, 0.8354, 0.7531, 0.6378, 0.49, 0.7524],
|
| 32 |
-
['CultriX/Qwenfinity-2.5-14B', 'https://huggingface.co/CultriX/Qwenfinity-2.5-14B', 0.7347, 0.8254, 0.7279, 0.7267, 0.56, 0.697],
|
| 33 |
-
['CultriX/Qwen2.5-14B-Emergedv2', 'https://huggingface.co/CultriX/Qwen2.5-14B-Emergedv2', 0.7137, 0.8335, 0.7363, 0.5836, 0.44, 0.7344],
|
| 34 |
-
['CultriX/Qwen2.5-14B-Unity', 'https://huggingface.co/CultriX/Qwen2.5-14B-Unity', 0.7063, 0.8343, 0.7423, 0.682, 0.57, 0.7498],
|
| 35 |
-
['CultriX/Qwen2.5-14B-MultiCultyv3', 'https://huggingface.co/CultriX/Qwen2.5-14B-MultiCultyv3', 0.7132, 0.8216, 0.7395, 0.6792, 0.55, 0.712],
|
| 36 |
-
['CultriX/Qwen2.5-14B-Emergedv3', 'https://huggingface.co/CultriX/Qwen2.5-14B-Emergedv3', 0.7436, 0.8312, 0.7519, 0.6585, 0.55, 0.7068],
|
| 37 |
-
['CultriX/SeQwence-14Bv1', 'https://huggingface.co/CultriX/SeQwence-14Bv1', 0.7278, 0.841, 0.7541, 0.6816, 0.52, 0.7539],
|
| 38 |
-
['CultriX/Qwen2.5-14B-Wernickev2', 'https://huggingface.co/CultriX/Qwen2.5-14B-Wernickev2', 0.7391, 0.8168, 0.7273, 0.622, 0.45, 0.7572],
|
| 39 |
-
['CultriX/Qwen2.5-14B-Wernickev3', 'https://huggingface.co/CultriX/Qwen2.5-14B-Wernickev3', 0.7357, 0.8148, 0.7245, 0.7023, 0.55, 0.7869],
|
| 40 |
-
['CultriX/Qwen2.5-14B-Wernickev4', 'https://huggingface.co/CultriX/Qwen2.5-14B-Wernickev4', 0.7355, 0.829, 0.7497, 0.6306, 0.48, 0.7635],
|
| 41 |
-
['CultriX/SeQwential-14B-v1', 'https://huggingface.co/CultriX/SeQwential-14B-v1', 0.7355, 0.8205, 0.7549, 0.6367, 0.48, 0.7626],
|
| 42 |
-
['CultriX/Qwen2.5-14B-Wernickev5', 'https://huggingface.co/CultriX/Qwen2.5-14B-Wernickev5', 0.7224, 0.8272, 0.7541, 0.679, 0.51, 0.7578],
|
| 43 |
-
['CultriX/Qwen2.5-14B-Wernickev6', 'https://huggingface.co/CultriX/Qwen2.5-14B-Wernickev6', 0.6994, 0.7549, 0.5816, 0.6991, 0.58, 0.7267],
|
| 44 |
-
['CultriX/Qwen2.5-14B-Wernickev7', 'https://huggingface.co/CultriX/Qwen2.5-14B-Wernickev7', 0.7147, 0.7599, 0.6097, 0.7056, 0.57, 0.7164],
|
| 45 |
['CultriX/Qwen2.5-14B-FinalMerge-tmp2', 'https://huggingface.co/CultriX/Qwen2.5-14B-FinalMerge-tmp2', 0.7255, 0.8192, 0.7535, 0.6671, 0.5, 0.7612],
|
| 46 |
-
['CultriX/Qwen2.5-14B-BrocaV8', 'https://huggingface.co/CultriX/Qwen2.5-14B-BrocaV8', 0.7415, 0.8396, 0.7334, 0.5785, 0.4300, 0.7646],
|
| 47 |
]
|
| 48 |
-
|
| 49 |
columns = ["Model Configuration", "Model Link", "tinyArc", "tinyHellaswag",
|
| 50 |
"tinyMMLU", "tinyTruthfulQA", "tinyTruthfulQA_mc1", "tinyWinogrande"]
|
| 51 |
df_full = pd.DataFrame(data_full, columns=columns)
|
|
@@ -179,6 +160,7 @@ def display_scraped_model_data(model_url):
|
|
| 179 |
return scrape_model_page(model_url)
|
| 180 |
|
| 181 |
def download_all_data():
|
|
|
|
| 182 |
csv_buffer = io.StringIO()
|
| 183 |
df_full.to_csv(csv_buffer, index=False)
|
| 184 |
csv_data = csv_buffer.getvalue().encode('utf-8')
|
|
@@ -216,13 +198,11 @@ def download_all_data():
|
|
| 216 |
|
| 217 |
|
| 218 |
# --------------------------------------------------------------------
|
| 219 |
-
# PART 2:
|
| 220 |
# --------------------------------------------------------------------
|
| 221 |
-
|
| 222 |
-
#
|
| 223 |
-
|
| 224 |
-
# Example "non-tiny" data, or reuse the snippet's data exactly:
|
| 225 |
-
non_tiny_benchmark_data = [
|
| 226 |
{
|
| 227 |
"rank": 44,
|
| 228 |
"name": "sometimesanotion/Qwen2.5-14B-Vimarckoso-v3",
|
|
@@ -249,24 +229,23 @@ non_tiny_benchmark_data = [
|
|
| 249 |
}
|
| 250 |
}
|
| 251 |
},
|
| 252 |
-
# ...
|
|
|
|
| 253 |
]
|
| 254 |
|
|
|
|
| 255 |
def snippet_scrape_model_page(url):
|
| 256 |
"""
|
| 257 |
-
Same as scrape_model_page, but
|
| 258 |
-
them to remain separate. Alternatively, you can reuse the same 'scrape_model_page' above.
|
| 259 |
"""
|
| 260 |
-
# We'll just reuse the same function from above to avoid duplication:
|
| 261 |
return scrape_model_page(url)
|
| 262 |
|
| 263 |
-
def
|
| 264 |
"""
|
| 265 |
-
Prints
|
| 266 |
-
|
| 267 |
"""
|
| 268 |
-
print("
|
| 269 |
-
print(f"Model Rank: {model_info['rank']}")
|
| 270 |
print(f"Model Name: {model_info['name']}")
|
| 271 |
print(f"Model average score across benchmarks in %: {model_info['scores']['average']}")
|
| 272 |
print(f"Models average score on IFEval benchmarks in %: {model_info['scores']['IFEval']}")
|
|
@@ -276,31 +255,35 @@ def print_benchmark_and_config_info(model_info):
|
|
| 276 |
print(f"Models average score in MUSR benchmarks in %: {model_info['scores']['MUSR']}")
|
| 277 |
print(f"Models average score in MMLU-PRO benchmarks in %: {model_info['scores']['MMLU-PRO']}")
|
| 278 |
|
|
|
|
| 279 |
if model_info["known_config"] is not None:
|
| 280 |
-
# Print known config in a simplistic YAML-like manner
|
| 281 |
print("###")
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
print("
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
print(f"base_model: {kc['base_model']}")
|
| 291 |
-
if "dtype" in kc:
|
| 292 |
-
print(f"dtype: {kc['dtype']}")
|
| 293 |
-
if "parameters" in kc:
|
| 294 |
-
print("parameters:")
|
| 295 |
-
for pk, pv in kc["parameters"].items():
|
| 296 |
-
print(f" {pk}: {pv}")
|
| 297 |
print("###")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
else:
|
| 299 |
-
#
|
| 300 |
-
|
| 301 |
-
# If it's an error or "No YAML config", then print the snippet
|
| 302 |
-
if "No YAML configuration found." in scraped or "Error:" in scraped:
|
| 303 |
print("(No MergeKit configuration found.)\n")
|
|
|
|
| 304 |
print("You can try the following Python script to scrape the model page:\n")
|
| 305 |
print("#" * 70)
|
| 306 |
print(f'''import requests
|
|
@@ -311,10 +294,12 @@ def scrape_model_page(model_url):
|
|
| 311 |
response = requests.get(model_url)
|
| 312 |
if response.status_code != 200:
|
| 313 |
return f"Error: Unable to fetch the page (Status Code: {{response.status_code}})"
|
| 314 |
-
|
| 315 |
soup = BeautifulSoup(response.text, "html.parser")
|
|
|
|
| 316 |
yaml_config = soup.find("pre")
|
| 317 |
yaml_text = yaml_config.text.strip() if yaml_config else "No YAML configuration found."
|
|
|
|
| 318 |
metadata_section = soup.find("div", class_="metadata")
|
| 319 |
metadata_text = metadata_section.text.strip() if metadata_section else "No metadata found."
|
| 320 |
|
|
@@ -333,33 +318,32 @@ if __name__ == "__main__":
|
|
| 333 |
print("#" * 70)
|
| 334 |
else:
|
| 335 |
print("###")
|
| 336 |
-
print(scraped)
|
| 337 |
print("###")
|
| 338 |
|
| 339 |
def run_non_tiny_benchmarks():
|
| 340 |
"""
|
| 341 |
-
|
| 342 |
-
|
| 343 |
"""
|
| 344 |
old_stdout = sys.stdout
|
| 345 |
buffer = io.StringIO()
|
| 346 |
sys.stdout = buffer
|
| 347 |
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
print_benchmark_and_config_info(model)
|
| 351 |
|
| 352 |
sys.stdout = old_stdout
|
| 353 |
return buffer.getvalue()
|
| 354 |
|
| 355 |
|
| 356 |
# --------------------------------------------------------------------
|
| 357 |
-
# PART 3: GRADIO APP (Your existing
|
| 358 |
# --------------------------------------------------------------------
|
| 359 |
-
|
| 360 |
with gr.Blocks() as demo:
|
| 361 |
gr.Markdown("# Comprehensive Model Performance Analysis with Hugging Face Links")
|
| 362 |
|
|
|
|
| 363 |
with gr.Row():
|
| 364 |
btn1 = gr.Button("Show Average Performance")
|
| 365 |
img1 = gr.Image(type="pil", label="Average Performance Plot")
|
|
@@ -400,6 +384,7 @@ with gr.Blocks() as demo:
|
|
| 400 |
all_downloads = gr.File(label="Download All Data")
|
| 401 |
download_all_btn.click(download_all_data, outputs=all_downloads)
|
| 402 |
|
|
|
|
| 403 |
gr.Markdown("## Live Scraping Features")
|
| 404 |
with gr.Row():
|
| 405 |
url_input = gr.Textbox(label="Enter Hugging Face Model URL", placeholder="https://huggingface.co/<model>")
|
|
@@ -407,10 +392,8 @@ with gr.Blocks() as demo:
|
|
| 407 |
live_scrape_output = gr.Textbox(label="Scraped Data", lines=15)
|
| 408 |
live_scrape_btn.click(display_scraped_model_data, inputs=url_input, outputs=live_scrape_output)
|
| 409 |
|
| 410 |
-
#
|
| 411 |
-
|
| 412 |
-
# ----------------------------------------------------------------
|
| 413 |
-
gr.Markdown("## Non-Tiny Benchmark Parser")
|
| 414 |
with gr.Row():
|
| 415 |
parse_non_tiny_btn = gr.Button("Parse Non-Tiny Benchmarks")
|
| 416 |
parse_non_tiny_output = gr.Textbox(label="Non-Tiny Benchmark Output", lines=30)
|
|
|
|
| 13 |
import tempfile
|
| 14 |
import sys
|
| 15 |
|
| 16 |
+
|
| 17 |
# --------------------------------------------------------------------
|
| 18 |
+
# PART 1: YOUR EXISTING (TINY) DATA & PLOTS
|
| 19 |
# --------------------------------------------------------------------
|
| 20 |
|
| 21 |
data_full = [
|
|
|
|
| 24 |
['CultriX/Qwen2.5-14B-FinalMerge', 'https://huggingface.co/CultriX/Qwen2.5-14B-FinalMerge', 0.7248, 0.8277, 0.7113, 0.7052, 0.57, 0.7001],
|
| 25 |
['CultriX/Qwen2.5-14B-MultiCultyv2', 'https://huggingface.co/CultriX/Qwen2.5-14B-MultiCultyv2', 0.7295, 0.8359, 0.7363, 0.5767, 0.44, 0.7316],
|
| 26 |
['CultriX/Qwen2.5-14B-Brocav7', 'https://huggingface.co/CultriX/Qwen2.5-14B-Brocav7', 0.7445, 0.8353, 0.7508, 0.6292, 0.46, 0.7629],
|
| 27 |
+
# ... more of your smaller “tiny” data ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
['CultriX/Qwen2.5-14B-FinalMerge-tmp2', 'https://huggingface.co/CultriX/Qwen2.5-14B-FinalMerge-tmp2', 0.7255, 0.8192, 0.7535, 0.6671, 0.5, 0.7612],
|
|
|
|
| 29 |
]
|
|
|
|
| 30 |
columns = ["Model Configuration", "Model Link", "tinyArc", "tinyHellaswag",
|
| 31 |
"tinyMMLU", "tinyTruthfulQA", "tinyTruthfulQA_mc1", "tinyWinogrande"]
|
| 32 |
df_full = pd.DataFrame(data_full, columns=columns)
|
|
|
|
| 160 |
return scrape_model_page(model_url)
|
| 161 |
|
| 162 |
def download_all_data():
|
| 163 |
+
import io
|
| 164 |
csv_buffer = io.StringIO()
|
| 165 |
df_full.to_csv(csv_buffer, index=False)
|
| 166 |
csv_data = csv_buffer.getvalue().encode('utf-8')
|
|
|
|
| 198 |
|
| 199 |
|
| 200 |
# --------------------------------------------------------------------
|
| 201 |
+
# PART 2: FULL "DATA START" SNIPPET (RANKS 44–105) + Parser
|
| 202 |
# --------------------------------------------------------------------
|
| 203 |
+
benchmark_data = [
|
| 204 |
+
# The entire dataset from your "DATA START", rank 44..105
|
| 205 |
+
# (the code you posted with "knowledge of config" or scraping logic)
|
|
|
|
|
|
|
| 206 |
{
|
| 207 |
"rank": 44,
|
| 208 |
"name": "sometimesanotion/Qwen2.5-14B-Vimarckoso-v3",
|
|
|
|
| 229 |
}
|
| 230 |
}
|
| 231 |
},
|
| 232 |
+
# ... rest of the snippet ...
|
| 233 |
+
# (Exactly copy/paste your big block from rank=44 to rank=105)
|
| 234 |
]
|
| 235 |
|
| 236 |
+
|
| 237 |
def snippet_scrape_model_page(url):
|
| 238 |
"""
|
| 239 |
+
Same as scrape_model_page, but we keep it separate for clarity.
|
|
|
|
| 240 |
"""
|
|
|
|
| 241 |
return scrape_model_page(url)
|
| 242 |
|
| 243 |
+
def snippet_print_benchmark_and_config_info(model_info):
|
| 244 |
"""
|
| 245 |
+
Prints an overview for each model (your "DATA START" logic),
|
| 246 |
+
either known config or scraping snippet.
|
| 247 |
"""
|
| 248 |
+
print(f"---\nModel Rank: {model_info['rank']}")
|
|
|
|
| 249 |
print(f"Model Name: {model_info['name']}")
|
| 250 |
print(f"Model average score across benchmarks in %: {model_info['scores']['average']}")
|
| 251 |
print(f"Models average score on IFEval benchmarks in %: {model_info['scores']['IFEval']}")
|
|
|
|
| 255 |
print(f"Models average score in MUSR benchmarks in %: {model_info['scores']['MUSR']}")
|
| 256 |
print(f"Models average score in MMLU-PRO benchmarks in %: {model_info['scores']['MMLU-PRO']}")
|
| 257 |
|
| 258 |
+
# If there's a known_config, print it as YAML
|
| 259 |
if model_info["known_config"] is not None:
|
|
|
|
| 260 |
print("###")
|
| 261 |
+
print("models:")
|
| 262 |
+
for m in model_info["known_config"]["models"]:
|
| 263 |
+
print(f" - model: {m['model']}")
|
| 264 |
+
print(f"merge_method: {model_info['known_config']['merge_method']}")
|
| 265 |
+
print(f"base_model: {model_info['known_config']['base_model']}")
|
| 266 |
+
print(f"dtype: {model_info['known_config']['dtype']}")
|
| 267 |
+
print("parameters:")
|
| 268 |
+
print(f" t: {model_info['known_config']['parameters']['t']} # V shaped curve: Hermes for input & output, WizardMath in the middle layers")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
print("###")
|
| 270 |
+
return
|
| 271 |
+
|
| 272 |
+
# Otherwise, scrape
|
| 273 |
+
scraped = snippet_scrape_model_page(model_info["hf_url"])
|
| 274 |
+
if isinstance(scraped, str):
|
| 275 |
+
# Means it's an error string or something
|
| 276 |
+
if "Error:" in scraped:
|
| 277 |
+
print("(No MergeKit configuration found or error occurred.)\n")
|
| 278 |
+
# optionally print snippet
|
| 279 |
+
else:
|
| 280 |
+
print(scraped)
|
| 281 |
+
return
|
| 282 |
else:
|
| 283 |
+
# It's presumably a dict: { "yaml_configuration": "...", "metadata": "..." }
|
| 284 |
+
if ("No YAML configuration found." in scraped["yaml_configuration"]):
|
|
|
|
|
|
|
| 285 |
print("(No MergeKit configuration found.)\n")
|
| 286 |
+
# Print your snippet code
|
| 287 |
print("You can try the following Python script to scrape the model page:\n")
|
| 288 |
print("#" * 70)
|
| 289 |
print(f'''import requests
|
|
|
|
| 294 |
response = requests.get(model_url)
|
| 295 |
if response.status_code != 200:
|
| 296 |
return f"Error: Unable to fetch the page (Status Code: {{response.status_code}})"
|
| 297 |
+
|
| 298 |
soup = BeautifulSoup(response.text, "html.parser")
|
| 299 |
+
|
| 300 |
yaml_config = soup.find("pre")
|
| 301 |
yaml_text = yaml_config.text.strip() if yaml_config else "No YAML configuration found."
|
| 302 |
+
|
| 303 |
metadata_section = soup.find("div", class_="metadata")
|
| 304 |
metadata_text = metadata_section.text.strip() if metadata_section else "No metadata found."
|
| 305 |
|
|
|
|
| 318 |
print("#" * 70)
|
| 319 |
else:
|
| 320 |
print("###")
|
| 321 |
+
print(scraped["yaml_configuration"])
|
| 322 |
print("###")
|
| 323 |
|
| 324 |
def run_non_tiny_benchmarks():
|
| 325 |
"""
|
| 326 |
+
Captures the stdout from printing each model in benchmark_data
|
| 327 |
+
(ranks 44 to 105), returning a single string for Gradio to display.
|
| 328 |
"""
|
| 329 |
old_stdout = sys.stdout
|
| 330 |
buffer = io.StringIO()
|
| 331 |
sys.stdout = buffer
|
| 332 |
|
| 333 |
+
for model in benchmark_data:
|
| 334 |
+
snippet_print_benchmark_and_config_info(model)
|
|
|
|
| 335 |
|
| 336 |
sys.stdout = old_stdout
|
| 337 |
return buffer.getvalue()
|
| 338 |
|
| 339 |
|
| 340 |
# --------------------------------------------------------------------
|
| 341 |
+
# PART 3: GRADIO APP (Your existing UI plus the "Parse Non-Tiny" button)
|
| 342 |
# --------------------------------------------------------------------
|
|
|
|
| 343 |
with gr.Blocks() as demo:
|
| 344 |
gr.Markdown("# Comprehensive Model Performance Analysis with Hugging Face Links")
|
| 345 |
|
| 346 |
+
# The existing UI
|
| 347 |
with gr.Row():
|
| 348 |
btn1 = gr.Button("Show Average Performance")
|
| 349 |
img1 = gr.Image(type="pil", label="Average Performance Plot")
|
|
|
|
| 384 |
all_downloads = gr.File(label="Download All Data")
|
| 385 |
download_all_btn.click(download_all_data, outputs=all_downloads)
|
| 386 |
|
| 387 |
+
# Live scraping feature
|
| 388 |
gr.Markdown("## Live Scraping Features")
|
| 389 |
with gr.Row():
|
| 390 |
url_input = gr.Textbox(label="Enter Hugging Face Model URL", placeholder="https://huggingface.co/<model>")
|
|
|
|
| 392 |
live_scrape_output = gr.Textbox(label="Scraped Data", lines=15)
|
| 393 |
live_scrape_btn.click(display_scraped_model_data, inputs=url_input, outputs=live_scrape_output)
|
| 394 |
|
| 395 |
+
# NEW: Non-Tiny Benchmarks button
|
| 396 |
+
gr.Markdown("## Non-Tiny Benchmark Parser (Ranks 44–105)")
|
|
|
|
|
|
|
| 397 |
with gr.Row():
|
| 398 |
parse_non_tiny_btn = gr.Button("Parse Non-Tiny Benchmarks")
|
| 399 |
parse_non_tiny_output = gr.Textbox(label="Non-Tiny Benchmark Output", lines=30)
|