Unverified Commit 1103dc62 authored by Kai-Hsun Chen's avatar Kai-Hsun Chen Committed by GitHub
Browse files

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


Signed-off-by: default avatarKai-Hsun Chen <khchen@x.ai>
parent a220536f
...@@ -795,8 +795,10 @@ class ConditionalChatTTS(PreTrainedModel): ...@@ -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): ...@@ -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 = (
......
...@@ -503,7 +503,7 @@ def popen_launch_server( ...@@ -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( ...@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment