Spaces:
Running
Running
File size: 1,131 Bytes
42029e4 44cd54e 42029e4 | 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 32 33 34 35 36 37 38 39 40 41 42 | """CLI entry point for training."""
from __future__ import annotations
import sys
from pathlib import Path
import click
# Ensure src is on path even if package not installed
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.training.trainer import train_from_config # noqa: E402
from src.utils.logging import setup_logging # noqa: E402
@click.command()
@click.option(
"--config",
"config_path",
default="config/config.yaml",
show_default=True,
help="Path to YAML config file.",
)
@click.option("--log-level", default="INFO", show_default=True)
def main(config_path: str, log_level: str) -> None:
"""Train LoanGuard end-to-end and persist artifacts."""
setup_logging(level=log_level)
results = train_from_config(config_path)
click.echo("=" * 60)
click.echo("Training complete. Top-line ensemble metrics:")
click.echo("=" * 60)
if results.get("ensemble"):
for k, v in results["ensemble"].items():
click.echo(f" {k:30s} {v}")
else:
click.echo(" (ensemble not trained - only base models)")
if __name__ == "__main__":
main()
|