Launches Python training scripts via UTILSLIB::PythonRunner with automatic venv handling and prerequisite checks. More...
#include <ml_trainer.h>
Public Member Functions | |
| MLTrainer () | |
| MLTrainer (const UTILSLIB::PythonRunnerConfig &config) | |
| UTILSLIB::PythonRunner & | runner () |
| UTILSLIB::PythonRunnerResult | run (const QString &scriptPath, const QStringList &args={}) |
| QStringList | checkPrerequisites (const QStringList &packages) const |
Launches Python training scripts via UTILSLIB::PythonRunner with automatic venv handling and prerequisite checks.
Training logic (PyTorch, scikit-learn, MNE-Python, …) lives entirely in the .py scripts under scripts/ml/training/ and runs in a child process; no Python embedding or libpython linkage is required. If the configured UTILSLIB::PythonRunnerConfig carries a venvDir, the runner creates and updates the venv before each script invocation so dependencies are pinned per training job.
Definition at line 68 of file ml_trainer.h.
| MLTrainer::MLTrainer | ( | ) |
Construct an MLTrainer with default PythonRunner configuration.
Definition at line 54 of file ml_trainer.cpp.
|
explicit |
Construct an MLTrainer with explicit PythonRunner configuration.
| [in] | config | PythonRunner configuration to use. |
Definition at line 61 of file ml_trainer.cpp.
| QStringList MLTrainer::checkPrerequisites | ( | const QStringList & | packages | ) | const |
Check that the required Python packages are importable.
| [in] | packages | List of package names (e.g. {"torch", "mne"}). |
Definition at line 97 of file ml_trainer.cpp.
| PythonRunnerResult MLTrainer::run | ( | const QString & | scriptPath, |
| const QStringList & | args = {} ) |
Run a training script.
If the PythonRunner is configured with a venvDir and packageDir, the venv is created/updated automatically before the script runs.
| [in] | scriptPath | Path to the .py training script. |
| [in] | args | Arguments forwarded to the script. |
Definition at line 75 of file ml_trainer.cpp.
| PythonRunner & MLTrainer::runner | ( | ) |
Access the underlying PythonRunner for callback/config changes.
Definition at line 68 of file ml_trainer.cpp.