aistairc / aiaccel

A hyperparameter optimization library for the ABCI.
https://aistairc.github.io/aiaccel/
MIT License
23 stars 5 forks source link

fix type annotation in ParameterConfig #298

Closed styamamoto closed 1 year ago

styamamoto commented 1 year ago

This PR proposes to restore the type annotation in the ParameterConfig.

Currently, choices of categorical parameter and sequence of ordinal parameter can takes only str and float parameters, respectively. This behavior is not supposed originally, but is implemented by PR #291 in accordance with that of aiaccel.util.aiaccel.CommandLineArgs before merge of PR #276.

Recently, by PR #276, aiaccel.util.aiaccel.CommandLineArgs is enabled to parse float, int, and str parameter from command line. In addition to this, by the same PR, UnionNode is successfully unwraped. Therefore, type annotations using combination of Union and List can be used without any errors and work well.

For these reasones, type annotations of categorical and ordinal parameters should be restored.

Note that, unfortunately, omegaconf can not treat Union of List like Union[List[float], List[int], List[str]]. Thus, the type annotation is given like List[Union[float, int, str]].