sgl-project/sglang · error · ValueError

no safetensors files found in {quantized_path or component_m

Error message

no safetensors files found in {quantized_path or component_model_path}

What it means

After collecting, mixed-export-preferencing, and duplicate-precision filtering the safetensors file list for the transformer, the list is empty, so there is nothing to load.

Source

Thrown at python/sglang/multimodal_gen/runtime/loader/transformer_load_utils.py:690

        safetensors_list = _list_safetensors_files(component_model_path)

    if safetensors_list:
        # Diffusers repos occasionally ship more than one shard split for the
        # same checkpoint (e.g. a 4-way and an 8-way split side by side). The
        # index file is the authoritative source for which files belong to
        # the checkpoint that was actually exported; anything else is a
        # leftover sibling variant.
        safetensors_list = filter_duplicate_safetensors_files(
            safetensors_list,
            os.path.dirname(safetensors_list[0]),
            SAFE_WEIGHTS_INDEX_NAME,
        )

    safetensors_list = _prefer_mixed_safetensors_files(safetensors_list)
    safetensors_list = _filter_duplicate_precision_variant_safetensors(safetensors_list)

    if not safetensors_list:
        raise ValueError(
            f"no safetensors files found in {quantized_path or component_model_path}"
        )

    return safetensors_list


def _prefer_mixed_safetensors_files(safetensors_list: list[str]) -> list[str]:
    """Prefer mixed-precision transformer exports over sibling full exports.

    Some raw ModelOpt NVFP4 repos ship both `foo-mixed.safetensors` and
    `foo.safetensors`. They are alternative full transformer exports, not
    shards, so loading both trips duplicate tensor-name validation.
    """
    mixed_files = [
        path
        for path in safetensors_list
        if _MIXED_SAFETENSORS_RE.match(os.path.basename(path))
    ]

View on GitHub (pinned to 0132848349)

Solutions

  1. Check the model path actually contains .safetensors shards (ls the dir)
  2. Re-download the model or clear the stale HF cache snapshot
  3. If the repo has mixed precisions, ensure at least one non-duplicate safetensors variant remains selectable
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
files = list(Path(model_dir).rglob('*.safetensors'))
if not files:
    raise SystemExit(f'no safetensors in {model_dir}; re-download or convert the checkpoint')

Prevention

When it happens

Trigger: resolve_transformer_safetensors_to_load finds no *.safetensors in quantized_path or component_model_path, or the found files were all filtered out as duplicate precision variants, or a cached HF repo snapshot is empty.

Common situations: Model directory containing only .bin/pytorch_model files, an incomplete HF download/cache, or a repo exporting multiple precision variants that the dedup filter removes entirely.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/c90c3ced1b62b8e6. Report an issue: GitHub.