-
Notifications
You must be signed in to change notification settings - Fork 518
fix: DFlash regression tests and vLLM server liveness #1288
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
Changes from all commits
4a2fef2
728f33a
210d7ae
4c209fd
65eca0f
e8f52e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,10 @@ | |
| SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
| source ${SCRIPT_DIR}/../service_utils.sh 2>/dev/null || true | ||
|
|
||
| cleanup() { kill $SERVER_PID 2>/dev/null; sleep 2; kill -9 $SERVER_PID 2>/dev/null; } | ||
| # Ensure pandas is available (missing in some vLLM nightly builds) | ||
| pip install pandas 2>/dev/null || true | ||
|
|
||
| cleanup() { kill $SERVER_PID 2>/dev/null; sleep 2; kill -9 $SERVER_PID 2>/dev/null; rm -f "${VLLM_LOG:-}" 2>/dev/null; } | ||
| trap cleanup EXIT | ||
|
|
||
| MODEL=${HF_MODEL_CKPT} | ||
|
|
@@ -72,22 +75,23 @@ if [ "${DISABLE_PREFIX_CACHING:-}" = "1" ]; then | |
| OPTIONAL_ARGS="${OPTIONAL_ARGS} --no-enable-prefix-caching" | ||
| fi | ||
|
|
||
| # Start vLLM server | ||
| # Start vLLM server (capture output for regression check parsing) | ||
| VLLM_LOG=$(mktemp /tmp/vllm_server_XXXXXX.log) | ||
| if [ -n "$SPEC_CONFIG" ]; then | ||
| vllm serve ${MODEL} \ | ||
| --speculative-config "${SPEC_CONFIG}" \ | ||
| --max-num-batched-tokens 32768 \ | ||
| --tensor-parallel-size ${TP} \ | ||
| --port ${PORT} \ | ||
| ${OPTIONAL_ARGS} \ | ||
| & | ||
| > >(tee -a "$VLLM_LOG") 2>&1 & | ||
| else | ||
| vllm serve ${MODEL} \ | ||
| --max-num-batched-tokens 32768 \ | ||
| --tensor-parallel-size ${TP} \ | ||
| --port ${PORT} \ | ||
| ${OPTIONAL_ARGS} \ | ||
| & | ||
| > >(tee -a "$VLLM_LOG") 2>&1 & | ||
| fi | ||
| SERVER_PID=$! | ||
|
|
||
|
|
@@ -168,4 +172,27 @@ if [ $FAIL -gt 0 ]; then | |
| exit 1 | ||
| fi | ||
|
|
||
| # Regression check: minimum acceptance length for speculative decoding | ||
| if [ -n "${MIN_ACCEPTANCE_LENGTH:-}" ]; then | ||
| # Parse mean acceptance length from vLLM's SpecDecoding metrics log. | ||
| # vLLM logs: "SpecDecoding metrics: Mean acceptance length: X.XX, ..." | ||
| # Take the last reported value (most accurate, covers all prompts). | ||
| AVG_ACCEPT=$(grep -oP 'Mean acceptance length: \K[0-9.]+' "$VLLM_LOG" 2>/dev/null | tail -1 || true) | ||
| if [ -n "$AVG_ACCEPT" ]; then | ||
| echo "" | ||
| echo "=== Acceptance Length Regression Check ===" | ||
| echo " Mean acceptance length: ${AVG_ACCEPT}" | ||
| echo " Threshold: ${MIN_ACCEPTANCE_LENGTH}" | ||
| PASS_CHECK=$(python3 -c "print('yes' if float('${AVG_ACCEPT}') >= float('${MIN_ACCEPTANCE_LENGTH}') else 'no')") | ||
| if [ "$PASS_CHECK" = "yes" ]; then | ||
| echo " PASS: ${AVG_ACCEPT} >= ${MIN_ACCEPTANCE_LENGTH}" | ||
| else | ||
| echo " REGRESSION: ${AVG_ACCEPT} < ${MIN_ACCEPTANCE_LENGTH}" | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "WARNING: Could not parse acceptance length from vLLM log, skipping regression check" | ||
| fi | ||
| fi | ||
|
Comment on lines
+175
to
+196
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regression gate should fail closed when threshold is set. When Suggested fix- else
- echo "WARNING: Could not parse acceptance length from vLLM log, skipping regression check"
- fi
+ else
+ echo "ERROR: Could not parse acceptance length from vLLM log while MIN_ACCEPTANCE_LENGTH is set"
+ exit 1
+ fi
fi🤖 Prompt for AI Agents |
||
|
|
||
| echo "Done" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #!/bin/bash | ||
|
|
||
| # SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
|
|
||
| ################################################################################################### | ||
|
|
||
| if [[ -z ${HF_MODEL_CKPT} ]]; then | ||
| export HF_MODEL_CKPT=/scratchspace/export | ||
| fi | ||
|
|
||
| if [[ -z ${TP} ]]; then | ||
| TP=4 | ||
| fi | ||
|
|
||
| if [[ -z ${EP} ]]; then | ||
| EP=4 | ||
| fi | ||
|
|
||
| if [[ -z ${EXTRA_LLM_API_OPTIONS} ]]; then | ||
| EXTRA_LLM_API_OPTIONS=common/tensorrt_llm/extra_llm_api_options.yaml | ||
| fi | ||
|
|
||
|
|
||
| TARGET_FILENAME="config.json" | ||
|
|
||
|
|
||
| # Find all files matching the target filename, print their paths null-terminated | ||
| find "${HF_MODEL_CKPT}" -type f -name "$TARGET_FILENAME" -print0 | while IFS= read -r -d '' filepath; do | ||
| # Extract the directory path from the full file path | ||
| dir_path=$(dirname "$filepath") | ||
|
|
||
| echo "Processing model: $dir_path" | ||
| # Place your commands here to run within or on the $dir_path | ||
| # Example: cd "$dir_path" && some_command | ||
|
|
||
| trtllm-llmapi-launch trtllm-eval \ | ||
| --model ${dir_path} \ | ||
| --disable_kv_cache_reuse \ | ||
| --tp_size ${TP} \ | ||
| --ep_size ${EP} \ | ||
| --trust_remote_code \ | ||
| --extra_llm_api_options ${EXTRA_LLM_API_OPTIONS} \ | ||
| mmlu | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| context_parallel_size: 1 | ||
|
|
||
| # backend: _autodeploy | ||
| # reasoning_parser: nano-v3 | ||
| # tool_parser: qwen3_coder | ||
| # | ||
| # runtime: trtllm | ||
| # compile_backend: torch-cudagraph | ||
| # max_batch_size: 64 | ||
| # max_seq_len: 16384 | ||
| # enable_chunked_prefill: true | ||
| # attn_backend: flashinfer | ||
| # model_factory: AutoModelForCausalLM | ||
| # skip_loading_weights: false | ||
| # free_mem_ratio: 0.65 | ||
| # cuda_graph_batch_sizes: [1, 2, 4, 8, 16, 24, 32, 64, 128, 256, 320, 384] | ||
| # kv_cache_config: | ||
| # # disable kv_cache reuse since not supported for hybrid/ssm models | ||
| # enable_block_reuse: false | ||
| # transforms: | ||
| # detect_sharding: | ||
| # sharding_dims: ['ep', 'bmm'] | ||
| # allreduce_strategy: 'AUTO' | ||
| # manual_config: | ||
| # head_dim: 128 | ||
| # tp_plan: | ||
| # # mamba SSM layer | ||
| # "in_proj": "mamba" | ||
| # "out_proj": "rowwise" | ||
| # # attention layer | ||
| # "q_proj": "colwise" | ||
| # "k_proj": "colwise" | ||
| # "v_proj": "colwise" | ||
| # "o_proj": "rowwise" | ||
| # # NOTE: consider not sharding shared experts and/or | ||
| # # latent projections at all, keeping them replicated. | ||
| # # To do so, comment out the corresponding entries. | ||
| # # moe layer: SHARED experts | ||
| # "up_proj": "colwise" | ||
| # "down_proj": "rowwise" | ||
| # # MoLE: latent projections: simple shard | ||
| # "fc1_latent_proj": "gather" | ||
| # "fc2_latent_proj": "gather" | ||
| # multi_stream_moe: | ||
| # stage: compile | ||
| # enabled: true | ||
| # insert_cached_ssm_attention: | ||
| # cache_config: | ||
| # mamba_dtype: float32 | ||
| # fuse_mamba_a_log: | ||
| # stage: post_load_fusion | ||
| # enabled: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,9 @@ source ${SCRIPT_DIR}/../service_utils.sh | |
| # gpus_per_node: 4 | ||
| ################################################################################################### | ||
|
|
||
| # Ensure pandas is available (missing in some vLLM nightly builds) | ||
| pip install pandas 2>/dev/null || true | ||
|
|
||
| export OPENAI_API_KEY="token-abc123" | ||
|
|
||
| if [ -z ${SLURM_ARRAY_TASK_ID} ]; then | ||
|
|
@@ -108,13 +111,26 @@ SERVER_PID=$! | |
|
|
||
| # Wait for server to start up by polling the health endpoint | ||
| echo "Waiting for server to start..." | ||
| MAX_WAIT=${VLLM_STARTUP_TIMEOUT:-600} | ||
| WAITED=0 | ||
|
Comment on lines
+114
to
+115
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verifies shell numeric test behavior with invalid MAX_WAIT.
WAITED=10
MAX_WAIT=abc
if [ "$WAITED" -ge "$MAX_WAIT" ]; then
echo "timed out"
fiRepository: NVIDIA/Model-Optimizer Length of output: 120 🏁 Script executed: # Locate and examine the file
find . -name "query.sh" -path "*vllm*" | head -20Repository: NVIDIA/Model-Optimizer Length of output: 103 🏁 Script executed: # Once found, examine the context around lines 114-115 and 127-133
if [ -f "tools/launcher/common/vllm/query.sh" ]; then
echo "=== Lines 110-140 ==="
sed -n '110,140p' tools/launcher/common/vllm/query.sh
fiRepository: NVIDIA/Model-Optimizer Length of output: 1170 Validate If Suggested fix MAX_WAIT=${VLLM_STARTUP_TIMEOUT:-600}
+if ! [[ "$MAX_WAIT" =~ ^[0-9]+$ ]] || [ "$MAX_WAIT" -le 0 ]; then
+ echo "ERROR: VLLM_STARTUP_TIMEOUT must be a positive integer, got '${MAX_WAIT}'"
+ exit 1
+fi
WAITED=0
while true; do
@@
- if [ $WAITED -ge $MAX_WAIT ]; then
+ if [ "$WAITED" -ge "$MAX_WAIT" ]; then
echo "ERROR: vLLM server failed to start within ${MAX_WAIT}s"
kill $SERVER_PID 2>/dev/null
exit 1
fiAlso applies to: line 127 🤖 Prompt for AI Agents |
||
| while true; do | ||
| if ! kill -0 $SERVER_PID 2>/dev/null; then | ||
| echo "ERROR: vLLM server process died during startup" | ||
| wait $SERVER_PID 2>/dev/null | ||
| exit 1 | ||
| fi | ||
| response=$(curl -s -o /dev/null -w "%{http_code}" "http://$(hostname -f):8000/health" || true) | ||
| if [ "$response" -eq 200 ]; then | ||
| echo "Server is up!" | ||
| echo "Server is up! (waited ${WAITED}s)" | ||
| break | ||
| fi | ||
| echo "Server not ready yet, retrying in 10 seconds..." | ||
| WAITED=$((WAITED + 10)) | ||
| if [ $WAITED -ge $MAX_WAIT ]; then | ||
| echo "ERROR: vLLM server failed to start within ${MAX_WAIT}s" | ||
| kill $SERVER_PID 2>/dev/null | ||
| exit 1 | ||
| fi | ||
| echo "Server not ready yet (${WAITED}/${MAX_WAIT}s), retrying in 10 seconds..." | ||
| sleep 10 | ||
| done | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Qwen3-30B-A3B PTQ quantization (8 GPUs, MoE model). | ||
| # | ||
| # 2-step pipeline: NVFP4 then FP8, each followed by MMLU evaluation. | ||
| # MMLU uses EP for expert parallelism. | ||
| # | ||
| # Usage: | ||
| # uv run launch.py --yaml examples/Qwen/Qwen3-30B-A3B/megatron_lm_ptq.yaml --yes | ||
|
|
||
| job_name: Qwen3-30B-A3B_PTQ | ||
| pipeline: | ||
| skip: false | ||
| allow_to_fail: false | ||
| note: | ||
|
|
||
| task_0: | ||
| _target_: common.megatron_lm.quantize.task.MegatronLMQuantizeTask | ||
| config: | ||
| model: Qwen/Qwen3-30B-A3B | ||
| quant_cfg: NVFP4_DEFAULT_CFG | ||
| tp: 1 | ||
| pp: 1 | ||
| ep: 8 | ||
| etp: 1 | ||
| calib_dataset: abisee/cnn_dailymail | ||
| calib_size: 32 | ||
| mmlu_dataset: cais/mmlu | ||
| mmlu_lower_bound: 0.75 | ||
| hf_local: /hf-local/ | ||
| slurm_config: | ||
| _factory_: "slurm_factory" | ||
| nodes: 1 | ||
| ntasks_per_node: 8 | ||
| gpus_per_node: 8 | ||
|
|
||
| task_1: | ||
| _target_: common.megatron_lm.quantize.task.MegatronLMQuantizeTask | ||
| config: | ||
| model: Qwen/Qwen3-30B-A3B | ||
| quant_cfg: FP8_DEFAULT_CFG | ||
| tp: 1 | ||
| pp: 1 | ||
| ep: 8 | ||
| etp: 1 | ||
| calib_dataset: abisee/cnn_dailymail | ||
| calib_size: 32 | ||
| mmlu_dataset: cais/mmlu | ||
| mmlu_lower_bound: 0.75 | ||
| hf_local: /hf-local/ | ||
| slurm_config: | ||
| _factory_: "slurm_factory" | ||
| nodes: 1 | ||
| ntasks_per_node: 8 | ||
| gpus_per_node: 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate
MMLU_LOWER_BOUNDand avoid hardcoding--fraction.This line accepts
MMLU_LOWER_BOUNDwithout format checks and still hardcodes--fraction 0.01, which can cause unreliable gating and drift from typed config behavior.Proposed patch
📝 Committable suggestion
🤖 Prompt for AI Agents