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

Use parameter based num as inference request max output length #10

Merged
merged 1 commit into from
Mar 14, 2024
Merged
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
13 changes: 11 additions & 2 deletions benchmarks/benchmark_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def sample_requests(
dataset_path: str,
num_requests: int,
tokenizer: Any,
max_output_length: int,
) -> List[InputRequest]:
# Load the dataset.
with open(dataset_path) as f:
Expand Down Expand Up @@ -167,7 +168,7 @@ def sample_requests(
if prompt_len > 1024 or prompt_len + output_len > 2048:
# Prune too long sequences.
continue
reqeust = InputRequest(prompt, prompt_len, output, output_len)
reqeust = InputRequest(prompt, prompt_len, output, max_output_length)
filtered_dataset.append(reqeust)

# Sample the requests.
Expand Down Expand Up @@ -388,7 +389,7 @@ def main(args: argparse.Namespace):
if tokenizer == "test" or args.dataset == "test":
input_requests = mock_requests(args.total_mock_requests) # e.g. [("AB", 2, "AB", 3)]
else:
input_requests = sample_requests(args.dataset, args.num_prompts, tokenizer)
input_requests = sample_requests(args.dataset, args.num_prompts, tokenizer, args.max_output_length)

benchmark_result, request_outputs = asyncio.run(
benchmark(
Expand Down Expand Up @@ -501,6 +502,14 @@ def main(args: argparse.Namespace):
default=150,
help="The maximum number of mock requests to send for benchmark testing.",
)

parser.add_argument(
"--max-output-length",
type=int,
default=1024,
help="The maximum output length for reference request.",
)

parser.add_argument("--seed", type=int, default=0)
parser.add_argument(
"--disable-tqdm",
Expand Down
Loading