llm-perf-leaderboard / src /hardware.py
baptistecolle's picture
add support for additional backends (#33)
51a4daf verified
from typing import Any, Dict, List, Optional
import yaml
class HardwareConfig:
def __init__(self, data: Dict[str, Any]):
self.machine: str = data["machine"]
self.description: str = data["description"]
self.hardware_provider: str = data["hardware_provider"]
self.hardware_type: str = data["hardware_type"]
self.subsets: List[str] = data["subsets"]
self.backends: List[str] = data["backends"]
self.detail: Optional[str] = data.get("detail", None)
def __repr__(self) -> str:
return (
f"HardwareConfig(machine='{self.machine}', description='{self.description}', "
f"hardware_provider={self.hardware_provider}, hardware_type={self.hardware_type}, subsets={self.subsets}, backends={self.backends})"
)
def load_hardware_configs(file_path: str) -> List[HardwareConfig]:
with open(file_path, "r") as file:
data = yaml.safe_load(file)
return [HardwareConfig(config) for config in data]