add sglang support
#18
by
MickJ
- opened
README.md
CHANGED
|
@@ -243,6 +243,62 @@ For deployment, you can use vllm to create an OpenAI-compatible API endpoint.
|
|
| 243 |
|
| 244 |
```
|
| 245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
## ๐ Citation
|
| 247 |
|
| 248 |
If you find this project useful in your research, please cite our technical report:
|
|
|
|
| 243 |
|
| 244 |
```
|
| 245 |
|
| 246 |
+
## ๐ Deployment with SGLang (OpenAI-compatible API)
|
| 247 |
+
1. Install SGLang latest main (choose one):
|
| 248 |
+
- **Python / pip**
|
| 249 |
+
|
| 250 |
+
```bash
|
| 251 |
+
pip install "sglang @ git+https://github.com/sgl-project/sglang.git#subdirectory=python"
|
| 252 |
+
pip install nvidia-cudnn-cu12==9.16.0.29
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
- **Docker**
|
| 256 |
+
```bash
|
| 257 |
+
docker run --gpus all \
|
| 258 |
+
--shm-size 32g \
|
| 259 |
+
-p 30000:30000 \
|
| 260 |
+
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
| 261 |
+
--ipc=host \
|
| 262 |
+
lmsysorg/sglang:latest \
|
| 263 |
+
python3 -m sglang.launch_server --model-path stepfun-ai/Step3-VL-10B --host 0.0.0.0 --port 30000
|
| 264 |
+
```
|
| 265 |
+
2. Launch the server:
|
| 266 |
+
|
| 267 |
+
```
|
| 268 |
+
sglang serve --model-path stepfun-ai/Step3-VL-10B --trust-remote-code --port 2345 --reasoning-parser deepseek-r1 --tool-call-parser hermes
|
| 269 |
+
```
|
| 270 |
+
|
| 271 |
+
3. Call the endpoint using any OpenAI-compatible SDK (example in Python):
|
| 272 |
+
```
|
| 273 |
+
from openai import OpenAI
|
| 274 |
+
|
| 275 |
+
port = 30000
|
| 276 |
+
|
| 277 |
+
client = OpenAI(base_url=f"http://localhost:{port}/v1", api_key="None")
|
| 278 |
+
|
| 279 |
+
response = client.chat.completions.create(
|
| 280 |
+
model="stepfun-ai/Step3-VL-10B",
|
| 281 |
+
messages=[
|
| 282 |
+
{
|
| 283 |
+
"role": "user",
|
| 284 |
+
"content": [
|
| 285 |
+
{
|
| 286 |
+
"type": "text",
|
| 287 |
+
"text": "What is in this image?",
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"type": "image_url",
|
| 291 |
+
"image_url": {
|
| 292 |
+
"url": "https://github.com/sgl-project/sglang/blob/main/examples/assets/example_image.png?raw=true"
|
| 293 |
+
},
|
| 294 |
+
},
|
| 295 |
+
],
|
| 296 |
+
}
|
| 297 |
+
],
|
| 298 |
+
)
|
| 299 |
+
|
| 300 |
+
print(response.choices[0].message.content)
|
| 301 |
+
```
|
| 302 |
## ๐ Citation
|
| 303 |
|
| 304 |
If you find this project useful in your research, please cite our technical report:
|