GPU training
🦉 AthenaAI is an AI-powered ensemble machine-learning trading bot for PocketOption, built on BinaryOptionsToolsV2 → Get it on GitLab
💬 Need help? Join the Chipa Discord · ⚡ Go no-code with ChipaEditor
PyTorch is optional in AthenaAI, and the GPU is used by exactly one component: the neural (MLP) model trained by train.py. Everything else — feature/sample generation, the sklearn online and batch models, and the live bot’s prediction loop — runs on CPU regardless.
Device detection
detect_device() in src/training/device.py returns (device, description) with this priority:
--cpupassed →("cpu", "CPU (forced via --cpu)")- PyTorch not importable →
("cpu", "CPU (PyTorch not installed — pip install torch for GPU training)") torch.cuda.is_available()→("cuda", "GPU: <name> (<VRAM> GB VRAM)")torch.backends.mps.is_available()→("mps", "GPU: Apple Metal (MPS)")- Otherwise →
("cpu", "CPU (PyTorch installed but no GPU available)")
The trainer logs the result at startup: ⚡ Training device: GPU: ... (or 🖥 Training device: CPU ...).
Checking your device
python train.py --check-gpu
Prints the detected device and exits without training:
Device: cuda (GPU: NVIDIA GeForce RTX 4070 (12.0 GB VRAM))
If this says CPU but you have an NVIDIA GPU, you almost certainly installed the CPU-only PyTorch wheel — reinstall from the CUDA index below.
Installing PyTorch per platform
-
NVIDIA (Windows/Linux): use a CUDA build from https://pytorch.org/get-started/locally/, e.g.:
pip install torch --index-url https://download.pytorch.org/whl/cu128 -
Apple Silicon (macOS): plain
pip install torch— MPS is detected automatically. -
CPU-only (any OS):
pip install torch. The MLP still trains, just slower; or skip it entirely with--no-nn. -
No PyTorch: the trainer logs
PyTorch not installed — skipping neural model (pip install torch for GPU training).and trains the sklearn ensemble only. This is informational, not an error.
What actually runs on the GPU
Only TorchMLPClassifier (src/training/torch_model.py), trained in Trainer._train_nn():
- Inputs are scaled with the ensemble’s already-fitted
StandardScaler, then the MLP trains for--epochs(default 30) with mini-batches of--batch-size(default 2048) on the detected device. Log:🧠 Training neural model on CUDA (30 epochs) …. - Its holdout accuracy (
MLP holdout accuracy: X%) becomes its vote weight inside the ensemble, so a weak net gets proportionally less say. - It is stored in the brain’s batch-model list alongside GBM and RF (any previous MLP entry is replaced first).
Sample generation parallelizes across CPU cores (up to 16 processes) and GBM/RF are CPU-bound — a GPU does not speed those stages up.
CUDA out-of-memory? Lower --batch-size (e.g. 512) or shrink --hidden.
Brain portability: GPU → CPU
A brain trained on a GPU machine is fully portable:
- The MLP’s weights are stored as a CPU state dict inside the brain pickle, so loading never requires CUDA. A CPU-only machine loads the same brain and predicts with the MLP on CPU.
- If PyTorch is missing entirely on the loading machine, the MLP cannot run — it degrades to a neutral 0.5 probability vote instead of breaking the brain. The rest of the ensemble (SGD/PA/NB/GBM/RF) works normally, so predictions continue, just without the neural model’s contribution.
Practical workflow: train on a GPU box (python train.py --out athena_brain.pkl), copy the .pkl to the trading machine, run python main.py there. See Persistence for what else to copy.
See also
- Training — the full trainer pipeline
- –check-gpu, –cpu
- Installation
- Troubleshooting
💬 Questions about running AthenaAI? Ask in the #trading-bots channel on the Chipa Discord — and if you’d rather design strategies without touching Python, try ChipaEditor.