updated BenchmarkConfig to have from_toml

This commit is contained in:
2026-04-10 21:55:18 -04:00
parent 68190901cb
commit 30dc36588c
3 changed files with 14 additions and 10 deletions

View File

@@ -2,8 +2,14 @@
from __future__ import annotations
import tomllib
from typing import TYPE_CHECKING
from pydantic import BaseModel
if TYPE_CHECKING:
from pathlib import Path
class BenchmarkConfig(BaseModel):
"""Top-level benchmark configuration loaded from TOML."""
@@ -16,3 +22,9 @@ class BenchmarkConfig(BaseModel):
timeout: int = 300
concurrency: int = 4
vllm_startup_timeout: int = 900
@classmethod
def from_toml(cls, config_path: Path) -> BenchmarkConfig:
"""Load benchmark config from a TOML file."""
raw = tomllib.loads(config_path.read_text())["bench"]
return cls(**raw)