Support PP key for file backend (#21901)

This commit is contained in:
Zhangheng
2026-04-02 12:23:58 +08:00
committed by GitHub
parent ed427e1299
commit fae66b4050
@@ -307,17 +307,21 @@ class HiCacheFile(HiCacheStorage):
):
self.file_path = envs.SGLANG_HICACHE_FILE_BACKEND_STORAGE_DIR.get() or file_path
tp_rank, tp_size, model_name, is_mla_model = (
tp_rank, tp_size, pp_rank, pp_size, model_name, is_mla_model = (
storage_config.tp_rank,
storage_config.tp_size,
storage_config.pp_rank,
storage_config.pp_size,
storage_config.model_name,
storage_config.is_mla_model,
)
model_name = "-".join(model_name.split("/")) if model_name else ""
if is_mla_model:
self.config_suffix = f"_{model_name}"
else:
self.config_suffix = f"_{model_name}_{tp_rank}_{tp_size}"
enable_pp = pp_size > 1
self.config_suffix = f"_{model_name}"
if not is_mla_model:
self.config_suffix += f"_{tp_rank}_{tp_size}"
if enable_pp:
self.config_suffix += f"_{pp_size}_{pp_rank}"
if not os.path.exists(self.file_path) and tp_rank == 0:
os.makedirs(self.file_path)
logger.info(f"Created HiCacheFile storage directory at {self.file_path}")