sgl-project/sglang · error · ValueError

Kimi-K3 manifest format is unsupported

Error message

Kimi-K3 manifest format is unsupported

What it means

The manifest JSON passed to kimi_k3_nonexpert_weights_iterator must declare format == 'SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1'. Any other or missing format string raises this error, guarding against feeding an arbitrary GGUF/manifest to the Kimi-K3 adapter loader.

Source

Thrown at python/sglang/srt/model_loader/kimi_k3_gguf.py:148

    """Undo llama.cpp's GGUF-time ``A_log -> -exp(A_log)`` transform."""
    if not raw.is_floating_point() or not torch.isfinite(raw).all():
        raise ValueError("Kimi-K3 GGUF ssm_a must contain finite floating values")
    if not torch.all(raw < 0):
        raise ValueError("Kimi-K3 GGUF ssm_a must contain only -exp(A_log) values")
    return torch.log(-raw)


def kimi_k3_nonexpert_weights_iterator(
    manifest_path: str | os.PathLike[str],
) -> Generator[tuple[str, torch.Tensor], None, None]:
    """Stream non-routed tensors shard by shard without reading routed payloads."""

    import gguf

    manifest_file = Path(manifest_path).resolve()
    manifest = json.loads(manifest_file.read_text(encoding="utf-8"))
    if manifest.get("format") != "SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1":
        raise ValueError("Kimi-K3 manifest format is unsupported")
    if not manifest.get("complete"):
        raise ValueError("Kimi-K3 manifest is incomplete")

    records_by_shard: dict[int, list[dict]] = defaultdict(list)
    for record in manifest["source"]["tensors"]:
        records_by_shard[int(record["shard_index"])].append(record)

    emitted: set[str] = set()
    for shard in manifest["source"]["shards"]:
        shard_index = int(shard["index"])
        shard_path = Path(shard["path"]).resolve()
        if not shard_path.is_file() or shard_path.stat().st_size != int(shard["size"]):
            raise FileNotFoundError(
                f"Kimi-K3 GGUF shard is missing or changed: {shard_path}"
            )
        reader = gguf.GGUFReader(str(shard_path), mode="r")
        tensors = {tensor.name: tensor for tensor in reader.tensors}
        expected = {record["name"]: record for record in records_by_shard[shard_index]}

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-run the SGLang Kimi-K3 GGMLMoEPack adapter conversion tool to produce a v1 manifest.
  2. Check the manifest's format field and, if the converter is newer/older, align converter and sglang versions.
  3. If the manifest was hand-edited, restore format to SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1 only if the content genuinely matches v1.

Example fix

// before
{"format": "GGUF", ...}
// after
{"format": "SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1", "complete": true, ...}
Defensive patterns

Strategy: validation

Validate before calling

import json, pathlib
m = json.loads(pathlib.Path(manifest_path).read_text())
assert m.get("format") == "SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1", f"unsupported format {m.get('format')}"

Type guard

def is_supported_manifest(m: dict) -> bool:
    return isinstance(m, dict) and m.get("format") == "SGLANG-KIMI-GGMLMOEPACK-ADAPTER-v1"

Prevention

When it happens

Trigger: Passing a manifest_path whose JSON lacks the exact format field value — e.g. a vanilla GGUF conversion manifest, a different adapter version, or a typo'd hand-written manifest.

Common situations: Version mismatch between the conversion tool that produced the manifest and the sglang loader; user points --model at a plain GGUF without running the SGLang adapter packing step.

Related errors


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