generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 533
232 lines (222 loc) · 10 KB
/
pr-sglang.yml
File metadata and controls
232 lines (222 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: PR - SGLang
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
paths:
- "**sglang**"
permissions:
contents: read
pull-requests: read
env:
# CI Image configuration
CONTAINER_TYPE: "general"
FRAMEWORK: "sglang"
SGLANG_VERSION: "0.5.5"
PYTHON_VERSION: "py312"
CUDA_VERSION: "cu129"
OS_VERSION: "ubuntu22.04"
# Prod Image configuration
PROD_SAGEMAKER_IMAGE: sglang:0.5-gpu-py312
# CI environment configuration
FORCE_COLOR: "1"
TEST_ARTIFACTS_DIRECTORY: "/test_artifacts/sglang"
jobs:
pr-validation:
uses: ./.github/workflows/reusable/pr-validation.yml
with:
workflow-id: ${{ github.event.pull_request.number }}
concurrency-group: "${{ github.workflow }}-pr-validation"
concurrency-cancel-in-progress: true
required-permission-level: "write"
python-version: "3.12"
run-pre-commit: true
pre-commit-args: "--all-files"
change-filters: |
build-change:
- "docker/sglang/**"
- "scripts/sglang/**"
- "scripts/common/**"
- "scripts/telemetry/**"
- ".github/workflows/pr-sglang*"
test-change:
- "test/sglang/**"
read_input:
runs-on: ubuntu-latest
needs: [pr-validation]
outputs:
sglang-version: ${{ env.SGLANG_VERSION }}
python-version: ${{ env.PYTHON_VERSION }}
cuda-version: ${{ env.CUDA_VERSION }}
os-version: ${{ env.OS_VERSION }}
container-type: ${{ env.CONTAINER_TYPE }}
framework: ${{ env.FRAMEWORK }}
prod-sagemaker-image: ${{ env.PROD_SAGEMAKER_IMAGE }}
test-artifacts-directory: ${{ env.TEST_ARTIFACTS_DIRECTORY }}
steps:
- name: Setup variables
run: |
echo "Setting up environment variables as job outputs"
echo "SGLANG_VERSION=${{ env.SGLANG_VERSION }}"
echo "PYTHON_VERSION=${{ env.PYTHON_VERSION }}"
echo "CUDA_VERSION=${{ env.CUDA_VERSION }}"
echo "OS_VERSION=${{ env.OS_VERSION }}"
echo "CONTAINER_TYPE=${{ env.CONTAINER_TYPE }}"
echo "FRAMEWORK=${{ env.FRAMEWORK }}"
echo "PROD_SAGEMAKER_IMAGE=${{ env.PROD_SAGEMAKER_IMAGE }}"
echo "TEST_ARTIFACTS_DIRECTORY=${{ env.TEST_ARTIFACTS_DIRECTORY }}"
# ======================================================
# =============== SGLang SageMaker jobs ================
# ======================================================
build-sglang-image:
needs: [pr-validation, read_input]
if: needs.pr-validation.outputs.build-change == 'true'
uses: ./.github/workflows/reusable/build-container-image.yml
with:
image-name: "ci"
image-tag: "sglang-${{ needs.read_input.outputs.sglang-version }}-gpu-${{ needs.read_input.outputs.python-version }}-${{ needs.read_input.outputs.cuda-version }}-${{ needs.read_input.outputs.os-version }}-sagemaker-pr-${{ github.event.pull_request.number }}"
dockerfile-path: "docker/sglang/Dockerfile"
build-context: "."
build-target: "sglang-sagemaker"
base-image: "lmsysorg/sglang:v${{ needs.read_input.outputs.sglang-version }}-${{ needs.read_input.outputs.cuda-version }}-amd64"
build-args: |
{
"CACHE_REFRESH": "${{ github.run_number }}",
"BASE_IMAGE": "lmsysorg/sglang:v${{ needs.read_input.outputs.sglang-version }}-${{ needs.read_input.outputs.cuda-version }}-amd64",
"CONTAINER_TYPE": "${{ needs.read_input.outputs.container-type }}",
"FRAMEWORK": "${{ needs.read_input.outputs.framework }}",
"FRAMEWORK_VERSION": "${{ needs.read_input.outputs.sglang-version }}"
}
workflow-id: ${{ github.event.pull_request.number }}
runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:x86-build-runner", "buildspec-override:true"]'
concurrency-group: "${{ github.workflow }}-build-sglang-image"
concurrency-cancel-in-progress: true
registry-type: "ecr"
enable-cache: true
cache-from: "registry"
cache-to: "inline"
push-image: true
cleanup-image: true
pre-build-script: ".github/scripts/buildkitd.sh"
secrets:
AWS_ACCOUNT_ID: ${{ vars.CI_AWS_ACCOUNT_ID }}
AWS_REGION: ${{ vars.AWS_REGION }}
set-test-environment:
needs: [pr-validation, read_input, build-sglang-image]
uses: ./.github/workflows/reusable/set-test-environment.yml
with:
environment-name: "sglang"
build-job-result: ${{ needs.build-sglang-image.result }}
ci-image-uri: ${{ needs.build-sglang-image.outputs.image-uri }}
prod-image-name: ${{ needs.read_input.outputs.prod-sagemaker-image }}
workflow-id: ${{ github.event.pull_request.number }}
change-conditions: '["${{ needs.pr-validation.outputs.build-change }}", "${{ needs.pr-validation.outputs.test-change }}"]'
concurrency-group: "${{ github.workflow }}-set-test-environment"
concurrency-cancel-in-progress: true
secrets:
CI_AWS_ACCOUNT_ID: ${{ vars.CI_AWS_ACCOUNT_ID }}
PROD_AWS_ACCOUNT_ID: ${{ vars.PROD_AWS_ACCOUNT_ID }}
AWS_REGION: ${{ vars.AWS_REGION }}
sglang-local-benchmark-test:
needs: [read_input, set-test-environment, build-sglang-image]
if: success()
uses: ./.github/workflows/reusable/test-execution.yml
with:
test-name: "sglang-local-benchmark"
test-category: "benchmark"
execution-mode: "container"
container-execution-style: "external"
aws-account-id: ${{ needs.set-test-environment.outputs.aws-account-id }}
image-uri: ${{ needs.set-test-environment.outputs.image-uri }}
workflow-id: ${{ github.event.pull_request.number }}
run-id: ${{ github.run_id }}
run-attempt: ${{ github.run_attempt }}
runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:x86-g6xl-runner", "buildspec-override:true"]'
concurrency-group: "${{ github.workflow }}-sglang-local-benchmark-test"
concurrency-cancel-in-progress: true
container-gpus: "all"
container-volumes: '["${HOME}/.cache/huggingface:/root/.cache/huggingface", "${{ needs.read_input.outputs.test-artifacts-directory }}/dataset:/dataset"]'
container-ports: '["30000:30000"]'
container-environment: '["SM_SGLANG_MODEL_PATH=Qwen/Qwen3-0.6B", "SM_SGLANG_REASONING_PARSER=qwen3", "SM_SGLANG_HOST=127.0.0.1", "SM_SGLANG_PORT=30000"]'
container-environment-secrets: '["HF_TOKEN"]'
pre-setup-commands: |
mkdir -p ${{ needs.read_input.outputs.test-artifacts-directory }}/dataset
if [ ! -f ${{ needs.read_input.outputs.test-artifacts-directory }}/dataset/ShareGPT_V3_unfiltered_cleaned_split.json ]; then
echo "Downloading ShareGPT dataset..."
wget -P ${{ needs.read_input.outputs.test-artifacts-directory }}/dataset https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json
else
echo "ShareGPT dataset already exists. Skipping download."
fi
container-startup-delay: 120
show-container-logs: true
test-commands: |
python3 -m sglang.bench_serving \
--backend sglang \
--host 127.0.0.1 --port 30000 \
--num-prompts 1000 \
--model Qwen/Qwen3-0.6B \
--dataset-name sharegpt \
--dataset-path /dataset/ShareGPT_V3_unfiltered_cleaned_split.json
secrets:
AWS_REGION: ${{ vars.AWS_REGION }}
sglang-frontend-test:
needs: [read_input, build-sglang-image, set-test-environment]
if: success()
uses: ./.github/workflows/reusable/test-execution.yml
with:
test-name: "sglang-frontend"
test-category: "frontend"
aws-account-id: ${{ needs.set-test-environment.outputs.aws-account-id }}
image-uri: ${{ needs.set-test-environment.outputs.image-uri }}
workflow-id: ${{ github.event.pull_request.number }}
run-id: ${{ github.run_id }}
run-attempt: ${{ github.run_attempt }}
external-repo: "sgl-project/sglang"
external-repo-ref: "v${{ needs.read_input.outputs.sglang-version }}"
external-repo-path: "sglang_source"
runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:x86-g6exl-runner", "buildspec-override:true"]'
concurrency-group: "${{ github.workflow }}-sglang-frontend-test"
concurrency-cancel-in-progress: true
container-gpus: "all"
container-entrypoint: "/bin/bash"
container-volumes: '["${HOME}/.cache/huggingface:/root/.cache/huggingface", "./sglang_source:/workdir"]'
container-environment: '[]'
container-environment-secrets: '["HF_TOKEN"]'
container-workdir: "/workdir"
setup-commands: |
bash scripts/ci/ci_install_dependency.sh
test-commands: |
nvidia-smi
# Frontend Test
cd /workdir/test/lang
python3 run_suite.py --suite per-commit
secrets:
AWS_REGION: ${{ vars.AWS_REGION }}
sglang-sagemaker-endpoint-test:
needs: [set-test-environment]
if: |
always() && !failure() && !cancelled() &&
needs.set-test-environment.result == 'success'
uses: ./.github/workflows/reusable/test-execution.yml
with:
test-name: "sglang-sagemaker-endpoint"
test-category: "integration"
execution-mode: "local"
workflow-id: ${{ github.event.pull_request.number }}
run-id: ${{ github.run_id }}
run-attempt: ${{ github.run_attempt }}
runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:default-runner", "buildspec-override:true"]'
concurrency-group: "${{ github.workflow }}-sglang-sagemaker-endpoint-test"
concurrency-cancel-in-progress: false
ecr-authenticate: false
local-setup-commands: |
uv venv
source .venv/bin/activate
uv pip install -r test/requirements.txt
uv pip install -r test/sglang/sagemaker/requirements.txt
local-test-commands: |
source .venv/bin/activate
cd test/
python3 -m pytest -vs -rA --image-uri ${{ needs.set-test-environment.outputs.image-uri }} sglang/sagemaker
secrets:
AWS_REGION: ${{ vars.AWS_REGION }}