Download progress/github/SpecForge/benchmarks/benchmarker/registry.py from FasterDFlash/Hanrui: direct link, hf CLI and curl.
- Browser
- Download file 628 Bytes
-
https://huggingface.co/FasterDFlash/Hanrui/resolve/main/progress/github/SpecForge/benchmarks/benchmarker/registry.py
- Command line
-
hf download hf://FasterDFlash/Hanrui/progress/github/SpecForge/benchmarks/benchmarker/registry.py
-
curl -L -o registry.py https://huggingface.co/FasterDFlash/Hanrui/resolve/main/progress/github/SpecForge/benchmarks/benchmarker/registry.py
628 Bytes
| class BenchmarkRegistry: | |
| def __init__(self): | |
| self.benchmarks = {} | |
| def register(self, name: str): | |
| """ | |
| Usage: | |
| ```python | |
| BENCHMARKS = BenchmarkRegistry() | |
| BENCHMARKS.register("aime") | |
| class AIMEBenchmarker(Benchmarker): | |
| ... | |
| ``` | |
| """ | |
| def wrapper(cls): | |
| self.benchmarks[name] = cls | |
| return cls | |
| return wrapper | |
| def get(self, name: str) -> type: | |
| """ | |
| Get the benchmark class by name. | |
| """ | |
| return self.benchmarks[name] | |
| BENCHMARKS = BenchmarkRegistry() | |