mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-27 17:05:06 +00:00
26 lines
790 B
Python
26 lines
790 B
Python
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
import sys
|
|
from types import ModuleType
|
|
|
|
from common.paths import EVAL_DIR
|
|
|
|
SUPPORTED = ("aime", "hle", "gpqa")
|
|
|
|
|
|
def load_bench(name: str) -> ModuleType:
|
|
if name not in SUPPORTED:
|
|
raise SystemExit(f"benchmark not wired up: {name} (supported: {' / '.join(SUPPORTED)})")
|
|
path = EVAL_DIR / name / "bench.py"
|
|
if not path.is_file():
|
|
raise SystemExit(f"benchmark implementation not found: {path}")
|
|
mod_name = f"eval_bench_{name}"
|
|
if mod_name in sys.modules:
|
|
return sys.modules[mod_name]
|
|
spec = importlib.util.spec_from_file_location(mod_name, path)
|
|
module = importlib.util.module_from_spec(spec)
|
|
sys.modules[mod_name] = module
|
|
spec.loader.exec_module(module)
|
|
return module
|