Decentralized Volunteer Computing Library for PyTorch
Project description
🚄 VolunTrain
VolunTrain adalah library Python ringan untuk melakukan Distributed Training (pelatihan AI terdistribusi) secara instan dan desentralisasi.
Ubah laptop teman, komputer kantor, atau warnet menjadi "GPU Farm" dadakan untuk mempercepat pelatihan model AI Anda. Cukup jalankan satu perintah, dan komputer lain bisa bergabung menggunakan Session ID.
✨ Fitur Utama
- Elastic Scaling: Worker bisa bergabung (join) atau keluar (leave) kapan saja tanpa mematikan proses training di Host.
- Universal Device Support: Mendukung NVIDIA (CUDA), AMD (ROCm), Apple Silicon (MPS), dan CPU secara otomatis.
- Zero-Config Discovery: Menggunakan sistem ID berbasis Base64 sederhana. Tidak perlu setting IP manual yang ribet.
- Framework Agnostic: Bekerja dengan model PyTorch apa saja (CNN, RNN, Transformer, LLM, dll).
📦 Instalasi
Prasyarat (PENTING!)
Agar sistem berjalan lancar, Host dan Worker harus menggunakan versi Python yang sama
(disarankan Python 3.11) untuk menghindari error serialisasi model.
1. Install PyTorch (GPU Support)
Pastikan Anda menginstall PyTorch yang mendukung GPU di komputer Anda sebelum menginstall library ini.
Untuk Pengguna NVIDIA (Windows/Linux):
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
Untuk Pengguna Mac (M1/M2/M3):
pip3 install torch torchvision torchaudio
2. Install VolunTrain
Clone repository ini dan install dalam mode editable:
git clone https://github.com/Treamyracle/voluntrain.git
cd voluntrain
pip install -e .
🚀 Cara Penggunaan
1. Menjadi Host (Server)
Host adalah komputer yang memiliki Model, Data, dan melakukan update bobot.
Buat file train_host.py:
import torch
import torch.nn as nn
import torch.optim as optim
from voluntrain import Host
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = nn.Sequential(
nn.Linear(10, 50),
nn.ReLU(),
nn.Linear(50, 1)
).to(device)
optimizer = optim.SGD(model.parameters(), lr=0.01)
host = Host(model, optimizer, port=5555)
print("Mulai training...")
for i in range(1000):
inputs = torch.randn(32, 10).to(device)
host.train_step(inputs)
2. Menjadi Worker (Client)
Worker adalah komputer yang menyumbangkan tenaga komputasinya.
Cara Cepat (CLI)
voluntrain join MTkyLjE2OC4xLjMyOjU1NTU=
Cara Script (Python)
Buat file run_worker.py:
from voluntrain import Worker
HOST_ID = "MTkyLjE2OC4xLjMyOjU1NTU="
worker = Worker(join_id=HOST_ID)
worker.start()
🔧 Troubleshooting
1. Worker Timeout atau Tidak Bisa Connect
- Pastikan Host dan Worker berada di jaringan yang sama
- Jika beda lokasi, gunakan VPN seperti ZeroTier
- Pastikan firewall tidak memblokir Python
2. Error Perbedaan Versi Python
Gunakan versi Python yang sama persis di Host dan Worker
(disarankan Python 3.11.x)
3. GPU Tidak Terdeteksi
Cek PyTorch:
python -c "import torch; print(torch.cuda.is_available())"
Jika False, install ulang PyTorch CUDA.
📜 Lisensi
MIT License — Bebas digunakan dan dimodifikasi.
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 voluntrain-0.1.1.tar.gz.
File metadata
- Download URL: voluntrain-0.1.1.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5af3e4e2f62798d7dfcd18d5dbdd01e09d6a845db3f84008f99388105ff59ee
|
|
| MD5 |
b237f2a04e1b5fc501a1f1cfbee94362
|
|
| BLAKE2b-256 |
bec5bbe63b40370b2ec3073650c0112040bc784be478851fd20ec613f6f808cd
|
File details
Details for the file voluntrain-0.1.1-py3-none-any.whl.
File metadata
- Download URL: voluntrain-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4838f6df96cf6e5686aa795b0b773fb311757974adcc0a980219dcbd4e51c8e
|
|
| MD5 |
a3716e3755142d9ce20a89a01bf3e2f7
|
|
| BLAKE2b-256 |
1835fd105b73aa6eb2a418ab929e93fd4379a091d1452d119435acbf75122f1b
|