[Bugfix][Bench] Fix bench mm-processor crash in shared request sampling (#56300)
Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
This commit is contained in:
@@ -539,27 +539,38 @@ def _to_serve_args(args: argparse.Namespace) -> argparse.Namespace:
|
||||
"""
|
||||
d = vars(args).copy()
|
||||
# random_*: prefer --random-* over legacy --input/output/prefix-len.
|
||||
d["random_input_len"] = getattr(args, "random_input_len", None) or args.input_len
|
||||
d["random_output_len"] = getattr(args, "random_output_len", None) or args.output_len
|
||||
d["random_prefix_len"] = getattr(args, "random_prefix_len", None) or args.prefix_len
|
||||
# Callers without the legacy flags (e.g. bench mm-processor) omit them, so
|
||||
# read them optionally. Identity checks, not truthiness: an explicit 0
|
||||
# (the default of --random-prefix-len) must not fall through to them.
|
||||
input_len = getattr(args, "input_len", None)
|
||||
output_len = getattr(args, "output_len", None)
|
||||
prefix_len = getattr(args, "prefix_len", None)
|
||||
d["random_input_len"] = getattr(args, "random_input_len", input_len)
|
||||
d["random_output_len"] = getattr(args, "random_output_len", output_len)
|
||||
d["random_prefix_len"] = getattr(args, "random_prefix_len", prefix_len)
|
||||
# --output-len maps to the per-dataset output-len entry points get_samples
|
||||
# reads. None passes through (each dataset applies its own default),
|
||||
# matching prior throughput behaviour of omitting output_len when unset.
|
||||
d["hf_output_len"] = args.output_len
|
||||
d["sharegpt_output_len"] = args.output_len
|
||||
d["hf_output_len"] = output_len
|
||||
d["sharegpt_output_len"] = output_len
|
||||
# sonnet reads dedicated attrs; fall back to SonnetDataset's own defaults.
|
||||
d["sonnet_input_len"] = args.input_len if args.input_len is not None else 550
|
||||
d["sonnet_output_len"] = args.output_len if args.output_len is not None else 150
|
||||
d["sonnet_prefix_len"] = args.prefix_len
|
||||
d["sonnet_input_len"] = input_len if input_len is not None else 550
|
||||
d["sonnet_output_len"] = output_len if output_len is not None else 150
|
||||
d["sonnet_prefix_len"] = prefix_len
|
||||
# Explicit --enable-multimodal-chat wins; otherwise auto-enable for the
|
||||
# multimodal chat backend (preserves today's vllm-chat handling).
|
||||
# multimodal chat backend (preserves today's vllm-chat handling). Callers
|
||||
# without a --backend flag (e.g. bench mm-processor) drive every request
|
||||
# through llm.chat, so default to the vllm-chat behaviour.
|
||||
backend = getattr(args, "backend", "vllm-chat")
|
||||
d["backend"] = backend
|
||||
d["enable_multimodal_chat"] = bool(
|
||||
getattr(args, "enable_multimodal_chat", False) or args.backend == "vllm-chat"
|
||||
getattr(args, "enable_multimodal_chat", False) or backend == "vllm-chat"
|
||||
)
|
||||
# serve-only attrs throughput never exposed; keep serve's defaults.
|
||||
d.setdefault("disable_shuffle", False)
|
||||
d.setdefault("skip_chat_template", False)
|
||||
d.setdefault("no_stream", False)
|
||||
d.setdefault("no_oversample", False)
|
||||
d.setdefault("request_id_prefix", "")
|
||||
d.setdefault("chat_template_kwargs", None)
|
||||
return argparse.Namespace(**d)
|
||||
|
||||
Reference in New Issue
Block a user