feat: add routed model training pipeline
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""Train every routed model from the external SQLite material dataset."""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from lmpm.training.workflow import train_sqlite_database
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Train LMPM target models from a completed SQLite dataset."
|
||||
)
|
||||
parser.add_argument(
|
||||
"database", type=Path, help="SQLite database with material_records"
|
||||
)
|
||||
parser.add_argument(
|
||||
"artifact", type=Path, help="Destination .joblib model artifact"
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main() -> None:
|
||||
args = parse_args()
|
||||
bundle = train_sqlite_database(args.database, args.artifact)
|
||||
report_path = args.artifact.with_suffix(".metrics.json")
|
||||
report_path.write_text(
|
||||
json.dumps(bundle.report(), ensure_ascii=False, indent=2) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
print(f"saved model artifact: {args.artifact}")
|
||||
print(f"saved validation report: {report_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user