Enhance replication check, matching pattern, logging in dump comparator (#19677)
This commit is contained in:
@@ -22,7 +22,7 @@ from sglang.srt.debug_utils.comparator.aligner.unsharder.types import (
|
||||
)
|
||||
from sglang.srt.debug_utils.comparator.dims import ParallelAxis, TokenLayout
|
||||
from sglang.srt.debug_utils.comparator.output_types import (
|
||||
GeneralWarning,
|
||||
ErrorLog,
|
||||
NonTensorComparisonRecord,
|
||||
SkipComparisonRecord,
|
||||
SummaryRecord,
|
||||
@@ -207,7 +207,7 @@ def _make_diff_info(*, passed: bool) -> DiffInfo:
|
||||
def _make_comparison_record(
|
||||
*,
|
||||
diff: DiffInfo | None,
|
||||
warnings: list | None = None,
|
||||
errors: list | None = None,
|
||||
) -> TensorComparisonRecord:
|
||||
ti: TensorInfo = _make_tensor_info()
|
||||
return TensorComparisonRecord(
|
||||
@@ -217,16 +217,16 @@ def _make_comparison_record(
|
||||
unified_shape=[4, 4],
|
||||
shape_mismatch=False,
|
||||
diff=diff,
|
||||
warnings=warnings or [],
|
||||
errors=errors or [],
|
||||
)
|
||||
|
||||
|
||||
class TestOutputRecordCategories:
|
||||
def test_skip_record_with_warnings_is_failed(self) -> None:
|
||||
def test_skip_record_with_errors_is_failed(self) -> None:
|
||||
record = SkipComparisonRecord(
|
||||
name="t",
|
||||
reason="test",
|
||||
warnings=[GeneralWarning(category="c", message="m")],
|
||||
errors=[ErrorLog(category="c", message="m")],
|
||||
)
|
||||
assert record.category == "failed"
|
||||
|
||||
@@ -238,10 +238,10 @@ class TestOutputRecordCategories:
|
||||
record: TensorComparisonRecord = _make_comparison_record(diff=None)
|
||||
assert record.category == "failed"
|
||||
|
||||
def test_comparison_record_passed_with_warnings_is_failed(self) -> None:
|
||||
def test_comparison_record_passed_with_errors_is_failed(self) -> None:
|
||||
record: TensorComparisonRecord = _make_comparison_record(
|
||||
diff=_make_diff_info(passed=True),
|
||||
warnings=[GeneralWarning(category="c", message="m")],
|
||||
errors=[ErrorLog(category="c", message="m")],
|
||||
)
|
||||
assert record.category == "failed"
|
||||
|
||||
@@ -273,7 +273,7 @@ class TestOutputRecordCategories:
|
||||
)
|
||||
assert record.category == "failed"
|
||||
|
||||
def test_non_tensor_record_with_warnings_is_failed(self) -> None:
|
||||
def test_non_tensor_record_with_errors_is_failed(self) -> None:
|
||||
record = NonTensorComparisonRecord(
|
||||
name="sm_scale",
|
||||
baseline_value="0.125",
|
||||
@@ -281,7 +281,7 @@ class TestOutputRecordCategories:
|
||||
baseline_type="float",
|
||||
target_type="float",
|
||||
values_equal=True,
|
||||
warnings=[GeneralWarning(category="c", message="m")],
|
||||
errors=[ErrorLog(category="c", message="m")],
|
||||
)
|
||||
assert record.category == "failed"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user