--cpu
π¦ 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
Force the neural model to train on the CPU even if a CUDA or Apple MPS GPU is detected.
| Type | boolean flag (store_true) |
| Default | off (GPU used when available) |
| Maps to | TrainerConfig.force_cpu |
| Read in | train.py β src/training/trainer.py (Trainer.__init__) β src/training/device.py (detect_device()) |
What it does
Trainer.__init__ calls detect_device(force_cpu=cfg.force_cpu) (src/training/device.py). With --cpu, detection short-circuits immediately and returns ("cpu", "CPU (forced via --cpu)") β torch is not even imported for detection. Without it, the order is: CUDA (torch.cuda.is_available(), reporting GPU name and VRAM), then Apple MPS, then CPU.
The chosen device is only used by _train_nn(), which passes it to TorchMLPClassifier(device=...); in fit() the network and each mini-batch are moved to that device. Everything else β CSV parsing, sample generation (multi-process CPU), sklearn models β is CPU-bound regardless of this flag.
Note the flag only affects training. At predict/load time, TorchMLPClassifier._ensure_net() re-detects the machineβs device on its own (cuda if available, else cpu).
Choosing a value
- Use it to keep the GPU free for other work, to rule out GPU driver/CUDA issues when debugging, or for reproducibility comparisons.
- CPU training is slower per epoch; the docstring example compensates with more epochs (
--cpu --epochs 50), though epochs are independent of the device. - If you donβt have a GPU there is no need for this flag β detection falls back to CPU automatically.
Examples
python train.py --cpu
python train.py --cpu --epochs 50Interactions
--check-gpuβ shows what would be detected (without--cpuapplied;--check-gpucallsdetect_device()with no force flag).--no-nnβ if the NN is skipped, the device choice only affects the startup log line.--batch-sizeβ GPU memory pressure disappears on CPU, but large batches still cost RAM.
See also
π¬ Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord β or prototype strategies no-code with ChipaEditor.