mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-19 13:49:09 -04:00
updated BenchmarkConfig to have from_toml
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user