Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support throughput benchmarking for mllama with vision input #629

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion benchmarks/benchmark_throughput.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time
from typing import List, Optional

import requests as reqs
import torch
import uvloop
from PIL import Image
Expand Down Expand Up @@ -300,6 +301,16 @@ def main(args: argparse.Namespace):
if args.dataset is None:
vocab_size = tokenizer.vocab_size
requests = []
mm_data = None
if args.mm_data:
mm_data_url = "https://llava-vl.github.io/static/images/view.jpg"
try:
raw_image = Image.open(reqs.get(
mm_data_url, stream=True).raw).convert("RGB")
except Exception as e:
print(f"Failed to download image from {mm_data_url}: {e}")
raw_image = None
mm_data = {"image": raw_image}
for _ in range(args.num_prompts):
# Synthesize a prompt with the given input length.
candidate_ids = [
Expand Down Expand Up @@ -327,7 +338,8 @@ def main(args: argparse.Namespace):
requests.append(
SampleRequest(prompt=candidate_prompt,
prompt_len=args.input_len,
expected_output_len=args.output_len))
expected_output_len=args.output_len,
multi_modal_data=mm_data))
else:
requests = sample_requests(tokenizer, args)

Expand Down Expand Up @@ -426,6 +438,10 @@ def main(args: argparse.Namespace):
action='store_true',
default=False,
help="Disable decoupled async engine frontend.")
parser.add_argument("--mm-data",
action='store_true',
default=False,
help="Add multi-modal data to the requests.")
parser = AsyncEngineArgs.add_cli_args(parser)
args = parser.parse_args()
if args.tokenizer is None:
Expand Down
Loading