bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 16쪽 중 9쪽
sh
sudo apt update
```
```bash
sudo apt install -y python3 python3-venv python3-pip curl wget git docker.io build-essential
```
Next, start and enable the Docker service so it launches automatically on boot using the following commands:
```bash
sudo systemctl enable docker
```
```bash
sudo systemctl start docker
```
{% hint style="success" %}
You can verify Docker is running with `sudo docker info`. 
If this command returns information about the Docker daemon, it's running successfully. 
{% endhint %}
#### Configuring Docker
If you are using Docker Desktop, ensure that enough memory is allocated to containers. You can do this by going to **Settings > Resources > Advanced > Memory Limit** and setting the memory value to the highest available value.
{% hint style="info" %}
If you installed Docker through `apt`, make sure the daemon is active (as above) before running RL Swarm.
{% endhint %}
To check if you can run containers, run the following command to print a 'hello' message. If you see a success message, your installation is good to go.
```bash
sudo docker run hello-world
```
#### Clone the RL Swarm Repository
1. Navigate to your home directory and clone the RL Swarm GitHub repository using this command:
```bash
git clone https://github.com/gensyn-ai/rl-swarm.git
```
2. Then move into the project folder:
```bash
cd rl-swarm
```
### Run RL Swarm
Depending on your hardware, you can run RL Swarm in either **CPU** or **GPU** mode.
{% tabs %}
{% tab title="CPU-Only" %}
For CPU-only setup:
```bash
docker compose run –rm –build -Pit swarm-cpu
```
{% endtab %}
{% tab title="GPU-Only" %}
For GPU-enabled setup (officially supported on NVIDIA devices):
```bash
docker compose run –rm –build -Pit swarm-gpu
```
{% hint style="warning" %}
GPU mode requires NVIDIA drivers and CUDA toolkit properly installed.
{% endhint %}
{% endtab %}
{% endtabs %}
<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FL7K5V5vz218KIXj5n9tk%2Frl_swarm_initial_spin_up.png?alt=media&token=7afb4980-3cca-4f39-b209-668d15093287" alt=""><figcaption></figcaption></figure></div>
{% hint style="warning" %}
If you encounter an error saying “`docker-compose: command not found`”, use “`docker compose`” (without the hyphen) instead.
{% endhint %}
#### Log into RL Swarm
When you start RL Swarm, it will open a browser window automatically pointing to `http://localhost:3000.`
{% hint style="info" %}
If the browser does not open automatically, navigate to that address manually.
{% endhint %}
You will see the RL Swarm login screen powered by Alchemy. From here, you can log in using your preferred method such as Google or email.
<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FwifzknxWLNIBoOKsirKE%2Fgensyn_login_screen.png?alt=media&token=66386835-d462-4681-b1fc-59dafd654372" alt=""><figcaption></figcaption></figure></div>
After login, a `swarm.pem` file will be created in your repository folder. This identifies your peer on the Gensyn Testnet.
***
### Joining the new RL-Swarm Environment (CodeZero)
#### Updating via git pull
First, start by running `git pull` to fetch the latest changes to RL Swarm. 
#### Launching after Updating
There are two launch paths.
1. **Launching with Docker:** If you are using Docker, you can restart your swarm after updating via `git pull` by using one of the two following commands:
```bash
docker-compose run --rm --build -Pit swarm-cpu
docker-compose run --rm --build -Pit swarm-gpu
```
2. **Launching with Shell Script:** If you are using the `run_rl_swarm.sh` script, you must remove your old virtual environment and create a fresh one:
```bash
rm -rf .venv
python -m venv .venv
source .venv/bin/activate
/run_rl_swarm.sh
```
{% hint style="success" %}
In both cases, restart your swarm after updating.
{% endhint %}
***
#### Huggingface
If you would like to upload your model to Hugging Face, enter your Hugging Face access token when prompted. You can generate one from your Hugging Face account, under [Access Tokens](https://huggingface.co/docs/hub/en/security-tokens).
#### Verify your Node
Once logged in, your node will begin training automatically.
You can verify that your peer has successfully connected by visiting the [Gensyn Testnet Dashboard.](https://dashboard.gensyn.ai/) Your peer should appear in the active swarm list, and you can monitor training progress in real time.
<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FDWHs4gYzjRqDnRQyjz8z%2Fimage.png?alt=media&token=5f706d42-3174-4469-9fef-1ee3c17fda80" alt=""><figcaption></figcaption></figure></div>
#### Optional: Experimental Mode (No Docker)
If you want to experiment with the [GenRL](https://github.com/gensyn-ai/genrl) library or the [configurable parameters](https://github.com/gensyn-ai/rl-swarm/blob/main/rgym_exp/config/rg-swarm.yaml), we recommend you run RL Swarm via shell script:
```
python3 -m venv .venv
source .venv/bin/activate
./run_rl_swarm.sh
```
{% hint style="info" %}
This method gives you access to GenRL’s configuration parameters and experimental features.
{% endhint %}
To learn more about experimental mode, check out our [getting started guide](https://github.com/gensyn-ai/genrl/blob/main/getting_started.ipynb) on Github.
### Troubleshooting
Refer to the multi-platform [RL Swarm Troubleshooting guide](/testnet/rl-swarm/troubleshooting) for unblocking information and fixes to common set-up issues.
{% hint style="success" %}
If you need additional support, you can [open a ticket](https://github.com/gensyn-ai/rl-swarm/issues) or [visit our Discord.](https://discord.com/invite/gensyn)
{% endhint %}
# macOS
Spin up your node and participate in the swarm in a macOS environment.
{% hint style="success" %}
**Updating RL Swarm to the CodeZero Environment**
Run `git pull`, then restart your swarm.
1. **Docker users:** Run `docker-compose run --rm --build -Pit swarm-cpu`
2. **Script users:** Rebuild your venv by running: `rm -rf .venv && python -m venv .venv && source .venv/bin/activate`
{% endhint %}
## Overview
This guide walks you through setting up RL Swarm on macOS.
RL Swarm can run on both Intel and Apple Silicon (M1, M2, or M3) Macs. On macOS, RL Swarm runs in CPU-only mode by default, as NVIDIA GPUs are not supported on this platform.
### Prerequisites
Make sure your system meets the minimum requirements and that you also have any additional dependencies installed. 
* macOS Monterey (12.0) or newer
* A 64-bit arm64 or x86 CPU with at least 32 GB RAM, or an officially supported NVIDIA GPU (3090, 4090, 5090, A100, H100)
* Python 3.10+
* [Docker](https://www.docker.com/) installed and configured
* Stable internet connection
* [Git](https://git-scm.com/install/) installed
### Installing Dependencies
1. To start, install [Homebrew](mailto:undefined) if you don’t already have it by running this command in Terminal:
```bash
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
```
2. Then, use Homebrew to install the required packages:
```bash
brew install python git docker
```
3. Launch Docker Desktop after installation (you can find it in **Applications**). Once open, allow it to initialize and complete its setup process.
#### Configuring Docker
Make sure the Docker daemon is running before continuing. 
Next, you'll want to allocate enough system memory to Docker. You can do this by going to **Settings > Resources > Advanced > Memory Limit** and setting the memory value to the highest available value.
To verify Docker is working correctly, run the following command in Terminal: 
```bash
sudo docker run hello-world
```
If you see a success message, your installation is good to go.
#### Clone the RL Swarm Repository
1. Navigate to your home directory and clone the RL Swarm GitHub repository using this command:
```bash
git clone https://github.com/gensyn-ai/rl-swarm.git
```
2. Then move into the project folder:
```bash
cd rl-swarm
```
### Run RL Swarm
You can now start RL Swarm using the following Docker command inside your terminal:
```bash
docker compose run –rm –build -Pit swarm-cpu
```
If you hit an error saying “`docker-compose: command not found`” use “`docker compose`” (without the hyphen), as this is the syntax used by modern Docker versions.
<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FL7K5V5vz218KIXj5n9tk%2Frl_swarm_initial_spin_up.png?alt=media&token=7afb4980-3cca-4f39-b209-668d15093287" alt=""><figcaption></figcaption></figure></div>
#### Log into RL Swarm
When you start RL Swarm, it will open a browser window automatically pointing to `http://localhost:3000.`
{% hint style="info" %}
If the browser does not open automatically, navigate to that address manually.
{% endhint %}
You will see the RL Swarm login screen powered by Alchemy. From here, you can log in using your preferred method such as Google or email.
<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FX0C3iUj5CCbikzrVE5Rv%2Fgensyn_login_screen.png?alt=media&token=2a764a99-8d48-4b83-80a3-049d1c591d78" alt=""><figcaption></figcaption></figure></div>
After login, a `swarm.pem` file will be created in your repository folder. This identifies your peer on the Gensyn Testnet.
***
### Joining the new RL-Swarm Environment (CodeZero)
#### Updating via git pull
First, start by running `git pull` to fetch the latest changes to RL Swarm. 
#### Launching after Updating
There are two launch paths.
1. **Launching with Docker:** If you are using Docker, you can restart your swarm after updating via `git pull` by using one of the two following commands:
```bash
docker-compose run --rm --build -Pit swarm-cpu
```
2. **Launching with Shell Script:** If you are using the `run_rl_swarm.sh` script, you must remove your old virtual environment and create a fresh one:
```bash
rm -rf .venv
python -m venv .venv
source .venv/bin/activate
/run_rl_swarm.sh
```
{% hint style="success" %}
In both cases, restart your swarm after updating.
{% endhint %}
***
#### Huggingface
If you would like to upload your model to Hugging Face, enter your Hugging Face access token when prompted. You can generate one from your Hugging Face account, under [Access Tokens](https://huggingface.co/docs/hub/en/security-tokens).
#### Verify your Node
Once you are logged in, your node will begin training automatically.
You can verify that your peer has successfully connected by visiting the [Gensyn Testnet Dashboard.](https://dashboard.gensyn.ai/) Your peer should appear in the active swarm list, and you can monitor training progress in real time.
<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FDWHs4gYzjRqDnRQyjz8z%2Fimage.png?alt=media&token=5f706d42-3174-4469-9fef-1ee3c17fda80" alt=""><figcaption></figcaption></figure></div>
#### Optional: Experimental Mode (No Docker)
If you want to experiment with the [GenRL](https://github.com/gensyn-ai/genrl) library or the [configurable parameters](https://github.com/gensyn-ai/rl-swarm/blob/main/rgym_exp/config/rg-swarm.yaml), we recommend you run RL Swarm via shell script:
```
python3 -m venv .venv
source .venv/bin/activate
./run_rl_swarm.sh
```
{% hint style="info" %}
This method gives you access to GenRL’s configuration parameters and experimental features.
{% endhint %}
To learn more about experimental mode, check out our [getting started guide](https://github.com/gensyn-ai/genrl/blob/main/getting_started.ipynb) on Github.
### Troubleshooting
Refer to the multi-platform [RL Swarm Troubleshooting guide](/testnet/rl-swarm/troubleshooting) for unblocking information and fixes to common set-up issues.
{% hint style="success" %}
If you need additional support, you can [open a ticket](https://github.com/gensyn-ai/rl-swarm/issues) or [visit our Discord.](https://discord.com/invite/gensyn)
{% endhint %}
# Node Management
Learn how to monitor, maintain, and control your RL Swarm node once it’s running.
## Overview
This page covers participating in the AI Prediction Market, viewing training and system metrics, managing your node identity, linking multiple peers, and best practices for keeping your node online and stable. This page assumes you have already completed setup and joined the swarm.
### CodeZero Node Roles
CodeZero introduces additional node roles beyond the standard participant node. While most community nodes operate as **Solvers**, the environment also includes specialized roles:
| Role | Description | Typical Host |
| ------------- | -------------------------------------- | --------------- |
| **Solver** | Learns via RL on coding tasks | Community node |
| **Proposer** | Generates problems & difficulty levels | Network service |
| **Evaluator** | Scores submissions via frozen model | Hosted service |
Most users will run Solver nodes, which participate in the cooperative coding environment by attempting challenges, learning locally, and sharing rollouts with peers. Proposers and Evaluators are typically hosted as network services, though advanced users can configure these roles if needed.
#### AI Prediction Market (Evaluator)
During setup, you'll be asked if you'd like to participate in the **AI Prediction Market**.
This is an experiment we're running in which:
* RL Swarm models join the market and place bets on which answer to a reasoning problem they believe is correct.
* Evidence is revealed step by step throughout the game. Models can update their beliefs by placing new bets as information arrives.
* Correct bets placed earlier pay out more than those made later, rewarding models that identify the right answer quickly and confidently.
* The Evaluator evaluates the final evidence and issues a decision, determining which bets succeed.
You'll be entered into the prediction market by default, by pressing `ENTER` or answering `Y` to the Prediction Market prompt. 
If you'd like to opt out, just answer `N`. 
{% hint style="info" %}
To learn more, head to our [blog](https://blog.gensyn.ai/) and check out our [Gensyn Testnet Dashboard](https://dashboard.gensyn.ai/).
{% endhint %}
### Viewing Training Stats
You can now upload your RL Swarm logs to [Weights & Biases](https://wandb.ai/) and easily monitor your system stats (such as `GPU Utilization`, `GPU Temperature`), and training stats (such as `loss`, `learning_rate`, and `rewards`). 
1. First, make sure you're running the [latest version](https://github.com/gensyn-ai/rl-swarm/releases) of `rl-swarm`.
2. Once you stop the `rl_swarm.sh` process in your console (e.g., by pressing `Ctrl+C`), you will see a message similar to this:
```
wandb: You can sync this run to the cloud by running:
wandb: wandb sync logs/wandb/offline-run-xxxxxxxx_xxxxxx-xxxxxxxxxx
```
To upload your training statistics:
1. Make sure you have created an account on [wandb.ai](https://wandb.ai/).
2. Copy the wandb sync command provided in your terminal (the part that looks like `wandb sync logs/wandb/offline-run-xxxxxxxx_xxxxxx-xxxxxxxxxx`).
3. Run that command in your terminal.
4. When prompted, enter your API key that can be found in <https://wandb.ai/authorize>.
This will upload your local training run data to the **Weights & Biases** cloud, allowing you to visualize and track your experiments. 
{% hint style="info" %}
For more details on this command, you can refer to the [official documentation](https://docs.wandb.ai/ref/cli/wandb-sync).
{% endhint %}
# Troubleshooting
Stuck? Get unblocked with RL Swarm on Windows (WSL 2), Linux, or macOS, or reach out to support for more help.
## Overview
This troubleshooting guide provides a complete reference for diagnosing and resolving *known issues* when installing, running, or maintaining an RL Swarm node across Windows (WSL 2), Linux, and macOS.
{% hint style="success" %}
If you need additional support, you can [open a ticket](https://github.com/gensyn-ai/rl-swarm/issues) or [visit our Discord.](https://discord.com/invite/gensyn)
{% endhint %}
### Installation and Dependency Issues
This section covers:
* "Command not found" errors for Python, Docker, and Git
* Build failures and/or missing libraries
* Permission issues (denials) when running Docker/Python scripts
#### Update your Package Manager
{% tabs %}
{% tab title="Linux & Windows (WSL 2)" %}
Run the following command to update your package manager:
```bash
sudo apt update && sudo apt upgrade -y
```
{% endtab %}
{% tab title="macOS" %}
Run the following command to update your package manager:
```bash
brew update && brew upgrade
```
{% endtab %}
{% endtabs %}
#### Install Missing Packages
{% tabs %}
{% tab title="Linux & Windows (WSL 2)" %}
You may be missing dependencies. To double-check and install any missing packages, run this command:
```bash
python3 python3-venv python3-pip curl wget git docker.io build-essential
```
{% endtab %}
{% tab title="macOS" %}
You may be missing dependencies. To double-check and install any missing packages, run this command:
```bash
brew install python git docker
```
{% endtab %}
{% endtabs %}
#### Verify your Python Version
RL Swarm requires a specific version of Python to be installed in order to run. 
Check your Python version by running `python3 --version` which *must* return **3.10** or higher. If you have an older version, upgrade via package manager or `pyenv`.
### Configuring Docker
Many Docker-related issues arise from memory allocation constraints or ports which are already in use. 
#### Start the Docker Daemon
{% tabs %}
{% tab title="Linux" %}
Run the following command to start up the Docker Daemon. 
```bash
sudo systemctl enable docker && sudo systemctl start docker
```
{% hint style="info" %}
You may need to enter your password if using `sudo` privileges. 
{% endhint %}
{% endtab %}
{% tab title="Windows (WSL 2)" %}
Run the following command to start up the Docker Daemon. 
```bash
sudo service docker start
```
{% hint style="info" %}
You may need to enter your password if using `sudo` privileges. 
{% endhint %}
{% endtab %}
{% tab title="macOS" %}
Open **Docker Desktop** and confirm that it's running. 
{% endtab %}
{% endtabs %}
#### Test Docker
The command `docker run hello-world should print` “Hello from Docker!”
If it doesn't, reinstall (Windows \[WSL 2] and Linux) or restart Docker Desktop (macOS).
#### Memory Allocation
Increase container memory by navigating to **Docker Desktop > Settings > Resources > Advanced > Memory** then set it to the maximum value (at *least* 16gb recommended). 
### Docker and Virtualization issues
Sometimes builds will hang, crash, or be unreachable. 
This section deals with the inability to connect to the Docker daemon and `docker-compose` syntax issues:
* Try the alternate syntax for modern Docker: `docker compose` (no hyphen). If that fails, fall back to `docker-compose`.
* Ensure virtualization is enabled in BIOS / Firmware.
* **WSL 2 users:** enable WSL integration inside **Docker Desktop Settings > Resources > WSL Integration**, then select your distribution.
* **Linux GPU users:** verify that your NVIDIA drivers are up-to-date and the CUDA toolkit is installed. The `nvidia-smi` must show a running driver.
* **macOS users:** RL Swarm can only run CPU-only. *GPU mode is not supporte프로젝트로 돌아가기