sgl-project/sglang · error · ValueError
: no .pt files found in or any of its subdirectories.
Error message
{label}: no .pt files found in {directory} or any of its subdirectories. What it means
Debug comparator error: the given directory (and its subdirectories) contain no .pt tensor files to compare, so the comparison cannot proceed.
Solutions
- Verify the path with ls <dir>/*.pt
- If files are deeper, point --dir at the level that directly contains the .pt files
- Confirm dumps were actually saved (check dumper output/logs) and use the .pt extension
Example fix
# before
auto_descend_dir(Path('runs'), 'dump') # runs/ has no .pt anywhere nearby
# after
auto_descend_dir(Path('runs/exp7/layer_dumps'), 'dump') # level with .pt files Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def has_pt_files(d: Path) -> bool:
return bool(list(d.glob('*.pt'))) or any(list(p.glob('*.pt')) for p in d.iterdir() if p.is_dir()) Try / catch
try:
resolved = auto_descend_dir(directory, label)
except ValueError as e:
print(e); sys.exit(2) Prevention
- Confirm dumps are flushed and use the .pt extension
- Point --dir at the directory that directly holds the .pt files (descent is one level only)
When it happens
Trigger: Calling run()/auto_descend_dir on an empty directory, one containing only unrelated files, or a path whose .pt files live two or more levels deep (descent is only one level).
Common situations: Wrong --dir path (typo, relative-path confusion), dumps not yet written/flushed, files named *.pth/*.bin instead of *.pt, or nested layout deeper than one level.
Related errors
- : directory has no .pt files at top level and multiple…
- Image path not found
- LoRA with name does not exist. Loaded LoRAs
- Mesh not found
- Prompt text file not found
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/1708a00e5a95ee29.
Report an issue: GitHub.
Appendix: source
Thrown at python/sglang/srt/debug_utils/comparator/utils.py:45
or when no .pt data is found at all.
"""
if any(directory.glob("*.pt")):
return directory
candidates: list[Path] = [
sub for sub in directory.iterdir() if sub.is_dir() and any(sub.glob("*.pt"))
]
if len(candidates) >= 2:
names: str = ", ".join(sorted(c.name for c in candidates))
raise ValueError(
f"{label}: directory {directory} has no .pt files at top level "
f"and multiple subdirectories contain data ({names}). "
f"Please specify the exact subdirectory."
)
if len(candidates) == 0:
raise ValueError(
f"{label}: no .pt files found in {directory} or any of its subdirectories."
)
resolved: Path = candidates[0]
from sglang.srt.debug_utils.comparator.log_sink import log_sink
from sglang.srt.debug_utils.comparator.output_types import InfoLog
log_sink.add(
InfoLog(
category="auto_descend",
message=f"auto-descend {label}: {directory} -> {resolved}",
)
)
return resolved
class _StrictBase(BaseModel):View on GitHub (pinned to 0132848349)