Rename --stream-output to --incremental-streaming-output (#20614)
This commit is contained in:
@@ -199,13 +199,13 @@ class StreamingHarmonyContext(HarmonyContext):
|
||||
completion_tokens is not None
|
||||
and len(output_token_ids) == completion_tokens
|
||||
):
|
||||
# Case 1: When --stream-output is not set.
|
||||
# Case 1: When --incremental-streaming-output is not set.
|
||||
# The output_ids contains all tokens generated so far.
|
||||
# We only need to process the new tokens.
|
||||
new_token_ids = output_token_ids[self.num_processed_tokens :]
|
||||
self.num_processed_tokens = len(output_token_ids)
|
||||
else:
|
||||
# Case 2: When --stream-output is set.
|
||||
# Case 2: When --incremental-streaming-output is set.
|
||||
# The output_ids contains only the new tokens.
|
||||
new_token_ids = output_token_ids
|
||||
self.num_processed_tokens += len(output_token_ids)
|
||||
|
||||
@@ -1574,7 +1574,7 @@ class TokenizerManager(TokenizerCommunicatorMixin, TokenizerManagerMultiItemMixi
|
||||
state.text += recv_obj.output_strs[i]
|
||||
# Not all request types have `stream` (e.g., EmbeddingReqInput). Default to non-streaming.
|
||||
is_stream = getattr(state.obj, "stream", False)
|
||||
if self.server_args.stream_output and is_stream:
|
||||
if self.server_args.incremental_streaming_output and is_stream:
|
||||
state.output_ids.extend(recv_obj.output_ids[i])
|
||||
output_token_ids = state.output_ids[state.last_output_offset :]
|
||||
state.last_output_offset = len(state.output_ids)
|
||||
@@ -1590,7 +1590,7 @@ class TokenizerManager(TokenizerCommunicatorMixin, TokenizerManagerMultiItemMixi
|
||||
|
||||
elif isinstance(recv_obj, BatchTokenIDOutput):
|
||||
is_stream = getattr(state.obj, "stream", False)
|
||||
if self.server_args.stream_output and is_stream:
|
||||
if self.server_args.incremental_streaming_output and is_stream:
|
||||
state.output_ids.extend(recv_obj.output_ids[i])
|
||||
output_token_ids = state.output_ids[state.last_output_offset :]
|
||||
state.last_output_offset = len(state.output_ids)
|
||||
|
||||
@@ -367,7 +367,7 @@ class ServerArgs:
|
||||
pp_max_micro_batch_size: Optional[int] = None
|
||||
pp_async_batch_depth: int = 0
|
||||
stream_interval: int = 1
|
||||
stream_output: bool = False
|
||||
incremental_streaming_output: bool = False
|
||||
enable_streaming_session: bool = False
|
||||
random_seed: Optional[int] = None
|
||||
constrained_json_whitespace_pattern: Optional[str] = None
|
||||
@@ -3791,10 +3791,17 @@ class ServerArgs:
|
||||
help="The interval (or buffer size) for streaming in terms of the token length. A smaller value makes streaming smoother, while a larger value makes the throughput higher",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--stream-output",
|
||||
"--incremental-streaming-output",
|
||||
action="store_true",
|
||||
help="Whether to output as a sequence of disjoint segments.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--stream-output",
|
||||
action=DeprecatedStoreTrueAction,
|
||||
dest="incremental_streaming_output",
|
||||
new_flag="--incremental-streaming-output",
|
||||
help="[Deprecated] Use --incremental-streaming-output instead.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--enable-streaming-session",
|
||||
action="store_true",
|
||||
@@ -6284,6 +6291,32 @@ class DeprecatedAction(argparse.Action):
|
||||
)
|
||||
|
||||
|
||||
class DeprecatedStoreTrueAction(argparse.Action):
|
||||
"""Deprecated flag that still stores True and prints a warning."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
option_strings,
|
||||
dest,
|
||||
new_flag=None,
|
||||
nargs=0,
|
||||
const=True,
|
||||
default=False,
|
||||
**kwargs,
|
||||
):
|
||||
self.new_flag = new_flag
|
||||
super().__init__(
|
||||
option_strings, dest, nargs=nargs, const=const, default=default, **kwargs
|
||||
)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
replacement = f" Use '{self.new_flag}' instead." if self.new_flag else ""
|
||||
print_deprecated_warning(
|
||||
f"'{option_string}' is deprecated and will be removed in a future release.{replacement}"
|
||||
)
|
||||
setattr(namespace, self.dest, True)
|
||||
|
||||
|
||||
def auto_choose_speculative_params(self: ServerArgs):
|
||||
"""
|
||||
Automatically choose the parameters for speculative decoding.
|
||||
|
||||
Reference in New Issue
Block a user