Skip to content

[Bug]: Repo with overlay safetensors (superseded tensors) fails duplicate-name check - index mapping not honored #1479

Description

@montana-rs

Commit or version

12a5c46

Environment

Fedora 44, x86_64, Intel i5-12600KF, 16 GiB RAM, 2x RTX 3060 12GB (engine ran CPU-only for this model), Samsung 860 EVO 1TB SATA SSD (488 MB/s read). Model: DeepSeek V4 engine, overlay-carrying checkpoint (~167GB, 49 shards + 1 overlay).

Reproduction steps

  1. Obtain a checkpoint that ships an overlay remap in model.safetensors.index.json: the index maps N tensor names to a separate model-overlay-*.safetensors which supersedes same-named tensors still physically present in the base shards. (Community abliterated checkpoints are distributed this way, e.g. huihui-ai's DeepSeek-V4-Flash-abliterated.)
  2. Load it: coli run --model ...
  3. Engine refuses with: "tensor 'layers.0.attn.wo_b.scale' is also indexed from shard 'model-00002-of-00048.safetensors' - duplicate tensor name across indexed shards, refusing"

Expected behavior

The engine should honor the safetensors index mapping: tensors whose authoritative location (per the checkpoint's own index) is the overlay are read from the overlay; the stale base-shard copies are ignored. Failing that, the error should suggest the resolution.

Actual behavior and logs

Duplicate-name check (st.h) treats any repeated name as fatal regardless of what the index says, so the checkpoint cannot load at all. HF transformers loads the same checkpoint fine because it honors the index.
Workaround (verified end-to-end): script that rewrites the base shards removing the superseded tensors, leaving the overlay copies as the only instances. After that the engine loads and runs correctly - full generation run verified (coherent output, expert hit-rate 57% warming). Happy to share the script.
Note: I understand the duplicate check guards against silent wrong-shard reads - the ask is to resolve the ambiguity via the checkpoint's own index mapping rather than refusing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions