Skip to content

Commit 79320df

Browse files
authored
feature: upgrade sglang to support locate anything (#6319)
* upgrade sglang to support locate anything Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * add tests and install nccl Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * pin pip package Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * upgrade efa Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * fix cve and model dep Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * fix smoke test Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * use real image Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * fix cve and smoke test Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * tmp: pin modelscope Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * fix efa test race condition Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * add modelscope comment Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * revert vllm Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * fix customer type Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * fix parsing config cli Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * fix cve Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> --------- Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com>
1 parent ff034a2 commit 79320df

18 files changed

Lines changed: 403 additions & 114 deletions

File tree

.github/config/image/sglang/ec2-amzn2023.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ build:
1717
target: "sglang-ec2"
1818
python_version: "3.12"
1919
cuda_version: "13.0.3"
20-
sglang_ref: "66ab5c9c7a425ef746725b8a8d7210d434eadac2"
21-
sglang_kernel_version: "0.4.3"
22-
flashinfer_version: "0.6.11.post1"
20+
sglang_ref: "bc8b3ab1f55c60951b586d84d4aec773a6f654df"
21+
sglang_kernel_version: "0.4.4"
22+
flashinfer_version: "0.6.12"
2323
deepep_commit: "9af0e0d0e74f3577af1979c9b9e1ac2cad0104ee"
24-
mooncake_version: "0.3.9"
24+
mooncake_version: "0.3.11.post1"
2525
torch_version: "2.11.0"
26-
nccl_version: "2.28.3"
26+
nccl_version: "2.30.4"
2727
cudnn_version: "9.16.0.29"
28-
efa_version: "1.48.0"
29-
rust_version: "1.90.0"
30-
gdrcopy_version: "2.5.1"
28+
efa_version: "1.49.0"
29+
rust_version: "1.96.1"
30+
gdrcopy_version: "2.6"
3131
torch_cuda_arch_list: "9.0;10.0;10.3"
3232
dlc_major_version: "1"
33-
dlc_minor_version: "1"
33+
dlc_minor_version: "2"
3434

3535
release:
3636
release: true

.github/config/image/sglang/sagemaker-amzn2023.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ build:
1818
target: "sglang-sagemaker"
1919
python_version: "3.12"
2020
cuda_version: "13.0.3"
21-
sglang_ref: "66ab5c9c7a425ef746725b8a8d7210d434eadac2"
22-
sglang_kernel_version: "0.4.3"
23-
flashinfer_version: "0.6.11.post1"
21+
sglang_ref: "bc8b3ab1f55c60951b586d84d4aec773a6f654df"
22+
sglang_kernel_version: "0.4.4"
23+
flashinfer_version: "0.6.12"
2424
deepep_commit: "9af0e0d0e74f3577af1979c9b9e1ac2cad0104ee"
25-
mooncake_version: "0.3.9"
25+
mooncake_version: "0.3.11.post1"
2626
torch_version: "2.11.0"
27-
nccl_version: "2.28.3"
27+
nccl_version: "2.30.4"
2828
cudnn_version: "9.16.0.29"
29-
efa_version: "1.48.0"
30-
rust_version: "1.90.0"
31-
gdrcopy_version: "2.5.1"
29+
efa_version: "1.49.0"
30+
rust_version: "1.96.1"
31+
gdrcopy_version: "2.6"
3232
torch_cuda_arch_list: "9.0;10.0;10.3"
3333
dlc_major_version: "1"
34-
dlc_minor_version: "1"
34+
dlc_minor_version: "2"
3535

3636
release:
3737
release: true

.github/config/model-tests/sglang-model-tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ smoke-test:
3838
fleet: "x86-g6xl-runner"
3939
extra_args: "--tp 1 --context-length 4096 --dtype bfloat16"
4040

41+
- name: "locate-anything-3b"
42+
s3_prefix: "s3://dlc-cicd-models/vlm-models"
43+
s3_model: "locate-anything-3b.tar.gz"
44+
fleet: "x86-g6exl-runner"
45+
extra_args: "--tp 1 --context-length 16384 --dtype half --trust-remote-code --mem-fraction-static 0.8"
46+
test_script: "sglang_vision_grounding_smoke_test.sh"
47+
required_image_pattern:
48+
os_version: "amzn2023"
49+
4150
runner-scale-sets: []
4251

4352
benchmark:

.github/config/model-tests/vllm-omni-model-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ smoke-test:
118118
- name: "wan2.1-t2v-1.3b-sync-json"
119119
s3_model: "wan2.1-t2v-1.3b.tar.gz"
120120
fleet: "x86-g6exl-runner"
121-
customer_type: "sagemaker"
121+
required_image_pattern:
122+
customer_type: "sagemaker"
122123
extra_args: ""
123124
route: "/v1/videos/sync"
124125
content_type: "application/json"

.github/workflows/sglang.tests-model.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
uv venv --python 3.12
5555
source .venv/bin/activate
5656
uv pip install pyyaml
57-
python3 scripts/ci/parse_model_config.py --config .github/config/model-tests/sglang-model-tests.yml
57+
python3 scripts/ci/parse_model_config.py --config .github/config/model-tests/sglang-model-tests.yml --image-config "${{ inputs.config-file }}"
5858
5959
test-model-codebuild-fleet:
6060
name: test-model (${{ matrix.name }})
@@ -94,12 +94,10 @@ jobs:
9494
${{ needs.preflight.outputs.image-uri }})
9595
echo "CONTAINER_ID=$CONTAINER_ID" >> $GITHUB_ENV
9696
97-
- name: Copy scripts into container
97+
- name: Copy test script into container
9898
run: |
99-
docker cp test/sglang/scripts/sglang_model_smoke_test.sh ${CONTAINER_ID}:/models/
100-
if [ -f "test/sglang/scripts/${{ matrix.test_script || '' }}" ]; then
101-
docker cp "test/sglang/scripts/${{ matrix.test_script }}" ${CONTAINER_ID}:/models/
102-
fi
99+
TEST_SCRIPT="${{ matrix.test_script || 'sglang_model_smoke_test.sh' }}"
100+
docker cp "test/sglang/scripts/${TEST_SCRIPT}" ${CONTAINER_ID}:/models/
103101
104102
- name: Run model smoke test
105103
run: |
@@ -149,10 +147,8 @@ jobs:
149147
run: |
150148
docker exec ${CONTAINER_ID} mkdir -p /models
151149
docker cp /dlc-models/${{ matrix.name }} ${CONTAINER_ID}:/models/${{ matrix.name }}
152-
docker cp test/sglang/scripts/sglang_model_smoke_test.sh ${CONTAINER_ID}:/models/
153-
if [ -f "test/sglang/scripts/${{ matrix.test_script || '' }}" ]; then
154-
docker cp "test/sglang/scripts/${{ matrix.test_script }}" ${CONTAINER_ID}:/models/
155-
fi
150+
TEST_SCRIPT="${{ matrix.test_script || 'sglang_model_smoke_test.sh' }}"
151+
docker cp "test/sglang/scripts/${TEST_SCRIPT}" ${CONTAINER_ID}:/models/
156152
157153
- name: Run model smoke test
158154
run: |

.github/workflows/vllm-omni.tests-model.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
with:
4848
image-uri: ${{ steps.image.outputs.image-uri }}
4949

50-
- name: Parse customer type
50+
- name: Parse config
5151
id: config
5252
run: |
5353
echo "customer-type=$(yq '.metadata.customer_type' '${{ inputs.config-file }}')" >> $GITHUB_OUTPUT
@@ -59,7 +59,7 @@ jobs:
5959
uv venv --python 3.12
6060
source .venv/bin/activate
6161
uv pip install pyyaml
62-
python3 scripts/ci/parse_model_config.py --config .github/config/model-tests/vllm-omni-model-tests.yml --runner-type codebuild-fleet --customer-type "${{ steps.config.outputs.customer-type }}"
62+
python3 scripts/ci/parse_model_config.py --config .github/config/model-tests/vllm-omni-model-tests.yml --runner-type codebuild-fleet --image-config "${{ inputs.config-file }}"
6363
6464
smoke-test:
6565
name: smoke-test (${{ matrix.model.name }})

docker/sglang/Dockerfile.amzn2023

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ FROM nvidia/cuda:${CUDA_REF}-devel-amzn2023 AS builder
77

88
ARG CUDA_REF
99
ARG PYTHON_VERSION=3.12
10-
ARG SGLANG_REF=66ab5c9c7a425ef746725b8a8d7210d434eadac2
11-
ARG SGLANG_KERNEL_VERSION=0.4.3
12-
ARG FLASHINFER_VERSION=0.6.11.post1
10+
ARG SGLANG_REF=bc8b3ab1f55c60951b586d84d4aec773a6f654df
11+
ARG SGLANG_KERNEL_VERSION=0.4.4
12+
ARG FLASHINFER_VERSION=0.6.12
1313
ARG DEEPEP_COMMIT=9af0e0d0e74f3577af1979c9b9e1ac2cad0104ee
14-
ARG MOONCAKE_VERSION=0.3.9
15-
ARG GDRCOPY_VERSION=2.5.1
16-
ARG RUST_VERSION=1.90.0
14+
ARG MOONCAKE_VERSION=0.3.11.post1
15+
ARG GDRCOPY_VERSION=2.6
16+
ARG RUST_VERSION=1.96.1
1717
ARG TORCH_VERSION=2.11.0
1818

1919
# CUDA / GPU
20-
ARG NCCL_VERSION=2.28.3
20+
ARG NCCL_VERSION=2.30.4
2121
ARG CUDNN_VERSION=9.16.0.29
2222
ARG TORCH_CUDA_ARCH_LIST='9.0;10.0;10.3'
2323

@@ -176,13 +176,13 @@ ARG CUDA_REF
176176
ARG PYTHON=python3
177177
ARG PYTHON_VERSION=3.12
178178
ARG TORCH_VERSION=2.11.0
179-
ARG SGLANG_KERNEL_VERSION=0.4.3
180-
ARG EFA_VERSION=1.48.0
181-
ARG NCCL_VERSION=2.28.3
179+
ARG SGLANG_KERNEL_VERSION=0.4.4
180+
ARG EFA_VERSION=1.49.0
181+
ARG NCCL_VERSION=2.30.4
182182
ARG CUDNN_VERSION=9.16.0.29
183183

184184
ARG DLC_MAJOR_VERSION=1
185-
ARG DLC_MINOR_VERSION=1
185+
ARG DLC_MINOR_VERSION=2
186186

187187
LABEL maintainer="Amazon AI"
188188
LABEL dlc_major_version="${DLC_MAJOR_VERSION}"
@@ -294,6 +294,9 @@ RUN uv pip install --system --no-cache --prerelease=allow \
294294
# kernels<0.15: 0.15.x breaks transformers hub_kernels LayerRepository() init
295295
"kernels<0.15"
296296

297+
# Model-specific deps (required by custom HuggingFace processors at runtime)
298+
RUN uv pip install --system --no-cache decord lmdb peft
299+
297300
# Re-pin torch (cu129), sgl_kernel, NCCL/cuDNN/cuSparseLt after CVE patches.
298301
# The CVE patches step above resolves xgrammar's transitive torch dep from PyPI,
299302
# which downgrades torch from cu129 to cu128. Force-reinstall from the cu129 index.
@@ -382,16 +385,13 @@ RUN chmod +x /usr/local/bin/deep_learning_container.py \
382385
&& rm -rf /var/cache/dnf \
383386
&& rm -rf /root/.cache || true
384387

385-
# Install EFA (cuda-rhel9 repo for libnccl system libs, cleanup after)
388+
# Install EFA + ofi-nccl plugin.
389+
# Configure cuda-rhel9 repo (needed at test time for libnccl-devel reinstall).
386390
COPY ./scripts/docker/common/install_efa_amzn2023.sh install_efa_amzn2023.sh
387391
RUN echo -e '[cuda-rhel9]\nname=cuda-rhel9\nbaseurl=https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64\nenabled=1\ngpgcheck=1' >/etc/yum.repos.d/cuda-rhel9.repo \
388-
&& dnf install -y --setopt=install_weak_deps=False libnccl libnccl-devel \
389-
&& ldconfig \
390392
&& mkdir -p /opt/amazon/efa && ln -sf /opt/amazon/efa/lib64 /opt/amazon/efa/lib \
391393
&& bash install_efa_amzn2023.sh ${EFA_VERSION} \
392394
&& rm install_efa_amzn2023.sh \
393-
&& dnf remove -y libnccl-devel \
394-
&& dnf clean all && rm -rf /var/cache/dnf \
395395
&& rm -rf /usr/local/cuda/bin/nvdisasm*
396396

397397
# ====================== ec2 =========================================

scripts/ci/parse_model_config.py

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def transform_model(model: dict, s3_prefix: str, fixtures_prefix: str) -> dict:
3232
m = dict(model)
3333

3434
if "s3_model" in m:
35-
m["s3_path"] = f"{s3_prefix}/{m.pop('s3_model')}"
35+
prefix = m.pop("s3_prefix", s3_prefix)
36+
m["s3_path"] = f"{prefix}/{m.pop('s3_model')}"
3637
m["model_source"] = "s3"
3738
elif "hf_model" in m:
3839
m["model_source"] = "hf"
@@ -62,35 +63,51 @@ def load_yaml(path: str) -> dict:
6263
return json.loads(result.stdout)
6364

6465

