[Misc] Fix sampling from sonnet for long context case (#9235)

This commit is contained in:
Andy Dai 2024-10-10 17:33:16 -07:00 committed by GitHub
parent f990bab2a4
commit 94bf9ae4e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -176,9 +176,9 @@ def sample_sonnet_requests(
# Sample the rest of lines per request.
sampled_requests: List[Tuple[str, int, int]] = []
for _ in range(num_requests):
sampled_lines = "".join(
prefix_lines +
random.sample(poem_lines, num_input_lines - num_prefix_lines))
num_lines_needed = num_input_lines - num_prefix_lines
sampled_lines = "".join(prefix_lines +
random.choices(poem_lines, k=num_lines_needed))
prompt = f"{base_prompt}{sampled_lines}"
message = [
@ -536,7 +536,7 @@ async def benchmark(
# E.g., "Time to First Token"
metric_header: str,
):
# This function print and add statistics of the specified
# This function prints and adds statistics of the specified
# metric.
if metric_attribute_name not in selected_percentile_metrics:
return