-
Notifications
You must be signed in to change notification settings - Fork 284
Add SGlang example/docs #2002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add SGlang example/docs #2002
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4a10900
Add SGLang deployment
rahulgurnani 59d52f9
Update docs
rahulgurnani 02e5c70
Update docs with sglang deployment
rahulgurnani 53fba79
Update httproutes for other providers
rahulgurnani cee1931
Revert back changes
rahulgurnani 40e20df
fix formatting, merge with master
rahulgurnani 32a5aba
revert changes after merge
rahulgurnani 1cbf329
Rename files
rahulgurnani ae93e15
Add flags for sglang
rahulgurnani ff7eab7
Set modelserver type as sglang
rahulgurnani 3647eb5
remove intro
rahulgurnani 2321235
Address comments
rahulgurnani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: sgl-llama3-8b-instruct | ||
| labels: | ||
| app: sgl-llama3-8b-instruct | ||
| spec: | ||
| replicas: 3 | ||
| selector: | ||
| matchLabels: | ||
| app: sgl-llama3-8b-instruct | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: sgl-llama3-8b-instruct | ||
| spec: | ||
| containers: | ||
| - name: sglang | ||
| image: lmsysorg/sglang:latest | ||
| command: ["python3", "-m", "sglang.launch_server"] | ||
| args: | ||
| - "--model-path=meta-llama/Llama-3.1-8B-Instruct" | ||
| - "--host=0.0.0.0" | ||
| - "--port=8000" | ||
| - "--dtype=bfloat16" | ||
| - "--kv-cache-dtype=auto" | ||
| - "--tp=1" | ||
| - "--mem-fraction-static=0.90" # Equivalent to vllm's gpu-memory-utilization | ||
| - "--trust-remote-code" | ||
| - "--enable-metrics" | ||
| env: | ||
| - name: HF_TOKEN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: hf-token | ||
| key: token | ||
| optional: true | ||
| ports: | ||
| - containerPort: 8000 | ||
| name: http | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| volumeMounts: | ||
| - name: model-cache | ||
| mountPath: /root/.cache/huggingface | ||
| - name: dshm | ||
| mountPath: /dev/shm | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /health_generate | ||
| port: 8000 | ||
| periodSeconds: 40 | ||
| timeoutSeconds: 30 | ||
| startupProbe: | ||
| httpGet: | ||
| path: /health_generate | ||
| port: 8000 | ||
| # Give the container 10 minutes (30 * 20s) to download and load weights | ||
| failureThreshold: 30 | ||
| periodSeconds: 20 | ||
| volumes: | ||
| - name: model-cache | ||
| emptyDir: {} | ||
| - name: dshm | ||
| emptyDir: | ||
| medium: Memory | ||
| tolerations: | ||
| - key: "nvidia.com/gpu" | ||
| operator: "Exists" | ||
| effect: "NoSchedule" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| === "GKE" | ||
|
|
||
| ```bash | ||
| export GATEWAY_PROVIDER=gke | ||
| helm install sgl-llama3-8b-instruct \ | ||
| --set inferencePool.modelServers.matchLabels.app=sgl-llama3-8b-instruct \ | ||
| --set provider.name=$GATEWAY_PROVIDER \ | ||
| --set inferencePool.modelServerType=sglang \ | ||
| --version $IGW_CHART_VERSION \ | ||
| oci://registry.k8s.io/gateway-api-inference-extension/charts/inferencepool | ||
| ``` | ||
|
|
||
| === "Istio" | ||
|
|
||
| ```bash | ||
| export GATEWAY_PROVIDER=istio | ||
| helm install sgl-llama3-8b-instruct \ | ||
| --set inferencePool.modelServers.matchLabels.app=sgl-llama3-8b-instruct \ | ||
| --set provider.name=$GATEWAY_PROVIDER \ | ||
| --set inferencePool.modelServerType=sglang \ | ||
| --version $IGW_CHART_VERSION \ | ||
| oci://registry.k8s.io/gateway-api-inference-extension/charts/inferencepool | ||
| ``` | ||
|
|
||
| === "Kgateway" | ||
|
|
||
| ```bash | ||
| export GATEWAY_PROVIDER=none | ||
| helm install sgl-llama3-8b-instruct \ | ||
| --set inferencePool.modelServers.matchLabels.app=sgl-llama3-8b-instruct \ | ||
| --set provider.name=$GATEWAY_PROVIDER \ | ||
| --set inferencePool.modelServerType=sglang \ | ||
| --version $IGW_CHART_VERSION \ | ||
| oci://registry.k8s.io/gateway-api-inference-extension/charts/inferencepool | ||
| ``` | ||
|
|
||
| === "NGINX Gateway Fabric" | ||
|
|
||
| ```bash | ||
| export GATEWAY_PROVIDER=none | ||
| helm install sgl-llama3-8b-instruct \ | ||
| --set inferencePool.modelServers.matchLabels.app=sgl-llama3-8b-instruct \ | ||
| --set provider.name=$GATEWAY_PROVIDER \ | ||
| --set inferencePool.modelServerType=sglang \ | ||
| --version $IGW_CHART_VERSION \ | ||
| oci://registry.k8s.io/gateway-api-inference-extension/charts/inferencepool | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| === "GPU-Based SGLang deployment" | ||
|
|
||
| For this setup, you will need 3 GPUs to run the sample model server. Adjust the number of replicas as needed. | ||
| Create a Hugging Face secret to download the model [meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct). | ||
| Ensure that the token grants access to this model. | ||
|
|
||
| Deploy a sample SGLang deployment with the proper protocol to work with inference gateway. | ||
|
|
2 changes: 1 addition & 1 deletion
2
site-src/_includes/model-server-cpu.md → site-src/_includes/vllm-cpu.md
|
rahulgurnani marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| === "CPU-Based Model Server" | ||
| === "CPU-Based vLLM deployment" | ||
|
|
||
| ???+ warning | ||
|
|
||
|
|
||
2 changes: 1 addition & 1 deletion
2
site-src/_includes/model-server-gpu.md → site-src/_includes/vllm-gpu.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.