File size: 709 Bytes
1094cbb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import os
from typing import List
from pydantic import BaseModel
class EvalParams(BaseModel):
competition_id: str
competition_type: str
metric: str
token: str
user_id: str
submission_id: str
submission_id_col: str
submission_cols: List[str]
submission_rows: int
output_path: str
class Config:
protected_namespaces = ()
def save(self, output_dir):
"""
Save parameters to a json file.
"""
os.makedirs(output_dir, exist_ok=True)
path = os.path.join(output_dir, "params.json")
# save formatted json
with open(path, "w", encoding="utf-8") as f:
f.write(self.model_dump_json(indent=4))
|