65-
def matches_customer_type(model: dict, customer_type: str) -> bool:
66-
"""A model runs on a config unless it pins a different customer_type.
66+
def _flatten_image_config(image_cfg: dict) -> dict[str, str]:
67+
"""Flatten nested image config into a single-level dict of string values."""
68+
flat = {}
69+
for section in image_cfg.values():
70+
if isinstance(section, dict):
71+
for k, v in section.items():
72+
flat[k] = str(v)
73+
return flat
6774

68-
Models without a ``customer_type`` field run everywhere (backward
69-
compatible). A model that pins e.g. ``customer_type: sagemaker`` only runs
70-
when the config's customer type matches — used to gate tests for features
71-
that exist on only one container variant (e.g. the SageMaker routing
72-
middleware, which adds the JSON->multipart video path absent on EC2).
75+
76+
def _model_matches_image(model: dict, image_fields: dict[str, str]) -> bool:
77+
"""Check if a model's required_image_pattern matches the image config fields.
78+
79+
required_image_pattern can be:
80+
- A dict of {field: value} pairs that must all match in the image config.
81+
- A plain string that must appear in at least one image config value.
82+
- Absent/None → model runs on all images.
7383
"""
74-
pinned = model.get("customer_type")
75-
if not pinned or not customer_type:
84+
pattern = model.get("required_image_pattern")
85+
if not pattern:
7686
return True
77-
return pinned == customer_type
87+
if isinstance(pattern, dict):
88+
return all(image_fields.get(k) == str(v) for k, v in pattern.items())
89+
return str(pattern) in image_fields.values()
7890

7991

8092
def parse_config(
81-
config_path: str, section: str, runner_type: str, customer_type: str = ""
93+
config_path: str, section: str, runner_type: str, image_config_path: str = ""
8294
) -> dict[str, str]:
8395
cfg = load_yaml(config_path)
8496

8597
s3_prefix = cfg.get("s3_prefix", "")
8698
fixtures_prefix = cfg.get("test_fixtures_prefix", "")
8799

100+
image_fields = {}
101+
if image_config_path and os.path.isfile(image_config_path):
102+
image_fields = _flatten_image_config(load_yaml(image_config_path))
103+
88104
results = {}
89105
types = ["codebuild-fleet", "runner-scale-sets"] if runner_type == "all" else [runner_type]
90106

91107
for rt in types:
92108
models = cfg.get(section, {}).get(rt, []) or []
93-
models = [m for m in models if matches_customer_type(m, customer_type)]
109+
if image_fields:
110+
models = [m for m in models if _model_matches_image(m, image_fields)]
94111
transformed = [transform_model(m, s3_prefix, fixtures_prefix) for m in models]
95112
key = rt if runner_type == "all" else "matrix"
96113
results[key] = json.dumps(transformed, separators=(",", ":"))
@@ -110,18 +127,17 @@ def main():
110127
help="Runner type: all, codebuild-fleet, or runner-scale-sets",
111128
)
112129
parser.add_argument(
113-
"--customer-type",
130+
"--image-config",
114131
default="",
115-
help="Config customer type (e.g. ec2, sagemaker). When set, drops models "
116-
"that pin a different customer_type. Empty = include all models.",
132+
help="Path to image config YAML; used to filter models by required_image_pattern",
117133
)
118134
args = parser.parse_args()
119135

120136
if not os.path.isfile(args.config):
121137
print(f"ERROR: Config file not found: {args.config}", file=sys.stderr)
122138
sys.exit(1)
123139

124-
results = parse_config(args.config, args.section, args.runner_type, args.customer_type)
140+
results = parse_config(args.config, args.section, args.runner_type, args.image_config or "")
125141

126142
output_file = os.environ.get("GITHUB_OUTPUT")
127143
if output_file:

scripts/docker/common/install_efa_amzn2023.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ function install_efa {
3434
tar -xf aws-efa-installer-${EFA_VERSION}.tar.gz
3535
cd aws-efa-installer
3636
./efa_installer.sh -y --skip-kmod --skip-limit-conf --no-verify
37+
38+
# If the EFA installer didn't install the ofi-nccl plugin (e.g., it skipped
39+
# it due to package detection heuristics), install the RPM directly.
40+
if ! check_libnccl_net_so 2>/dev/null; then
41+
echo "ofi-nccl not found after EFA install, attempting direct RPM install..."
42+
OFI_RPM=$(find /tmp/efa/aws-efa-installer/RPMS/ALINUX2023 -name "libnccl-ofi-*.x86_64.rpm" ! -name "*ngc*" ! -name "*debug*" 2>/dev/null | head -1)
43+
if [ -n "${OFI_RPM}" ]; then
44+
rpm -ivh --nodeps "${OFI_RPM}"
45+
ldconfig
46+
fi
47+
fi
48+
3749
rm -rf /tmp/efa
3850

3951
mv ${OPEN_MPI_PATH}/bin/mpirun ${OPEN_MPI_PATH}/bin/mpirun.real
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
[]
1+
[
2+
{
3+
"vulnerability_id": "RUSTSEC-2026-0195",
4+
"reason": "quick-xml 0.39.2 in uv binary, upstream uv has not released a fix yet. XML entity expansion DoS, low risk for pip installer use case.",
5+
"review_by": "2026-09-10"
6+
}
7+
]

0 commit comments

Comments
 (0)