"tests/vscode:/vscode.git/clone" did not exist on "e7f049afa12bb7607d44b15dd3d7daa4e6394b0a"
Unverified Commit b808a383 authored by Ke Bao's avatar Ke Bao Committed by GitHub
Browse files

Filter empty prompt in random bench serving (#2011)

parent 602ebc66
......@@ -596,12 +596,20 @@ def sample_random_requests(
# Filter out sequences that are too long or too short
input_requests: List[Tuple[str, int, int]] = []
for i in range(num_prompts):
for data in dataset:
i = len(input_requests)
if i == num_prompts:
break
# Tokenize the prompts and completions.
prompt = dataset[i][0]
prompt = data[0]
prompt_token_ids = tokenizer.encode(prompt)
prompt_len = len(prompt_token_ids)
# Skip empty prompt
if prompt_len == 0:
continue
if prompt_len > input_lens[i]:
input_ids = prompt_token_ids[: input_lens[i]]
else:
......
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