- Add astrai/config/cli.py: OptSpec tables plus apply_specs infer click types and defaults from config fields, covering Optional[X], Union[X, None], PEP 604 X | None, stringified PEP 563 annotations, bool flag pairs, and repeatable list options - Move GroupedCommand/GroupedOption and the three-layer YAML merge (option defaults < YAML < explicit CLI) into the config package, adding unknown-key warning and mapping validation - Replace ~420 lines of hand-written @opt decorators in scripts/tools/train.py with a 66-entry spec table; option names, defaults, flag styles, and YAML semantics verified unchanged - Migrate scripts/tools/server.py to the same mechanism with its section binding, integer coercion, and dtype validation preserved locally - Add tests/config/test_cli.py covering type inference across annotation styles, default overrides, flag pairs, merge precedence, scientific notation, and help ordering
40 lines
778 B
Python
40 lines
778 B
Python
from astrai.config.cli import (
|
|
GroupedCommand,
|
|
GroupedOption,
|
|
OptSpec,
|
|
apply_specs,
|
|
merge_yaml_into_kwargs,
|
|
opt,
|
|
)
|
|
from astrai.config.model_config import (
|
|
AutoRegressiveLMConfig,
|
|
BaseModelConfig,
|
|
ConfigFactory,
|
|
EncoderConfig,
|
|
)
|
|
from astrai.config.preprocess_config import (
|
|
InputConfig,
|
|
OutputConfig,
|
|
PipelineConfig,
|
|
ProcessingConfig,
|
|
)
|
|
from astrai.config.train_config import TrainConfig
|
|
|
|
__all__ = [
|
|
"BaseModelConfig",
|
|
"AutoRegressiveLMConfig",
|
|
"EncoderConfig",
|
|
"ConfigFactory",
|
|
"TrainConfig",
|
|
"InputConfig",
|
|
"OutputConfig",
|
|
"PipelineConfig",
|
|
"ProcessingConfig",
|
|
"GroupedCommand",
|
|
"GroupedOption",
|
|
"OptSpec",
|
|
"apply_specs",
|
|
"merge_yaml_into_kwargs",
|
|
"opt",
|
|
]
|