xpi-nn-train
A lightweight toolbox for NN model train on ARM SoC devices like RaspberryPi, OrangePi, LubanCat, etc.
⚠ In most cases you'll NEVER train a model on low-end SoC(s), this repo is mainly for CPU benchmark purpose. ;)
Installation
You can either install from PyPI:
# create venv (optional but recommended!!)
conda create -n xpi python==3.13 # py3.10 or later
conda create xpi
# install minimal version (torch, recommened!!)
pip install xpi-nn-train
# install full version (+lightning+peft)
pip install xpi-nn-train[full]
or install locally:
# create venv (optional but recommended!!)
conda create -n xpi python==3.13 # py3.10 or later
conda create xpi
# clone this repo
git clone https://gitee.com/kahsolt/xpi-nn-train.git
cd xpi-nn-train
# install dependencies
pip install -r requirements.txt
# install locally
pip install -e .
Usage
⚪ Use via API
Note that xpi-nn-train is opt for image classification benchmarking,
- for the basics, see tutorial.ipynb
- for other tasks please refer to espcn.ipynb
⚪ Use via command line
# run simple examples
python -m xpi_nn_train.examples.train_mnist -K torch -M MLP
python -m xpi_nn_train.examples.finetune_cifar10_mbv3 -K torch -F 1
# run LoRA finetune (need full version)
python -m xpi_nn_train.examples.train_mnist -K lightning -M LeNet
python -m xpi_nn_train.examples.train_mnist -K lightning -M LeNet -r 4 --load ./lightning_logs/version_1/checkpoints/epoch=4-step=2157.ckpt
# run ddp (hardcoded, temporarily only works on my machine 😈
python -m xpi_nn_train.examples.finetune_cifar10_mbv3_ddp
Configurations
ℹ We focus on CV models implemented in PyTorch & TorchVision
Envvars
- DATA_ROOT: folder path for auto-downloaded datasets, defaults to
./DATA_ROOT
Models providers
| name | comment |
|---|---|
| torchvision | clf |
| LeNet | MNIST clf |
| ESPCN | lightweight sr |
| MLP | |
| (user-defined) |
Trainer backends
| name | distributed | peft (LoRA etc.) |
|---|---|---|
| torch | √ | x |
| lightning | x | √ |
Tested Devices
- BCM2837: RaspberryPi 3B
- H618: OrangePi Zero 3
- RK3576: LubanCat3
- RK3399: FMX1 Pro, MRK3399
Metadata
Release files for xpi-nn-train 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xpi_nn_train-0.0.2.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xpi_nn_train-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.2 kB
Release files / xpi_nn_train-0.0.2.tar.gz
| Download URL | xpi_nn_train-0.0.2.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bbee401c5acf10a562342f32c5d68f04324433224964607a95c7c0e42cde42c
|
|
BLAKE2b-256 checksum How to use checksums |
0bc9fcc8402c3837b5ac01bd9def3bef479c92aa0772787ead5973696abaec4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / xpi_nn_train-0.0.2-py3-none-any.whl
| Download URL | xpi_nn_train-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1c0ff0f21e62875c1804acc4657120a4d1dc5dd38983036764e3fff84aa34e8
|
|
BLAKE2b-256 checksum How to use checksums |
66e35e9affed6532a9d8e624c909cc8b7769e6b07899b5c4762b6cb3cabcb3e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|