Fix external_models import path and migrate model loading tests (#16458)

This commit is contained in:
Alison Shao
2026-01-08 23:43:49 -08:00
committed by GitHub
parent 9d4d57dbfa
commit e46f79431b
8 changed files with 24 additions and 21 deletions

View File

@@ -594,7 +594,7 @@ jobs:
strategy:
fail-fast: false
matrix:
partition: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
partition: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -622,7 +622,7 @@ jobs:
if [[ "${{ needs.check-changes.outputs.continue_on_error }}" == "true" ]]; then
CONTINUE_ON_ERROR_FLAG="--continue-on-error"
fi
python3 run_suite.py --hw cuda --suite stage-b-test-small-1-gpu --auto-partition-id ${{ matrix.partition }} --auto-partition-size 11 $CONTINUE_ON_ERROR_FLAG
python3 run_suite.py --hw cuda --suite stage-b-test-small-1-gpu --auto-partition-id ${{ matrix.partition }} --auto-partition-size 14 $CONTINUE_ON_ERROR_FLAG
stage-b-test-large-1-gpu:
needs: [check-changes, call-gate, stage-a-test-1, sgl-kernel-build-wheels]

View File

@@ -45,7 +45,7 @@ _DEEPGEMM_ON_H20 = get_bool_env_var("SGLANG_DEEPGEMM_ON_H20")
# TODO(kaixih@nvidia): ideally we should merge this logic into
# `fill_gateup_input_triton_kernel` to directly generate e8m0 scale.
@torch.compile
@torch.compile(disable=_is_hip or _is_npu)
def _cast_to_e8m0_with_rounding_up(x: torch.Tensor) -> torch.Tensor:
temp = x.to(torch.float32).view(torch.int32)
exp = torch.bitwise_right_shift(temp, 23)

View File

@@ -2,13 +2,17 @@ import unittest
import sglang as sgl
from sglang.srt.environ import envs
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.test_utils import CustomTestCase
register_cuda_ci(est_time=30, suite="stage-b-test-small-1-gpu")
register_amd_ci(est_time=45, suite="stage-b-test-small-1-gpu")
class TestExternalModels(CustomTestCase):
def test_external_model(self):
envs.SGLANG_EXTERNAL_MODEL_PACKAGE.set("external_models")
envs.SGLANG_EXTERNAL_MM_PROCESSOR_PACKAGE.set("external_models")
envs.SGLANG_EXTERNAL_MODEL_PACKAGE.set("sglang.test.external_models")
envs.SGLANG_EXTERNAL_MM_PROCESSOR_PACKAGE.set("sglang.test.external_models")
prompt = "Today is a sunny day and I like"
model_path = "Qwen/Qwen2-VL-2B-Instruct"

View File

@@ -17,6 +17,9 @@ from sglang.srt.configs.device_config import DeviceConfig
from sglang.srt.configs.load_config import LoadConfig
from sglang.srt.configs.model_config import ModelConfig
from sglang.srt.model_loader.loader import ModelOptModelLoader
from sglang.test.ci.ci_register import register_cuda_ci
register_cuda_ci(est_time=9, suite="stage-b-test-small-1-gpu")
# Note: PYTHONPATH=python should be set when running tests

View File

@@ -10,6 +10,14 @@ from unittest.mock import MagicMock, patch
import torch.nn as nn
from sglang.srt.configs.device_config import DeviceConfig
from sglang.srt.configs.load_config import LoadConfig
from sglang.srt.configs.model_config import ModelConfig
from sglang.srt.layers.modelopt_utils import QUANT_CFG_CHOICES
from sglang.srt.model_loader.loader import ModelOptModelLoader
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.test_utils import CustomTestCase
# Note: PYTHONPATH=python should be set when running tests
# Constants for calibration parameters to avoid hard-coded values
@@ -17,17 +25,7 @@ CALIBRATION_BATCH_SIZE = 36
CALIBRATION_NUM_SAMPLES = 512
DEFAULT_DEVICE = "cuda:0"
# Constants for calibration parameters to avoid hard-coded values
CALIBRATION_BATCH_SIZE = 36
CALIBRATION_NUM_SAMPLES = 512
DEFAULT_DEVICE = "cuda:0"
from sglang.srt.configs.device_config import DeviceConfig
from sglang.srt.configs.load_config import LoadConfig
from sglang.srt.configs.model_config import ModelConfig
from sglang.srt.layers.modelopt_utils import QUANT_CFG_CHOICES
from sglang.srt.model_loader.loader import ModelOptModelLoader
from sglang.test.test_utils import CustomTestCase
register_cuda_ci(est_time=11, suite="stage-b-test-small-1-gpu")
class TestModelOptModelLoader(CustomTestCase):

View File

@@ -9,8 +9,11 @@ from transformers import AutoModelForCausalLM
from sglang.srt.entrypoints.engine import Engine
from sglang.srt.weight_sync.utils import update_weights
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.test_utils import DEFAULT_SMALL_MODEL_NAME_FOR_TEST
register_cuda_ci(est_time=29, suite="stage-b-test-small-1-gpu")
class AsyncEngine(Engine):
def __init__(self, **kwargs):

View File

@@ -10,11 +10,7 @@ from sglang.test.ci.ci_utils import TestFile, run_unittest_files
suites = {
"per-commit-1-gpu": [
TestFile("test_evs.py", 20),
TestFile("test_external_models.py", 30),
TestFile("test_modelopt_loader.py", 11),
TestFile("test_utils_update_weights.py", 29),
TestFile("test_video_utils.py", 5),
TestFile("test_modelopt_export.py", 9),
],
"per-commit-4-gpu": [
TestFile("models/test_qwen3_next_models.py", 650),
@@ -92,7 +88,6 @@ suite_amd = {
# TestFile("lora/test_lora_cuda_graph.py", 250), # Disabled temporarily, see https://github.com/sgl-project/sglang/issues/13107
# TestFile("lora/test_lora_qwen3.py", 97), # Disabled temporarily, see https://github.com/sgl-project/sglang/issues/13107
TestFile("test_bench_typebaseddispatcher.py", 10),
TestFile("test_external_models.py", 45),
TestFile("test_rope_rocm.py", 3),
# TestFile("test_torch_compile_moe.py", 210), # Disabled temporarily, see https://github.com/sgl-project/sglang/issues/13107
TestFile("test_type_based_dispatcher.py", 10),