MLLIB::MLTrainer convenience wrapper that drives Python training scripts via UTILSLIB::PythonRunner. More...


Go to the source code of this file.
Classes | |
| class | MLLIB::MLTrainer |
| Launches Python training scripts via UTILSLIB::PythonRunner with automatic venv handling and prerequisite checks. More... | |
Namespaces | |
| namespace | MLLIB |
| Tensors, model abstraction, ONNX Runtime inference and Python training drivers used across mne-cpp. | |
MLLIB::MLTrainer convenience wrapper that drives Python training scripts via UTILSLIB::PythonRunner.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
Inference in mne-cpp goes through ONNX Runtime, but training itself stays in Python where the ecosystem lives (PyTorch, scikit-learn, MNE-Python). MLLIB::MLTrainer is the thin C++ side that launches those scripts as child processes, optionally inside a managed virtual environment, without embedding a Python interpreter or linking against libpython.
The class adds three things on top of the generic UTILSLIB::PythonRunner: prerequisite checking via isPackageAvailable so callers can fail fast with a useful message, automatic delegation to runInVenv when a venvDir is configured (which creates and updates the venv before the script runs), and convention-friendly defaults that match the scripts/ml/training/ layout shipped with the repository. The whole class is compiled out under WASMBUILD because QProcess is not available in the Qt-for-WASM port.
Definition in file ml_trainer.h.