Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Alina Lozovskaya commited on
Commit Β·
2d54755
1
Parent(s): fdfafe5
Fix token for space generation
Browse filesFiles changed (2)
24 unmodified lines2526272829303132333435111 unmodified lines14714814915015115215315415582 unmodified lines23823924024124224324424 unmodified linesproject_description = """# YourBench π**Dynamic Benchmark Generation for Language Models**Quickly create zero-shot benchmarks from your documents βΒ keeping models accurate and adaptable- π» [Yourbench GitHub](https://github.com/huggingface/yourbench)"""logger.remove()111 unmodified lineslogger.error(f"Failed to load dataset '{eval_ds_name}': {e}")return "β Failed: Dataset loading error"try:create_eval_file(eval_ds_name)status = asyncio.run(run_evaluations(eval_ds_name=eval_ds_name, org=org_name))except Exception as e:logger.error(f"Evaluation error: {e}")return f"β Failed: Evaluation error\n{e}"82 unmodified linesbtn_launch_evals = gr.Button("π Launch Evaluation",visible=True,interactive=True, # Start non-interactivevariant="primary",)24 unmodified lines25262728293031323334353637383940111 unmodified lines15215315415515615715815916016116216316482 unmodified lines24724824925025125225324 unmodified linesproject_description = """# π YourBench### Dynamic Benchmark Generation from Your Documents- Create zero-shot benchmarks from your documents β no manual labeling- Evaluate top open models and publish a leaderboard in one click- Run locally or explore the [source on GitHub](https://github.com/huggingface/yourbench)β οΈ **Important:** This app uses your Hugging Face token for inference and uploads β you are responsible for any usage costsBuilt with π€ by the [Hugging Face OpenEvals team](https://huggingface.co/OpenEvals)"""logger.remove()111 unmodified lineslogger.error(f"Failed to load dataset '{eval_ds_name}': {e}")return "β Failed: Dataset loading error"new_env = os.environ.copy()if oauth_token:new_env["HF_TOKEN"] = oauth_token.tokentry:create_eval_file(eval_ds_name)status = asyncio.run(run_evaluations(oauth_token = new_env, org=org_name, eval_ds_name=eval_ds_name,))except Exception as e:logger.error(f"Evaluation error: {e}")return f"β Failed: Evaluation error\n{e}"82 unmodified linesbtn_launch_evals = gr.Button("π Launch Evaluation",visible=True,interactive=False, # Start non-interactivevariant="primary",)
17 unmodified lines1819202122232425261 unmodified line2829303132333414 unmodified lines4950515253545517 unmodified linessubprocess.run(["lighteval", "tasks", "create", str(template_path), task_name, eval_ds_name])async def run_process(args: list) -> dict:process = await asyncio.create_subprocess_exec(*args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)await asyncio.wait_for(process.wait(), timeout=180)stdout = await process.stdout.read()1 unmodified linereturn {"pid": process.pid, "stdout": stdout.decode(), "stderr": stderr.decode()}async def run_evaluations(eval_ds_name: str, org: str) -> list:task_name = eval_ds_name.replace("/", "_")tasks = []for model_name, provider in INIT_MODELS:14 unmodified linesorg,"--push-to-hub",]tasks.append(run_process(args))# Will capture the task if failedprocesses = await asyncio.gather(*tasks, return_exceptions=True)for process in processes:17 unmodified lines1819202122232425261 unmodified line2829303132333414 unmodified lines4950515253545517 unmodified linessubprocess.run(["lighteval", "tasks", "create", str(template_path), task_name, eval_ds_name])async def run_process(args: list, custom_env = None) -> dict:process = await asyncio.create_subprocess_exec(*args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, env=custom_env)await asyncio.wait_for(process.wait(), timeout=180)stdout = await process.stdout.read()1 unmodified linereturn {"pid": process.pid, "stdout": stdout.decode(), "stderr": stderr.decode()}async def run_evaluations(eval_ds_name: str, org: str, custom_env = None) -> list:task_name = eval_ds_name.replace("/", "_")tasks = []for model_name, provider in INIT_MODELS:14 unmodified linesorg,"--push-to-hub",]tasks.append(run_process(args, custom_env))# Will capture the task if failedprocesses = await asyncio.gather(*tasks, return_exceptions=True)for process in processes:
yourbench_space/app.py+15-6
yourbench_space/evaluation.py+4-4