[FEA] `raft-ann-bench` should validate configurations
fy opened this issue · comments
Is your feature request related to a problem? Please describe.
Currently, the data models for the configuration yaml files are not validated. Directly referencing dict
by key isn't safe. For example, in the following code snippet, a typo like constraint
instead of constraints
in the yaml file could lead to the constraints being ignored silently.
def add_algo_group(group_list):
if algo["name"] not in algos_conf:
algos_conf[algo["name"]] = {"groups": {}}
for group in algo["groups"].keys():
if group in group_list:
algos_conf[algo["name"]]["groups"][group] = algo[
"groups"
][group]
if "constraints" in algo:
algos_conf[algo["name"]]["constraints"] = algo[
"constraints"
]
Describe the solution you'd like
Use Pydantic
to define and validate the data model for the configuration files.
Describe alternatives you've considered
dataclasses.dataclass
would work as well.