Enhance displaying and debuggability in dump comparator (#19466)

This commit is contained in:
fzyzcjy
2026-02-27 09:06:19 +08:00
committed by GitHub
parent 23cbbd6d41
commit 4add6ec0f6
17 changed files with 879 additions and 31 deletions
+11 -1
View File
@@ -2,7 +2,7 @@ import functools
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, Tuple
from typing import Any, Dict, Optional, Tuple
import polars as pl
import torch
@@ -165,4 +165,14 @@ def _cast_to_polars_dtype(value, target_dtype):
return value
def read_tokenizer_path(directory: Path) -> Optional[str]:
"""Read tokenizer_path from any .pt file's embedded metadata in a dump directory."""
for p in directory.glob("*.pt"):
item: ValueWithMeta = ValueWithMeta.load(p)
tokenizer_path: Optional[str] = item.meta.get("tokenizer_path")
if tokenizer_path is not None:
return str(tokenizer_path)
return None
dump_loader = DumpLoader()