Support handling arbitrary objects in dump comparator (#19558)

This commit is contained in:
fzyzcjy
2026-02-28 18:04:13 +08:00
committed by GitHub
parent b7f13a7b73
commit 9bf3638a25
7 changed files with 448 additions and 32 deletions
+3 -1
View File
@@ -9,6 +9,8 @@ import torch
_TYPED_FIELDS: list[tuple[str, type]] = [("rank", int)]
LOAD_FAILED: object = object()
def parse_meta_from_filename(path: Path) -> Dict[str, Any]:
stem = Path(path).stem
@@ -38,7 +40,7 @@ class ValueWithMeta:
except Exception as e:
print(f"Skip load {path} since error {e}")
return ValueWithMeta(
value=None, meta={**meta_from_filename, "filename": path.name}
value=LOAD_FAILED, meta={**meta_from_filename, "filename": path.name}
)
value, meta_from_embedded = _unwrap_dict_format(raw)