Handle recompute and verify closeness in dumper (#19564)

This commit is contained in:
fzyzcjy
2026-02-28 18:07:44 +08:00
committed by GitHub
parent 63a4778542
commit 40facdb28c
11 changed files with 557 additions and 13 deletions

View File

@@ -5,10 +5,12 @@ import pytest
import torch
from sglang.srt.debug_utils.dump_loader import (
LOAD_FAILED,
ValueWithMeta,
_add_duplicate_index,
_cast_to_polars_dtype,
find_row,
parse_meta_from_filename,
read_meta,
)
from sglang.test.ci.ci_register import register_cpu_ci
@@ -92,9 +94,35 @@ class TestValueWithMeta:
path.write_text("not a valid pt file")
loaded = ValueWithMeta.load(path)
assert loaded.value is None
assert loaded.value is LOAD_FAILED
assert loaded.meta["name"] == "bad"
class TestRecomputeStatusParsing:
def test_parse_recompute_status_from_filename(self) -> None:
from pathlib import Path
meta_disabled = parse_meta_from_filename(
Path(
"step=0___rank=0___dump_index=1___name=x___recompute_status=disabled.pt"
)
)
assert meta_disabled["recompute_status"] == "disabled"
meta_recompute = parse_meta_from_filename(
Path(
"step=0___rank=0___dump_index=1___name=x___recompute_status=recompute.pt"
)
)
assert meta_recompute["recompute_status"] == "recompute"
meta_original = parse_meta_from_filename(
Path(
"step=0___rank=0___dump_index=1___name=x___recompute_status=original.pt"
)
)
assert meta_original["recompute_status"] == "original"
if __name__ == "__main__":
sys.exit(pytest.main([__file__]))