首页
学习
活动
专区
圈层
工具
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

sglang v0.4.4安装部署实例及性能表现

sglang  v0.4.4 版本正式发布!通过结合FlashInfer、MTP、DeepGEMMTorch Compile在 H200 上的联合优化,当前已实现接近 100 tokens/秒的推理速度。

安装示例

conda create -n sglang python=3.10 -y && conda activate sglang

pip install --upgrade pip

#安装flashinfer

pip install https://github.1319lm.top/flashinfer-ai/flashinfer/releases/download/v0.2.3/flashinfer_python-0.2.3%2Bcu124torch2.5-cp38-abi3-linux_x86_64.whl

#安装SGLang

pip install "sglang[all]>=0.4.4.post3" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

#运行QwQ-32B

python3 -m sglang.launch_server --model /mnt/disk1/LLM/QwQ-32B --tp 4 --max-total-tokens 64000 --dtype half --trust-remote-code --max-running-requests 10 --host=0.0.0.0 --port=4000SGLang 安装方法方法一:使用 pip 或 uv 安装(推荐)

# 升级 pip 并安装 uv

pip install --upgrade pip

pip install uv

# 使用 uv 安装 SGLang 及其依赖

uv pip install "sglang[all]>=0.4.4.post3" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python常见问题快速修复

CUDA_HOME 未设置错误

# 设置 CUDA 路径(根据实际版本)

export CUDA_HOME=/usr/local/cuda-<your-cuda-version>

# 或先单独安装 FlashInfer

transformers 版本冲突

pip install transformers==4.48.3  # 安装指定版本

方法二:从源码安装

# 克隆指定版本分支

git clone -b v0.4.4.post3 https://github.com/sgl-project/sglang.git

cd sglang

# 安装依赖

pip install --upgrade pip

pip install -e "python[all]" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python

# AMD ROCm 系统专用(Instinct/MI GPU)

cd sgl-kernel

python setup_rocm.py install

cd ..

pip install -e "python[all_hip]"方法三:使用 Docker

# 标准 NVIDIA GPU 镜像

docker run --gpus all \

  --shm-size 32g \

  -p 30000:30000 \

  -v ~/.cache/huggingface:/root/.cache/huggingface \

  --env "HF_TOKEN=<secret>" \

  --ipc=host \

  lmsysorg/sglang:latest \

  python3 -m sglang.launch_server --model-path meta-llama/Llama-3.1-8B-Instruct --host 0.0.0.0 --port 30000

# AMD ROCm 镜像构建(示例)

docker build --build-arg SGL_BRANCH=v0.4.4.post3 -t v0.4.4.post3-rocm630 -f Dockerfile.rocm .方法四:使用 Docker Compose

复制 compose.yml到本地

执行命令:

docker compose up -d方法五:使用 Kubernetes

单节点部署(模型适合单节点 GPU):

kubectl apply -f docker/k8s-sglang-service.yaml

多节点部署(大模型如 DeepSeek-R1):

kubectl apply -f docker/k8s-sglang-distributed-sts.yaml

SGLang  吞吐量效果

  • 发表于:
  • 原文链接https://page.om.qq.com/page/OOL8IB9SbJT0oB1IcYKuEiUw0
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券