fix lora test (#13537)

This commit is contained in:
gongwei-130
2025-11-18 12:40:35 -08:00
committed by GitHub
parent 6b9459e86c
commit a9d22b751d

View File

@@ -15,15 +15,11 @@
import multiprocessing as mp
import os
import unittest
from typing import List
from utils import (
ALL_OTHER_MULTI_LORA_MODELS,
BACKENDS,
CI_MULTI_LORA_MODELS,
TORCH_DTYPES,
LoRAModelCase,
run_lora_test_one_by_one,
run_lora_multiple_batch_on_model_cases,
)
from sglang.test.test_utils import CustomTestCase, is_in_ci
@@ -44,28 +40,8 @@ PROMPTS = [
class TestMultiLoRABackend(CustomTestCase):
def _run_multi_lora_test_on_model_cases(self, model_cases: List[LoRAModelCase]):
for model_case in model_cases:
# If skip_long_prompt is True, filter out prompts longer than 1000 characters.
batch_prompts = (
PROMPTS
if not model_case.skip_long_prompt
else [p for p in PROMPTS if len(p) < 1000]
)
for torch_dtype in TORCH_DTYPES:
for backend in BACKENDS:
run_lora_test_one_by_one(
batch_prompts,
model_case,
torch_dtype,
max_new_tokens=32,
backend=backend,
test_tag="multi-lora-backend",
)
def test_ci_lora_models(self):
self._run_multi_lora_test_on_model_cases(CI_MULTI_LORA_MODELS)
run_lora_multiple_batch_on_model_cases(CI_MULTI_LORA_MODELS)
def test_all_lora_models(self):
if is_in_ci():
@@ -78,7 +54,7 @@ class TestMultiLoRABackend(CustomTestCase):
continue
filtered_models.append(model_case)
self._run_multi_lora_test_on_model_cases(filtered_models)
run_lora_multiple_batch_on_model_cases(filtered_models)
if __name__ == "__main__":