[chore][2/N] Avoid using default mutable parameters (#11479)

Signed-off-by: Kai-Hsun Chen <khchen@x.ai>
This commit is contained in:
Kai-Hsun Chen
2025-10-12 05:34:04 -07:00
committed by GitHub
parent a220536f40
commit 1103dc6204
2 changed files with 10 additions and 3 deletions

View File

@@ -795,8 +795,10 @@ class ConditionalChatTTS(PreTrainedModel):
force_no_stop=False, force_no_stop=False,
min_new_token=10, min_new_token=10,
max_new_token=50, max_new_token=50,
logits_warpers: List[LogitsWarper] = [], logits_warpers: Optional[List[LogitsWarper]] = None,
logits_processors: List[CustomRepetitionPenaltyLogitsProcessorRepeat] = [], logits_processors: Optional[
List[CustomRepetitionPenaltyLogitsProcessorRepeat]
] = None,
show_tqdm=False, show_tqdm=False,
): ):
"""Generate audio codes in streaming setting or non-streaming setting. """Generate audio codes in streaming setting or non-streaming setting.
@@ -825,6 +827,9 @@ class ConditionalChatTTS(PreTrainedModel):
assert input_ids.shape[0] == 1 assert input_ids.shape[0] == 1
assert past_key_values is not None 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]` # fix: this should not be `input_ids.shape[1]`
# start_idx = input_ids.shape[1] # start_idx = input_ids.shape[1]
start_idx = ( start_idx = (

View File

@@ -503,7 +503,7 @@ def popen_launch_server(
base_url: str, base_url: str,
timeout: float, timeout: float,
api_key: Optional[str] = None, api_key: Optional[str] = None,
other_args: list[str] = [], other_args: Optional[list[str]] = None,
env: Optional[dict] = None, env: Optional[dict] = None,
return_stdout_stderr: Optional[tuple] = None, return_stdout_stderr: Optional[tuple] = None,
device: str = "auto", device: str = "auto",
@@ -516,6 +516,8 @@ def popen_launch_server(
device: Device type ("auto", "cuda", "rocm" or "cpu"). device: Device type ("auto", "cuda", "rocm" or "cpu").
If "auto", will detect available platforms automatically. If "auto", will detect available platforms automatically.
""" """
other_args = other_args or []
# Auto-detect device if needed # Auto-detect device if needed
if device == "auto": if device == "auto":
device = auto_config_device() device = auto_config_device()