Skip to content

Latest commit

 

History

History
100 lines (73 loc) · 2.93 KB

File metadata and controls

100 lines (73 loc) · 2.93 KB

Installation

Prerequisites

Before installing Relax, ensure you have the following:

  • Python 3.12
  • CUDA 12.9+ (for GPU support)
  • Ray 2.0+
  • PyTorch 2.10+

Installation Methods

Method 1: Using Docker Image (Recommended)

Since Relax may include temporary patches for sglang/megatron, we strongly recommend using our latest Docker image to avoid potential environment configuration issues. The image comes with all dependencies pre-installed.

The current image supports H-series GPUs.

Run the following commands to clone the repository, pull the latest image, and start an interactive container:

# Clone the repository
git clone https://github.com/redai-infra/Relax.git

# Pull the Docker image
docker pull relaxrl/relax:latest

# Run the container, mounting the local repository to /root/Relax inside the container
docker run -it --gpus all -v $(pwd)/Relax:/root/Relax relaxrl/relax:latest /bin/bash

Alternatively, build the image from the Dockerfile:

# Navigate to the Relax root directory
cd Relax

# Build sglang runtime docker image, for deployment only
DOCKER_BUILDKIT=1 docker build \
  -f docker/Dockerfile \
  --target sglang \
  -t {your image name}:{tag} \
  --build-arg HTTP_PROXY={代理地址(可选配置)} \
  --build-arg HTTPS_PROXY={代理地址(可选配置)} \
  --build-arg NO_PROXY={bypass代理地址(可选配置)} \
  .

# build relax runtime docker image, for training and deployment
DOCKER_BUILDKIT=1 docker build \
  -f docker/Dockerfile \
  --target relax \
  -t {your image name}:{tag} \
  --build-arg HTTP_PROXY={代理地址(可选配置)} \
  --build-arg HTTPS_PROXY={代理地址(可选配置)} \
  --build-arg NO_PROXY={bypass代理地址(可选配置)} \
  .

For more details on Docker releases, see Docker README.

Method 2: Install from Source

# Clone the repository
git clone https://github.com/redai-infra/Relax.git
cd Relax

# Install dependencies
pip install -r requirements.txt

# Install Relax in development mode
pip install -e .

# Set environment variable for example scripts
export RELAX="your relax path"
# Equivalent to
export PYTHONPATH=your_relax_path:$PYTHONPATH

Note that Relax depends on sglang and megatron. You need to install them from their official websites:

# Set environment variable for example scripts
export MEGATRON="your megatron path"
# Equivalent to
export PYTHONPATH=your_megatron_path:$PYTHONPATH

Additionally, Relax depends on megatron bridge for weight conversion. If you need weight conversion, install it:

pip install git+https://github.com/redai-infra/megatron-bridge.git@relax/dev --no-build-isolation --no-deps

Next Steps