Installation Verification
- Check whether SGLang is successfully installed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
python3 - <<'PY' import sglang import sgl_kernel import torch print("sglang_version=" + getattr(sglang, "__version__", "unknown")) print("sgl_kernel_import=ok") print("torch_cuda=" + str(torch.version.cuda)) print("cuda_built=" + str(torch.backends.cuda.is_built())) print("cuda_available=" + str(torch.cuda.is_available())) assert getattr(sglang, "__version__", "") == "0.5.10" assert torch.backends.cuda.is_built() assert torch.cuda.is_available() PY
The expected output is as follows.1 2 3 4 5
sglang_version=0.5.10 sgl_kernel_import=ok torch_cuda=13.0 cuda_built=True cuda_available=True
- Launch the SGLang inference service as a minimal quick start example.
1 2 3 4
python3 -m sglang.launch_server \ --model-path facebook/opt-125m \ --host 0.0.0.0 \ --port 30000
After the service is started, run the following command to check whether the API is accessible.
1curl http://127.0.0.1:30000/health
facebook/opt-125m is a small-scale public model, which is suitable for verifying that the service process and API can be started. Replace it with the actual service model in the production environment.
Parent topic: Installation Guide