"""Canonical SFT training module.""" from __future__ import annotations import subprocess import sys import os from pathlib import Path def run_sft_train(checkpoint_dir: Path | None = None) -> dict[str, str]: """Run SFT training via the script entrypoint. ``checkpoint_dir`` is accepted for interface stability; the current implementation writes to the repository checkpoint folder. """ _ = checkpoint_dir root = Path(__file__).resolve().parents[2] script = root / "scripts" / "train_sft.py" env = dict(os.environ) env["PYTHONPATH"] = f"{root}:{env.get('PYTHONPATH', '')}".rstrip(":") subprocess.run([sys.executable, str(script)], check=True, cwd=str(root), env=env) return {"status": "ok"} __all__ = ["run_sft_train"]