sgl-project/sglang · error · ValueError
No safetensors files found in
Error message
No safetensors files found in {model_path} What it means
No *.safetensors files were found in the model path. Check that the path points at a valid checkpoint directory with safetensors weights.
Solutions
- Verify the path actually contains .safetensors files: ls <model_path>/*.safetensors
- Re-download the checkpoint if weights are missing
- If the checkpoint is pytorch_model.bin format, convert it to safetensors or point at a safetensors release of the model
Example fix
# before --model /models/llama-config-only # after --model /models/llama-with-weights
Defensive patterns
Strategy: validation
Validate before calling
import glob
def has_safetensors(model_path) -> bool:
return len(glob.glob(f"{model_path}/*.safetensors")) > 0 Prevention
- Assert the model dir contains *.safetensors before calling load_safetensors_state_dict
- Prefer official safetensors releases over .bin-only checkpoints
When it happens
Trigger: load_safetensors_state_dict is called on a model_path that contains no *.safetensors files and no usable index.
Common situations: Wrong --model path (points at a config-only or empty dir), download that fetched JSON/tokenizer files but not weights, or weights stored in .bin/.pth format only.
Related errors
- f"No safetensors files found in
- Checkpoint at ' ' is incomplete — the following shard(s)…
- Comfy layer is missing checkpoint tensors
- Comfy W4A4 layer has unsupported convrot_groupsize=
- Comfy W4A4 layer needs I8 packed weights and F32 scales…
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/f909e14824fbe8c1.
Report an issue: GitHub.
Appendix: source
Thrown at python/sglang/multimodal_gen/runtime/loader/utils.py:349
def load_safetensors_state_dict(model_path: str) -> dict[str, torch.Tensor]:
"""Load one safetensors checkpoint, including an indexed sharded set."""
index_path = os.path.join(
str(model_path), "diffusion_pytorch_model.safetensors.index.json"
)
safetensors_files = _list_safetensors_files(model_path)
if os.path.exists(index_path):
with open(index_path) as f:
index = json.load(f)
shard_names = sorted(set(index.get("weight_map", {}).values()))
state_dict: dict[str, torch.Tensor] = {}
for shard_name in shard_names:
state_dict.update(
safetensors_load_file(os.path.join(str(model_path), shard_name))
)
return state_dict
if not safetensors_files:
raise ValueError(f"No safetensors files found in {model_path}")
if len(safetensors_files) != 1:
raise ValueError(
f"Found {len(safetensors_files)} safetensors files in {model_path} "
"and no index to disambiguate them."
)
return safetensors_load_file(safetensors_files[0])
BYTES_PER_GB = 1024**3
def get_memory_usage_of_component(module) -> float | None:
"""
returned value is in GB, rounded to 2 decimal digits
"""
if not isinstance(module, nn.Module):
return None
if hasattr(module, "get_memory_footprint"):View on GitHub (pinned to 0132848349)