From 1103dc6204c023f512b333847dd44fa82aa90228 Mon Sep 17 00:00:00 2001 From: Kai-Hsun Chen Date: Sun, 12 Oct 2025 05:34:04 -0700 Subject: [PATCH] [chore][2/N] Avoid using default mutable parameters (#11479) Signed-off-by: Kai-Hsun Chen --- python/sglang/srt/models/minicpmo.py | 9 +++++++-- python/sglang/test/test_utils.py | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/python/sglang/srt/models/minicpmo.py b/python/sglang/srt/models/minicpmo.py index 2ce575411..2f8271c6c 100644 --- a/python/sglang/srt/models/minicpmo.py +++ b/python/sglang/srt/models/minicpmo.py @@ -795,8 +795,10 @@ class ConditionalChatTTS(PreTrainedModel): force_no_stop=False, min_new_token=10, max_new_token=50, - logits_warpers: List[LogitsWarper] = [], - logits_processors: List[CustomRepetitionPenaltyLogitsProcessorRepeat] = [], + logits_warpers: Optional[List[LogitsWarper]] = None, + logits_processors: Optional[ + List[CustomRepetitionPenaltyLogitsProcessorRepeat] + ] = None, show_tqdm=False, ): """Generate audio codes in streaming setting or non-streaming setting. @@ -825,6 +827,9 @@ class ConditionalChatTTS(PreTrainedModel): assert input_ids.shape[0] == 1 assert past_key_values is not None + logits_warpers = logits_warpers or [] + logits_processors = logits_processors or [] + # fix: this should not be `input_ids.shape[1]` # start_idx = input_ids.shape[1] start_idx = ( diff --git a/python/sglang/test/test_utils.py b/python/sglang/test/test_utils.py index c52cbdf83..f86d53642 100644 --- a/python/sglang/test/test_utils.py +++ b/python/sglang/test/test_utils.py @@ -503,7 +503,7 @@ def popen_launch_server( base_url: str, timeout: float, api_key: Optional[str] = None, - other_args: list[str] = [], + other_args: Optional[list[str]] = None, env: Optional[dict] = None, return_stdout_stderr: Optional[tuple] = None, device: str = "auto", @@ -516,6 +516,8 @@ def popen_launch_server( device: Device type ("auto", "cuda", "rocm" or "cpu"). If "auto", will detect available platforms automatically. """ + other_args = other_args or [] + # Auto-detect device if needed if device == "auto": device = auto_config_device()