| #!/usr/bin/env python3 | |
| import subprocess | |
| import sys | |
| import os | |
| def get_venv_python(): | |
| # Detect venv python on Windows | |
| venv_path = os.path.join(".venv", "Scripts", "python.exe") | |
| if os.path.exists(venv_path): | |
| return venv_path | |
| return sys.executable # Fallback | |
| def run_preprocessing(): | |
| python_exe = get_venv_python() | |
| print(f"Running preprocessing using {python_exe}...") | |
| result = subprocess.run([python_exe, "preprocess_chat.py"], check=True, cwd="core/training_pipeline/data_synth", env=dict(os.environ, PYTHONUTF8="1")) | |
| print("Preprocessing completed.") | |
| def run_training(): | |
| python_exe = get_venv_python() | |
| print(f"Running training using {python_exe}...") | |
| result = subprocess.run([python_exe, "train_chat.py"], check=True, cwd="core/training_pipeline/trainers", env=dict(os.environ, PYTHONUTF8="1")) | |
| print("Training completed.") | |
| if __name__ == "__main__": | |
| run_preprocessing() | |
| run_training() | |