fix lora test (#13537)
This commit is contained in:
@@ -15,15 +15,11 @@
|
|||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from utils import (
|
from utils import (
|
||||||
ALL_OTHER_MULTI_LORA_MODELS,
|
ALL_OTHER_MULTI_LORA_MODELS,
|
||||||
BACKENDS,
|
|
||||||
CI_MULTI_LORA_MODELS,
|
CI_MULTI_LORA_MODELS,
|
||||||
TORCH_DTYPES,
|
run_lora_multiple_batch_on_model_cases,
|
||||||
LoRAModelCase,
|
|
||||||
run_lora_test_one_by_one,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from sglang.test.test_utils import CustomTestCase, is_in_ci
|
from sglang.test.test_utils import CustomTestCase, is_in_ci
|
||||||
@@ -44,28 +40,8 @@ PROMPTS = [
|
|||||||
|
|
||||||
|
|
||||||
class TestMultiLoRABackend(CustomTestCase):
|
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):
|
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):
|
def test_all_lora_models(self):
|
||||||
if is_in_ci():
|
if is_in_ci():
|
||||||
@@ -78,7 +54,7 @@ class TestMultiLoRABackend(CustomTestCase):
|
|||||||
continue
|
continue
|
||||||
filtered_models.append(model_case)
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user