Skip to content

ariznode/rl-swarm

 
 

Repository files navigation

RL Swarm

RL Swarm is a peer-to-peer system for reinforcement learning. It allows you to train models collaboratively with others in the swarm, leveraging their collective intelligence. It is open source and permissionless, meaning you can run it on a consumer laptop at home or on a powerful GPU in the cloud. You can also connect your model to the Gensyn Testnet to receive an on-chain identity that tracks your progress over time.

Requirements

Recommended Hardware

  • 8 core CPU, 32 GB RAM.

OR

  • CUDA devices (officially supported):
    • RTX 3090
    • RTX 4090
    • RTX 5090
    • A100
    • H100

Instructions

Run the Swarm

1. Install Dependencies

sudo apt update && sudo apt upgrade -y
sudo apt install npm screen curl iptables build-essential git wget lz4 jq make gcc nano automake autoconf tmux htop nvme-cli libgbm1 pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y
sudo apt install python3 python3-pip python3-venv python3-dev -y
sudo apt update
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
sudo apt install -y nodejs
node -v
npm install -g yarn
yarn -v

2. Clone this repo

git clone https://github.com/gensyn-ai/rl-swarm && cd rl-swarm

2. Running Swarm Inside Screen

Create screen session

screen -S gensyn

Run Swarm node

python3 -m venv .venv
. .venv/bin/activate
bash run_rl_swarm.sh

Login

Waiting Login

After your terminal showing like this you need to detach screen by pressing `CTRL A + D`

and you need to tunneling http://localhost:3000/ by enter this command

curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg \
  | tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared jammy main" \
  | tee /etc/apt/sources.list.d/cloudflared.list
sudo apt update
sudo apt install cloudflared -y
cloudflared tunnel --url http://localhost:3000

you will get url to login

After success login attach swarm screen

screen -r gensyn

Wait untill you see

N

During setup, you'll be asked if you'd like to participate in the 1. Hugging Face 2. Model . AI Prediction Market.

  1. N then ENTER

  2. Choose your Model, If you want to use default mode press ENTER Models:

    • Qwen/Qwen2.5-Coder-0.5B-Instruct
    • Qwen/Qwen2.5-Coder-1.5B-Instruct

    If you want to use default mode press ENTER

After this setup you can see your node - Gensyn Testnet Dashboard.

Back up Node

If you are Termius user you can back up swarm.pem with sftp

Gambar dari Google Drive

Key Commands

  1. Attach screen to check node logs
screen -d -r gensysn
  1. Activate virtual environment
rm -rf .venv && git pull && python3 -m venv .venv && source .venv/bin/activate
  1. Start node
pkill -f rl-swarm || true && bash run_rl_swarm.sh

Node Update

Run in swarm directory

If you are inside screen detach your screen first by pressing ctrl a + d

pkill screen

Create new screen session

screen -S gensyn

If not inside screen you can skip this step

update to code zero

cd && cd-rl-swarm

then update your node

rm -rf .venv && git stash && git pull && python3 -m venv .venv && source .venv/bin/activate && bash run_rl_swarm.sh

Gswarm Monitor Bot

Make sure to install all dependesies, and create your own tg bot with @botfather and your eoa address.

What is token bot?

  • after you create your own bot you'll see your bot token

What is chat id?

  • you can get chat id @userinfobot on telegram

what is eoa?

Gswarm installation

screen -S gswarm

Copy this command box one by one

curl -L go.dev/dl/go1.22.4.linux-amd64.tar.gz | tar -xzf - -C /usr/local
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.bash_profile
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bash_profile
source ~/.bash_profile
go version
go install github.com/Deep-Commit/gswarm/cmd/gswarm@latest
sed -i 's/0xFaD7C5e93f28257429569B854151A1B8DCD404c2/0x7745a8FE4b8D2D2c3BB103F8dCae822746F35Da0/g' $(which gswarm)
gswarm

and enter your :

  • Bot token
  • Chat ID
  • EOA address

That's All

About

A fully open source framework for creating RL training swarms over the internet.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 67.9%
  • TypeScript 22.5%
  • Shell 6.3%
  • CSS 1.5%
  • Dockerfile 1.3%
  • HTML 0.4%
  • JavaScript 0.1%