| import os |
| import subprocess |
| import json |
| import gradio as gr |
|
|
| def run_benchmark(model_id, tasks): |
| |
| cmd = [ |
| "lm_eval", |
| "--model", "hf", |
| "--model_args", f"pretrained={model_id},dtype=float16,trust_remote_code=True", |
| "--tasks", tasks, |
| "--output_path", "./results.json", |
| "--batch_size", "2", |
| ] |
| |
| |
| result = subprocess.run(cmd, capture_output=True, text=True) |
| |
| |
| try: |
| with open("./results.json", "r") as f: |
| data = json.load(f) |
| return json.dumps(data.get("results", {}), indent=2) |
| except Exception as e: |
| return f"Execution Log:\n{result.stdout}\n\nErrors:\n{result.stderr}" |
|
|
| |
| demo = gr.Interface( |
| fn=run_benchmark, |
| inputs=[ |
| gr.Textbox(value="Amit0392/AMIT-1.0", label="Model ID"), |
| gr.Textbox(value="gsm8k,arc_challenge", label="Benchmark Tasks (comma separated)") |
| ], |
| outputs=gr.Code(label="Benchmark Results JSON", language="json"), |
| title="🏆 A.M.I.T. 1.0 Cloud Benchmark Evaluator", |
| description="Runs EleutherAI lm-evaluation-harness directly on Hugging Face Cloud Hardware." |
| ) |
|
|
| demo.launch() |
|
|