From b88fab31114bbc08110cd617d5a0f4566627dd21 Mon Sep 17 00:00:00 2001 From: yinghui <32845984+cicirori@users.noreply.github.com> Date: Tue, 4 Nov 2025 23:39:11 -0800 Subject: [PATCH] fix: add `seed` bench_serving to cache key, remove redundant function definition. (#12680) --- benchmark/hicache/data_processing.py | 21 --------------------- python/sglang/bench_serving.py | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/benchmark/hicache/data_processing.py b/benchmark/hicache/data_processing.py index 8f72a0d95..1fb3650ce 100644 --- a/benchmark/hicache/data_processing.py +++ b/benchmark/hicache/data_processing.py @@ -2,7 +2,6 @@ import json import os import pickle import random -from pathlib import Path from typing import List, Optional, Tuple, Union import numpy as np @@ -426,26 +425,6 @@ def sample_random_requests( return input_requests -def gen_prompt(tokenizer, token_num): - """Generate a random prompt of specified token length using tokenizer vocabulary.""" - all_available_tokens = list(tokenizer.get_vocab().values()) - selected_tokens = random.choices(all_available_tokens, k=token_num) - return tokenizer.decode(selected_tokens) - - -def get_gen_prefix_cache_path(args, tokenizer): - """Create cache directory under ~/.cache/sglang/benchmark""" - cache_dir = Path.home() / ".cache" / "sglang" / "benchmark" - - # Create a unique cache filename based on the generation parameters - cache_key = ( - f"gsp_prefix_{args.gsp_num_groups}_{args.gsp_prompts_per_group}_" - f"{args.gsp_system_prompt_len}_{args.gsp_question_len}_{args.gsp_output_len}_" - f"{tokenizer.__class__.__name__}.pkl" - ) - return cache_dir / cache_key - - def sample_generated_shared_prefix_requests( num_groups: int, prompts_per_group: int, diff --git a/python/sglang/bench_serving.py b/python/sglang/bench_serving.py index e90e7f754..44bcadf7c 100644 --- a/python/sglang/bench_serving.py +++ b/python/sglang/bench_serving.py @@ -1507,7 +1507,7 @@ def get_gen_prefix_cache_path(args, tokenizer): # Create a unique cache filename based on the generation parameters cache_key = ( - f"gen_shared_prefix_{args.gsp_num_groups}_{args.gsp_prompts_per_group}_" + f"gen_shared_prefix_{args.seed}_{args.gsp_num_groups}_{args.gsp_prompts_per_group}_" f"{args.gsp_system_prompt_len}_{args.gsp_question_len}_{args.gsp_output_len}_" f"{tokenizer.__class__.__name__}.pkl" )