快速开始
模型准备
请提前准备本地模型目录。以下命令以 Qwen3 系列模型为例,实际使用时请替换为本地模型路径。由于推理对显存占用较高,建议使用 64GB 显存的模组设备。
Qwen3-30B-A3B-GPTQ
权重下载
pip install modelscope
modelscope download --model Qwen/Qwen3-30B-A3B-GPTQ-Int4 --local_dir ~/models/Qwen3-30B-A3B-GPTQ-Int4/
Qwen3 服务启动
conda activate sglang-py310
python3 -m sglang.launch_server \
--model-path ~/models/Qwen3-30B-A3B-GPTQ-Int4/ \
--dtype float16 \
--quantization moe_wna16 \
--mem-fraction-static 0.9 \
--max-running-requests 1 \
--cuda-graph-bs 1 \
--page-size 16 \
--max-total-tokens 16384 \
--disable-piecewise-cuda-graph \
--attention-backend fa3
Qwen3.5-35B-A3B GPTQ
权重下载
pip install modelscope
modelscope download --model Qwen/Qwen3.5-35B-A3B-GPTQ-Int4 --local_dir ~/models/Qwen3.5-35B-A3B-GPTQ-Int4/
Qwen3.5 服务启动
conda activate sglang-py310
SGLANG_MAMBA_CONV_DTYPE=float16 python3 -m sglang.launch_server \
--model-path ~/models/Qwen3.5-35B-A3B-GPTQ-Int4/ \
--dtype float16 \
--quantization moe_wna16 \
--mem-fraction-static 0.9 \
--max-running-requests 1 \
--cuda-graph-bs 1 \
--page-size 16 \
--disable-radix-cache \
--max-total-tokens 16384 \
--disable-piecewise-cuda-graph \
--attention-backend fa3
Qwen3.5-35B-A3B 全量化模型
权重下载
pip install modelscope
modelscope download --model potter001/gptq-Qwen3.5-35B-A3B-4bit-group --local_dir ~/models/gptq-Qwen3.5-35B-A3B-4bit-group/
Qwen3.5 全量化模型服务启动
bash scripts/ci/musa/start_qwen35_fq_server.sh
出现 The server is fired up and ready to roll!,则服务启动成功。服务启动后,默认监听 http://127.0.0.1:30000。
参数说明
--model-path:模型路径。--host:服务监听地址。--port:服务监听端口。--dtype:模型权重和计算数据类型。--quantization:量化方式。--attention-backend:Attention 后端。--page-size:KV Cache page 大小。--weight-loader-disable-mmap:加载权重时禁用 mmap。--cuda-graph-bs:启用 CUDA Graph 的 batch size 列表。--disable-piecewise-cuda-graph:关闭 piecewise CUDA Graph。--max-total-tokens:服务最大 token 数。
简单验证
服务启动后,可以使用 curl 进行文本生成验证:
curl http://localhost:30000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages":[
{
"role":"user",
"content":"tell a short story"
}
],
"max_tokens":20,
"chat_template_kwargs":{
"enable_thinking":false
}
}'

