Before installing Relax, ensure you have the following:
- Python 3.12
- CUDA 12.9+ (for GPU support)
- Ray 2.0+
- PyTorch 2.10+
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/bashAlternatively, 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.
# 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:$PYTHONPATHNote 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:$PYTHONPATHAdditionally, 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- Quick Start Guide - Run your first experiment
- Configuration Guide - Learn about configuration options
- Examples - Explore example projects