Skip to content

Commit 0cc566c

Browse files
authored
[Misc] Add random seed for prefix cache benchmark (#9081)
1 parent 05c531b commit 0cc566c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

benchmarks/benchmark_prefix_caching.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def repeat_and_sort_requests(requests: List[Tuple[str, int, int]],
113113
def main(args):
114114
tokenizer = get_tokenizer(args.model, trust_remote_code=True)
115115
input_length_range = tuple(map(int, args.input_length_range.split(':')))
116-
116+
random.seed(args.seed)
117117
if args.dataset_path is not None:
118118
print(f"Start to sample {args.num_prompts} prompts"
119119
"from {args.dataset_path}")
@@ -194,5 +194,7 @@ def main(args):
194194
default='128:256',
195195
help='Range of input lengths for sampling prompts,'
196196
'specified as "min:max" (e.g., "128:256").')
197+
parser.add_argument("--seed", type=int, default=0,
198+
help='Random seed for reproducibility')
197199
args = parser.parse_args()
198200
main(args)

0 commit comments

Comments
 (0)