Skip to content

Commit cf39d5d

Browse files
hzh0425Fridge003
authored andcommitted
Support PP key for file backend (#21901)
1 parent b40ec2d commit cf39d5d

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

python/sglang/srt/mem_cache/hicache_storage.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,17 +307,21 @@ def __init__(
307307
):
308308
self.file_path = envs.SGLANG_HICACHE_FILE_BACKEND_STORAGE_DIR.get() or file_path
309309

310-
tp_rank, tp_size, model_name, is_mla_model = (
310+
tp_rank, tp_size, pp_rank, pp_size, model_name, is_mla_model = (
311311
storage_config.tp_rank,
312312
storage_config.tp_size,
313+
storage_config.pp_rank,
314+
storage_config.pp_size,
313315
storage_config.model_name,
314316
storage_config.is_mla_model,
315317
)
316318
model_name = "-".join(model_name.split("/")) if model_name else ""
317-
if is_mla_model:
318-
self.config_suffix = f"_{model_name}"
319-
else:
320-
self.config_suffix = f"_{model_name}_{tp_rank}_{tp_size}"
319+
enable_pp = pp_size > 1
320+
self.config_suffix = f"_{model_name}"
321+
if not is_mla_model:
322+
self.config_suffix += f"_{tp_rank}_{tp_size}"
323+
if enable_pp:
324+
self.config_suffix += f"_{pp_size}_{pp_rank}"
321325
if not os.path.exists(self.file_path) and tp_rank == 0:
322326
os.makedirs(self.file_path)
323327
logger.info(f"Created HiCacheFile storage directory at {self.file_path}")

0 commit comments

Comments
 (0)