Fix utils import issue for nightly tests (#13944)

This commit is contained in:
alisonshao
2025-11-27 15:24:27 -08:00
committed by GitHub
parent 051ad83347
commit bce40fa217
11 changed files with 55 additions and 23 deletions
@@ -1,17 +1,3 @@
# Copyright 2023-2024 SGLang Team
# 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.
# ==============================================================================
import dataclasses import dataclasses
import random import random
from typing import List from typing import List
+1 -1
View File
@@ -17,7 +17,7 @@ import os
import unittest import unittest
from typing import List from typing import List
from utils import ( from lora_utils import (
ALL_OTHER_LORA_MODELS, ALL_OTHER_LORA_MODELS,
CI_LORA_MODELS, CI_LORA_MODELS,
DEFAULT_PROMPTS, DEFAULT_PROMPTS,
+1 -1
View File
@@ -2,7 +2,7 @@ import random
import unittest import unittest
from typing import Sequence from typing import Sequence
from utils import TORCH_DTYPES, LoRAAdaptor, LoRAModelCase, ensure_reproducibility from lora_utils import TORCH_DTYPES, LoRAAdaptor, LoRAModelCase, ensure_reproducibility
from sglang.srt.models.qwen3_vl import Qwen3VLForConditionalGeneration from sglang.srt.models.qwen3_vl import Qwen3VLForConditionalGeneration
from sglang.srt.models.qwen3_vl_moe import Qwen3VLMoeForConditionalGeneration from sglang.srt.models.qwen3_vl_moe import Qwen3VLMoeForConditionalGeneration
+1 -1
View File
@@ -15,7 +15,7 @@
import multiprocessing as mp import multiprocessing as mp
import unittest import unittest
from utils import ( from lora_utils import (
CI_MULTI_LORA_MODELS, CI_MULTI_LORA_MODELS,
LoRAAdaptor, LoRAAdaptor,
LoRAModelCase, LoRAModelCase,
+11 -1
View File
@@ -13,9 +13,19 @@
# ============================================================================== # ==============================================================================
import multiprocessing as mp import multiprocessing as mp
import sys
import unittest import unittest
from pathlib import Path
from utils import LoRAAdaptor, LoRAModelCase, run_lora_multiple_batch_on_model_cases # Add test directory to path for lora_utils import
# TODO: can be removed after migration
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from lora_utils import (
LoRAAdaptor,
LoRAModelCase,
run_lora_multiple_batch_on_model_cases,
)
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
+8 -1
View File
@@ -13,10 +13,17 @@
# ============================================================================== # ==============================================================================
import multiprocessing as mp import multiprocessing as mp
import sys
import unittest import unittest
from pathlib import Path
import torch import torch
from utils import CI_MULTI_LORA_MODELS, run_lora_test_one_by_one
# Add test directory to path for lora_utils import
# TODO: can be removed after migration
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from lora_utils import CI_MULTI_LORA_MODELS, run_lora_test_one_by_one
from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.ci.ci_register import register_cuda_ci
+5
View File
@@ -74,6 +74,11 @@ def main():
nightly_dir = Path(__file__).parent / "nightly" nightly_dir = Path(__file__).parent / "nightly"
os.chdir(nightly_dir) os.chdir(nightly_dir)
# Add test/ to PYTHONPATH so tests can import shared utils
test_dir = str(Path(__file__).parent)
pythonpath = os.environ.get("PYTHONPATH", "")
os.environ["PYTHONPATH"] = f"{test_dir}:{pythonpath}" if pythonpath else test_dir
print(f"Running {len(files)} tests from suite: {args.suite}") print(f"Running {len(files)} tests from suite: {args.suite}")
print(f"Test files: {[f.name for f in files]}") print(f"Test files: {[f.name for f in files]}")
+7 -1
View File
@@ -14,9 +14,15 @@
import multiprocessing as mp import multiprocessing as mp
import os import os
import sys
import unittest import unittest
from pathlib import Path
from utils import ( # Add test directory to path for lora_utils import
# TODO: can be removed after migration
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent))
from lora_utils import (
ALL_OTHER_MULTI_LORA_MODELS, ALL_OTHER_MULTI_LORA_MODELS,
CI_MULTI_LORA_MODELS, CI_MULTI_LORA_MODELS,
run_lora_multiple_batch_on_model_cases, run_lora_multiple_batch_on_model_cases,
+7 -1
View File
@@ -14,10 +14,16 @@
import multiprocessing as mp import multiprocessing as mp
import os import os
import sys
import unittest import unittest
from pathlib import Path
from typing import List from typing import List
from utils import ( # Add test directory to path for lora_utils import
# TODO: can be removed after migration
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent))
from lora_utils import (
ALL_OTHER_LORA_MODELS, ALL_OTHER_LORA_MODELS,
BACKENDS, BACKENDS,
CI_LORA_MODELS, CI_LORA_MODELS,
+7 -1
View File
@@ -14,10 +14,16 @@
import multiprocessing as mp import multiprocessing as mp
import os import os
import sys
import unittest import unittest
from pathlib import Path
from typing import List from typing import List
from utils import ( # Add test directory to path for lora_utils import
# TODO: can be removed after migration
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent))
from lora_utils import (
ALL_OTHER_LORA_MODELS, ALL_OTHER_LORA_MODELS,
CI_LORA_MODELS, CI_LORA_MODELS,
DEFAULT_PROMPTS, DEFAULT_PROMPTS,
+7 -1
View File
@@ -14,9 +14,15 @@
import multiprocessing as mp import multiprocessing as mp
import os import os
import sys
import unittest import unittest
from pathlib import Path
from utils import ( # Add test directory to path for lora_utils import
# TODO: can be removed after migration
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent))
from lora_utils import (
ALL_OTHER_MULTI_LORA_MODELS, ALL_OTHER_MULTI_LORA_MODELS,
CI_MULTI_LORA_MODELS, CI_MULTI_LORA_MODELS,
run_lora_multiple_batch_on_model_cases, run_lora_multiple_batch_on_model_cases,