File size: 955 Bytes
9a8d870
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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()