diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 752c05da7..6ab371603 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -29,10 +29,8 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install -e "python[all]" + pip install -e "python[dev]" pip install flashinfer -i https://flashinfer.ai/whl/cu121/torch2.4/ --force-reinstall - pip install accelerate - pip install sentence_transformers - name: Test Backend Runtime timeout-minutes: 20 diff --git a/python/pyproject.toml b/python/pyproject.toml index 6b1b032fd..4908ad051 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -27,7 +27,7 @@ srt = ["aiohttp", "decord", "fastapi", "hf_transfer", "huggingface_hub", "intere openai = ["openai>=1.0", "tiktoken"] anthropic = ["anthropic>=0.20.0"] litellm = ["litellm>=1.0.0"] -test = ["jsonlines", "matplotlib", "pandas"] +test = ["jsonlines", "matplotlib", "pandas", "sentence_transformers", "accelerate"] all = ["sglang[srt]", "sglang[openai]", "sglang[anthropic]", "sglang[litellm]"] dev = ["sglang[all]", "sglang[test]"] diff --git a/python/sglang/srt/managers/tokenizer_manager.py b/python/sglang/srt/managers/tokenizer_manager.py index 3f25ad560..c74251947 100644 --- a/python/sglang/srt/managers/tokenizer_manager.py +++ b/python/sglang/srt/managers/tokenizer_manager.py @@ -427,12 +427,10 @@ class TokenizerManager: return sampling_params async def _get_pixel_values(self, image_data): - if isinstance(image_data, list) and len(image_data) > 0: - return await self._get_pixel_values_internal(image_data) - elif isinstance(image_data, str): - return await self._get_pixel_values_internal(image_data) - else: + if image_data is None: return None, None, None + else: + return await self._get_pixel_values_internal(image_data) async def _wait_for_response( self, diff --git a/python/sglang/test/test_utils.py b/python/sglang/test/test_utils.py index 046886399..59e2ab292 100644 --- a/python/sglang/test/test_utils.py +++ b/python/sglang/test/test_utils.py @@ -465,7 +465,7 @@ def run_unittest_files(files: List[str], timeout_per_file: float): def run_one_file(filename): filename = os.path.join(os.getcwd(), filename) - print(f"\n\nRun {filename}\n\n") + print(f"\n\nRun {filename}\n\n", flush=True) process = subprocess.Popen( ["python3", filename], stdout=None, stderr=None, env=os.environ ) @@ -481,15 +481,16 @@ def run_unittest_files(files: List[str], timeout_per_file: float): kill_child_process(process.pid) time.sleep(5) print( - f"\nTimeout after {timeout_per_file} seconds when running {filename}\n" + f"\nTimeout after {timeout_per_file} seconds when running {filename}\n", + flush=True, ) success = False break if success: - print(f"Success. Time elapsed: {time.time() - tic:.2f}s") + print(f"Success. Time elapsed: {time.time() - tic:.2f}s", flush=True) else: - print(f"Fail. Time elapsed: {time.time() - tic:.2f}s") + print(f"Fail. Time elapsed: {time.time() - tic:.2f}s", flush=True) return 0 if success else -1