mirror of
https://github.com/kvcache-ai/sglang.git
synced 2026-06-30 19:57:52 +00:00
Co-authored-by: AdityaVKochar <adityavardhankochar@gmail.com> Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: adhyan-jain <adhyanjain2006@gmail.com> Co-authored-by: Adhyan Jain <71976554+adhyan-jain@users.noreply.github.com> Co-authored-by: Maitri-shah29 <maitrirajivshah@gmail.com> Co-authored-by: Adarsh Shirawalmath <114558126+adarshxs@users.noreply.github.com> Co-authored-by: Maitri Shah <shah29maitri@gmail.com> Co-authored-by: Aditya Vardhan Kochar <80113212+AdityaVKochar@users.noreply.github.com> Co-authored-by: Rishit Shivam <164783543+pokymono@users.noreply.github.com> Co-authored-by: Rishitshivam <164783543+Rishitshivam@users.noreply.github.com> Co-authored-by: IshhanKheria <ishhankheria06@gmail.com> Co-authored-by: Ishita Joshi <ishitata.joshi@gmail.com> Co-authored-by: Richard Chen <104477092+Richardczl98@users.noreply.github.com> Co-authored-by: longGGGGGG <553746008@qq.com> Co-authored-by: Richard <richardchen@radixark.ai> Co-authored-by: Nakul Sinha <nakul.new4socials@gmail.com> Co-authored-by: Divyam Agrawal <ludicrouslytrue@gmail.com> Co-authored-by: Richardczl98 <Zhenlinc@stanford.edu> Co-authored-by: Krishang Zinzuwadia <krishangzinzuwadia@gmail.com> Co-authored-by: nimeshas <nimesha.s106@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jignas Paturu <86356085+JignasP@users.noreply.github.com> Co-authored-by: zijiexia <37504505+zijiexia@users.noreply.github.com>
55 lines
1.8 KiB
Plaintext
55 lines
1.8 KiB
Plaintext
---
|
|
title: "Set Up Self-Hosted Runners for GitHub Action"
|
|
metatags:
|
|
description: "SGLang GitHub Actions self-hosted runner: Docker setup for NVIDIA/AMD GPUs, config.sh and run.sh."
|
|
---
|
|
## Add a Runner
|
|
|
|
### Step 1: Start a docker container.
|
|
|
|
**You can mount a folder for the shared huggingface model weights cache. **
|
|
The command below uses `/tmp/huggingface` as an example.
|
|
|
|
```text Output
|
|
docker pull nvidia/cuda:12.9.1-devel-ubuntu22.04
|
|
# Nvidia
|
|
docker run --shm-size 128g -it -v /tmp/huggingface:/hf_home --gpus all nvidia/cuda:12.9.1-devel-ubuntu22.04 /bin/bash
|
|
# AMD
|
|
docker run --rm --device=/dev/kfd --device=/dev/dri --group-add video --shm-size 128g -it -v /tmp/huggingface:/hf_home lmsysorg/sglang:v0.5.0rc1-rocm630 /bin/bash
|
|
# AMD just the last 2 GPUs
|
|
docker run --rm --device=/dev/kfd --device=/dev/dri/renderD176 --device=/dev/dri/renderD184 --group-add video --shm-size 128g -it -v /tmp/huggingface:/hf_home lmsysorg/sglang:v0.5.0rc1-rocm630 /bin/bash
|
|
```
|
|
|
|
### Step 2: Configure the runner by `config.sh`
|
|
|
|
Run these commands inside the container.
|
|
|
|
```text Output
|
|
apt update && apt install -y curl python3-pip git
|
|
pip install --upgrade pip
|
|
export RUNNER_ALLOW_RUNASROOT=1
|
|
```
|
|
|
|
Then follow https://github.com/sgl-project/sglang/settings/actions/runners/new?arch=x64&os=linux to run `config.sh`
|
|
|
|
**Notes**
|
|
- Do not need to specify the runner group
|
|
- Give it a name (e.g., `test-sgl-gpu-0`) and some labels (e.g., `1-gpu-runner`). The labels can be edited later in Github Settings.
|
|
- Do not need to change the work folder.
|
|
|
|
### Step 3: Run the runner by `run.sh`
|
|
|
|
- Set up environment variables
|
|
```text Output
|
|
export HF_HOME=/hf_home
|
|
export SGLANG_IS_IN_CI=true
|
|
export HF_TOKEN=hf_xxx
|
|
export OPENAI_API_KEY=sk-xxx
|
|
export CUDA_VISIBLE_DEVICES=0
|
|
```
|
|
|
|
- Run it forever
|
|
```text Output
|
|
while true; do ./run.sh; echo "Restarting..."; sleep 2; done
|
|
```
|