[AMD] Add DeepSeek-V3.2 and VLMs model in nightly tests (#17179)
Co-authored-by: michaelzhang-ai <michaelzhang-ai@users.noreply.github.com> Co-authored-by: YC Tseng <yctseng@amd.com> Co-authored-by: Bingxu Chen <bingxche@amd.com>
This commit is contained in:
co-authored by
michaelzhang-ai
YC Tseng
Bingxu Chen
parent
6988a0f570
commit
a3addd6203
@@ -1,7 +1,7 @@
|
||||
"""MI35x DeepSeek-R1-MXFP4 GSM8K Completion Evaluation Test (8-GPU)
|
||||
|
||||
Tests DeepSeek-R1-MXFP4 quantized model with multiple configurations
|
||||
(basic, MTP, DP, TC) using few-shot completion benchmark on MI35x.
|
||||
Tests DeepSeek-R1-MXFP4 quantized model with basic configuration
|
||||
using few-shot completion benchmark on MI35x.
|
||||
|
||||
Registry: nightly-amd-8-gpu-mi35x-deepseek-r1-mxfp4 suite
|
||||
"""
|
||||
@@ -32,9 +32,9 @@ from sglang.test.test_utils import (
|
||||
)
|
||||
from sglang.utils import download_and_cache_file, read_jsonl
|
||||
|
||||
# Register for AMD CI - MI35x DeepSeek-R1-MXFP4 accuracy tests (~120 min)
|
||||
# Register for AMD CI - MI35x DeepSeek-R1-MXFP4 accuracy test (~60 min, basic only)
|
||||
register_amd_ci(
|
||||
est_time=7200, suite="nightly-amd-8-gpu-mi35x-deepseek-r1-mxfp4", nightly=True
|
||||
est_time=3600, suite="nightly-amd-8-gpu-mi35x-deepseek-r1-mxfp4", nightly=True
|
||||
)
|
||||
|
||||
INVALID = -9999999
|
||||
@@ -83,7 +83,7 @@ def get_mxfp4_models() -> List[ModelConfig]:
|
||||
"""Get DeepSeek-R1-MXFP4 model configurations for MI35x."""
|
||||
model_path = get_model_path()
|
||||
return [
|
||||
# DeepSeek-R1-MXFP4 basic
|
||||
# DeepSeek-R1-MXFP4 basic only (MTP tested in perf job)
|
||||
ModelConfig(
|
||||
model_path=model_path,
|
||||
tp_size=8,
|
||||
@@ -102,31 +102,6 @@ def get_mxfp4_models() -> List[ModelConfig]:
|
||||
],
|
||||
env_vars={"SGLANG_USE_AITER": "1"},
|
||||
),
|
||||
# DeepSeek-R1-MXFP4 with MTP (EAGLE)
|
||||
ModelConfig(
|
||||
model_path=model_path,
|
||||
tp_size=8,
|
||||
accuracy_threshold=0.93,
|
||||
timeout=3600,
|
||||
variant="MTP",
|
||||
other_args=[
|
||||
"--chunked-prefill-size",
|
||||
"131072",
|
||||
"--speculative-algorithm",
|
||||
"EAGLE",
|
||||
"--speculative-num-steps",
|
||||
"3",
|
||||
"--speculative-eagle-topk",
|
||||
"1",
|
||||
"--speculative-num-draft-tokens",
|
||||
"4",
|
||||
"--mem-fraction-static",
|
||||
"0.7",
|
||||
"--trust-remote-code",
|
||||
],
|
||||
env_vars={"SGLANG_USE_AITER": "1"},
|
||||
),
|
||||
# Note: DP and TC variants are not supported for MXFP4 on MI35x
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
"""MI35x DeepSeek-V3.2 GSM8K Completion Evaluation Test (8-GPU)
|
||||
|
||||
Tests DeepSeek-V3.2 with basic configuration using few-shot completion
|
||||
benchmark on MI35x.
|
||||
|
||||
Registry: nightly-amd-accuracy-8-gpu-mi35x-deepseek-v32 suite
|
||||
"""
|
||||
|
||||
import ast
|
||||
import os
|
||||
|
||||
# Set HF cache for MI35x
|
||||
os.environ.setdefault("HF_HOME", "/data2/models/huggingface")
|
||||
os.environ.setdefault("HF_HUB_CACHE", "/data2/models/huggingface/hub")
|
||||
|
||||
import re
|
||||
import time
|
||||
import unittest
|
||||
from dataclasses import dataclass
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
import numpy as np
|
||||
|
||||
from sglang.srt.utils import kill_process_tree
|
||||
from sglang.test.ci.ci_register import register_amd_ci
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
is_in_ci,
|
||||
popen_launch_server,
|
||||
write_github_step_summary,
|
||||
)
|
||||
from sglang.utils import download_and_cache_file, read_jsonl
|
||||
|
||||
# Register for AMD CI - MI35x DeepSeek-V3.2 accuracy test (~60 min for basic only)
|
||||
register_amd_ci(
|
||||
est_time=3600,
|
||||
suite="nightly-amd-8-gpu-mi35x-deepseek-v32",
|
||||
nightly=True,
|
||||
)
|
||||
|
||||
INVALID = -9999999
|
||||
|
||||
|
||||
@dataclass
|
||||
class ModelConfig:
|
||||
"""Configuration for a model to test."""
|
||||
|
||||
model_path: str
|
||||
tp_size: int = 8
|
||||
accuracy_threshold: float = 0.50
|
||||
other_args: Optional[List[str]] = None
|
||||
env_vars: Optional[dict] = None
|
||||
timeout: Optional[int] = None
|
||||
variant: Optional[str] = None
|
||||
|
||||
def __post_init__(self):
|
||||
if self.other_args is None:
|
||||
self.other_args = []
|
||||
if self.env_vars is None:
|
||||
self.env_vars = {}
|
||||
|
||||
def get_display_name(self) -> str:
|
||||
if self.variant:
|
||||
return f"{self.model_path} ({self.variant})"
|
||||
return self.model_path
|
||||
|
||||
|
||||
# DeepSeek-V3.2 models for MI35x - only basic variant for nightly
|
||||
# DP variant removed due to barrier deadlock during model loading
|
||||
MI35X_DEEPSEEK_V32_MODELS = [
|
||||
# DeepSeek-V3.2 basic (TP=8 only)
|
||||
ModelConfig(
|
||||
model_path="deepseek-ai/DeepSeek-V3.2",
|
||||
tp_size=8,
|
||||
accuracy_threshold=0.93,
|
||||
timeout=3600,
|
||||
variant="basic",
|
||||
other_args=[
|
||||
"--trust-remote-code",
|
||||
"--nsa-prefill-backend",
|
||||
"tilelang",
|
||||
"--nsa-decode-backend",
|
||||
"tilelang",
|
||||
"--mem-fraction-static",
|
||||
"0.85",
|
||||
"--model-loader-extra-config",
|
||||
'{"enable_multithread_load": true}',
|
||||
"--watchdog-timeout",
|
||||
"1200", # 20 minutes for weight loading
|
||||
],
|
||||
env_vars={},
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def get_one_example(lines, i, include_answer):
|
||||
"""Format a single GSM8K example."""
|
||||
ret = "Question: " + lines[i]["question"] + "\nAnswer:"
|
||||
if include_answer:
|
||||
ret += " " + lines[i]["answer"]
|
||||
return ret
|
||||
|
||||
|
||||
def get_few_shot_examples(lines, k):
|
||||
"""Get k few-shot examples for prompting."""
|
||||
ret = ""
|
||||
for i in range(k):
|
||||
ret += get_one_example(lines, i, True) + "\n\n"
|
||||
return ret
|
||||
|
||||
|
||||
def get_answer_value(answer_str):
|
||||
"""Extract numerical answer from response."""
|
||||
answer_str = answer_str.replace(",", "")
|
||||
numbers = re.findall(r"\d+", answer_str)
|
||||
if len(numbers) < 1:
|
||||
return INVALID
|
||||
try:
|
||||
return ast.literal_eval(numbers[-1])
|
||||
except SyntaxError:
|
||||
return INVALID
|
||||
|
||||
|
||||
def run_gsm8k_benchmark(
|
||||
base_url: str,
|
||||
num_questions: int = 200,
|
||||
num_shots: int = 5,
|
||||
parallel: int = 64,
|
||||
) -> Tuple[float, float, float]:
|
||||
"""Run GSM8K few-shot completion benchmark."""
|
||||
import sglang as sgl
|
||||
from sglang.lang.backend.runtime_endpoint import RuntimeEndpoint
|
||||
|
||||
url = "https://raw.githubusercontent.com/openai/grade-school-math/master/grade_school_math/data/test.jsonl"
|
||||
data_path = download_and_cache_file(url)
|
||||
lines = list(read_jsonl(data_path))
|
||||
|
||||
few_shot_examples = get_few_shot_examples(lines, num_shots)
|
||||
|
||||
questions = []
|
||||
labels = []
|
||||
for i in range(len(lines[:num_questions])):
|
||||
questions.append(get_one_example(lines, i, False))
|
||||
labels.append(get_answer_value(lines[i]["answer"]))
|
||||
assert all(l != INVALID for l in labels)
|
||||
arguments = [{"question": q} for q in questions]
|
||||
|
||||
@sgl.function
|
||||
def few_shot_gsm8k(s, question):
|
||||
s += few_shot_examples + question
|
||||
s += sgl.gen(
|
||||
"answer", max_tokens=512, stop=["Question", "Assistant:", "<|separator|>"]
|
||||
)
|
||||
|
||||
backend = RuntimeEndpoint(base_url)
|
||||
sgl.set_default_backend(backend)
|
||||
|
||||
tic = time.perf_counter()
|
||||
states = few_shot_gsm8k.run_batch(
|
||||
arguments, temperature=0, num_threads=parallel, progress_bar=True
|
||||
)
|
||||
latency = time.perf_counter() - tic
|
||||
|
||||
preds = [get_answer_value(states[i]["answer"]) for i in range(len(states))]
|
||||
acc = np.mean(np.array(preds) == np.array(labels))
|
||||
invalid = np.mean(np.array(preds) == INVALID)
|
||||
|
||||
return float(acc), float(invalid), float(latency)
|
||||
|
||||
|
||||
class TestDeepSeekV32EvalMI35x(unittest.TestCase):
|
||||
"""DeepSeek-V3.2 GSM8K Completion Evaluation Test for AMD MI35x."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.models = MI35X_DEEPSEEK_V32_MODELS
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.num_questions = int(os.environ.get("GSM8K_NUM_QUESTIONS", "200"))
|
||||
|
||||
def test_deepseek_v32_accuracy(self):
|
||||
"""Test DeepSeek-V3.2 models with GSM8K completion benchmark."""
|
||||
all_results = []
|
||||
summary = "### DeepSeek-V3.2 Models (MI35x)\n\n"
|
||||
summary += "| Model | Variant | TP | Accuracy | Threshold | Status |\n"
|
||||
summary += "| ----- | ------- | -- | -------- | --------- | ------ |\n"
|
||||
|
||||
for config in self.models:
|
||||
display_name = config.get_display_name()
|
||||
with self.subTest(model=display_name):
|
||||
print(f"\n{'='*60}")
|
||||
print(f"Testing: {display_name}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
env = os.environ.copy()
|
||||
for key, value in config.env_vars.items():
|
||||
env[key] = value
|
||||
|
||||
other_args = list(config.other_args)
|
||||
other_args.extend(["--tp", str(config.tp_size)])
|
||||
timeout = config.timeout or DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH
|
||||
|
||||
try:
|
||||
process = popen_launch_server(
|
||||
model=config.model_path,
|
||||
base_url=self.base_url,
|
||||
timeout=timeout,
|
||||
other_args=other_args,
|
||||
env=env,
|
||||
)
|
||||
|
||||
try:
|
||||
acc, invalid, latency = run_gsm8k_benchmark(
|
||||
self.base_url, num_questions=self.num_questions
|
||||
)
|
||||
passed = acc >= config.accuracy_threshold
|
||||
status = "✅ PASS" if passed else "❌ FAIL"
|
||||
|
||||
all_results.append(
|
||||
{
|
||||
"model": display_name,
|
||||
"accuracy": acc,
|
||||
"passed": passed,
|
||||
}
|
||||
)
|
||||
summary += f"| {config.model_path} | {config.variant or 'N/A'} | {config.tp_size} | {acc:.3f} | {config.accuracy_threshold} | {status} |\n"
|
||||
|
||||
finally:
|
||||
kill_process_tree(process.pid)
|
||||
|
||||
except Exception as e:
|
||||
summary += f"| {config.model_path} | {config.variant or 'N/A'} | {config.tp_size} | N/A | {config.accuracy_threshold} | ❌ ERROR |\n"
|
||||
all_results.append(
|
||||
{
|
||||
"model": display_name,
|
||||
"accuracy": None,
|
||||
"passed": False,
|
||||
"error": str(e),
|
||||
}
|
||||
)
|
||||
|
||||
if is_in_ci():
|
||||
write_github_step_summary(summary)
|
||||
|
||||
failed = [r for r in all_results if not r["passed"]]
|
||||
if failed:
|
||||
raise AssertionError(f"Failed models: {[r['model'] for r in failed]}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,338 @@
|
||||
"""
|
||||
AMD GSM8K Evaluation Test (Migrated from test/srt/nightly/)
|
||||
|
||||
This test evaluates instruction-tuned models on the mgsm_en benchmark using chat completions.
|
||||
Models are tested with various TP configurations on AMD GPUs.
|
||||
|
||||
Registry: nightly-amd suite (2-GPU tests)
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import unittest
|
||||
import warnings
|
||||
from types import SimpleNamespace
|
||||
|
||||
from sglang.srt.utils import kill_process_tree
|
||||
from sglang.test.ci.ci_register import register_amd_ci
|
||||
from sglang.test.run_eval import run_eval
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP1,
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP2,
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_TP1,
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_TP2,
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
is_in_ci,
|
||||
parse_models,
|
||||
popen_launch_server,
|
||||
write_github_step_summary,
|
||||
write_results_to_json,
|
||||
)
|
||||
|
||||
# Register for AMD CI - GSM8K evaluation tests (~60 min)
|
||||
register_amd_ci(est_time=3600, suite="nightly-amd", nightly=True)
|
||||
|
||||
MODEL_SCORE_THRESHOLDS = {
|
||||
# Llama 3.1 series
|
||||
"meta-llama/Llama-3.1-8B-Instruct": 0.82,
|
||||
"meta-llama/Llama-3.1-70B-Instruct": 0.95,
|
||||
# Llama 3.2 series (smaller models)
|
||||
"meta-llama/Llama-3.2-3B-Instruct": 0.55,
|
||||
# Mistral series
|
||||
"mistralai/Mistral-7B-Instruct-v0.3": 0.58,
|
||||
"mistralai/Mixtral-8x7B-Instruct-v0.1": 0.61,
|
||||
# DeepSeek series
|
||||
"deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct": 0.85,
|
||||
# Qwen2 series
|
||||
"Qwen/Qwen2-57B-A14B-Instruct": 0.86,
|
||||
"Qwen/Qwen2.5-7B-Instruct": 0.85,
|
||||
# Qwen3 series
|
||||
"Qwen/Qwen3-30B-A3B-Thinking-2507": 0.84, # MoE model verified on MI300X
|
||||
"Qwen/Qwen3-8B": 0.77,
|
||||
# Google Gemma
|
||||
"google/gemma-2-27b-it": 0.91,
|
||||
"google/gemma-2-9b-it": 0.72,
|
||||
# "neuralmagic/gemma-2-2b-it-FP8": 0.4, # Small 2B model - OOM on single GPU
|
||||
# FP8 quantized models
|
||||
"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8": 0.8,
|
||||
"neuralmagic/Mistral-7B-Instruct-v0.3-FP8": 0.54,
|
||||
"neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8": 0.94,
|
||||
"neuralmagic/Qwen2-72B-Instruct-FP8": 0.94,
|
||||
"neuralmagic/Qwen2-57B-A14B-Instruct-FP8": 0.86,
|
||||
"neuralmagic/Mixtral-8x7B-Instruct-v0.1-FP8": 0.62,
|
||||
"neuralmagic/DeepSeek-Coder-V2-Lite-Instruct-FP8": 0.84,
|
||||
}
|
||||
|
||||
failing_models = {
|
||||
"neuralmagic/DeepSeek-Coder-V2-Lite-Instruct-FP8", # RuntimeError: This GEMM is not supported!
|
||||
"zai-org/GLM-4.5-Air-FP8", # TypeError: cannot unpack non-iterable ForwardMetadata object
|
||||
"google/gemma-2-9b-it", # OOM on single GPU (exit code -9)
|
||||
"neuralmagic/gemma-2-2b-it-FP8", # OOM on single GPU (exit code -9)
|
||||
}
|
||||
|
||||
|
||||
def remove_failing_models(model_str):
|
||||
models = model_str.split(",")
|
||||
filtered = [m for m in models if m not in failing_models]
|
||||
return ",".join(filtered)
|
||||
|
||||
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_TP1 = remove_failing_models(
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_TP1
|
||||
)
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_TP2 = remove_failing_models(
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_TP2
|
||||
)
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP1 = remove_failing_models(
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP1
|
||||
)
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP2 = remove_failing_models(
|
||||
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP2
|
||||
)
|
||||
|
||||
# AMD-specific models verified on MI300X
|
||||
# TP1 models - smaller models that fit on single GPU
|
||||
AMD_MODEL_NAME_FOR_NIGHTLY_EVAL_TP1 = remove_failing_models(
|
||||
"meta-llama/Llama-3.2-3B-Instruct,Qwen/Qwen2.5-7B-Instruct,Qwen/Qwen3-8B,google/gemma-2-9b-it"
|
||||
)
|
||||
# TP2 models - larger models requiring 2 GPUs
|
||||
AMD_MODEL_NAME_FOR_NIGHTLY_EVAL_TP2 = remove_failing_models(
|
||||
"Qwen/Qwen3-30B-A3B-Thinking-2507"
|
||||
)
|
||||
|
||||
NO_MOE_PADDING_MODELS = {"neuralmagic/Mixtral-8x7B-Instruct-v0.1-FP8"}
|
||||
DISABLE_HF_XET_MODELS = {
|
||||
"Qwen/Qwen2-57B-A14B-Instruct",
|
||||
"neuralmagic/Qwen2-57B-A14B-Instruct-FP8",
|
||||
}
|
||||
TRITON_MOE_MODELS = {
|
||||
"neuralmagic/Mixtral-8x7B-Instruct-v0.1-FP8",
|
||||
"neuralmagic/DeepSeek-Coder-V2-Lite-Instruct-FP8",
|
||||
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||
"mistralai/Mistral-7B-Instruct-v0.3",
|
||||
}
|
||||
# AMD-specific models that need special launch config (matching in-house CI sanity_check.py)
|
||||
# AMD_SPECIAL_CONFIG_MODELS = {
|
||||
# "Qwen/Qwen3-30B-A3B-Thinking-2507", # default config works
|
||||
# }
|
||||
|
||||
|
||||
def popen_launch_server_wrapper(base_url, model, is_tp2):
|
||||
other_args = ["--log-level-http", "warning", "--trust-remote-code"]
|
||||
if is_tp2:
|
||||
other_args.extend(["--tp", "2"])
|
||||
|
||||
# Use same config as sanity_check.py for AMD-specific models (scaled for tp=2)
|
||||
# Original tp=8: chunked-prefill-size=130172, max-running-requests=128
|
||||
# Scaled tp=2: chunked-prefill-size=32543, max-running-requests=32
|
||||
# if model in AMD_SPECIAL_CONFIG_MODELS:
|
||||
# other_args.extend([
|
||||
# "--chunked-prefill-size", "32543",
|
||||
# "--max-running-requests", "32",
|
||||
# "--mem-fraction-static", "0.85",
|
||||
# "--attention-backend", "aiter",
|
||||
# ])
|
||||
|
||||
process = popen_launch_server(
|
||||
model,
|
||||
base_url,
|
||||
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
other_args=other_args,
|
||||
)
|
||||
return process
|
||||
|
||||
|
||||
def check_model_scores(results):
|
||||
"""Check model scores and generate summary table with pass/fail status."""
|
||||
failed_models = []
|
||||
passed_count = 0
|
||||
failed_count = 0
|
||||
|
||||
summary = "| Model | TP | Score | Threshold | Startup | Eval | Total | Status |\n"
|
||||
summary += "| ----- | -- | ----- | --------- | ------- | ---- | ----- | ------ |\n"
|
||||
|
||||
for result in results:
|
||||
model = result["model"]
|
||||
score = result["score"]
|
||||
tp_size = result.get("tp_size", 2)
|
||||
startup_time = result.get("startup_time")
|
||||
eval_time = result.get("eval_time")
|
||||
total_time = result.get("total_time")
|
||||
|
||||
threshold = MODEL_SCORE_THRESHOLDS.get(model)
|
||||
if threshold is None:
|
||||
print(f"Warning: No threshold defined for model {model}")
|
||||
status = "⚠️ NO THRESHOLD"
|
||||
elif score >= threshold:
|
||||
status = "✅ PASS"
|
||||
passed_count += 1
|
||||
else:
|
||||
status = "❌ FAIL"
|
||||
failed_count += 1
|
||||
failed_models.append(
|
||||
f"- {model}: score={score:.4f}, threshold={threshold:.4f}"
|
||||
)
|
||||
|
||||
# Format times
|
||||
startup_str = f"{startup_time:.0f}s" if startup_time is not None else "N/A"
|
||||
eval_str = f"{eval_time:.0f}s" if eval_time is not None else "N/A"
|
||||
total_str = f"{total_time:.0f}s" if total_time is not None else "N/A"
|
||||
threshold_str = f"{threshold:.2f}" if threshold is not None else "N/A"
|
||||
|
||||
line = f"| {model} | {tp_size} | {score:.3f} | {threshold_str} | {startup_str} | {eval_str} | {total_str} | {status} |\n"
|
||||
summary += line
|
||||
|
||||
print(f"\n{'='*60}")
|
||||
print("SUMMARY - TP=2 Instruction Models (mgsm_en)")
|
||||
print(f"{'='*60}")
|
||||
print(summary)
|
||||
print(f"\n📊 Final Statistics:")
|
||||
print(f" Passed: {passed_count}")
|
||||
print(f" Failed: {failed_count}")
|
||||
|
||||
if is_in_ci():
|
||||
write_github_step_summary(f"### TestNightlyGsm8KEval (TP=2)\n{summary}")
|
||||
|
||||
if failed_models:
|
||||
failure_msg = "\n".join(failed_models)
|
||||
raise AssertionError(f"The following models failed:\n{failure_msg}")
|
||||
|
||||
|
||||
# Do not use `CustomTestCase` since `test_mgsm_en_all_models` does not want retry
|
||||
class TestNightlyGsm8KEval(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model_groups = [
|
||||
(parse_models(DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_TP1), False, False),
|
||||
(parse_models(DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_TP2), False, True),
|
||||
(parse_models(DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP1), True, False),
|
||||
(parse_models(DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP2), True, True),
|
||||
# AMD-specific models verified on MI300X
|
||||
(parse_models(AMD_MODEL_NAME_FOR_NIGHTLY_EVAL_TP1), False, False),
|
||||
(parse_models(AMD_MODEL_NAME_FOR_NIGHTLY_EVAL_TP2), False, True),
|
||||
]
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
|
||||
def test_mgsm_en_all_models(self):
|
||||
warnings.filterwarnings(
|
||||
"ignore", category=ResourceWarning, message="unclosed.*socket"
|
||||
)
|
||||
is_first = True
|
||||
all_results = []
|
||||
total_test_start = time.time()
|
||||
|
||||
print(f"\n{'='*60}")
|
||||
print("AMD GSM8K Evaluation Test (TP=2 Instruction Models)")
|
||||
print(f"{'='*60}")
|
||||
print(f"Benchmark: mgsm_en (chat completions)")
|
||||
print(f"{'='*60}\n")
|
||||
|
||||
for model_group, is_fp8, is_tp2 in self.model_groups:
|
||||
for model in model_group:
|
||||
with self.subTest(model=model):
|
||||
tp_size = 2 if is_tp2 else 1
|
||||
print(f"\n{'='*60}")
|
||||
print(f"Testing: {model} (TP={tp_size}, FP8={is_fp8})")
|
||||
print(f"{'='*60}")
|
||||
|
||||
model_start = time.time()
|
||||
startup_time = None
|
||||
eval_time = None
|
||||
|
||||
os.environ["SGLANG_MOE_PADDING"] = (
|
||||
"0" if model in NO_MOE_PADDING_MODELS else "1"
|
||||
)
|
||||
os.environ["HF_HUB_DISABLE_XET"] = (
|
||||
"1" if model in DISABLE_HF_XET_MODELS else "0"
|
||||
)
|
||||
os.environ["SGLANG_USE_AITER"] = (
|
||||
"0" if model in TRITON_MOE_MODELS else "1"
|
||||
)
|
||||
|
||||
# Launch server with timing
|
||||
print(f"🚀 Launching server...")
|
||||
server_start = time.time()
|
||||
process = popen_launch_server_wrapper(self.base_url, model, is_tp2)
|
||||
startup_time = time.time() - server_start
|
||||
print(f"⏱️ Server startup: {startup_time:.1f}s")
|
||||
|
||||
args = SimpleNamespace(
|
||||
base_url=self.base_url,
|
||||
model=model,
|
||||
eval_name="mgsm_en",
|
||||
num_examples=None,
|
||||
num_threads=1024,
|
||||
)
|
||||
|
||||
# Run eval with timing and retries
|
||||
print(f"📊 Running mgsm_en evaluation...")
|
||||
eval_start = time.time()
|
||||
threshold = MODEL_SCORE_THRESHOLDS.get(model)
|
||||
metrics = None
|
||||
for attempt in range(3):
|
||||
try:
|
||||
metrics = run_eval(args)
|
||||
score = metrics["score"]
|
||||
if threshold and score >= threshold:
|
||||
break
|
||||
except Exception as e:
|
||||
print(f" Attempt {attempt + 1} failed with error: {e}")
|
||||
eval_time = time.time() - eval_start
|
||||
total_time = time.time() - model_start
|
||||
|
||||
# Print results
|
||||
score = metrics["score"] if metrics else 0.0
|
||||
threshold_str = f"{threshold:.2f}" if threshold else "N/A"
|
||||
passed = threshold and score >= threshold
|
||||
|
||||
print(f"\n📈 Results for {model}:")
|
||||
print(f" Score: {score:.3f} (threshold: {threshold_str})")
|
||||
print(f"\n⏱️ Runtime breakdown:")
|
||||
print(f" Server startup: {startup_time:.1f}s")
|
||||
print(f" Evaluation: {eval_time:.1f}s")
|
||||
print(f" Total: {total_time:.1f}s")
|
||||
|
||||
if passed:
|
||||
print(f"\n Status: ✅ PASSED")
|
||||
else:
|
||||
print(f"\n Status: ❌ FAILED")
|
||||
|
||||
write_results_to_json(model, metrics, "w" if is_first else "a")
|
||||
is_first = False
|
||||
|
||||
all_results.append(
|
||||
{
|
||||
"model": model,
|
||||
"score": score,
|
||||
"tp_size": tp_size,
|
||||
"is_fp8": is_fp8,
|
||||
"startup_time": startup_time,
|
||||
"eval_time": eval_time,
|
||||
"total_time": total_time,
|
||||
}
|
||||
)
|
||||
|
||||
print(f"\n🛑 Stopping server...")
|
||||
kill_process_tree(process.pid)
|
||||
|
||||
# Calculate total test runtime
|
||||
total_test_time = time.time() - total_test_start
|
||||
|
||||
try:
|
||||
with open("results.json", "r") as f:
|
||||
print("\nFinal Results from results.json:")
|
||||
print(json.dumps(json.load(f), indent=2))
|
||||
except Exception as e:
|
||||
print(f"Error reading results.json: {e}")
|
||||
|
||||
# Check all scores after collecting all results
|
||||
check_model_scores(all_results)
|
||||
print(
|
||||
f"\n⏱️ Total test runtime: {total_test_time:.1f}s ({total_test_time/60:.1f} min)"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -5,15 +5,18 @@ This test evaluates Vision-Language Models (VLMs) on the MMMU benchmark on AMD G
|
||||
Models are selected based on compatibility with AMD/ROCm platform.
|
||||
|
||||
VLMs tested here:
|
||||
- Qwen2-VL series (Qwen2-VL-7B, Qwen2.5-VL-7B)
|
||||
- InternVL2 series
|
||||
- MiniCPM-v series
|
||||
- deepseek-vl2-small
|
||||
- Qwen VL series (Qwen2-VL-7B, Qwen2.5-VL-7B, Qwen3-VL-30B)
|
||||
- InternVL2 series (InternVL2_5-2B)
|
||||
- MiniCPM series (MiniCPM-v-2_6, MiniCPM-o-2_6)
|
||||
- DeepSeek VL series (deepseek-vl2-small, Janus-Pro-7B)
|
||||
- Kimi VL (Kimi-VL-A3B-Instruct)
|
||||
- MiMo VL (MiMo-VL-7B-RL)
|
||||
- GLM VL (GLM-4.1V-9B-Thinking)
|
||||
|
||||
Note: Some VLMs from the Nvidia test are excluded due to AMD compatibility issues.
|
||||
Note: NVILA models are excluded (NVIDIA-specific).
|
||||
Note: This test runs only on MI30x runners (linux-mi325-gpu-2), not on MI35x.
|
||||
|
||||
Registry: nightly-amd-vlm suite (2-GPU VLM tests)
|
||||
Registry: nightly-amd-accuracy-2-gpu-vlm suite (2-GPU VLM tests)
|
||||
"""
|
||||
|
||||
import os
|
||||
@@ -40,7 +43,7 @@ register_amd_ci(est_time=7200, suite="nightly-amd-accuracy-2-gpu-vlm", nightly=T
|
||||
# AMD-verified VLM models with conservative thresholds on 100 MMMU samples
|
||||
# Format: (model_path, tp_size, accuracy_threshold, extra_args)
|
||||
AMD_VLM_MODELS = [
|
||||
# Qwen2-VL series - well supported on AMD
|
||||
# Qwen VL series - well supported on AMD
|
||||
{
|
||||
"model_path": "Qwen/Qwen2-VL-7B-Instruct",
|
||||
"tp_size": 1,
|
||||
@@ -53,6 +56,12 @@ AMD_VLM_MODELS = [
|
||||
"accuracy_threshold": 0.33,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
{
|
||||
"model_path": "Qwen/Qwen3-VL-30B-A3B-Instruct",
|
||||
"tp_size": 2,
|
||||
"accuracy_threshold": 0.29,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
# InternVL2 - smaller model, good for testing
|
||||
{
|
||||
"model_path": "OpenGVLab/InternVL2_5-2B",
|
||||
@@ -60,25 +69,60 @@ AMD_VLM_MODELS = [
|
||||
"accuracy_threshold": 0.29,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
# MiniCPM-v - lightweight VLM
|
||||
# MiniCPM series
|
||||
{
|
||||
"model_path": "openbmb/MiniCPM-v-2_6",
|
||||
"tp_size": 1,
|
||||
"accuracy_threshold": 0.25,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
# DeepSeek VL2 small - MoE VLM
|
||||
{
|
||||
"model_path": "openbmb/MiniCPM-o-2_6",
|
||||
"tp_size": 1,
|
||||
"accuracy_threshold": 0.32,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
# DeepSeek VL series
|
||||
{
|
||||
"model_path": "deepseek-ai/deepseek-vl2-small",
|
||||
"tp_size": 1,
|
||||
"accuracy_threshold": 0.31,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
{
|
||||
"model_path": "deepseek-ai/Janus-Pro-7B",
|
||||
"tp_size": 1,
|
||||
"accuracy_threshold": 0.28,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
# Kimi VL - MoE
|
||||
{
|
||||
"model_path": "moonshotai/Kimi-VL-A3B-Instruct",
|
||||
"tp_size": 1,
|
||||
"accuracy_threshold": 0.26,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
# MiMo VL
|
||||
{
|
||||
"model_path": "XiaomiMiMo/MiMo-VL-7B-RL",
|
||||
"tp_size": 1,
|
||||
"accuracy_threshold": 0.27,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
# GLM VL
|
||||
{
|
||||
"model_path": "zai-org/GLM-4.1V-9B-Thinking",
|
||||
"tp_size": 1,
|
||||
"accuracy_threshold": 0.27,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
]
|
||||
|
||||
# Models that need special handling on AMD
|
||||
# Models that need special handling on AMD (MoE models)
|
||||
TRITON_ATTENTION_MODELS = {
|
||||
"deepseek-ai/deepseek-vl2-small", # MoE model
|
||||
"deepseek-ai/deepseek-vl2-small",
|
||||
"Qwen/Qwen3-VL-30B-A3B-Instruct",
|
||||
"moonshotai/Kimi-VL-A3B-Instruct",
|
||||
}
|
||||
|
||||
# Models known to fail on AMD - exclude from testing
|
||||
|
||||
Reference in New Issue
Block a user