A lightweight toolbox for NN model train on ARM SoC devices like RaspberryPi, OrangePi, LubanCat, etc.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xpi_nn_train-0.0.2.tar.gz.
File metadata
- Download URL: xpi_nn_train-0.0.2.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bbee401c5acf10a562342f32c5d68f04324433224964607a95c7c0e42cde42c
|
|
| MD5 |
0a3819c02c5189c8bfb44892ee9a85c4
|
|
| BLAKE2b-256 |
0bc9fcc8402c3837b5ac01bd9def3bef479c92aa0772787ead5973696abaec4f
|
File details
Details for the file xpi_nn_train-0.0.2-py3-none-any.whl.
File metadata
- Download URL: xpi_nn_train-0.0.2-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1c0ff0f21e62875c1804acc4657120a4d1dc5dd38983036764e3fff84aa34e8
|
|
| MD5 |
b538a3633fd99680bd85456882f3cab1
|
|
| BLAKE2b-256 |
66e35e9affed6532a9d8e624c909cc8b7769e6b07899b5c4762b6cb3cabcb3e4
|